Allow duplicate feature switch settings (#87207)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Wed, 7 Jun 2023 20:50:18 +0000 (05:50 +0900)
committerGitHub <noreply@github.com>
Wed, 7 Jun 2023 20:50:18 +0000 (05:50 +0900)
Fixes #86186.

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSwitchManager.cs

index 7d406ce0be29633fa3dffd35f853862d86b3921f..a1dfaeca37930c349b08ad54c7084765d8ee4f9d 100644 (file)
@@ -28,7 +28,13 @@ namespace ILCompiler
         public FeatureSwitchManager(ILProvider nestedILProvider, Logger logger, IEnumerable<KeyValuePair<string, bool>> switchValues)
         {
             _nestedILProvider = nestedILProvider;
-            _hashtable = new FeatureSwitchHashtable(logger, new Dictionary<string, bool>(switchValues));
+
+            // Last setting wins
+            var dictionary = new Dictionary<string, bool>();
+            foreach ((string name, bool value) in switchValues)
+                dictionary[name] = value;
+
+            _hashtable = new FeatureSwitchHashtable(logger, dictionary);
         }
 
         private BodySubstitution GetSubstitution(MethodDesc method)