LavaGang / MelonLoader

The World's First Universal Mod Loader for Unity Games compatible with both Il2Cpp and Mono
https://discord.gg/2Wn3N2P
Apache License 2.0
2.43k stars 477 forks source link

[Bug]: Failed to Open Mono Assembly under Proton (old Unity versions?) #253

Closed Hexcede closed 1 year ago

Hexcede commented 2 years ago

All of the following criteria must be met

All of the following are optional to answer

Describe the issue.

I am currently trying to get MelonLoader working with a mono game using Unity version 2019.4.21f1 working under Proton. The game is 20 Minutes Till Dawn. I am having similar issues with all of the other Unity mono games I try.

I am presented with an error and a matching line in my log file: [INTERNAL FAILURE] Failed to Open Mono Assembly!

I followed the steps on the wiki for proton/wine installs and get a console window to appear, and I have enabled debug logs.

Here is my Latest.log.

Did you attach your log file?

Hexcede commented 2 years ago

This issue is very likely related to improper dotnet config. For example, mscoree.dll is deleted when running --force dotnet472 as the wiki suggests to do, which of course is required for MelonLoader to function, however wine's installer explicitly removes mscoree.dll. Perhaps installing a different compatible dotnet version after cancelling the installer may fix this issue.

Hexcede commented 2 years ago

I indeed confirmed this is the case. When using a fresh prefix, CLR.dll fails to be found by .NET programs like dnSpy (e.g. when trying to attach a debugger). After running any --force dotnetXX command, mscoree.dll is not re-created (dotnet didn't get installed because we skipped it since it won't function) so the program then can't find mscoree.dll.

This is a complex issue, and, I'm not sure the real cause or solution or what's changed to create this problem in the first place ☹️

guoshuyan commented 2 years ago

你可以看一下你是否使用了 ASCII 字符集以外的字符(比如汉字“开”) You can check whether you use characters other than ASCII character set (such as Chinese character "开")

RinLovesYou commented 2 years ago

Hi there, I can not reproduce this. image

I need to update the Wiki entry anyways, vcrun and dotnet are just not required for ML to run anymore

Hexcede commented 2 years ago

Hi there, I can not reproduce this. image

I need to update the Wiki entry anyways, vcrun and dotnet are just not required for ML to run anymore

Is this screenshot under Proton?

Based on your logs, the game's Unity version is now newer. The issue seemed to be specific to Unity version 2019.4.21f1 and possibly others. Whereas the game's Unity version in the screenshot you posted is 2019.4.40f1. It's only a minor version difference, but I could previously confirm that the issue occurred under Proton Experimental with a fresh Unity project I compiled myself using specifically Unity version 2019.4.21f1.

RinLovesYou commented 2 years ago

I really doubt that's a thing, but i'll install 2019.4.21f1 and make a demo project to test.

RinLovesYou commented 2 years ago

image

Aside from the start screen failing, i am still entirely unable to reproduce this issue As i've mentioned before, you can skip vcrun2019/dotnet472 and see if that resolves your issue? I've already submitted a pull request to the Wiki here

HerpDerpinstine commented 2 years ago

@Hexcede Was this resolved?

Hexcede commented 2 years ago

@Hexcede Was this resolved?

I apologize, I've been super busy so I haven't had a chance to test/respond. I'll go ahead and test and follow up later today.