diff --git a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs index f8816f13a62ab7..a749e939d226e3 100644 --- a/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs +++ b/src/libraries/System.Runtime/tests/System/Type/TypeTests.cs @@ -923,6 +923,16 @@ public void IsContextful() Assert.True(!typeof(ContextBoundClass).IsContextful); } + [Fact] + public void MakeGenericType_NonRuntimeType() + { + foreach (Type nonRuntimeType in Helpers.NonRuntimeTypes) + { + Type t = typeof(List<>).MakeGenericType(nonRuntimeType); + Assert.NotNull(t); + } + } + #region GetInterfaceMap tests public static IEnumerable GetInterfaceMap_TestData() { diff --git a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs index 2d0a4b925096e4..f6d349d99ba261 100644 --- a/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/RuntimeType.Mono.cs @@ -1336,8 +1336,9 @@ public override Type MakeGenericType(Type[] instantiation) for (int iCopy = 0; iCopy < instantiation.Length; iCopy++) instantiationCopy[iCopy] = instantiation[iCopy]; instantiation = instantiationCopy; - - throw new NotImplementedException(); + if (!RuntimeFeature.IsDynamicCodeSupported) + throw new PlatformNotSupportedException(); + return System.Reflection.Emit.TypeBuilderInstantiation.MakeGenericType(this, instantiation); } instantiationRuntimeType[i] = rtInstantiationElem;