Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Breaking on exceptions reveals the ugly truth of your application

So, you wanna know how good or bad your application really is?  Setup your IDE to break on all thrown exceptions.  This will really let you know how good or bad your application is.  This is also great way to find a pesky unhandled exception.

To tell your IDE to break on thrown exceptions do the following.
Click the Debug toolbar item
Click the Exceptions menu item (Ctrl+Alt+E)
Check the check box for 'Thrown' for the Common Language Runtime Exceptions

ExceptionDialog

After you turn this option on you just may be surprised how many unhandled and swallowed exceptions your application has.

Have fun, and use with caution.  You may not like the results you get.

Till next time,


Posted 02-04-2008 8:38 AM by Derik Whittaker

[Advertisement]

Comments

Peter Ritchie wrote re: Breaking on exceptions reveals the ugly truth of your application
on 02-04-2008 10:30 AM

I don't recommend this for XML Web Services (unless you're very patient).  The way XML Serialization decides that it needs to generate an assembly for the serialization of a type is that when it tries to first access the assembly it gets a file not found exception.  Of course, it needs to regenerate those assemblies after you do a build, so when you debug a web service to spent some initial time skipping pass several handled exceptions before you even get to your code.

This also fires some extraneous BindingFailure MDA alerts when you turn on the BindingFailure MDA.  Very much a PITA.

Derik Whittaker wrote re: Breaking on exceptions reveals the ugly truth of your application
on 02-04-2008 10:39 AM

@Peter,

This is good to know.  I have not actually done this when anything that has web services.  

Thanks,

Wojciech Gebczyk wrote re: Breaking on exceptions reveals the ugly truth of your application
on 02-04-2008 5:46 PM

Yes, it's very convenient way to discover bad code :-)

Additionally:

Tools>Options | Debugging>General option "Enable Just My Code"

If you check it then ony "yours" exceptions will be handled, otherwise ALL exceptions including framework ones.

It's true, unfortunatelly XML Serializer, WebServices, WCF seems to be using exceptions as flow controllers :/

DotNetKicks.com wrote Breaking on exceptions reveals the ugly truth of your application
on 02-05-2008 6:13 AM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

» Daily Bits - February 5, 2008 Alvin Ashcraft’s Daily Geek Bits: Daily links, development, gadgets and raising rugrats. wrote » Daily Bits - February 5, 2008 Alvin Ashcraft’s Daily Geek Bits: Daily links, development, gadgets and raising rugrats.
on 02-05-2008 8:28 AM

Pingback from  » Daily Bits - February 5, 2008 Alvin Ashcraft’s Daily Geek Bits: Daily links, development, gadgets and raising rugrats.

Dennison Uy wrote re: Breaking on exceptions reveals the ugly truth of your application
on 02-20-2008 6:01 AM

Neat stuff. The VS debugger is such a powerful tool. Aside from this, it is useful to have an exception trapper in your main thread that will trap all exceptions of member objects and variables and log them.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)