Quick and Easy: Debugging VS 2010 Solution Deployment

Visual Studio 2010 reports hard-to-debug errors during deployment some times.  A quick and easy way to do some very rough debugging is to throw your own named exceptions.  Visual Studio will show them in the output console.

Consider this bit of code:

image

If this feature is scoped to a web application, site will be null.  If you try and reference a property of site, you’ll get the ambiguous error:

Error occurred in deployment step ‘Add Solution’: Object reference not set to an instance of an object.

However, if throw a new Exception and pass a string to the constructor, you get a slightly more useful message:

image

It’s a crude technique, but pretty fast and easy.

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

One thought on “Quick and Easy: Debugging VS 2010 Solution Deployment

Leave a Reply

Your email address will not be published. Required fields are marked *