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

Commit 0bc18f6

Browse files
author
Atsushi Kanamori
committed
CoreFX on ILC tests burndown
Getting down to 1-bucket items here... - Disabled MarshalAs custom attribute test (not implemented on .Net Native) - Reenabled GetTypeFromCLSID() data item (restored on .Net Native) - Avoid testing contents of ToString() (.Net Native ToString() simplifies the type name in order to avoid excess metadata probing.)
1 parent 6f07f7e commit 0bc18f6

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

src/System.Reflection/tests/ParameterInfoTests.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ public void Attributes(Type type, string name, int index, ParameterAttributes ex
151151
}
152152

153153
[Theory]
154-
[InlineData(typeof(OptionalAttribute))]
155-
[InlineData(typeof(MarshalAsAttribute))]
156-
[InlineData(typeof(OutAttribute))]
157-
[InlineData(typeof(InAttribute))]
154+
[MemberData(nameof(s_CustomAttributesTestData))]
158155
public void CustomAttributesTest(Type attrType)
159156
{
160157
ParameterInfo parameterInfo = GetParameterInfo(typeof(ParameterInfoMetadata), "MethodWithOptionalDefaultOutInMarshalParam", 0);
@@ -172,6 +169,20 @@ public void CustomAttributesTest(Type attrType)
172169
Assert.True(prov.IsDefined(attrType, true));
173170
}
174171

172+
public static IEnumerable<object[]> s_CustomAttributesTestData
173+
{
174+
get
175+
{
176+
yield return new object[] { typeof(OptionalAttribute) };
177+
yield return new object[] { typeof(OutAttribute) };
178+
yield return new object[] { typeof(InAttribute) };
179+
if (!PlatformDetection.IsNetNative) // Native Metadata format does not expose FieldMarshal info: https://github.com/dotnet/corert/issues/3366
180+
{
181+
yield return new object[] { typeof(MarshalAsAttribute) };
182+
}
183+
}
184+
}
185+
175186
[Theory]
176187
[InlineData(typeof(ParameterInfoMetadata), "Method1", 0, new Type[0])]
177188
[InlineData(typeof(ParameterInfoMetadata), "VirtualMethod", 0, new Type[0])]

src/System.Reflection/tests/System.Reflection.Tests.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<Compile Include="TypeInfoTests.cs" />
2626
<Compile Include="ExceptionTests.cs" />
2727
</ItemGroup>
28+
<ItemGroup>
29+
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
30+
<Link>Common\System\PlatformDetection.cs</Link>
31+
</Compile>
32+
</ItemGroup>
2833
<ItemGroup>
2934
<EmbeddedResource Include="Resources\EmbeddedImage.png">
3035
<LogicalName>EmbeddedImage.png</LogicalName>

src/System.Runtime/tests/System/Reflection/CustomAttributeDataTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static void Test_CustomAttributeData_ToString()
136136
{
137137
if (cad.AttributeType == typeof(MyAttribute))
138138
{
139-
Assert.Equal("[System.Reflection.Tests.CustomAttributeDataTests+MyAttribute((Int32)3)]", cad.ToString());
139+
Assert.NotNull(cad.ToString());
140140
return;
141141
}
142142
}

src/System.Runtime/tests/System/TypeTests.netcoreapp.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ static TypeTestsNetcore()
2424

2525
if (PlatformDetection.IsWindows)
2626
{
27-
if (!PlatformDetection.IsNetNative) // .Net Native - MakeArrayType() of these magic types throws exception: (https://github.com/dotnet/corert/issues/3522)
28-
{
29-
NonArrayBaseTypes.Add(Type.GetTypeFromCLSID(default(Guid)));
30-
}
27+
NonArrayBaseTypes.Add(Type.GetTypeFromCLSID(default(Guid)));
3128
}
3229
}
3330

@@ -209,4 +206,4 @@ public static IEnumerable<object[]> NotDefinedTypes
209206
}
210207
}
211208
}
212-
}
209+
}

0 commit comments

Comments
 (0)