@@ -34,6 +34,7 @@ private sealed class Parser
34
34
private const string JsonNodeFullName = "System.Text.Json.Nodes.JsonNode" ;
35
35
private const string JsonObjectFullName = "System.Text.Json.Nodes.JsonObject" ;
36
36
private const string JsonValueFullName = "System.Text.Json.Nodes.JsonValue" ;
37
+ private const string JsonDocumentFullName = "System.Text.Json.JsonDocument" ;
37
38
private const string JsonIgnoreAttributeFullName = "System.Text.Json.Serialization.JsonIgnoreAttribute" ;
38
39
private const string JsonIgnoreConditionFullName = "System.Text.Json.Serialization.JsonIgnoreCondition" ;
39
40
private const string JsonIncludeAttributeFullName = "System.Text.Json.Serialization.JsonIncludeAttribute" ;
@@ -92,6 +93,7 @@ private sealed class Parser
92
93
private readonly Type ? _jsonNodeType ;
93
94
private readonly Type ? _jsonObjectType ;
94
95
private readonly Type ? _jsonValueType ;
96
+ private readonly Type ? _jsonDocumentType ;
95
97
96
98
// Unsupported types
97
99
private readonly Type _delegateType ;
@@ -229,6 +231,7 @@ public Parser(Compilation compilation, in JsonSourceGenerationContext sourceGene
229
231
_jsonNodeType = _metadataLoadContext . Resolve ( JsonNodeFullName ) ;
230
232
_jsonObjectType = _metadataLoadContext . Resolve ( JsonObjectFullName ) ;
231
233
_jsonValueType = _metadataLoadContext . Resolve ( JsonValueFullName ) ;
234
+ _jsonDocumentType = _metadataLoadContext . Resolve ( JsonDocumentFullName ) ;
232
235
233
236
// Unsupported types.
234
237
_delegateType = _metadataLoadContext . Resolve ( SpecialType . System_Delegate ) ;
@@ -1556,6 +1559,7 @@ private void PopulateKnownTypes()
1556
1559
AddTypeIfNotNull ( _knownTypes , _jsonNodeType ) ;
1557
1560
AddTypeIfNotNull ( _knownTypes , _jsonObjectType ) ;
1558
1561
AddTypeIfNotNull ( _knownTypes , _jsonValueType ) ;
1562
+ AddTypeIfNotNull ( _knownTypes , _jsonDocumentType ) ;
1559
1563
1560
1564
_knownUnsupportedTypes . Add ( _typeType ) ;
1561
1565
_knownUnsupportedTypes . Add ( _serializationInfoType ) ;
0 commit comments