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
Bad Data Grid, Bad... Don't swallow your Excpetions

The other day I was working on hunting down an issue in the application at my new company.  It appeared to be pretty straight forward find.  It was the standard 'Object not set to instance of an object' message. 

After getting some guidance as to how to use the system and reproduce the issue, I was off on the hunt.  The issue was that when the user would enter data inline into a data grid and then leave the grid, an exception message would pop up.  Since this application is using data binding with CSLA, I put a break point in the 'AddRow' method in the collection. 

As I started stepping through the code I would just 'get' the message box.  It appeared as if it were coming out of thin air.  If you know anything about CSLA, you know there is a TON of stuff going on in the framework.  In order to help me find the location of the bug faster, I thought I would enable ALL Common Language runtime Exceptions to cause a break point.  I was pretty sure this would at least lead me to the exception and where it was being shoved into a message box. 

Well, I was DEAD WRONG.  I stepped though the application a few times trying different things but I NEVER got the exception break point.  Being the stubborn guy I am, and out to prove to the company I am worth my salary, I beat my head against the desk for about an hour without asking for help.

Finally after an hour I asked on of the other developers for help.  I explained to him what I had tried, and what was happening.  I also said that I was 99.9% sure that SOMEONE was actually displaying the exception message because it was in the standard .net message box.  After a few minutes of helping me look, he remembered coming across this issue before......

Turns out that the 3rd party data grid that we are using has a nasty little bug with data binding.  BTW, this only happens in rare occasions and with no rhyme or reason.  Finally after wiring up the 'exception' handler on the grid, I was able to determine what the issue was, well not really what it was, but at least what was happening.

On to the Explanation

Turns out that this data grid when it encounters certain (unknown list) types of executions, instead of just throwing them on like a good little boy, IT POPS A DIALOG.  How nice....

On to the fix

Like I said before, we are using databinding.  Turns out that in this scenario when you wire the databinding information up at design time there CAN be issues.  All we had to do was set the Binding and Datasource in code and ALL IS FIXED....

Why would any 3rd party app think it is even remotely acceptable to pop an exception message box inside their API?  Throw the damn exception on...

kick it on DotNetKicks.com
Posted 06-16-2007 6:54 PM by Derik Whittaker
Filed under: ,

[Advertisement]

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)