diff --git a/src/utils/reshapedreflection.fs b/src/utils/reshapedreflection.fs index 7f0eb87c052..19be659bfd6 100644 --- a/src/utils/reshapedreflection.fs +++ b/src/utils/reshapedreflection.fs @@ -327,7 +327,15 @@ module internal ReflectionAdapters = override this.Load (assemblyName:AssemblyName):Assembly = this.LoadFromAssemblyName(assemblyName) - let globalLoadContext = new CustomAssemblyResolver() + let globalLoadContext = + // This is an unfortunate temporary fix!!!! + // ======================================== + // We need to run fsi tests on a very old version of the corclr because of an unfortunate test framework + // This hack detects that, and uses the old code. + // On slightly newer code AssemblyLoadContext.Default is the way to go. + match Seq.tryHead (typeof.GetTypeInfo().Assembly.GetCustomAttributes()) with + | Some a when a.Version = "4.6.24410.01" -> new CustomAssemblyResolver() :> AssemblyLoadContext + | _ -> AssemblyLoadContext.Default #endif type System.Reflection.Assembly with