Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple UWP apps crash at start due to missing "Windows.Foundation.UniversalApiContract" #196

Closed
Fox2Code opened this issue Jun 29, 2024 · 10 comments

Comments

@Fox2Code
Copy link

Wine bug: https://bugs.winehq.org/show_bug.cgi?id=52092

I know this is dotnet 5+, but dotnet 5 seems to be crashing when running with dotnet 5+

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'
  at MinecraftInstaller.App.Main () [0x0007d] in <e46d004a5e4349df92f513ccadd5bbaf>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'

Currently dotnet crashes on wine when running the Minecraft installer.

Extra dlls are available here: https://www.nuget.org/packages?q=WindowsContract

@Fox2Code
Copy link
Author

I really think wine would benefit from wine-mono supporting dotnet 5

@madewokherd
Copy link
Owner

That's a .winmd file. Wine should provide those separately from Wine Mono. No need to replace any part of dotnet 5.

@Fox2Code
Copy link
Author

@madewokherd The nuget package doesn't contain any winmd files, thoses are not winmd files.

Maybe you mean the dlls needs the winmd files to work properly?
Wine doesn't support .winmd files yet, but will in the future if given enough interest.

When nothing is done the error message is:

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'
  at MinecraftInstaller.App.Main () [0x0007d] in <e46d004a5e4349df92f513ccadd5bbaf>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Windows.Foundation.UniversalApiContract, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'

When I move all the required dlls from the nuget packages next to the installer the error message is:

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')

(See #151)

With Microsoft dotnet, it return an error from kernel32 which is out of scope for wine-mono, but what I can say is Microsoft dotnet embed those dlls in some way.

Definitely an update to #151

On GitHub there is labels for issues, if you want to support dotnet5.0 making a label for it would be great.

I think either leave both issues open, or close both.
I really would like wine-mono leave both open and experiment with dotnet5.0 but it's not my call to make.

Whatever is decided, please make it clear in the readme, because Wine-Mono stance on it is currently unclear.

@Fox2Code
Copy link
Author

This is fine -> #15 (comment)

Just found out about this after sending my message, well you could still have changed your mind.

I'll close my other dotnet5+ related issue (#151), reopen both issues if you changed your mind.

@madewokherd
Copy link
Owner

The installer exe for this is .NET 4 and runs in .NET Framework on Windows.

@madewokherd
Copy link
Owner

Maybe it references types from .NET 5 but the references are unused, and .NET Framework ignores the unused references in this situation while Mono does not?

@Fox2Code
Copy link
Author

Fox2Code commented Jul 1, 2024

I think wine-mono and dotnet5 behave similarly enough.

With the GAC, I don't think wine-mono being able to run most dotnet5+ stuff would be an enormous amount of work.

My theory is the MinecraftInstaller is probs declaring itself as dotnet4 while being a dotnet5 application, and it expect dotnet4 to be able load and run dotnet5 libraries?

@madewokherd
Copy link
Owner

I don't think so, but if that's the case then it should be possible to write a test case demonstrating that in .NET Framework.

@Fox2Code
Copy link
Author

Fox2Code commented Jul 2, 2024

Windows.Foundation.UniversalApiContract.dll is clearly dotnet5+ according to nuget.

And you are telling me the Minecraft installer declare itself as dotnet4, while it uses that.

Either nuget website is drunk, and both this issue and #151 are dotnet4 features, or it expect dotnet4 to be dotnet5 in some way?

Maybe Wine-Mono wrongly detect MinecraftSetup.exe as dotnet4 while it's dotnet5? Maybe some hidden flag?

@Fox2Code
Copy link
Author

Fox2Code commented Jul 2, 2024

I think talking about it in #197 is maybe better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants