Skip to content

System.Text.Json.SourceGeneration.Tests have issues with BigInteger and records on netfx #63802

@krwq

Description

@krwq

Following issues were found when enabling netfx tests:

Whenever:

[JsonSerializable(typeof(ClassWithUnsupportedBigInteger))]
// and couple of other BigInteger related classes 

is used the code no longer compiles - code generator seem to be generating code which tries to access private fields. Search for #if !NETFRAMEWORK in that code - this have been removed for netfx for now to unblock remainder of the tests

also JsonIgnoreAttribute_UnsupportedBigInteger is not passing - expected exception seem to differ. See test with ActiveIssue.

Another issues I'm seeing are InvalidOperationException (emit fails in CreateAssemblyImage in the test code), following tests are affected:

  • System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.RecordInExternalAssembly
  • System.Text.Json.SourceGeneration.UnitTests.GeneratorTests.Record
  • System.Text.Json.SourceGeneration.Tests.JsonSerializerContextTests.Converters_AndTypeInfoCreator_NotRooted_WhenMetadataNotPresent (I'm not able to reproduce this one locally)

(those tests were recently added)

Related to: #63463

cc: @layomia

Note: this issue is related to the PR which is not merged yet so some details reated to ActiveIssue or DefineConstants are relevant after merging it. (I need ActiveIssue number in order to finish PR)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions