Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Expose RuntimeFeature.IsDynamicCodeSupported/Compiled (#33928)
Browse files Browse the repository at this point in the history
Fixes #29258
  • Loading branch information
jkotas authored Dec 8, 2018
1 parent 5e932ed commit 5ce17d9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
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
14 changes: 2 additions & 12 deletions src/System.Runtime/src/ApiCompatBaseline.netcoreappaot.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
Compat issues with assembly System.Runtime:
MembersMustExist : Member 'System.String System.Runtime.CompilerServices.RuntimeFeature.DefaultImplementationsOfInterfaces' does not exist in the implementation but it does exist in the contract.
TypeCannotChangeClassification : Type 'System.DateTimeOffset' is marked as readonly in the contract so it must also be marked readonly in the implementation.
TypeCannotChangeClassification : Type 'System.TimeSpan' is marked as readonly in the contract so it must also be marked readonly in the implementation.
TypeCannotChangeClassification : Type 'System.Runtime.Serialization.SerializationEntry' is marked as readonly in the contract so it must also be marked readonly in the implementation.
TypesMustExist : Type 'System.ArgIterator' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Index' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Range' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Text.Rune' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Text.StringRuneEnumerator' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ReadOnlySpan<T>.Item.get(System.Index)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ReadOnlySpan<T>.Item.get(System.Range)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Span<T>.Item.get(System.Index)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Span<T>.Item.get(System.Range)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled.get()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported.get()' does not exist in the implementation but it does exist in the contract.
10 changes: 2 additions & 8 deletions src/System.Runtime/src/ApiCompatBaseline.uapaot.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
TypesMustExist : Type 'System.ArgIterator' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Index' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Range' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Text.Rune' does not exist in the implementation but it does exist in the contract.
TypesMustExist : Type 'System.Text.StringRuneEnumerator' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ReadOnlySpan<T>.Item.get(System.Index)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.ReadOnlySpan<T>.Item.get(System.Range)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Span<T>.Item.get(System.Index)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Span<T>.Item.get(System.Range)' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled.get()' does not exist in the implementation but it does exist in the contract.
MembersMustExist : Member 'System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported.get()' does not exist in the implementation but it does exist in the contract.
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);
}
}
}

1 comment on commit 5ce17d9

@davidfowl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @pakrym

Please sign in to comment.