Ambiguous invocation moq EAP7 2021.3 VS22

Ambiguous invocation:
Moq.Language.Flow.ICallbackResult Callback(System.Action) (in interface ICallback)
Moq.Language.Flow.ICallbackResult Callback(System.Delegate) (in interface ICallback)

 

Upload id: 2021_11_10_5VQkUvseoftJhNfe (file: 333.PNG)

0
6 comments

Hello Dave Senn, thanks for the report. I have checked the behavior you described, but could not reproduce it.
Do you have a chance to share a small sample solution so that we can reproduce the problem on our side? Thanks in advance!

0

Maria Pleskunina  Sure here:

 

Program.cs:

 

using Moq;
using Xunit;
 
public interface IFile
{
    void Delete( String path );
}
 
public sealed class Test
{
    [Fact]
    public void Foo()
    {
        var fileMock = new Mock<IFile>();
 
        var deleteCount = 0;
        fileMock
            .Setup( x => x.Delete( @"X:\Test\test.txt" ) )
            .Callback( ( String _ ) =>
            {
                deleteCount++;
                if ( deleteCount < 4 )
                    throw new();
            } );
    }
}

csproj:

<Project Sdk="Microsoft.NET.Sdk">
 
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
 
  <ItemGroup>
    <PackageReference Include="Moq" Version="4.18.2" />
    <PackageReference Include="xunit" Version="2.4.2" />
  </ItemGroup>
 
</Project>



0

Hello Dave,

Could you please specify what ReSharper version you are using?

Could you please also try the latest ReSharper 2022.2 and check if the problem is still reproduced?

Thank you.

0

Problem still exists with 2022.2

 

My versions:

JetBrains ReSharper 2022.2 Build 222.0.20220728.74125 built on 2022-07-28
dotCover 2022.2.20220729.153522
dotTrace 2022.2.20220729.153641
ReSharper 2022.2.20220728.80202
dotMemory 2022.2.20220729.153641

 

 

Microsoft Visual Studio Professional 2022
Version 17.2.6
VisualStudio.17.Release/17.2.6+32630.192
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA471
Microsoft Visual C++ 2022

.NET Core Debugging with WSL   1.0
.NET Core Debugging with WSL

ASP.NET and Web Tools 2019   17.2.393.26812
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0   17.2.393.26812
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   17.2.393.26812
Azure Functions and Web Jobs Tools

C# Tools   4.2.0-4.22281.5+8d3180e5f00d42f0f0295165f756f368f0cbfa44
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Entity Framework Core Power Tools   2.5
Adds useful design-time EF Core DbContext features to the Visual Studio Solution Explorer context menu.

Markdown Editor v2   2.0.127
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager   6.2.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2218101+885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62204.01010
Microsoft SQL Server Data Tools

Switch Startup Project   4.2.76
Provides a toolbar dropdown box  to switch between startup projects.

Telerik Reporting Tools   3.44.11.0
Complete .NET Reporting Solution for Web, Mobile and Desktop Applications. For more information please visit http://www.telerik.com/reporting. 

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.2.0-4.22281.5+8d3180e5f00d42f0f0295165f756f368f0cbfa44
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.22329.1+702b8e77f5fbfe21e6743324c1750503e02f182d
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Unity   17.2.3.0
Visual Studio Tools for Unity

VsChromium   0.9.39
Collection of tools to help contributing code to the Chromium project.

VSColorOutput64   2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput

0

Thank you for the reply, Dave.

Strangely I cannot reproduce the issue.

Could you please clear caches via ReSharper | Options | Environment | General | Clear caches, restart VS and check the issue once again?

Thank you.

0

Please sign in to leave a comment.