Skip to content

Commit

Permalink
Expose RuntimeFeature.IsDynamicCodeSupported/Compiled
Browse files Browse the repository at this point in the history
Fixes #29258
  • Loading branch information
jkotas committed Dec 8, 2018
1 parent 1baa54e commit 6b52764
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public void End() { }
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg(System.RuntimeTypeHandle rth) { throw null; }
public System.RuntimeTypeHandle GetNextArgType() { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
public int GetRemainingCount() { throw null; }
}
public partial class ArgumentException : System.SystemException
Expand Down Expand Up @@ -6756,6 +6755,8 @@ public static partial class RuntimeFeature
public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces";
#endif
public const string PortablePdb = "PortablePdb";
public static bool IsDynamicCodeCompiled { get { throw null; } }
public static bool IsDynamicCodeSupported { get { throw null; } }
public static bool IsSupported(string feature) { throw null; }
}
public static partial class RuntimeHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,24 @@ public static void PortablePdb()
{
Assert.True(RuntimeFeature.IsSupported("PortablePdb"));
}

[Fact]
public static void DynamicCode()
{
Assert.Equal(RuntimeFeature.IsDynamicCodeSupported, RuntimeFeature.IsSupported("IsDynamicCodeSupported"));
Assert.Equal(RuntimeFeature.IsDynamicCodeCompiled, RuntimeFeature.IsSupported("IsDynamicCodeCompiled"));

if (RuntimeFeature.IsDynamicCodeCompiled)
{
Assert.True(RuntimeFeature.IsDynamicCodeSupported);
}
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNative))]
public static void DynamicCode_Jit()
{
Assert.True(RuntimeFeature.IsDynamicCodeSupported);
Assert.True(RuntimeFeature.IsDynamicCodeCompiled);
}
}
}

0 comments on commit 6b52764

Please sign in to comment.