Repository navigation
MA0011: do not bind the invocations of attribute arguments speculatively - #1709
Merged
Merged
Conversation
This was referenced Oct 18, 2026
Closed
Closed
Closed
This was referenced Oct 18, 2026
Open
This was referenced Oct 24, 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.
Fixes #1686
ArgumentListHelperbinds the new invocation speculatively to check the overload it calls. For an invocation in an attribute argument, Roslyn threwNullReferenceExceptionin the binder ([assembly:(string.Format("", new object[] { -1, a is g System })with top-level statements).An attribute argument must be a constant (CS0182), so an invocation can never be one.
ArgumentListHelperno longer binds the invocations in an attribute argument, so the code fixes that use it (MA0011, and the ones that add aStringComparison,CancellationToken,MidpointRounding, orTimeProviderargument) are not offered there.Tests
Regression tests for each issue, using the fuzz inputs reduced to the code that reproduces them. The fuzz inputs no longer reproduce with
dotnet run --project tests/Meziantou.Analyzer.Fuzz -c Release -- repro. The whole test suite passes on all the Roslyn versions.