Skip to content

Commit

Permalink
AccessTools: Don't call TypeByName for full type to not trigger assem…
Browse files Browse the repository at this point in the history
…bly resolving
  • Loading branch information
ghorsington committed Oct 3, 2020
1 parent 13a549d commit 60e1905
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Harmony/Tools/AccessTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1552,13 +1552,13 @@ public static void RethrowException(Exception exception)
/// <summary>True if the current runtime is .NET Framework, false otherwise (.NET Core or Mono, although latter isn't guaranteed)</summary>
///
public static bool IsNetFrameworkRuntime { get; } =
TypeByName("System.Runtime.InteropServices.RuntimeInformation")?.GetProperty("FrameworkDescription")
Type.GetType("System.Runtime.InteropServices.RuntimeInformation", false)?.GetProperty("FrameworkDescription")
.GetValue(null, null).ToString().StartsWith(".NET Framework") ?? IsMonoRuntime is false;

/// <summary>True if the current runtime is .NET Core, false otherwise (Mono or .NET Framework)</summary>
///
public static bool IsNetCoreRuntime { get; } =
TypeByName("System.Runtime.InteropServices.RuntimeInformation")?.GetProperty("FrameworkDescription")
Type.GetType("System.Runtime.InteropServices.RuntimeInformation", false)?.GetProperty("FrameworkDescription")
.GetValue(null, null).ToString().StartsWith(".NET Core") ?? false;

/// <summary>Throws a missing member runtime exception</summary>
Expand Down

0 comments on commit 60e1905

Please sign in to comment.