dotnet / dotnet/format

Useless fix is suggested to `CS0612: XXX is obsolete` when the obsolete thing is a part of the Attribute for fields/props

Open
#1,628 4 comments 8 reactions 1 assignee Claimed by @JoeRobich View on GitHub
Area-IDE Bug IDE-Formatter
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

**Version Used**:
VS2022 17.1.0 preview1.1
dotnet format: 6.0.252703+68bc36719088c86b0ff01334039b0611741b8276

**Steps to Reproduce**:
```cs
[Obsolete]
public class Attr1Attribute : Attribute
{
public Attr1Attribute(Type t) { }
}

[Obsolete]
public class Class1
{
}
public class Class2
{
[Attr1(typeof(Class1))]
public int field1;
}
```
Run `dotnet format` with this code.

**Expected Behavior**:
`dotnet format` should finally get an stable result.

**Actual Behavior**:
`[Obsolete]` is added to field again and again every times you run `dotnet format`, and finally you will get an field like this
```cs
public class Class2
{
[Attr1(typeof(Class1))]
[Obsolete]
[Obsolete]
//...
[Obsolete]
[Obsolete]
public int field1;
}
```

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.