ResultToProblem 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package ResultToProblem --version 1.0.3
                    
NuGet\Install-Package ResultToProblem -Version 1.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ResultToProblem" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ResultToProblem" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="ResultToProblem" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ResultToProblem --version 1.0.3
                    
#r "nuget: ResultToProblem, 1.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ResultToProblem@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ResultToProblem&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=ResultToProblem&version=1.0.3
                    
Install as a Cake Tool

ResultToProblem

https://www.nuget.org/packages/ResultToProblem/

ResultToProblem is a .NET library that extends the Result pattern and simplifies the conversion of domain results into standard HTTP responses using ProblemDetails.

Its purpose is to streamline error handling in ASP.NET Core applications, maintaining a clean and consistent style across endpoints and controllers.


Installation

Install the package from NuGet:

bash dotnet add package ResultToProblem


Usage

Examples in an ASP.NET Core project:


Minimal API endpoint using ResultToProblem:

program.cs:

using ResultToProblem.Domain.Common;
using ResultToProblem.Domain.Enums;
using ResultToProblem.Api.Extensions;

//....

app.MapGet("/", () =>
{
    var random = new Random();
    var temperature = random.Next(-10, 40);

    if (temperature < -5)
    {
        var result = Result.Failure(
            message: "Temperature sensor error",
            code: "WEATHER_SENSOR_FAILURE",
            type: ErrorType.Unexpected
        );

        return Results.Problem(result.ToProblemDetails());
    }

    var success = Result.Success($"Today's temperature is {temperature}°C");
    return Results.Ok(success.Value);
});

app.Run();


✨ Features

  • Automatically converts Result objects into ProblemDetails
  • Standardized handling for common errors: NotFound, Validation, Conflict, Unexpected
  • Easy-to-use extensions for minimal API endpoints
  • Compatible with Clean Architecture and Domain-Driven Design

📦 Publishing

This project is distributed as a NuGet package.
To publish a new version:

bash dotnet build -c Release dotnet pack -c Release dotnet nuget push bin/Release/ResultToProblem.1.0.0.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json


⚖️ License

This project is freely available under the MIT license.
You may use, modify, and distribute it without restrictions, as long as you retain the reference to the original license.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.7 148 6/14/2026
2.0.6 112 5/13/2026
2.0.5 105 5/13/2026
2.0.4 107 5/13/2026
2.0.3 107 5/13/2026
2.0.2 108 5/12/2026
2.0.1 107 5/12/2026
2.0.0 109 5/12/2026
1.0.9 117 5/12/2026
1.0.8 105 5/11/2026
1.0.7 116 5/11/2026
1.0.6 108 5/11/2026
1.0.5 103 5/11/2026
1.0.4 116 5/8/2026
1.0.3 122 5/8/2026
1.0.2 109 5/8/2026
1.0.1 108 5/8/2026
1.0.0 112 5/8/2026