Change FinalizerThreadCreate location to after profiler is initialized (#13663)
authorSung Yoon Whang <suwhang@microsoft.com>
Wed, 30 Aug 2017 17:45:52 +0000 (10:45 -0700)
committerGitHub <noreply@github.com>
Wed, 30 Aug 2017 17:45:52 +0000 (10:45 -0700)
* Change FinalizerThreadCreate location to after profiler is initialized to ensure finalizer creation notification to profilerAPI

* Fixes issue #13499

src/vm/ceemain.cpp

index 9779813..011caf0 100644 (file)
@@ -899,10 +899,6 @@ void EEStartupHelper(COINITIEE fFlags)
 
 #ifndef CROSSGEN_COMPILE
 
-        // This isn't done as part of InitializeGarbageCollector() above because thread
-        // creation requires AppDomains to have been set up.
-        FinalizerThread::FinalizerThreadCreate();
-
 #ifndef FEATURE_PAL
         // Watson initialization must precede InitializeDebugger() and InstallUnhandledExceptionFilter() 
         // because on CoreCLR when Waston is enabled, debugging service needs to be enabled and UEF will be used.
@@ -1009,6 +1005,10 @@ void EEStartupHelper(COINITIEE fFlags)
         hr = g_pGCHeap->Initialize();
         IfFailGo(hr);
 
+        // This isn't done as part of InitializeGarbageCollector() above because thread
+        // creation requires AppDomains to have been set up.
+        FinalizerThread::FinalizerThreadCreate();
+
         // Now we really have fully initialized the garbage collector
         SetGarbageCollectorFullyInitialized();