Debugging Woes

  • Thread starter Thread starter ChrisM
  • Start date Start date
C

ChrisM

I have written an application in C#, using VS.NET
When debugging the program, break-points etc. work find, but if I hit any
unhandled exceptions, I just get an Error box, and no chance to jump back to
the faulty code. The error box talks about invoking Just-In-Time debugging,
and I think I've done what it says:

Set 'Generate Debugging Information' in 'Project Properties' to TRUE

Added
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
to my app.config

But I still only get the Error Dialog, not the JIT debugger.

I'm sure that this used to work, but no more... Please can anyone suggest
what I might be missing or doing wrong.

Thanks,

ChrisM
 
Chris,

Go to Debug->Exceptions, and you should see a new dialog appear called
"Exceptions". Cliuck "Common Language Runtime Exceptions" and make
sure the bullet boxes on the bottom are set appropriately. For
unhandled exceptions, you should have "Break into the debugger"
selected.

Louis
 
Wow, that was a quick answer!
Sadly though, it didn't help. In that Dialog "Common Language Runtime
Exceptions" (which is the only item on my machine) has the following
settings:
'When the exception is thrown' - Continue
'If the exception is not handled' - Break Into The Debugger

Everything below that (including System.NulReferenceException which is the
one being thrown) is set to 'Use Parent Setting' for both.
This is the way it was already set, but still no JIT debugging.

Sorry! Any more suggestions?

ChrisM.
 
Chris,

Are you running the application from within VS.NET. I.e., VS.NET is
attached to the application while it is executing in Debug Mode? If
so, I think you may want to remove the line: <system.windows.forms
jitDebugging="true" /> from your config.

Either way, even if you get an error that asks you whether you want to
use the JIT debugger or a VS.NET debugger, you /should/ be able to see
where the exception occured.

Louis
 
Is it possible that my JIT debugger is not running, and hence not being able
to catch the exception?
How could I check that that is the case.
Cheers,

ChrisM
 
You are running a debug build, right?

Louis

ChrisM said:
Is it possible that my JIT debugger is not running, and hence not being able
to catch the exception?
How could I check that that is the case.
Cheers,

ChrisM
 
Yeesss... I think so.
If I got into Build->Configuration Manager

It says Active Configuration : Debug

Is that what you meant? Anything else I should check?

However, it is possible (tho I'm not sure) that this problem started when I
added a 'Release' Configuration. I'm quite sure I'm not using that at the
moment tho.

I have also just created a new Configuration (Debug2) which a created using
the 'Default Settings' still get the same problem :-(

In response to your earlier post, CLR debugger? Hmm, that makes me think
that since I am running my program inside of VS.NET, I shouldn't event be
bothering with the JIT debugger anyway. Is that correct? If so why doesn't
the CLR debugger pick up the fact that an exception has occured? it picks up
the break points OK?

Going home now, but thanks for your help so far. If you're around tomorrow
p'raps you could make some further suggestions?

Thanks a lot.

ChrisM
 
See if this has any effect. Go to Debug->Exceptions, and change "When
the Exception is Thrown" to "Break into the Debugger".
 
Yea, that has an effect.
It now breaks to the Debugger if an error occurs, but it does it even if the
error is handled (Does exactly what it say on the tin!)
So it seems that if I grab the exception as soon as it happens, the debugger
can handle it, but as soon as the exception goes into the CLRs Exception
Handling stuff, the debugger looses track of it, and it gets thrown in the
usual way...

ChrisM
 
One Last point, I have found that even if I am 'single stepping' through the
code, if an error is thrown, I get lobbed back to my Application and the
normal (ie non-debugger) exception message.

ChrisM
 
Chris,

I'm afraid I'm a bit perplexed here. Is it possible you have a global
exception handler installed in the AppDomain? There is an event in
there that you can subscribe to that will cause unhandled exceptions
to be handled.
 
I don't think so, as far as I know I have a standard install of VS.NET
I haven't knowingly subscribed to any events concerning exceptions.

Thanks for you suggestions anyway. Maybe I'll have to un/re-install VS....

Regards,

ChrisM
 
Back
Top