dotnet / dotnet/docs

IDE0071: misleading analyzer's description where .NET version< 6.0

Open
#25,405 3 comments 0 reactions 0 assignees View on GitHub
dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

[IDE0071](https://docs.microsoft.com/ru-ru/dotnet/fundamentals/code-analysis/style-rules/ide0071)

![image](https://user-images.githubusercontent.com/28877846/127548183-6635df8b-9a0f-4b01-b170-1a3be5739475.png)

```csharp
enum Foo
{
A = 0
}

var test1 = $"Test foo = {Foo.A}."; // No diagnostic for IDE0071. But the compiler will convert the code to this with boxing: string.Format("Test foo = {0}.", Foo.A);
var test2 = $"Test foo = {Foo.A.ToString()}."; // Get diagnostic for IDE0071. But there is no boxing.
```

It may be worth correcting the description of the analyzer so that it is not misleading.

https://github.com/dotnet/roslyn/issues/55240
https://github.com/JosefPihrt/Roslynator/issues/828

[Edited to add doc details]

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: b5899d7a-30d1-32aa-a91e-6ae492e86bcf
* Version Independent ID: ba625de0-931a-eb2c-2c77-0a87a76a86f9
* Content: [IDE0071: Simplify interpolation - .NET](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0071)
* Content Source: [docs/fundamentals/code-analysis/style-rules/ide0071.md](https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/style-rules/ide0071.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @gewarren
* Microsoft Alias: **gewarren**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.