Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion BepInEx.Core/PlatformUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ public static void SetPlatform()
if (wineGetVersion != IntPtr.Zero)
{
current |= Platform.Wine;
var getVersion = wineGetVersion.AsDelegate<GetWineVersionDelegate>();
// It's not safe to use the AsDelegate() extension method here because:
// - It comes from the MonoMod.Utils.DynDll class, defined in MonoMod.Common.
// - The DynDll class has a static constructor that reads PlatformHelper.Current.
// - Reading from that property freezes it: subsequent writes will throw an exception.
// - This method only sets PlatformHelper.Current at the very end.
var getVersion = Marshal.GetDelegateForFunctionPointer(wineGetVersion, typeof(GetWineVersionDelegate)) as GetWineVersionDelegate;
WineVersion = getVersion();
}
}
Expand Down
Loading