You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deal with Shutdown issues for EventSource on CoreCLR #8015
The CLR has a general problem with callbacks from managed code on shutdown. The issue is that when the CLR shuts down it tears down EE structures needed to run managed code but it does NOT necessarily call the destructors of managed objects.
This is a problem if you have a native callback (that can happen at any time) because that native code could call that callaback during shutdown when it is illegal to call managed code.
APIs to insure that these callbacks are shut down before CLR shutdown happens. This was done on the Desktop framework but (I think because these events did not exist in Core 1.0 it was pulled from .NET Core. These APIs I believe are back, so we can do this. This issue is a reminder to do this.
The DisposeOnShutdown method is already present in EventSource, so pretty much you just need to put the APIs above back in.
As extra credit, we should consider fixing this in a generic way (this problem is a 'gotcha' that can occur in most uses of native->managed callbacks. Ideally it is fixed in a generic way.
Activity