Skip to content

Commit

Permalink
Fix stack overflow on assembly resolution (#3658)
Browse files Browse the repository at this point in the history
* Fix stack overflow on tp assembly resolution

* Feedback
  • Loading branch information
KevinRansom authored Sep 29, 2017
1 parent 780b6c4 commit 34e669c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/reshapedreflection.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RuntimeTypeHandle>.GetTypeInfo().Assembly.GetCustomAttributes<AssemblyFileVersionAttribute>()) with
| Some a when a.Version = "4.6.24410.01" -> new CustomAssemblyResolver() :> AssemblyLoadContext
| _ -> AssemblyLoadContext.Default

#endif
type System.Reflection.Assembly with
Expand Down

0 comments on commit 34e669c

Please sign in to comment.