@@ -129,10 +129,10 @@ public void CreateProvider_NullLanguage_ThrowsArgumentNullException()
129129 public void CreateProvider_NoSuchLanguage_ThrowsConfigurationErrorsException ( string language )
130130 {
131131 Exception ex1 = Assert . ThrowsAny < Exception > ( ( ) => CodeDomProvider . CreateProvider ( language ) ) ;
132- Assert . Equal ( "ConfigurationErrorsException" , ex1 . GetType ( ) . Name ) ;
132+ AssertIsConfigurationErrorsException ( ex1 ) ;
133133
134134 Exception ex2 = Assert . ThrowsAny < Exception > ( ( ) => CodeDomProvider . CreateProvider ( language , new Dictionary < string , string > ( ) ) ) ;
135- Assert . Equal ( "ConfigurationErrorsException" , ex2 . GetType ( ) . Name ) ;
135+ AssertIsConfigurationErrorsException ( ex2 ) ;
136136 }
137137
138138 [ Theory ]
@@ -187,7 +187,7 @@ public void GetLanguageFromExtension_NullExtension_ThrowsArgumentNullException()
187187 public void GetLanguageFromExtension_NoSuchExtension_ThrowsConfigurationErrorsException ( string extension )
188188 {
189189 Exception ex = Assert . ThrowsAny < Exception > ( ( ) => CodeDomProvider . GetLanguageFromExtension ( extension ) ) ;
190- Assert . Equal ( "ConfigurationErrorsException" , ex . GetType ( ) . Name ) ;
190+ AssertIsConfigurationErrorsException ( ex ) ;
191191 }
192192
193193 [ Theory ]
@@ -241,7 +241,7 @@ public void GetCompilerInfo_NullLanguage_ThrowsArgumentNullException()
241241 public void GetCompilerInfo_NoSuchExtension_ThrowsKeyNotFoundException ( string language )
242242 {
243243 Exception ex = Assert . ThrowsAny < Exception > ( ( ) => CodeDomProvider . GetCompilerInfo ( language ) ) ;
244- Assert . Equal ( "ConfigurationErrorsException" , ex . GetType ( ) . Name ) ;
244+ AssertIsConfigurationErrorsException ( ex ) ;
245245 }
246246
247247 [ Fact ]
@@ -418,6 +418,14 @@ public void Parse_NullParser_ThrowsNotImplementedException()
418418 Assert . Throws < NotImplementedException > ( ( ) => new NullProvider ( ) . Parse ( new StringReader ( "abc" ) ) ) ;
419419 }
420420
421+ private static void AssertIsConfigurationErrorsException ( Exception ex )
422+ {
423+ if ( ! PlatformDetection . IsNetNative ) // Can't do internal Reflection
424+ {
425+ Assert . Equal ( "ConfigurationErrorsException" , ex . GetType ( ) . Name ) ;
426+ }
427+ }
428+
421429 protected class NullProvider : CodeDomProvider
422430 {
423431#pragma warning disable 0672
0 commit comments