Skip to content

ToActionResult() not working with version 4.0.0 #247

Description

@chunty

The following code:

using FluentResults;
using FluentResults.Extensions.AspNetCore;
using Microsoft.AspNetCore.Mvc;

public class Program
{
	public static void Main()
	{
		var err = Result.Fail(new MyError());
		var controller = new MyController();
		var result = err.ToActionResult();

		Console.WriteLine(result);
	}

	public class MyController : ControllerBase;

	public class MyError() : Error("Error");

}

Gives the error:

System.MissingMethodException
  HResult=0x80131513
  Message=Method not found: 'System.Collections.Generic.List`1<FluentResults.IError> FluentResults.ResultBase.get_Errors()'.
  Source=FluentResults.Extensions.AspNetCore
  StackTrace:
   at FluentResults.Extensions.AspNetCore.DefaultAspNetCoreResultEndpointProfile.TransformFailedResultToActionResult(FailedResultToActionResultTransformationContext context)
   at FluentResults.Extensions.AspNetCore.ResultToActionResultTransformer.Transform(Result result, IAspNetCoreResultEndpointProfile profile)
   at FluentResults.Extensions.AspNetCore.ResultExtensions.ToActionResult(Result result, IAspNetCoreResultEndpointProfile profile)
   at FluentResults.Extensions.AspNetCore.ResultExtensions.ToActionResult(Result result)
   at Program.Main() in C:\Users\chrishunt.QES-OFFICE\source\repos\Countrywide\TestFluentResults\ConsoleApp1\Program.cs:line 11

I believe the problem has been introduced as part of this change: #164

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions