Add RuntimeFeature.IsDynamicCodeSupported/IsDynamicCodeCompiled
authorJan Kotas <jkotas@microsoft.com>
Mon, 3 Dec 2018 18:26:14 +0000 (10:26 -0800)
committerJan Kotas <jkotas@microsoft.com>
Tue, 4 Dec 2018 03:55:37 +0000 (19:55 -0800)
Contributes to dotnet/corefx#29258

src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.CoreCLR.cs [new file with mode: 0644]

index 6f1c424..30f8416 100644 (file)
   <ItemGroup>
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ICastableHelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeFeature.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\jithelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ConditionalWeakTable.cs" />
index c6a97ec..b0cd9dd 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace System.Runtime.CompilerServices
 {
-    public static class RuntimeFeature
+    public static partial class RuntimeFeature
     {
         /// <summary>
         /// Name of the Portable PDB feature.
@@ -30,6 +30,10 @@ namespace System.Runtime.CompilerServices
                 case DefaultImplementationsOfInterfaces:
 #endif
                     return true;
+                case nameof(IsDynamicCodeSupported):
+                    return IsDynamicCodeSupported;
+                case nameof(IsDynamicCodeCompiled):
+                    return IsDynamicCodeCompiled;
             }
 
             return false;
diff --git a/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeFeature.CoreCLR.cs
new file mode 100644 (file)
index 0000000..69a7465
--- /dev/null
@@ -0,0 +1,12 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.CompilerServices
+{
+    public static partial class RuntimeFeature
+    {
+        public static bool IsDynamicCodeSupported => true;
+        public static bool IsDynamicCodeCompiled => true;
+    }
+}