question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException thrown when attempting to build unmet expectation message that includes an anonymous parameter

See original GitHub issue

Hello. I’m using FakeItEasy to test F# projects, and I much prefer it over Moq 😃

However there is one problem, and that is when making assertion that a call must have happened, the assertion message it prints is misleading at best: System.ArgumentNullException: Value cannot be null. (Parameter 'value'). I wonder if this can be fixed somehow, either in my own code, or something you could fix on your side. I’ve included a small repository to to reproduce this issue, and also shows that it works as expected when testing a C# class

https://github.com/kaeedo/FakeItFSharp

I also noticed an old issue about adding an F# extension #232 . Any updates on that?

Thanks.

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
blairconradcommented, Apr 23, 2023

🥇 Thanks for the contribution @kaeedo. Look for your name in the release notes!

1reaction
thomaslevesquecommented, Mar 29, 2023

Actually, I see what the problem is: the Database implementation specifies a parameter name, but the interface doesn’t! If you just fix the interface to specify the parameter name, it should work as expected:

type IDatabase =
    abstract member Save: user: (int * string) -> unit

(we still need to fix the case where we don’t have the parameter name, though)

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - What is a NullReferenceException, and how do I fix it?
If the person does not have a title, this will throw an exception because it is trying to call ToUpper on a property...
Read more >
Add a FakeItEasy.FSharp package · Issue #232
NullReferenceException thrown when attempting to build unmet expectation message that includes an anonymous parameter #1920.
Read more >
FakeItEasy (@fakeiteasyfx) / Twitter
Get FakeItEasy 7.4.0! fixed: NullReferenceException thrown when building unmet expectation message that includes an anonymous parameter.
Read more >
Object Reference Not Set to an Instance of an Object
This infamous and dreaded error message happens when you get a NullReferenceException. This exception is thrown when you try to access a member—for...
Read more >
Null Reference Exception in Blazor Router - Matthew Champion
So this is a bit speculative, but I believe that the NullReferenceException is thrown in circumstances where the router is unable to correctly ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found