Skip to content

[Test] System.Text.Json.Tests crashes in ReflectionMemberAccessor.CreateParameterizedConstructor  for non-public [JsonConstructor] #130678

Description

@mdh1418

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1506631
Build error leg or test failing: System.Text.Json.Tests.WorkItemExecution
Pull request: #129457

Failing leg

• Helix work item:  System.Text.Json.Tests 
• Queue:  azurelinux.3.amd64.open.rt 
• Job:  d8ef37cc-cc4a-4936-a547-fe9551536f99 
• Console log: https://helixr1107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-pull-129457-merge-d8ef37cccc4a4936a5/System.Text.Json.Tests/1/console.b5bc1750.log?helixlogtype=result

Failure signature

Error Message

Process terminated. Assertion failed.
constructor.DeclaringType == type && constructor.IsPublic && !constructor.IsStatic
   at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage) in /_/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.cs:line 22
   at System.Diagnostics.Debug.Fail(String message, String detailMessage) in /_/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Debug.cs:line 135
   at System.Diagnostics.Debug.Assert(Boolean condition, String message) in /_/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Debug.cs:line 88
   at System.Text.Json.Serialization.Metadata.ReflectionMemberAccessor.CreateParameterizedConstructor[PrivateParameterizedCtor_WithAttribute,Int32,Object,Object,Object](ConstructorInfo constructor) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/ReflectionMemberAccessor.cs:line 73
   at System.Text.Json.Serialization.Converters.SmallObjectWithParameterizedConstructorConverter`5[[System.Text.Json.Serialization.Tests.PrivateParameterizedCtor_WithAttribute, System.Text.Json.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51],[System.Int32, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ConfigureJsonTypeInfoUsingReflection(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Small.cs:line 126
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreateTypeInfoCore(Type type, JsonConverter converter, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.Helpers.cs:line 78
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreateJsonTypeInfo(Type type, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.cs:line 82
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/DefaultJsonTypeInfoResolver.cs:line 59
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoNoCaching(Type type) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs:line 1030
   at System.Text.Json.JsonSerializerOptions.CachingContext.CreateCacheEntry(Type type, CachingContext context) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs:line 292
   at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Type, System.Private.CoreLib, Version=11.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Text.Json.JsonSerializerOptions.CachingContext.CacheEntry, System.Text.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].GetOrAdd[CachingContext](Type key, Func`3 valueFactory, CachingContext factoryArgument) in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Concurrent/ConcurrentDictionary.cs:line 1243
   at System.Text.Json.JsonSerializerOptions.CachingContext.GetOrAddCacheEntry(Type type) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs:line 282
   at System.Text.Json.JsonSerializerOptions.CachingContext.GetOrAddTypeInfo(Type type, Boolean fallBackToNearestAncestorType) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs:line 261
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs:line 143
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs:line 183
   at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions options, Type inputType) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Helpers.cs:line 45
   at System.Text.Json.JsonSerializer.Deserialize(ReadOnlySpan`1 json, Type returnType, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.String.cs:line 160
   at System.Text.Json.Serialization.Tests.JsonSerializerWrapper.SpanSerializerWrapper.DeserializeWrapper(String json, Type type, JsonSerializerOptions options) in /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonSerializerWrapper.Reflection.cs:line 83
   at System.Text.Json.Serialization.Tests.ConstructorTests.NonPublicCtors_WithJsonConstructorAttribute_WorksAsExpected(Type type) in /_/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.AttributePresence.cs:line 30
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<NonPublicCtors_WithJsonConstructorAttribute_WorksAsExpected>d__1](<NonPublicCtors_WithJsonConstructorAttribute_WorksAsExpected>d__1& stateMachine) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncMethodBuilderCore.cs:line 38
   at System.Text.Json.Serialization.Tests.ConstructorTests.NonPublicCtors_WithJsonConstructorAttribute_WorksAsExpected(Type type)

Process exits with:

Aborted (core dumped) ... Exit Code:134 (SIGABRT)

{
  "ErrorMessage": "constructor.DeclaringType == type && constructor.IsPublic && !constructor.IsStatic",
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Copilot's brief analysis

Why this is likely happening

The failing test ( NonPublicCtors_WithJsonConstructorAttribute_WorksAsExpected ) exercises non-public ctors annotated with  [JsonConstructor]  (e.g.  PrivateParameterizedCtor_WithAttribute ).

The crashing path goes through  CreateParameterizedConstructor<T,...>  in  ReflectionMemberAccessor , which asserts the constructor is public. In this scenario the ctor is intentionally non-public, so the invariant is violated and the assert terminates the process in this checked/assert-enabled run.

Initial triage hypothesis

Likely a regression in constructor-selection/delegate-creation for non-public  [JsonConstructor]  where the non-public path is reaching a helper that assumes  constructor.IsPublic == true  instead of using a non-public-compatible path.

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1506631
Error message validated: [constructor.DeclaringType == type && constructor.IsPublic && !constructor.IsStatic]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 7/14/2026 12:55:17 PM UTC

Report

Build Repository Test Pull Request
1506631 dotnet/runtime System.Text.Json.Tests.WorkItemExecution #129457

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 1 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Known Build ErrorUse this to report build issues in the .NET Helix tabarea-System.Text.Jsonblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions