-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add code fix for MSTEST0021 #3827
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # src/Analyzers/MSTest.Analyzers.CodeFixes/CodeFixResources.Designer.cs # src/Analyzers/MSTest.Analyzers.CodeFixes/CodeFixResources.resx
|
||
[TestClass] | ||
public class MyTestClass | ||
: IDisposable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this related to BaseList
ready function as i tried a lot nothing there. after using the function in removing it removes the new line and in add in adds the newline
|
||
await VerifyCS.VerifyAnalyzerAsync(code); | ||
public async Task WhenTestClassHasTestCleanup_AndHasDispose_Diagnostic() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure about this one? what if the two bodies conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user have to fix it, in old fix we did it like the with Amaury
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
|
||
public class LocalBase{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this class has got a dispose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in all fix we were working was the first layer
public class MyTestClass | ||
: IDisposable | ||
{ | ||
public void Dispose() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be virtual to allow override? https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the usual fix for implementing the interface gives the not virtual one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions for you and @Evangelink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would need to look at roslyn and roslyn-analyzer code fixes but it feels wrong that we have to do all of these actions ourselves.
fix: #3665