vkhorikov / CSharpFunctionalExtensions

Functional extensions for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Ambiguous invocation" error after update

BernhardMaier opened this issue · comments

Hey Vladimir,

i tried to update from 1.31.1 to 1.33.2 but it resulted it many errors. In general it's a Ambiguous invocation error on several extension methods, for example .Ensure() or .Tap(), when they are called async:

private static async Task<Result> UploadPdf(byte[] pdfAsBytes, BlobClient blobClient) =>
    await Result.Success(new MemoryStream(pdfAsBytes))
      .Tap(async pdfStream => await blobClient.UploadAsync(pdfStream, true));
Ambiguous invocation:

CSharpFunctionalExtensions.Result<System.IO.MemoryStream> Tap<MemoryStream>(
  this CSharpFunctionalExtensions.Result<System.IO.MemoryStream>,
  System.Action<System.IO.MemoryStream>)
(in class ResultExtensions)

System.Threading.Tasks.Task<CSharpFunctionalExtensions.Result<System.IO.MemoryStream>> Tap<MemoryStream>(
  this CSharpFunctionalExtensions.Result<System.IO.MemoryStream>,
  System.Func<System.IO.MemoryStream,System.Threading.Tasks.Task>)
(in class AsyncResultExtensionsRightOperand) 

System.Threading.Tasks.ValueTask<CSharpFunctionalExtensions.Result<System.IO.MemoryStream>> Tap<MemoryStream>(
  this CSharpFunctionalExtensions.Result<System.IO.MemoryStream>,
  System.Func<System.IO.MemoryStream,System.Threading.Tasks.ValueTask>)
(in class AsyncResultExtensionsRightOperand)

match

Do you already know about this issue or have a solution for it?
Thank you in advance.

Please fall back to v1.31.1 for now. I'll be publishing a fix today or tomorrow for this with v1.31.3. See #433 for more details.

Nice, thank you for the fast reply and fix 👍

This should be working now with v2.33.3. @BernhardMaier could please try?

Good news: v2.33.3 works like charm and build succeeds 👍