Skip to content

Commit e75d5bf

Browse files
authored
1 parent 6d969dd commit e75d5bf

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed

tests/dotnet/UnitTests/TrimmerWarningsTest.cs

+57-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@ public class TrimmerWarningsTest : TestBaseClass {
88
[TestCase (ApplePlatform.TVOS, "tvossimulator-x64")]
99
public void TrimmerWarningsManagedStaticRegistrar (ApplePlatform platform, string runtimeIdentifiers)
1010
{
11-
TrimmerWarnings (platform, runtimeIdentifiers, "managed-static", Array.Empty<ExpectedBuildMessage> ());
11+
// FIXME: dotnet/runtime#100256
12+
ExpectedBuildMessage [] expectedWarnings;
13+
switch (platform) {
14+
case ApplePlatform.iOS:
15+
case ApplePlatform.TVOS:
16+
expectedWarnings = Array.Empty<ExpectedBuildMessage> ();
17+
break;
18+
case ApplePlatform.MacOSX:
19+
case ApplePlatform.MacCatalyst:
20+
expectedWarnings = new ExpectedBuildMessage [] {
21+
new ExpectedBuildMessage ("ILLink" /* line 0 */, "System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled: Attribute 'System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances)."),
22+
};
23+
break;
24+
default:
25+
Assert.Fail ($"Unknown platform: {platform}");
26+
return;
27+
}
28+
29+
TrimmerWarnings (platform, runtimeIdentifiers, "managed-static", expectedWarnings);
1230
}
1331

1432
[Test]
@@ -18,7 +36,25 @@ public void TrimmerWarningsManagedStaticRegistrar (ApplePlatform platform, strin
1836
[TestCase (ApplePlatform.TVOS, "tvos-arm64")]
1937
public void TrimmerWarningsStaticRegistrar (ApplePlatform platform, string runtimeIdentifiers)
2038
{
21-
TrimmerWarnings (platform, runtimeIdentifiers, "static", Array.Empty<ExpectedBuildMessage> ());
39+
// FIXME: dotnet/runtime#100256
40+
ExpectedBuildMessage [] expectedWarnings;
41+
switch (platform) {
42+
case ApplePlatform.iOS:
43+
case ApplePlatform.TVOS:
44+
expectedWarnings = Array.Empty<ExpectedBuildMessage> ();
45+
break;
46+
case ApplePlatform.MacOSX:
47+
case ApplePlatform.MacCatalyst:
48+
expectedWarnings = new ExpectedBuildMessage [] {
49+
new ExpectedBuildMessage ("ILLink" /* line 0 */, "System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled: Attribute 'System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances)."),
50+
};
51+
break;
52+
default:
53+
Assert.Fail ($"Unknown platform: {platform}");
54+
return;
55+
}
56+
57+
TrimmerWarnings (platform, runtimeIdentifiers, "static", expectedWarnings);
2258
}
2359

2460
[Test]
@@ -28,7 +64,25 @@ public void TrimmerWarningsStaticRegistrar (ApplePlatform platform, string runti
2864
[TestCase (ApplePlatform.TVOS, "tvos-arm64")]
2965
public void TrimmerWarningsDynamicRegistrar (ApplePlatform platform, string runtimeIdentifiers)
3066
{
31-
TrimmerWarnings (platform, runtimeIdentifiers, "dynamic", Array.Empty<ExpectedBuildMessage> ());
67+
// FIXME: dotnet/runtime#100256
68+
ExpectedBuildMessage [] expectedWarnings;
69+
switch (platform) {
70+
case ApplePlatform.iOS:
71+
case ApplePlatform.TVOS:
72+
expectedWarnings = Array.Empty<ExpectedBuildMessage> ();
73+
break;
74+
case ApplePlatform.MacOSX:
75+
case ApplePlatform.MacCatalyst:
76+
expectedWarnings = new ExpectedBuildMessage [] {
77+
new ExpectedBuildMessage ("ILLink" /* line 0 */, "System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled: Attribute 'System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute' is being referenced in code but the trimmer was instructed to remove all instances of this attribute. If the attribute instances are necessary make sure to either remove the trimmer attribute XML portion which removes the attribute instances, or override the removal by using the trimmer XML descriptor to keep the attribute type (which in turn keeps all of its instances)."),
78+
};
79+
break;
80+
default:
81+
Assert.Fail ($"Unknown platform: {platform}");
82+
return;
83+
}
84+
85+
TrimmerWarnings (platform, runtimeIdentifiers, "dynamic", expectedWarnings);
3286
}
3387

3488
void TrimmerWarnings (ApplePlatform platform, string runtimeIdentifiers, string registrar, params ExpectedBuildMessage [] expectedWarnings)

0 commit comments

Comments
 (0)