DevBetterCom / DevBetterCom/DevBetter.JsonExtensions

Fails to deserialise when type is a record

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4
Forks
1
PR merge metrics
No merged PRs in 30d

Description

```csharp
public record Config(
string test);
```

```csharp
var options = new JsonSerializerOptions()
.SetMissingMemberHandling(MissingMemberHandling.Error);
JsonSerializer.Deserialize("{\"test\":\"test\"}", options);
```

```
Unhandled exception. System.MissingMethodException: Cannot dynamically create an instance of type 'TestProject.Config'. Reason: No parameterless constructor defined.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by reproducing the JsonSerializer.Deserialize example with SetMissingMemberHandling(MissingMemberHandling.Error), then trace the deserialization entry point for record construction; done means the record deserializes from the shown JSON without MissingMethodException while retaining the requested missing-member behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.