The error I got in the FSX file is: cannot reference to the DLL contains my own type. I double checked the FSX and I did add #r. The real reason behind is the AssemblyLoad context. The type provider code was doing the Assembly.LoadFile in a different load context. The following code should resolve the problem:
static do
System.AppDomain.CurrentDomain.add_AssemblyResolve(fun sender anea ->
let loaded = System.AppDomain.CurrentDomain.GetAssemblies()
let an = System.Reflection.AssemblyName(anea.Name)
match loaded |> Seq.tryFind(fun a -> System.Reflection.AssemblyName.ReferenceMatchesDefinition(an, a.GetName())) with
| Some a -> a
| None -> null
)
No comments:
Post a Comment