Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill in FeatureCheckDataflow.cs assertions with issue links #102679

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -154,7 +154,7 @@ static void MethodWithRequires ()
}

[ExpectedWarning ("IL2026", nameof (MethodWithRequires))]
[ExpectedWarning ("IL3050", nameof (MethodWithRequires), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (MethodWithRequires), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
public static void Test ()
{
MethodWithRequires ();
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ class GenericTypeWithRequires<
{
}

[ExpectedWarning ("IL3050", Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
// The way we track arrays causes the analyzer to track exponentially many
// ArrayValues in the ValueSet for the pattern in this method, hitting the limit.
// When this happens, we replace the ValueSet with an unknown value, producing
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ public static void Main ()
class CallFeatureUnguarded
{
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void Unguarded ()
{
RequiresUnreferencedCode ();
@@ -50,8 +50,8 @@ static void Unguarded ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void UnguardedIf ()
{
if (!TestFeatures.IsUnreferencedCodeSupported) {
@@ -62,8 +62,8 @@ static void UnguardedIf ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void UnguardedElse ()
{
if (TestFeatures.IsUnreferencedCodeSupported)
@@ -99,8 +99,8 @@ static void UnguardedTernary ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void UnguardedThrow ()
{
if (TestFeatures.IsUnreferencedCodeSupported)
@@ -114,8 +114,8 @@ static void UnguardedThrow ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void UnguardedReturn ()
{
if (TestFeatures.IsUnreferencedCodeSupported)
@@ -205,8 +205,8 @@ public static void Test ()
GuardedDoesNotReturnIfFalseCtor ();
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
static void GuardedIf ()
{
if (TestFeatures.IsUnreferencedCodeSupported) {
@@ -216,8 +216,8 @@ static void GuardedIf ()
}
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
static void GuardedElse ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -248,8 +248,8 @@ static void GuardedTernary ()
var b = !TestFeatures.IsUnreferencedCodeSupported ? true : RequiresUnreferencedCodeBool ();
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
static void GuardedThrow ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -262,8 +262,8 @@ static void GuardedThrow ()
RequiresAssemblyFiles ();
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "Trimmer and NativeAOT eliminate the entire problematic branch. Analyzer can only guarantee UnreferencedCode will be supported")]
static void GuardedReturn ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -277,7 +277,7 @@ static void GuardedReturn ()
}

// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void GuardedAssert ()
{
Debug.Assert (TestFeatures.IsUnreferencedCodeSupported);
@@ -286,7 +286,7 @@ static void GuardedAssert ()
}

// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void GuardedDoesNotReturnIfTrue ()
{
DoesNotReturnIfTrue (!TestFeatures.IsUnreferencedCodeSupported);
@@ -295,7 +295,7 @@ static void GuardedDoesNotReturnIfTrue ()
}

// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void GuardedDoesNotReturnIfFalse ()
{
DoesNotReturnIfFalse (TestFeatures.IsUnreferencedCodeSupported);
@@ -304,7 +304,7 @@ static void GuardedDoesNotReturnIfFalse ()
}

// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void GuardedDoesNotReturn ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -314,7 +314,7 @@ static void GuardedDoesNotReturn ()
}

// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void GuardedDoesNotReturnIfFalseCtor ()
{
new DoesNotReturnIfFalseCtor (TestFeatures.IsUnreferencedCodeSupported);
@@ -326,8 +326,8 @@ static void GuardedDoesNotReturnIfFalseCtor ()
class FeatureCheckBooleanExpressions
{
// Trimmer/NativeAot aren't able to optimize away the branch in this case.
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "")]
[UnexpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
[UnexpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
static void And ()
{
if (TestFeatures.IsUnreferencedCodeSupported && RuntimeFeature.IsDynamicCodeSupported) {
@@ -337,7 +337,7 @@ static void And ()
}
Copy link
Member Author

@jtschuster jtschuster May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we treat this as expected behavior based, described at https://github.com/dotnet/runtime/blob/main/docs/design/tools/illink/feature-checks.md#boolean-andor, but I think we could file an issue to track it and reference that here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made #102830 to track unifying behavior on this.


[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void AndNot ()
{
if (!TestFeatures.IsUnreferencedCodeSupported && !RuntimeFeature.IsDynamicCodeSupported)
@@ -348,8 +348,8 @@ static void AndNot ()
}

// Trimmer/NativeAot aren't able to optimize away the branch in this case.
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "")]
[UnexpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
[UnexpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
static void NotAnd ()
{
if (!(TestFeatures.IsUnreferencedCodeSupported && RuntimeFeature.IsDynamicCodeSupported))
@@ -360,7 +360,7 @@ static void NotAnd ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void Or ()
{
if (TestFeatures.IsUnreferencedCodeSupported || RuntimeFeature.IsDynamicCodeSupported) {
@@ -370,8 +370,8 @@ static void Or ()
}

// Trimmer/NativeAot aren't able to optimize away the branch in this case.
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "")]
[UnexpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
[UnexpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
static void OrNot ()
{
if (!TestFeatures.IsUnreferencedCodeSupported || !RuntimeFeature.IsDynamicCodeSupported)
@@ -382,7 +382,7 @@ static void OrNot ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void NotOr ()
{
if (!(TestFeatures.IsUnreferencedCodeSupported || RuntimeFeature.IsDynamicCodeSupported))
@@ -424,7 +424,7 @@ static void NotEqualsTrue ()
{
if (TestFeatures.IsUnreferencedCodeSupported != true)
throw null;

RequiresUnreferencedCode ();
}

@@ -477,7 +477,7 @@ static void IsNotFalse ()
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102830")]
static void Contradiction ()
{
if (TestFeatures.IsUnreferencedCodeSupported && !TestFeatures.IsUnreferencedCodeSupported) {
@@ -532,7 +532,7 @@ static void CallTestDynamicCodeGuarded ()
RequiresDynamicCode ();
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void CallTestDynamicCodeUnguarded ()
{
RequiresDynamicCode ();
@@ -545,7 +545,7 @@ static void CallTestAssemblyFilesGuarded ()
}
}

[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer | Tool.NativeAot, "NativeAOT Specific Warning")]
static void CallTestAssemblyFilesUnguarded ()
{
RequiresAssemblyFiles ();
@@ -564,9 +564,9 @@ public static void Test ()

class FeatureCheckCombinations
{
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Trimmer won't warn for NativeAOT specific warning. Both features are disabled in NativeAOT and no path can reach the problematic methods")]
// Trimmer warns because IsDynamicCodeSupported is not a constant, so the call is reachable.
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Analyzer | Tool.Trimmer, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Analyzer | Tool.Trimmer, "Both features are disabled in NativeAOT and no path can reach the problematic methods")]
static void MeetFeaturesEmptyIntersection (bool b = true)
{
if (b) {
@@ -582,7 +582,7 @@ static void MeetFeaturesEmptyIntersection (bool b = true)

// Shows that ILLink has the same branch removal as NativeAot for this pattern, when
// the branches both use a feature check that's substituted by ILLink.
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Analyzer and NativeAOT eliminate the branch, but Analyzer can only guarantee UnreferencedCode is available")]
static void MeetFeaturesEmptyIntersection_IdenticalBranches (bool b = true)
{
if (b) {
@@ -596,7 +596,7 @@ static void MeetFeaturesEmptyIntersection_IdenticalBranches (bool b = true)
RequiresDynamicCode ();
}

[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "")]
[ExpectedWarning ("IL3050", nameof (RequiresDynamicCode), Tool.Analyzer, "Analyzer and NativeAOT eliminate the branch, but Analyzer can only guarantee UnreferencedCode is available")]
static void MeetFeaturesIntersection (bool b = true)
{
if (b) {
@@ -622,7 +622,7 @@ static void IntroduceFeature ()
}
}

[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "")]
[ExpectedWarning ("IL3002", nameof (RequiresAssemblyFiles), Tool.Analyzer, "Analyzer and NativeAOT eliminate the branch, but Analyzer can only guarantee UnreferencedCode is available")]
static void RemoveFeature ()
{
if (TestFeatures.IsUnreferencedCodeSupported) {
@@ -787,7 +787,7 @@ static void NestedTryInCheckInFinally ()

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInTryNoCatch () {
try {
Debug.Assert (TestFeatures.IsUnreferencedCodeSupported);
@@ -828,7 +828,7 @@ static void AssertInCatch () {
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInFinally () {
try {
RequiresUnreferencedCode0 ();
@@ -843,8 +843,8 @@ static void AssertInFinally () {
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInTryNestedInTry ()
{
try {
@@ -885,8 +885,8 @@ static void AssertInTryWithCatchNestedInTry ()
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInTryNestedInFinally ()
{
try {
@@ -925,8 +925,8 @@ static void AssertInTryWithCatchNestedInFinally ()
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInFinallyNestedInTry () {
try {
try {
@@ -944,8 +944,8 @@ static void AssertInFinallyNestedInTry () {
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInFinallyWithCatchNestedInTry () {
try {
try {
@@ -965,8 +965,8 @@ static void AssertInFinallyWithCatchNestedInTry () {
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1))]
// Trimmer/NativeAot don't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInFinallyNestedInFinally ()
{
try {
@@ -985,8 +985,8 @@ static void AssertInFinallyNestedInFinally ()
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode0))]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode1))]
// Trimmer/NativeAot doesn't optimize branches away based on DoesNotReturnIfAttribute
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode2), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode3), Tool.Trimmer | Tool.NativeAot, "ILLink and NativeAOT should not respect DoesNotReturnAttribute")]
static void AssertInFinallyWithCatchNestedInFinally ()
{
try {
@@ -1056,7 +1056,7 @@ static IEnumerable<int> GuardInIterator ()
}
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer, "", CompilerGeneratedCode = true)]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer, "https://github.com/dotnet/linker/issues/3087", CompilerGeneratedCode = true)]
static IEnumerable<int> StateFlowsAcrossYield ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -1075,7 +1075,7 @@ static async Task GuardInAsync ()
}
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/linker/issues/3087", CompilerGeneratedCode = true)]
static async Task StateFlowsAcrossAwait ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)
@@ -1095,7 +1095,7 @@ static async IAsyncEnumerable<int> GuardInAsyncIterator ()
}
}

[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[ExpectedWarning ("IL2026", nameof (RequiresUnreferencedCode), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/linker/issues/3087", CompilerGeneratedCode = true)]
static async IAsyncEnumerable<int> StateFlowsAcrossAwaitAndYield ()
{
if (!TestFeatures.IsUnreferencedCodeSupported)