diff --git a/src/linker/Linker.Steps/RemoveFeaturesStep.cs b/src/linker/Linker.Steps/RemoveFeaturesStep.cs index 14bb889fae73..1c65ab0ba8a3 100644 --- a/src/linker/Linker.Steps/RemoveFeaturesStep.cs +++ b/src/linker/Linker.Steps/RemoveFeaturesStep.cs @@ -12,6 +12,7 @@ public class RemoveFeaturesStep : BaseStep public bool FeatureCOM { get; set; } public bool FeatureETW { get; set; } + public bool FeatureSRE { get; set; } // // Manually overrides System.Globalization.Invariant mode @@ -57,6 +58,17 @@ void ProcessType (TypeDefinition type) ExcludeEventSourceImplementation (type); } + if (FeatureSRE) { + if (type.Namespace == "System" && type.Name == "RuntimeType") { + foreach (var method in type.Methods) { + if (method.Name == "MakeTypeBuilderInstantiation") { + Annotations.SetAction (method, MethodAction.ConvertToThrow); + break; + } + } + } + } + if (RemoveCustomAttributes (type)) { if (FeatureCOM && type.IsImport) { type.IsImport = false; diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs index a23bd7c404c5..75cc02fba1ff 100644 --- a/src/linker/Linker/Driver.cs +++ b/src/linker/Linker/Driver.cs @@ -353,6 +353,7 @@ public void Run (ILogger customLogger = null) p.AddStepBefore (typeof (MarkStep), new RemoveFeaturesStep () { FeatureCOM = excluded_features.Contains ("com"), FeatureETW = excluded_features.Contains ("etw"), + FeatureSRE = excluded_features.Contains ("sre"), FeatureGlobalization = excluded_features.Contains ("globalization") });