@@ -54,8 +54,9 @@ private static string GetDefaultDllName(Version version)
5454 }
5555
5656 private static bool _isInitialized = false ;
57-
5857 internal static bool IsInitialized => _isInitialized ;
58+ private static bool _typesInitialized = false ;
59+ internal static bool TypeManagerInitialized => _typesInitialized ;
5960 internal static readonly bool Is32Bit = IntPtr . Size == 4 ;
6061
6162 // .NET core: System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
@@ -151,6 +152,7 @@ internal static void Initialize(bool initSigs = false)
151152 ClassManager . Reset ( ) ;
152153 ClassDerivedObject . Reset ( ) ;
153154 TypeManager . Initialize ( ) ;
155+ _typesInitialized = true ;
154156
155157 // Initialize modules that depend on the runtime class.
156158 AssemblyManager . Initialize ( ) ;
@@ -272,6 +274,7 @@ internal static void Shutdown()
272274 NullGCHandles ( ExtensionType . loadedExtensions ) ;
273275 ClassManager . RemoveClasses ( ) ;
274276 TypeManager . RemoveTypes ( ) ;
277+ _typesInitialized = false ;
275278
276279 MetaType . Release ( ) ;
277280 PyCLRMetaType . Dispose ( ) ;
@@ -291,9 +294,10 @@ internal static void Shutdown()
291294 Finalizer . Shutdown ( ) ;
292295 InternString . Shutdown ( ) ;
293296
297+ ResetPyMembers ( ) ;
298+
294299 if ( ! HostedInPython )
295300 {
296- ResetPyMembers ( ) ;
297301 GC . Collect ( ) ;
298302 GC . WaitForPendingFinalizers ( ) ;
299303 PyGILState_Release ( state ) ;
@@ -310,7 +314,6 @@ internal static void Shutdown()
310314 }
311315 else
312316 {
313- ResetPyMembers ( ) ;
314317 PyGILState_Release ( state ) ;
315318 }
316319 }
0 commit comments