EDIT: Okay, I think I know the problem... it's due to deferred query execution.
EDIT: Okay, I think I know the problem... it's due to deferred query execution. If you've just got the query construction in the try/catch block, that's not going to catch exceptions which occur while the query is being executed. Look at the stack trace you've got, and you'll find that there'll be a stack frame where you're executing the query - it's just the auto-generated lambda expression which comes from this bit of code, and it's not running within the scope of the try/catch block.
ORIGINAL ANSWER: Are you just seeing the exception in the debugger? If so, go into the debugger exception dialog and change the preferences for the point at which exceptions cause the debugger to "break". The catch block should be handling the NullReferenceException normally.(Admittedly I don't think you should really be catching NullReferenceException in the first place, and catching all exceptions like that is generally a bad idea too, other than at the top of the stack - but that's a different matter.).
The debugger points me to the "where" part of the linq statement. When I run this program normally (aka no debugger, just straight run) I still get the exception. Also just for the record I normally wouldn't be catching all exceptions like that either, but I have been trying to figure out why the more specialized exception wasn't working.
– Adkins Jan 4 '10 at 10:18 @Adkins: Okay, I've worked it out now - see my edit. – Jon Skeet Jan 4 '10 at 10:39 @Adkins: Move the catch block to where it's actually executing... or call ToList() to execute the query eagerly and remember the results. – Jon Skeet Jan 4 '10 at 10:49 @Jon: Thanks a lot.
I have been staring at that little bit of code for far too long. I added a foreach that actually worked with the code into the try block and now it works perfectly! – Adkins Jan 4 '10 at 10:51.
When I run this chunk of code in the debugger it points directly to the "where" part of the linq statement. – Adkins Jan 4 '10 at 10:16.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.