Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

if I get an "Application.Run()" exception, how do I determine which control threw it?

I've inherited some code with less-than-perfect exception handling.   Once in a while I get an unhandled exception.  The debugger breaks at Application.Run(),  which isn't very helpful.  Putting a try()/catch() around Application.Run() lets me display the stack trace, but this isn't helpful either -- all I learn from it is that some NI control somewhere threw an exception.

 

Is there a way I can find the name of the control which threw the exception?

 

A simple test case is:

* project with one form, containing two NumericEdit controls

* each control is set to a range of 0 to 100, with "OutOfRangeMode"  set to "ThrowException" (the default)


Run the program. Enter a value of -1 in one of the controls  Without any exception handler provided, the excption appears at the Application.Run() level.  How can I tell which control thew the exception?  My actual application has dozens of controls and sometimes crashes at startup.  If I knew which control were out of range it'd probably be easy to fix.

 

Thanks for ideas,

     Kevin

 

0 Kudos
Message 1 of 2
(4,822 Views)

You are not setting to default values at startup?

 

0 Kudos
Message 2 of 2
(4,818 Views)