File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ public void Test_AccessTools_TypeByName_NoInvalidAssembly()
125125 Test_AccessTools_TypeByName_CurrentAssemblies ( ) ;
126126 }
127127
128- [ Test , NonParallelizable ]
128+ [ Test ]
129129 public void Test_AccessTools_TypeSearch_CacheInvalidation ( )
130130 {
131131 AccessTools . ClearTypeSearchCache ( ) ;
@@ -135,7 +135,18 @@ public void Test_AccessTools_TypeSearch_CacheInvalidation()
135135
136136 var dummy = DefineAssembly ( "HarmonyTestsDummyAssemblyD" , module => module . DefineType ( "HarmonyTestsDummyAssemblyD.Class1" , TypeAttributes . Public ) ) ;
137137 SaveAssembly ( dummy ) ;
138- TestTools . RunInIsolationContext ( ctx => ctx . AssemblyLoad ( "HarmonyTestsDummyAssemblyD" ) ) ;
138+
139+ // ask the parent domain to load it so that it persists after the context is unloaded.
140+ TestTools . RunInIsolationContext ( ctx => ctx . ParentCallback < string > ( name =>
141+ {
142+ #if NETCOREAPP
143+ // On .NET Core, load the DLL from its path into the default AssemblyLoadContext
144+ Assembly . LoadFrom ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , name + ".dll" ) ) ;
145+ #else
146+ // On .NET Framework, Assembly.Load will load from the probing path (BaseDirectory)
147+ Assembly . Load ( name ) ;
148+ #endif
149+ } , "HarmonyTestsDummyAssemblyD" ) ) ;
139150
140151 Assert . Null ( AccessTools . TypeSearch ( search ) ) ;
141152
You can’t perform that action at this time.
0 commit comments