wine-mono icon indicating copy to clipboard operation
wine-mono copied to clipboard

System.TypeLoadException: System.Runtime.InteropServices.IDynamicInterfaceCastable

Open Fox2Code opened this issue 1 year ago • 7 comments

Mono logs:

Unhandled Exception:
System.TypeLoadException: Could not resolve type with token 01000046 from typeref (expected class 'System.Runtime.InteropServices.IDynamicInterfaceCastable' in assembly 'System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
  at MinecraftInstaller.App.Main () [0x0007d] in <e46d004a5e4349df92f513ccadd5bbaf>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not resolve type with token 01000046 from typeref (expected class 'System.Runtime.InteropServices.IDynamicInterfaceCastable' in assembly 'System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')

I was a bit confused of where I should contribute, so I decided to open an issue here instead.

upstream mono seems the best, but the the last time I contributed to upstream mono I just found out it didn't affected wine-mono due to using another source for it's wpf implementation. (See #121 for reference)

Fox2Code avatar Aug 30 '22 11:08 Fox2Code

It sounds like you may have a .NET 6 image. Does this work in .NET Framework on Windows?

madewokherd avatar Aug 30 '22 13:08 madewokherd

This is the official Minecraft installer for Windows 10, it's probably dotnet 6 as I had to copy some dlls to make it works.

  • WinRT.Runtime.dll
  • WinRT.Host.Shim.dll
  • Windows.Networking.Connectivity.WwanContract.dll
  • Windows.Foundation.UniversalApiContract.dll
  • Windows.Foundation.FoundationContract.dll

( Minecraft installer for Windows 10 and Minecraft installer for Windows are completely different )

WinRT.*.dll are found at microsoft/CsWinRT but I haven't looked in the code, I just know the license is MIT. As wine-mono already use some components from microsoft, maybe making CsWinRT to use it with wine-mono could be an alternative to improve wine-mono app compatibility.

I added wintypes.RoResolveNamespace stub to wine because it was used by dotnet for some reason.

The logs of my wine install with Microsoft dotnet and all needed dlls says:

013c:err:combase:RoGetActivationFactory Failed to find library for L"Windows.ApplicationModel.DesignMode"
013c:fixme:wintypes:RoResolveNamespace name L"Windows.UI.ViewManagement", windowsMetaDataDir L"", metaDataFilePaths 024CCA60, subNamespaces 00000000 stub!
013c:fixme:advapi:RegisterEventSourceW ((null),L".NET Runtime"): stub
013c:fixme:advapi:ReportEventW (CAFE4242,0x0001,0x0000,0x00000402,00000000,0x0001,0x00000000,024CD0A8,00000000): stub
013c:err:eventlog:ReportEventW L"Application: MinecraftInstaller.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.TypeLoadException\n   at MinecraftInstaller.App..ctor()\n   at MinecraftInstaller.App.Main()\n\n"
013c:fixme:advapi:DeregisterEventSource (CAFE4242) stub

Unhandled Exception: 014c:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0834F470, 0267AEB0, 0834F474, 0834F468
014c:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0834F470, 0267AEB0, 0834F474, 0834F468
014c:fixme:nls:GetFileMUIPath stub: 0x10, L"C:\\windows\\system32\\tzres.dll", (null), 0834F470, 0267AEB0, 0834F474, 0834F468
System.TypeLoadException: Could not find Windows Runtime type 'Windows.UI.ViewManagement.AccessibilitySettings'.
   at MinecraftInstaller.App..ctor()
   at MinecraftInstaller.App.Main()
wine: Unhandled exception 0xe0434352 in thread 13c at address 7B012576 (thread 013c), starting debugger...

Fox2Code avatar Aug 30 '22 20:08 Fox2Code

I'm really more interested making a simple stub before doing anything else, the goal of this issue is not to make the Windows 10 installer of Minecraft works on wine, just to make progress on app compatibility on wine.

As I said, I'm more interesting in contributing to wine-mono than making Windows 10 launcher installer works (Minecraft Bedrock edition requires the Windows 10 launcher)

So if I just had a better idea of where to contribute this code this would be enough for me to make a basic stub for System.Runtime.InteropServices.IDynamicInterfaceCastable and related components if missing, and then close this issue once I'm done making the stubs and opening a pull request to mono or wine-mono.

Fox2Code avatar Aug 30 '22 20:08 Fox2Code

My Windows machine does not have those dll's, so I suspect what we actually need are winmd files. These would be out of scope of Wine Mono and should be part of Wine, probably generated from its existing WinRT idl's.

Supporting winmd files is in scope and likely to be a large project that touches things at a low level.

madewokherd avatar Aug 30 '22 20:08 madewokherd

I'm also unsure that implementing IDynamicInterfaceCastable is the right thing, since according to MSDN that type is not supported by .NET Framework.

madewokherd avatar Aug 30 '22 20:08 madewokherd

I agree that .winmd files should be handled by wintypes.dll and other wine components.

But IDynamicInterfaceCastable should be in System.Runtime.InteropServices.dll according to MSDN documentation.

Fox2Code avatar Aug 31 '22 09:08 Fox2Code

MSDN says it's in .NET 5, not Framework.

madewokherd avatar Aug 31 '22 11:08 madewokherd