After converting to .net 4.5, can no longer load a library. RRS feed

  • Question

  • I have a library that is a combination of tlbimp'ed COM interop dlls, and regular C# code all ilmerged together to form a single runtime.

    Everything worked fine .NET 2.0, but we recently had to switch to 4.5 and x64.

    I'm getting a problem now when it tries to load:

    System.TypeLoadException occurred
      Message=Could not load the structure 'CaminoVTXRuntimeLib.MathTypes.COLOR' from assembly 'CaminoVTXRuntime, Version=, Culture=neutral, PublicKeyToken=null'. The structure is marked as eligible for type equivalence, but it has a method.

    It is a struct with methods, which is valid and needed since it gets handed out across a p/invoke call to other win32 calls.

    No, I don't want to embed interop types... I just want to get this to load. I've tried marking it [ComVisible(false)], that doesn't help.

    Is there a way to disable type equivalence in the newer runtimes? Or is there something else I can do.

    Tuesday, May 1, 2018 9:03 PM

All replies