Add back in code deleted in .NET Core port.
authorVance Morrison <vancemorrison@comcast.net>
Mon, 16 Jul 2018 16:40:31 +0000 (09:40 -0700)
committerVance Morrison <vancemorrison@comcast.net>
Mon, 16 Jul 2018 16:40:31 +0000 (09:40 -0700)
This fixes shutdown race bug that CoreCLR port reintroduced.
Basically the fix needed some Appdomain APIs that were probably
not in .NET Core 1.0 so they were removed.   However they are
back in .NET Core 2.0 so it is trivial to simply 'do the right thing', and
put the shutdown logic back.

See comment in front of DisposeOnShutdown for more.

Commit migrated from https://github.com/dotnet/coreclr/commit/f4b36aa998ead4dddea6c29de6ac0a393fb138a8

src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs

index 1620267..534e387 100644 (file)
@@ -4049,6 +4049,8 @@ namespace System.Diagnostics.Tracing
                 if (!s_EventSourceShutdownRegistered)
                 {
                     s_EventSourceShutdownRegistered = true;
+                    AppDomain.CurrentDomain.ProcessExit += DisposeOnShutdown;
+                    AppDomain.CurrentDomain.DomainUnload += DisposeOnShutdown;
                 }