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.22k stars 458 forks source link

[Bug]: Unicode characters not supported in names (method, type...) #659

Open laymain opened 3 weeks ago

laymain commented 3 weeks ago

All of the following criteria must be met

All of the following are optional to answer

Describe the issue.

Hi there,

I am facing an issue with Rewired library and IL2CPP, MelonLoader is not able to load the dependency because of an invalid name:

[01:18:23.989] [DEBUG] [AssemblyVerifier] Il2CppRewired_Core.dll Has an Invalid Type Name String "MethodInfoStoreGeneric_nqXVGKvgfzozBIAcnvWAyMFzaDld_Internal_Static_Int32_IList_1_☺_Predicate_1_☺_Int32_0`1"

Latest.log

SamboyCoding commented 3 weeks ago

This is arguably a bug in Il2cppInterop which should have renamed the type to not contain those characters (so that they can be referenced in c# source code, if nothing else)

laymain commented 3 weeks ago

I'm not sure to understand, in C#, Unicode characters are allowed for type and method names https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names

[EDIT] Hum... you're right, there seem to be a non-valid character in this name, but some are valid, AssemblyVerifier could take inspiration from https://github.com/microsoft/referencesource/blob/51cf7850defa8a17d815b4700b67116e3fa283c2/System/compmod/system/codedom/compiler/CodeGenerator.cs#L1926-L1968

SamboyCoding commented 3 weeks ago

To be clear, what I mean by invalid character is that we should, in theory, force all type and member names to contain only printable ascii characters. Whether or not you can in theory have an emoji in c# type names isn't particularly relevant because they will be a pain to type in an IDE anyway.

laymain commented 2 weeks ago

Submitted a PR to Il2CppInterop, hopefully it will be merged 🤞