Add source generator unit tests for invalid JsonExtensionData cases #58945
Labels
area-System.Text.Json
source-generator
Indicates an issue with a source generator feature
test-enhancement
Improvements of test source code
Milestone
Some of the serializer tests intentionally define invalid
JsonExtensionData
properties which would causeInvalidOperationException
to be thrown at runtime, e.g.runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ExtensionDataTests.cs
Lines 300 to 304 in b683032
When source generation is used, compile-time errors are logged rather than deferred to runtime. The PR adding support for
JsonExtensionData
(#58912) thus disables these tests so that the source generator test project (System.Text.Json.SourceGeneration.Tests
) can compile. We should add unit test variants for coverage inSystem.Text.Json.SourceGeneration.Unit.Tests
.The text was updated successfully, but these errors were encountered: