You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a Roslyn analyzer warning comes up for a file in VS Code (e.g., SA1649 from StyleCop - file name must match class name) and you rename the file, the issue remains in the "Problems" list in VS Code until you close the whole workspace and reopen it.
Steps to Reproduce
Open a C# / .NET Core project.
Add the StyleCop.Analyzers package if it's not already there.
Add a new file called Foo.cs.
In the file, paste the following code to create a class named Bar:
namespaceMyNamespace{publicclassBar{}}
Notice in the "problems" window there's a warning for Foo.cs - "File name should match first type name. csharp(SA1649)"
Rename the file to Bar.cs - the file name now matches the type name.
Notice in the "problems" window that all the warnings for Foo.cs remain.
Click on one of the warnings and VS Code will prompt you to create the file Foo.cs. Don't do it.
Build the project. The warnings for Foo.cs remain.
Expected Behavior
After renaming the Foo.cs file I expect the warnings/issues for that file to be removed from the "Problems" window. If analysis finds new warnings in the renamed file, those should appear.
Actual Behavior
After renaming the Foo.cs file the warnings/issues for Foo.cs remain in the "Problems" window until you close VS Code and reopen it.
Logs
OmniSharp log
There don't appear to be relevant logs for this issue, though I do see a lot of messages like this:
[info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.CachingCodeFixProviderForProjects
Skipping code fix provider 'Microsoft.CodeQuality.Analyzers.QualityGuidelines.MarkMembersAsStaticFixer' because its language doesn't match 'C#'.
I find that odd because a lot of the skipped fixes appear to be things I'd expect to be supported in C#, though perhaps these are the VB equivalents.
C# log
There is not a single log line in the C# output window.
Environment information
VSCode version: 1.41.1 C# Extension: 1.21.9
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
Seems this is a common problem where extensions aren't registering for the right events to handle file close/delete/rename. Enough that VS Code is going to add a 'clear' button to the Problems window. However, it'd still be nice if this extension would handle the events and clean up after itself on delete/rename of files.
Issue Description
If a Roslyn analyzer warning comes up for a file in VS Code (e.g., SA1649 from StyleCop - file name must match class name) and you rename the file, the issue remains in the "Problems" list in VS Code until you close the whole workspace and reopen it.
Steps to Reproduce
Foo.cs
.Bar
:Foo.cs
- "File name should match first type name. csharp(SA1649)"Bar.cs
- the file name now matches the type name.Foo.cs
remain.Foo.cs
. Don't do it.Foo.cs
remain.Expected Behavior
After renaming the
Foo.cs
file I expect the warnings/issues for that file to be removed from the "Problems" window. If analysis finds new warnings in the renamed file, those should appear.Actual Behavior
After renaming the
Foo.cs
file the warnings/issues forFoo.cs
remain in the "Problems" window until you close VS Code and reopen it.Logs
OmniSharp log
There don't appear to be relevant logs for this issue, though I do see a lot of messages like this:
I find that odd because a lot of the skipped fixes appear to be things I'd expect to be supported in C#, though perhaps these are the VB equivalents.
C# log
There is not a single log line in the C# output window.
Environment information
VSCode version: 1.41.1
C# Extension: 1.21.9
Mono Information
OmniSharp using built-in monoDotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.1.100 Commit: cd82f021f4Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 65f04fb6db
.NET Core SDKs installed:
2.1.607 [/usr/local/share/dotnet/sdk]
3.1.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
The text was updated successfully, but these errors were encountered: