roslynator
roslynator copied to clipboard
RCS1043 should also remove calls to partial methods
Product and Version Used: Visual Studio Extension 3.1.0
Steps to Reproduce: Consider the class below:
public partial class Foo
{
public Foo()
{
this.Initialize();
}
partial void Initialize();
}
Actual Behavior: When there is no other partial class is defined for Foo in the project, this analyzer provides an option to remove the partial keyword. When it is selected, it removed the keyword as well as the partial method. But does not remove call to it resulting into a compiler error.
public class Foo
{
public Foo()
{
this.Initialize();
}
}
Expected Behavior: The code fix should also remove calls to the partial method.
public class Foo
{
public Foo()
{
}
}
I came across RCS1043 in a Blazor app with a partial class. Roslynator gives me the option to remove the partial
modifier, but it is needed for code-behind Blazor class.
@ryanbuening I think it would be possible to suppress the diagnostic if a class is derived from ComponentBase
. Can you please create a new issue for it?
Created #807
@ryanbuening I think it would be possible to suppress the diagnostic if a class is derived from
ComponentBase
. Can you please create a new issue for it?
What about when we don't have a razor file and are defining the component entirely in c#?
What about when we don't have a razor file and are defining the component entirely in c#?
In that case you have to suppress diagnostic or disable the analyzer.