Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <mabaul@microsoft.com>2019-05-03 17:09:48 +0300
committerGitHub <noreply@github.com>2019-05-03 17:09:48 +0300
commit40372422e7bfa506e6a93fd06e9315513d9341c6 (patch)
treecaf1e09f2ce27fddfdeb62294fa622aadbf61703 /mcs/class/referencesource
parent231da41c789ccc8810452de516ffec0f9e5c34cf (diff)
Add a few `RuntimeFeature.IsDynamicCodeSupported` conditionals. (#14284)
* Add a few `RuntimeFeature.IsDynamicCodeSupported` conditionals. * Update RuntimeMethodInfo.cs
Diffstat (limited to 'mcs/class/referencesource')
-rw-r--r--mcs/class/referencesource/mscorlib/system/activator.cs2
-rw-r--r--mcs/class/referencesource/mscorlib/system/rttype.cs6
2 files changed, 6 insertions, 2 deletions
diff --git a/mcs/class/referencesource/mscorlib/system/activator.cs b/mcs/class/referencesource/mscorlib/system/activator.cs
index 67a42942d32..660a30f7661 100644
--- a/mcs/class/referencesource/mscorlib/system/activator.cs
+++ b/mcs/class/referencesource/mscorlib/system/activator.cs
@@ -74,7 +74,7 @@ namespace System {
throw new ArgumentNullException("type");
Contract.EndContractBlock();
#if !FULL_AOT_RUNTIME
- if (type is System.Reflection.Emit.TypeBuilder)
+ if (RuntimeFeature.IsDynamicCodeSupported && type is System.Reflection.Emit.TypeBuilder)
throw new NotSupportedException(Environment.GetResourceString("NotSupported_CreateInstanceWithTypeBuilder"));
#endif
// If they didn't specify a lookup, then we will provide the default lookup.
diff --git a/mcs/class/referencesource/mscorlib/system/rttype.cs b/mcs/class/referencesource/mscorlib/system/rttype.cs
index 20c994fd335..8a1ce0fbd26 100644
--- a/mcs/class/referencesource/mscorlib/system/rttype.cs
+++ b/mcs/class/referencesource/mscorlib/system/rttype.cs
@@ -3782,7 +3782,7 @@ namespace System
}
#if !FULL_AOT_RUNTIME
// Special case for TypeBuilder to be backward-compatible.
- if (c is System.Reflection.Emit.TypeBuilder)
+ if (RuntimeFeature.IsDynamicCodeSupported && c is System.Reflection.Emit.TypeBuilder)
{
// If c is a subclass of this class, then c can be cast to this type.
if (c.IsSubclassOf(this))
@@ -4303,7 +4303,11 @@ namespace System
#if NETCORE
throw new NotImplementedException ();
#else
+#pragma warning disable 162
+ if (!RuntimeFeature.IsDynamicCodeSupported)
+ throw new PlatformNotSupportedException();
return System.Reflection.Emit.TypeBuilderInstantiation.MakeGenericType(this, instantiation);
+#pragma warning restore 162
#endif
}