Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable CallInfo analysis when Arg.AnyType used for argument matching #212

Closed
tpodolak opened this issue Sep 8, 2023 · 2 comments · Fixed by #215
Closed

Disable CallInfo analysis when Arg.AnyType used for argument matching #212

tpodolak opened this issue Sep 8, 2023 · 2 comments · Fixed by #215
Milestone

Comments

@tpodolak
Copy link
Member

tpodolak commented Sep 8, 2023

nsubstitute/NSubstitute#715 (comment)
nsubstitute/NSubstitute#715 (comment)

@tpodolak
Copy link
Member Author

@dtchepak from perspective of analyzer project new NSubstitute version seems to be introduced breaking change in the NSubstitute API. I have tons of failing tests after upgrade e.g

using System;
using NSubstitute;
using NSubstitute.ReceivedExtensions;

namespace MyNamespace
{
    public interface IFoo
    {
        int? this[int? x] { get; set; }
    }

    public class FooTests
    {
        public void Test()
        {
            var substitute = Substitute.For<IFoo>();
            substitute.DidNotReceiveWithAnyArgs()[1] = Arg.Compat.Do<int>(__ => {});
        }
    }
}
Test0.cs(17,67): error CS0121: The call is ambiguous between the following methods or properties: 'Arg.Compat.Do<T>(Action<T>)' and 'Arg.Compat.Do<T>(Action<object>)'

Interestingly the same piece of code compiles just fine with dotnet build so I need to figure out how to fix analyzers tests in order to make analyzers aware of Arg.AnyType

@dtchepak
Copy link
Member

Interestingly the same piece of code compiles just fine with dotnet build so I need to figure out how to fix analyzers tests in order to make analyzers aware of Arg.AnyType

As in it only fails with VS? 🤔 Confirmed dotnet test fine on Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants