Skip to content

Commit

Permalink
Merge pull request #1573 from takeshik/fix-MonoProtection-on-newer-mo…
Browse files Browse the repository at this point in the history
…no-vm

Use Mono.RuntimeStructs rather than Mono.Runtime to test if app is running on Mono runtime
  • Loading branch information
AArnott authored Mar 13, 2023
2 parents dd703a8 + fef9ec6 commit 1d322ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal struct MonoProtection
/// <summary>
/// Gets a value indicating whether the mono runtime is executing this code.
/// </summary>
internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null;
internal static bool IsRunningOnMono => Type.GetType("Mono.RuntimeStructs") != null;

/// <summary>
/// A lock that we enter on mono when generating dynamic types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class Utilities
#if UNITY_2018_3_OR_NEWER
internal const bool IsMono = true; // hard code since we haven't tested whether mono is detected on all unity platforms.
#else
internal static readonly bool IsMono = Type.GetType("Mono.Runtime") is Type;
internal static readonly bool IsMono = Type.GetType("Mono.RuntimeStructs") is Type;
#endif

internal delegate void GetWriterBytesAction<TArg>(ref MessagePackWriter writer, TArg argument);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class TestUtilities
/// <summary>
/// Gets a value indicating whether the mono runtime is executing this code.
/// </summary>
internal static bool IsRunningOnMono => Type.GetType("Mono.Runtime") != null;
internal static bool IsRunningOnMono => Type.GetType("Mono.RuntimeStructs") != null;

internal static string ToHex(byte[] buffer) => BitConverter.ToString(buffer).Replace("-", string.Empty).ToLowerInvariant();
}
Expand Down

0 comments on commit 1d322ca

Please sign in to comment.