What is the DotNet Core alternative to AppDomain.CurrentDomain.ProcessExit event?

Since your code is in a library you can make the caller of the library provide a notification. That way the host can decide to notify you.

Normally, a library is not supposed to mess with process global state. It should not assume much about the environment it's being hosted it.

Maybe the caller can pass a Task that becomes completed when process shutdown starts. Or, the caller can call a static method on your library (NotifyProcessShutdown or PerformProcessShutdownCleanup).

Tags:

.Net

.Net Core