[ci-fix] Needs review: Fix PolymorphicTests order-dependent assertion on tvOS Mono (refs #128765)#129653
Draft
github-actions[bot] wants to merge 2 commits into
Draft
[ci-fix] Needs review: Fix PolymorphicTests order-dependent assertion on tvOS Mono (refs #128765)#129653github-actions[bot] wants to merge 2 commits into
github-actions[bot] wants to merge 2 commits into
Conversation
The test MetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifier used Assert.Collection which is order-sensitive. On tvOS Mono, attribute ordering from Type.GetCustomAttributes differs from CoreCLR, causing DerivedTypes to appear as [Cat, Dog] instead of [Dog, Cat]. Since the ECMA specification does not guarantee attribute ordering from GetCustomAttributes, replace the order-sensitive Assert.Collection with Assert.Contains checks that verify both derived types are present with correct discriminators, regardless of order. Remove the [ActiveIssue] annotation that disabled the test on Apple Mobile Mono since the fix addresses the root cause. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-text-json |
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.
Workflow artifact: ci-fix
Artifact kind: help
Linked KBE: #128765
Note
This is an AI/Copilot-generated draft PR that attempts to fix the CI failure described in KBE #128765. It has NOT been build-validated (environment lacks .NET 11 SDK). Human review is needed.
Root cause
The test
MetadataServices_NullPolymorphismOptions_DoesNotActivateAttributeClassifierusesAssert.Collection(order-sensitive) to verifyJsonPolymorphismOptions.DerivedTypes. It expects[Dog, Cat]matching the attribute declaration order onAttrClassifiedAnimal:On tvOS Mono,
Type.GetCustomAttributes()returns these attributes in reverse order ([Cat, Dog]), causing the test to fail. The ECMA specification does not guarantee attribute ordering from reflection APIs.Fix
Replace the order-sensitive
Assert.Collectionwith:Assert.Equal(2, options.DerivedTypes.Count)— verifies the expected number of typesAssert.Contains(...)for each type — verifies presence and discriminator without order dependencyRemove the
[ActiveIssue]annotation since this fix addresses the root cause rather than disabling the test.What is unverified / help needed
DerivedTypessemantically significant for JSON serialization behavior? If so, the real fix may be in the product code (ensuring deterministic ordering). If not, this test fix is correct.Suggested reviewers / area contacts
@eiriktsarpalis(area-System.Text.Json owner)@SteveSandersonMSValidation
dotnet build src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csprojEvidence
Filed by
ci-failure-fix, which attempts validated fixes for[ci-scan]Known Build Errors and otherwise loops in owners. Comment here or on the workflow file to suggest changes;ci-failure-scan-feedbackreads in-scope feedback daily and opens (or updates) a PR with prompt edits.Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".issue_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: