eliminate test data serialization warnings#12983
Merged
JanProvaznik merged 4 commits intodotnet:mainfrom Jan 7, 2026
Merged
Conversation
…meration Co-authored-by: JanProvaznik <25267098+JanProvaznik@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR eliminates xUnit test data serialization warnings that pollute context for agents running tests on the CLI. The fix addresses warnings in two ways: by implementing proper xUnit serialization for test data classes, and by disabling discovery enumeration for complex test data collections.
Key Changes
- Implemented
IXunitSerializableinterface for theTestDatumclass to support proper xUnit test data serialization - Added
DisableDiscoveryEnumeration = trueparameter toMemberDataattributes across multiple test files to prevent xUnit from enumerating test data during test discovery
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/StringTools.UnitTests/InterningTestData.cs | Implements IXunitSerializable with Serialize/Deserialize methods and adds parameterless constructor for TestDatum class |
| src/Shared/UnitTests/FileMatcher_Tests.cs | Adds DisableDiscoveryEnumeration to MemberData attribute for GetFilesComplexGlobbingMatchingInfo test |
| src/Build.UnitTests/Graph/ResultCacheBasedBuilds_Tests.cs | Adds DisableDiscoveryEnumeration to MemberData attribute for BuildGraphData test |
| src/Build.UnitTests/Graph/ProjectGraph_Tests.cs | Adds DisableDiscoveryEnumeration to 4 MemberData attributes for various graph-related tests |
| src/Build.UnitTests/Graph/IsolateProjects_Tests.cs | Adds DisableDiscoveryEnumeration to MemberData attribute for UndeclaredReferenceEnforcementShouldNormalizeFilePathsTestData test |
| src/Build.UnitTests/Graph/GraphLoadedFromSolution_tests.cs | Adds DisableDiscoveryEnumeration to MemberData attribute for SolutionOnlyDependenciesData test |
| src/Build.OM.UnitTests/Definition/Project_Tests.cs | Adds DisableDiscoveryEnumeration to 2 MemberData attributes for item provenance tests |
| src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs | Adds DisableDiscoveryEnumeration to MemberData attribute for UpdateAndRemoveShouldWorkWithEscapedCharactersTestData test |
| src/Build.OM.UnitTests/Definition/DefinitionEditing_Tests.cs | Adds DisableDiscoveryEnumeration to 10 MemberData attributes across multiple test methods |
| src/Build.OM.UnitTests/Construction/ConstructionEditing_Tests.cs | Adds DisableDiscoveryEnumeration to 2 MemberData attributes for metadata element insertion tests |
baronfel
approved these changes
Jan 7, 2026
This was referenced Jan 8, 2026
This was referenced Mar 11, 2026
Closed
This was referenced Mar 13, 2026
Open
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.
this pollutes context for agents running tests on cli