dotnet / dotnet/linker

Linker cannot determine whether suppression is redundant if the method body is unreachable.

Open
#2,920 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

Consider the following code:
```csharp
public static void Test ()
{
UsedToMarkMethod (null);
}

static void UsedToMarkMethod (Type t)
{
t.MethodConvertedToThrow ();
}

class Type
{
[UnconditionalSuppressMessage ("Test", "IL2072")]
public string MethodConvertedToThrow ()
{
// Trigger IL2072 warning
}
}
```
The body of `MethodConvertedToThrow ()` is unreachable and will not be processed. The linker is unable to determine whether the suppression on this method is useful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.