David Tchepak

Results 248 comments of David Tchepak

@zvirja Thanks for figuring this out! I notice the minimal case won't throw if we have `InternalsVisibleTo` dynamic proxy, but I'm guessing this does not help us much as normally...

Thank you for the detailed report! Does the `result.Should().Be(2)` assertion fail (actually returns `0`)? I'm trying to reproduce this on Mac but haven't been able to yet.

@doxakis Yes when an arg matcher (like `Arg.Is`) fails with an exception it catches it and regards that as a non-match. https://github.com/nsubstitute/NSubstitute/blob/d8024ac574c595b04b5560117c929371d8b770fb/src/NSubstitute/Core/Arguments/ArgumentSpecification.cs#L23-L28

@alexandrnikitin @zvirja: Do you have any thoughts on the implications of catching this? Any alternatives you can think of? Regards, David

Sorry for the delay @doxakis , thank you for following up. I still need to get some agreement with the team on how to approach this. My only reservation with...

@alexandrnikitin Thanks for taking a look at this. 🙇 IIRC the reason is so specifying arg matchers can be kept as simple as possible. For example: ``` sub.AddPerson(new Person {...

> It's probably .NET Runtime failure that it couldn't catch it at compile time. I would expect at least a warning (is there one?). This is a very good point....

Stopping capturing the exception would be a fairly big breaking change I think, especially for anyone that is using assertion libraries with arg matchers. I think it is reasonable(ish) that...

Hi @backwardsDave1 , Thanks for the concise repro case. I don't think we can detect this case at run-time. We are going to try to [detect this statically with NSubstitute.Analyzers...

Implementing this and realised it is actually a bit more nuanced. The documentation is referring to real code executing for non-overridable members. This includes code in `protected virtual`, even if...