Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit fe784bc

Browse files
author
Atsushi Kanamori
committed
Fix all failures in System.CodeDom.Tests on ILC.
1 parent 72b1fcb commit fe784bc

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public void ICollection_NonGeneric_CopyTo_TwoDimensionArray_ThrowsException(int
208208
}
209209
}
210210

211-
[Theory]
211+
[ConditionalTheory(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNonZeroLowerBoundArraySupported))]
212212
[MemberData(nameof(ValidCollectionSizes))]
213213
public virtual void ICollection_NonGeneric_CopyTo_NonZeroLowerBound(int count)
214214
{

src/System.CodeDom/tests/CodeObjects/CodeNamespaceTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void Ctor_String(string name)
3333
}
3434

3535
[Fact]
36+
[SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Cannot do internal Reflection on framework types.")]
3637
public void Ctor_SerializationInfo_StreamingContext()
3738
{
3839
ConstructorInfo constructor = typeof(CodeNamespace).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(SerializationInfo), typeof(StreamingContext) }, null);

src/System.CodeDom/tests/Compiler/CodeDomProviderTests.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)