jeudi 31 octobre 2019

Unable to load assemby built with F# compiler services via reflection

I keep getting the following error message when I tried to load (via reflection) a .dll built using F# compiler services (even though the Equals method being complained about does exist in the build):

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Method 'Equals' in type 'Convlets.MarketPlace.Utterances.ExpenseWithinPeriod' from assembly '3c60568e-1748-4326-82d1-01bc02fd3b3c-1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()

I'm using .NET Core on Ubuntu.

However, if I build using Visual Studio Code, I'm able to load the assmbly. I opened both builds and I noticed the version that doesn't work has on override for one of the Equals method while the version that does, doesn't. I'm not sure if this is of consequence:

    [CompilerGenerated]
    public sealed bool Equals(object obj, IEqualityComparer comp)

vs

    [CompilerGenerated]
    public sealed override bool Equals(object obj, IEqualityComparer comp)

Additionally, when I check the references using dnSpy, the version that works has a reference to .netstandard while the version that does not does not have this reference. I've tried adding a reference to the .netstandard .dll as part of the compilation but this doesn't seem to have any effect.

I'm not sure why the .dll isn't loading and what I need to do differently.





Aucun commentaire:

Enregistrer un commentaire