Skip to content

Converting Invalid Result to ActionResult throws System.ArgumentNullException when Identifier is not set on ValidationError #179

@uflowie

Description

@uflowie

Summary

When returning an InvalidResult that is lacking an identifier (ie it has been instantiated with the constructor that takes just the ErrorMessage as a string), converting it into an ActionResult using the TranslateResultToActionResult attribute, the server will throw a System.ArgumentNullException and return StatusCode 500. I have created a minimal reproducible example here: https://github.com/uflowie/InvalidResult.

Expected Behavior

Using a parameterized constructor should instantiate a result that can be translated to an ActionResult without throwing unexpected Exceptions.

Version

Ardalis.Result: 8.0
Ardalis.Result.AspNetCore: 8.0.0
dotnet: net8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions