This project is read-only.

NullReferenceExceptions not Replicated On Debug

Jan 10, 2009 at 1:53 AM
I have suddenly started to get a bunch of NullReferenceExceptions in my Pex Explorations (reliably in certain methods), but when I go to manually debug, the tests pass.  Moreover, there is just no way anything in these methods is null unless it's supposed to be.  Is this a known bug?  I was running in VS.NET 2005, then added VS.NET 2008, but I don't think this happened right away - rather it happened after a bunch of code changes.  I then uninstalled Pex and reinstalled it to get the VS.NET 2008 integration, but that didn't change anything.

Many, but not all of the tests for which this is happening are not actually parameterized - not sure if that matters.

Anyway, like I said, none of them actually fail when run manually - only during the exploration. 

Hope someone has some info.

Jan 11, 2009 at 9:54 PM
Have you tried going through one of the Pex tutorials to make sure everything is working okay? Are you able to undo the "bunch of code changes" and get back to where you started?
Jan 12, 2009 at 6:18 PM
Edited Jan 12, 2009 at 8:22 PM
Well, I've been using Pex for a while now and it has been working fine.  Really, my question is, if I can step through a Pex-generated test in debug mode and have it Pass every time, shouldn't it pass in Exploration mode?  If not, why not?  This is the case for every one of these NullReferenceException outcomes.
May 28, 2009 at 11:56 PM

Questions about Pex itself should be posted on the pex forums at