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
S2325 is raised on partial implementations that only refer to their own parameters. The rule correctly recognizes that no instance-specific methods or properties are accessed, but making the partial implementation static doesn't even compile, because both partial declarations should be static.
The original declaring partial class is generated, so it's not an option to edit that.
Repro steps
// In our project this class is generated.partialclassClass{publicvoidWriteEverything(){Console.WriteLine("Something");WriteMore();}partialvoidWriteMore();}partialclassClass{partialvoidWriteMore()// Noncompliant - FP{Console.WriteLine("More");}}
Expected behavior
S2325 is not triggered on methods that are part of an external contract.
(This works fine for interfaces.)
Add a private readonly field for any constant value that is used and access that.
// In our project this class is generated.partialclassClass{publicvoidWriteEverything(){Console.WriteLine("Something");WriteMore();}partialvoidWriteMore();}partialclassClass{privatereadonlystring_workaround="More";partialvoidWriteMore(){Console.WriteLine(_workaround);}}
Description
S2325 is raised on partial implementations that only refer to their own parameters. The rule correctly recognizes that no instance-specific methods or properties are accessed, but making the partial implementation static doesn't even compile, because both partial declarations should be static.
The original declaring partial class is generated, so it's not an option to edit that.
Repro steps
Expected behavior
S2325 is not triggered on methods that are part of an external contract.
(This works fine for interfaces.)
Actual behavior
S2325 is triggered.
Known workarounds
Add a private readonly field for any constant value that is used and access that.
Related information
The text was updated successfully, but these errors were encountered: