CA1822 mistakenly triggers on partial class
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 173
- Avg merge
- 10d 13h
- Merged PRs (30d)
- 1
Description
If you have a C# class, then rule CA1822 can incorrectly be flagged for a method which accesses a field defined in a separate file.
Example:
D:\projects\ConceptReader\testbed\catcher\liveview\MainWindow.xaml.cs(39,21): info CA1822: Member 'WriteLine' does not access instance data and can be marked as static [D:\projects\ConceptReader\testbed\catcher\liveview\liveview.csproj]
```
public void WriteLine(string message)
{
Trace.WriteLine(message);
statusText.Text = message;
}
```
However, statusText is an internal field in the machine-generated MainWindows.g.i.cs partial class. This doesn't seem to be picked up by dotnet format and so it is happy to rewrite the WriteLine code to make it static, which doesn't compile anymore.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.