Add warning and code fix suggestion for non-public/static [JSInvokable] methods#67137
Draft
damyanpetev wants to merge 2 commits into
Draft
Add warning and code fix suggestion for non-public/static [JSInvokable] methods#67137damyanpetev wants to merge 2 commits into
[JSInvokable] methods#67137damyanpetev wants to merge 2 commits into
Conversation
…fier handling ComponentParametersShouldBePublicCodeFixProvider was modifying the SyntaxTokenList while iterating, causing attempts to remove beyond the first to fail, leaving resulting code in worng state with likely compiler errors
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.
Add Blazor Analyzer diagnostic warning and Code fix provider when a
[JSInvokable]method is not public and/or staticAdded new analyzer and code fix provider, plus a small fix for an old code fix provider with similar logic.
Description
Note: Includes a small fix (first commit) for an existing
ComponentParametersShouldBePublicCodeFixProvideras it was modifying the SyntaxTokenList while iterating, causing attempts to remove beyond the first to fail, leaving resulting code in wrong state with likely compiler errors - usually CS0107.Can move to a separate PR if that goes too out of scope for this one.
Added two diagnostic warnings - one for

[JSInvokable]not beingpublicand one for it not beingstaticsince I saw that was also not covered. Could merge into a single warning in case the two are too noisy.The code fix handles both at the same time regardless.
Closes #65235