MonoMod.Common icon indicating copy to clipboard operation
MonoMod.Common copied to clipboard

DynDll does not work with non-ASCII characters in path

Open NotNite opened this issue 1 year ago • 0 comments

See: https://github.com/SlopCrew/SlopCrew/issues/134

My mod Slop Crew uses DynDll to load GameNetworkingSockets inside of Unity. When the path to the library contains non-ASCII characters, a cryptic error is thrown:

[Error  : Unity Log] EntryPointNotFoundException: No matching entry point found for GameNetworkingSockets_Init in SlopCrew.Common.Native
Stack trace:
MonoMod.Utils.DynDll.InternalResolveDynDllImports (System.Type type, System.Object instance, System.Collections.Generic.Dictionary`2[TKey,TValue] mappings) (at <6733e342b5b549bba815373898724469>:0)
MonoMod.Utils.DynDll.ResolveDynDllImports (System.Type type, System.Collections.Generic.Dictionary`2[TKey,TValue] mappings) (at <6733e342b5b549bba815373898724469>:0)
SlopCrew.Common.Native..cctor () (at D:/code/c#/brc/SlopCrew/SlopCrew.Common/ValveSockets.cs:909)
Rethrow as TypeInitializationException: The type initializer for 'SlopCrew.Common.Native' threw an exception.
SlopCrew.Common.Library.Initialize (System.Text.StringBuilder errorMessage) (at D:/code/c#/brc/SlopCrew/SlopCrew.Common/ValveSockets.cs:830)
SlopCrew.Common.Library.Initialize () (at D:/code/c#/brc/SlopCrew/SlopCrew.Common/ValveSockets.cs:819)

(For the sake of testing, I renamed Bomb Rush Cyberfunk to Bómb Rush Cyberfunk.)

This is a problem because r2modman installs profiles into AppData by default, so users with non-ASCII characters in their Windows username will not be able to use my mod.

NotNite avatar Mar 18 '24 21:03 NotNite