Convert xUnit1004 analyzer to IOperation API - #224
Merged
bradwilson merged 2 commits intoSep 19, 2026
Merged
bradwilson merged 2 commits into
bradwilson merged 2 commits into
Conversation
Replace the attribute syntax node action with an OperationKind.Attribute operation action. Named arguments are read from the attribute's object initializer property assignments instead of the NameEquals text, and the attribute type comes from the object creation operation rather than a SemanticModel lookup. Add a derived-attribute and const Skip value scenario to the existing test.
meziantou
marked this pull request as ready for review
September 13, 2026 22:14
Member
|
Looks like the tests failed because of the addition of the test cases deriving from |
FactAttribute is sealed in xUnit.net v3 Native AOT, so the derived attribute scenario failed to compile in the AOT test context. Move it to a V2_and_V3_NonAot test and keep the const Skip value scenario on Fact.
Contributor
Author
|
The CI should be green now |
Member
|
Thanks! |
Member
|
Available in |
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.
Converts
TestMethodShouldNotBeSkipped(xUnit1004) from a syntax node action to the IOperation API, following the same approach as #222.What changed
OperationKind.Attributeaction instead of aSyntaxKind.Attributeaction; theMicrosoft.CodeAnalysis.CSharp/.Syntaxusings are gone.ISimpleAssignmentOperations, matching on the target property name instead of theNameEqualstext.IObjectCreationOperationwrapped byIAttributeOperation, rather than aSemanticModel.GetTypeInfocall. TheIsAssignableFromcheck is kept, so attributes derived fromFactAttribute/TheoryAttributeare still covered.Constants.AttributeProperties.Skipalongside the existingSkipUnless/SkipWhenconstants.Notes for reviewers
SkipUnlessorSkipWhenis set, and is reported on theSkip = ...argument. Each assignment's syntax is theAttributeArgumentSyntax, so diagnostic locations are unchanged and the fixer (which looks forAttributeArgumentSyntax) needs no update.V2_and_V3test is extended with an attribute derived fromFactAttribute(with and withoutSkip) and aSkipvalue coming from aconst.