Add code fixers for MA0118, MA0161, and MA0186#1079
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 31, 2026
Closed
Closed
Closed
This was referenced Apr 12, 2026
Open
This was referenced Apr 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
These three analyzers already reported useful diagnostics but lacked automatic remediation, which made adoption slower and more manual. This change adds code fixers so developers can apply safe, consistent fixes directly from the IDE.
What changed
MA0118([JSInvokable] methods must be public) that updates method accessibility topublicwhile preserving other modifiers (for examplestatic).MA0161(UseShellExecute must be explicitly set) that offers both actions:Set UseShellExecute to falseSet UseShellExecute to trueand handles both
new ProcessStartInfo()and object initializers with existing members.MA0186(Equals/TryGetValue nullable attributes) that:[NotNullWhen(true)]onEqualsparameters[MaybeNullWhen(false)]onTryGetValueoutvalue parameterssrc/DocumentationGenerator, which updated rule source links and the README/docs fixer support matrix.Notes for reviewers
MA0161intentionally exposes two code actions (true/false) because both are semantically valid depending on caller intent.MA0118tests were split into targeted code-fix cases to align with the test harness behavior that applies one fix option at a time.Validation
dotnet test tests\Meziantou.Analyzer.Test\Meziantou.Analyzer.Test.csproj --filter "FullyQualifiedName~ProcessStartAnalyzerTests|FullyQualifiedName~MissingNotNullWhenAttributeOnEqualsAnalyzerTests|FullyQualifiedName~JSInvokableMethodsMustBePublicAnalyzerTests" --nologodotnet test tests\Meziantou.Analyzer.Test\Meziantou.Analyzer.Test.csproj /p:RoslynVersion=roslyn4.14 --filter "FullyQualifiedName~ProcessStartAnalyzerTests|FullyQualifiedName~MissingNotNullWhenAttributeOnEqualsAnalyzerTests|FullyQualifiedName~JSInvokableMethodsMustBePublicAnalyzerTests" --nologodotnet run --project src\DocumentationGenerator