© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
8 replies
Gopher

MapPost: Parameters are null

This is my Post endpoint
app.MapPost("/register", (UserRepo userRepo, RegisterDto RegisterDto ) =>
{
  ...
}
app.MapPost("/register", (UserRepo userRepo, RegisterDto RegisterDto ) =>
{
  ...
}

When sending a Request with this Payload
{RegisterDto: {Name: "Herbert"}}
{RegisterDto: {Name: "Herbert"}}

the Endpoint is hit, but the Name-Property in RegisterDto is still null
with [FromBody] and [AsParameters] i have the same issue
 public class RegisterDto
    {
        public string Name { get; set; }
    }
 public class RegisterDto
    {
        public string Name { get; set; }
    }

What does the JSON have to look like so that it works?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

NullReferenceException but checking for Null?
C#CC# / help
2y ago
Properties of IConfigurationSection.Get are null?
C#CC# / help
3y ago
Converting null literal or possible null value to non-nullable type.
C#CC# / help
2y ago
❔ Converting null iteral or possible null value to non-nullable type
C#CC# / help
3y ago