0

We have a C# UWP winmd library (no DLL, winmd only) that will be used in a C++ UWP application project.

The problem is that if I run the C++ application in Debug it crashes somewhere when trying to get the activation factory for the winmd.

If we force enable UseDotNetNativeToolchain in Debug build then it sometimes work, but it's really strange because it seems to be inconsistent and it sometimes works and then it starts crashing again.

The crash happens asap when trying to access any of the classes from the winmd C# library.

It works if the winmd is a C++ winmd, but this is not applicable to us right now (also wrapping the C# winmd in a C++ winmd crashes with the same issue).

Does anyone know a way to have Debug builds of a C++ UWP that consumes a C# winmd working WITHOUT the UseDotNetNativeToolchain flag?

We don't want to use UseDotNetNativeToolchain in Debug builds because we're afraid that it might increase compile times too much.

This is the crash stack, but the actual crash is somewhere deep where there is no PDB symbols for:

enter image description here

  • Isn't that a first chance exception? https://stackoverflow.com/questions/564681/what-is-a-first-chance-exception – Simon Mourier May 25 '23 at 12:20
  • Does your .winmd file include the library code and data alongside the metadata? Seems like an unconventional way to deploy a Windows Runtime Component. – IInspectable May 25 '23 at 12:32
  • @SimonMourier It crashes even if I continue it. – user6410441 May 25 '23 at 17:54
  • @IInspectable there is only code, we don't have any concrete resources. – user6410441 May 25 '23 at 17:54
  • 1
    Ok, I overlooked the error code which is 0x80131040: FUSION_E_REF_DEF_MISMATCH so it's a more .NET binaries deployment issue, you can google on it, for ex https://learn.microsoft.com/en-us/answers/questions/413435/the-located-assemblys-manifest-definition-does-not or https://stackoverflow.com/questions/93879/hresult-0x80131040-the-located-assemblys-manifest-definition-does-not-match-t – Simon Mourier May 25 '23 at 19:08

0 Answers0