Archive for the ‘Linq’ category

Value cannot be null. Parameter name: source

April 25th, 2013

Sometimes you may get this error when you are debugging a linq query and it may seem pretty vague to you, and it is, very.  In my situation I didn’t have a parameter name called “Source” or a property named that either, it turns out the problem was a property I had in my linq query that was in fact null and when you execute a query across stuff that may be null you can run into stuff like this.

If  you see this error when you writing code, the easiest way that I know to figure out your problem is to look into anything the query is grabbing that may have a null in it.  Just simply start commenting out stuff and see what happens.

Good luck and I hope this helps someone!!