Debugging under Win7/64 (VB 2008)

A

Armin Zingler

Hi,

I had no problems with XP/32, but now in Win7/64, debugging works differently:
If I start from within the IDE and an exception occurs, the debugger does not break.
Instead, Win7's problem report window opens. Also the "application compatibility
assitant" (or simlar) pops up: (sorry, German text)

http://www.abload.de/image.php?img=exceptionwin7qmfq.png

If I close these and restart the application, no exception occurs. So I can't
reproduce and debug the problem.

Example:

Public Class Form1

Shared Sub main()

Try
Dim f As New Form1
Application.Run(f)
Catch ex As Exception
Stop
End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load

MsgBox("before")
Throw New Exception("stop now!")
MsgBox("after")

End Sub

End Class


"before" is shown, "after" is not shown, but the Form then opens normally, i.e. Form_Load
exits at the exception without any message.

If I throw the exception right at the start of Sub Main, the debugger catches it
as expected.

Tried AnyCPU and x86 target. No difference.

Tried it with vshost en-/disabled. No difference.

If i "start without debugging" (Ctrl+F5), the exception is thrown. Huh?
Do I still have to enable "jitDebugging" in machine.config? But this shouldn't
be necessary when starting from the IDE as there is already the debugger attached,
and JIT-Debugging is enabled in Options->Debugging. Whatever this "application
compatibility assistant" do to my application, I think the exception must never
be ignored! If I follow the links in the window, I'm finally lead to
http://technet.microsoft.com/default.aspx
Great, that's not very specific.

How did _you_ solve this?
 
S

StrandElectric

Typical Micro$oft! Make me want to look for a stable platform elsewhere...
(er that won't then be taken over by...)
 
T

Tom Shelton

Armin Zingler has brought this to us :
Hi,

I had no problems with XP/32, but now in Win7/64, debugging works
differently: If I start from within the IDE and an exception occurs, the
debugger does not break. Instead, Win7's problem report window opens. Also
the "application compatibility assitant" (or simlar) pops up: (sorry, German
text)

http://www.abload.de/image.php?img=exceptionwin7qmfq.png

If I close these and restart the application, no exception occurs. So I can't
reproduce and debug the problem.

Example:

Public Class Form1

Shared Sub main()

Try
Dim f As New Form1
Application.Run(f)
Catch ex As Exception
Stop
End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) _ Handles MyBase.Load

MsgBox("before")
Throw New Exception("stop now!")
MsgBox("after")

End Sub

End Class


"before" is shown, "after" is not shown, but the Form then opens normally,
i.e. Form_Load exits at the exception without any message.

If I throw the exception right at the start of Sub Main, the debugger catches
it as expected.

Tried AnyCPU and x86 target. No difference.

Tried it with vshost en-/disabled. No difference.

If i "start without debugging" (Ctrl+F5), the exception is thrown. Huh?
Do I still have to enable "jitDebugging" in machine.config? But this
shouldn't be necessary when starting from the IDE as there is already the
debugger attached, and JIT-Debugging is enabled in Options->Debugging.
Whatever this "application compatibility assistant" do to my application, I
think the exception must never be ignored! If I follow the links in the
window, I'm finally lead to http://technet.microsoft.com/default.aspx
Great, that's not very specific.

How did _you_ solve this?

I didn't... I can't say I've ever seen this happen. I've been running
win7/64 and vs 2008/2010 on two machines and everythign seems to work
fine.
 
C

Cor

Armin,

I've the same VB 2010 SP1, I cannot get my hands behind it what it is, but
I'm awaiting until I see more of this before I report it.

It is so difficult to report something you don't know why and when it
occurs.

:)

Cor

"Armin Zingler" wrote in message
Hi,

I had no problems with XP/32, but now in Win7/64, debugging works
differently:
If I start from within the IDE and an exception occurs, the debugger does
not break.
Instead, Win7's problem report window opens. Also the "application
compatibility
assitant" (or simlar) pops up: (sorry, German text)

http://www.abload.de/image.php?img=exceptionwin7qmfq.png

If I close these and restart the application, no exception occurs. So I
can't
reproduce and debug the problem.

Example:

Public Class Form1

Shared Sub main()

Try
Dim f As New Form1
Application.Run(f)
Catch ex As Exception
Stop
End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles MyBase.Load

MsgBox("before")
Throw New Exception("stop now!")
MsgBox("after")

End Sub

End Class


"before" is shown, "after" is not shown, but the Form then opens normally,
i.e. Form_Load
exits at the exception without any message.

If I throw the exception right at the start of Sub Main, the debugger
catches it
as expected.

Tried AnyCPU and x86 target. No difference.

Tried it with vshost en-/disabled. No difference.

If i "start without debugging" (Ctrl+F5), the exception is thrown. Huh?
Do I still have to enable "jitDebugging" in machine.config? But this
shouldn't
be necessary when starting from the IDE as there is already the debugger
attached,
and JIT-Debugging is enabled in Options->Debugging. Whatever this
"application
compatibility assistant" do to my application, I think the exception must
never
be ignored! If I follow the links in the window, I'm finally lead to
http://technet.microsoft.com/default.aspx
Great, that's not very specific.

How did _you_ solve this?
 
A

Armin Zingler

Am 05.01.2011 10:11, schrieb Cor:
Armin,

I've the same VB 2010 SP1, I cannot get my hands behind it what it is, but
I'm awaiting until I see more of this before I report it.

It is so difficult to report something you don't know why and when it
occurs.

:)


Thanks Cor and Tom, did something else and I haven't come across this problem
lately, so I didn't answer earlier. I'll watch it if it comes back.
 
A

Armin Zingler

Am 10.01.2011 22:08, schrieb Armin Zingler:
Am 05.01.2011 10:11, schrieb Cor:


Thanks Cor and Tom, did something else and I haven't come across this problem
lately, so I didn't answer earlier. I'll watch it if it comes back.

I was writing a lot about this issue yesterday, but today I prefer the
short answer. ;) How to disable the "PCA":

http://forums.techarena.in/operating-systems/1188041.htm

The hard way, but if it works..... Well, it doesn't. :-(
The only difference I see is that the PCA window doesn't show anymore
and the application just quits without any message. If my firewall
wouldn't inform me about "WerFault.exe" (windows error report) trying
to send an error report, I would see NOTHING.

The above only applies if x64 is the target. If I target x86, it
behaves as already described: The method exits at the exception location
without a message but the application continues.


Be a debugger attached or not, it doesn't make a difference: It doesn't
stop at the exception. Though, I can catch it in code using Try-Catch.
There is not even a window asking me to send an error report or if I
want to debug.

Very strange. Investigating.....
 
A

Armin Zingler

Am 11.01.2011 21:26, schrieb Armin Zingler:
Very strange. Investigating.....

One of these magic Windows-Forms things:
If the exception occurs in Button1_Click instead of Form_Load,
the IDE catches the exception. JitDebugging is enabled
in machine.config (in the 32 bit and in the 64 bit Framework
version folder).

If started without a debugger attached, I get the "Program
doesn't work anymore" window, trying to find a solution online.
Though, still no possibility to debug it. It just quits.
(no matter if x86 or x64)

I don't get it.
 
A

Armin Zingler

Debugging is really driving me nuts!

Whenever an exception occurs, _without_ a debugger attached,
Win7 _first_ tries to find a solution in the internet:

http://www.abload.de/image.php?img=debugging1irkj.png

How can I change Win7 so that it does _not_ look for a solution
online _first_ before asking me to debug it?

_After_ that, I'm asked to debug it or close the program:
http://www.abload.de/image.php?img=debugging25pe4.png

If I click on "close program", it is NOT closed. The window stays
there greyed-out. I have to kill it via task manager. Why?

Why is not the following dialog shown as I was always used to?
(the left window in the screenshot)
http://www.abload.de/image.php?img=exceptionwin7qmfq.png

It's hard to work this way. :-(
 
N

Nobody

Armin Zingler said:
How can I change Win7 so that it does _not_ look for a solution
online _first_ before asking me to debug it?

You could do it from Windows by following this article, it's for XP though:

How To Configure and Use Error Reporting in Windows XP
http://support.microsoft.com/kb/310414

Programmatically, you could tell Windows not to report the error to
Microsoft, perhaps by calling WerAddExcludedApplication(Vista+):

Windows Error Reporting:
http://msdn.microsoft.com/en-us/library/bb513641(VS.85).aspx

Also, see this function:

SetErrorMode Function
http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx

How to call:

SetErrorMode(SetErrorMode(SEM_NOGPFAULTERRORBOX) Or SEM_NOGPFAULTERRORBOX)
 
A

Armin Zingler

Am 14.01.2011 20:28, schrieb Nobody:
You could do it from Windows by following this article, it's for XP though:

How To Configure and Use Error Reporting in Windows XP
http://support.microsoft.com/kb/310414

Yep, that's for XP. It works well under XP.
Programmatically, you could tell Windows not to report the error to
Microsoft, perhaps by calling WerAddExcludedApplication(Vista+):

Windows Error Reporting:
http://msdn.microsoft.com/en-us/library/bb513641(VS.85).aspx

My problem is not that it reports errors. My problem is that
Win7 doesn't show the error window as I am used to (see screenshot).
I don't know why. I'll ask in a Win7 group. ... No, I've found the
setting on my own. But I've never changed it before.^^ So, this
problem is solved, finally.

Thanks.
 
A

Armin Zingler

OK, I succeeded in
- the PCA has been disabled.
- The expected error dialog is back again.


What's left:
The debugger doesn't catch exceptions!

Again steps to reproduce:
1. new WindowsForms application
2. Throw exception in OnLoad
3. F5 (=start with debugger attached)

I expect the IDE to stop at the place of the exception
as it worked under WinXP! The line

<system.windows.forms jitDebugging="true" />

exists in machine.config in the 32 bit and 64 bit directory. It must work!
 
A

Armin Zingler

Am 19.01.2011 16:21, schrieb Armin Zingler:
I expect the IDE to stop at the place of the exception
as it worked under WinXP!

Instead of the debugger jumping in,
a) target = x86: The exception is ignored an the form is opened
b) target = x64: The error dialog is shown. (options=search online, debug, close)

I don't know what to do anymore.
 
A

Armin Zingler

Am 22.01.2011 20:16, schrieb Armin Zingler:
Am 19.01.2011 16:41, schrieb Armin Zingler:

I reinstalled the machine. No change. Same problems.

Not trying to annoy anyone.... but, I'm afraid, nothing's
getting better. Could anyone please try this? What happens?

Public Class Form1
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)

Throw New Exception

End Sub
End Class
 
C

Cor

Armin,

To get it running I had to made it from a kind of console application and
then to change the properties.
(Even created first a sub main which I never do, but that was not needed)

Otherwise all kind of generic created classes prevents that it even reach
it.

However, I needed to set the by my already to you told exception checkbox to
let it break.

Public Class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)
Throw New Exception
End Sub
End Class

Success
Cor

"Armin Zingler" wrote in message
Am 22.01.2011 20:16, schrieb Armin Zingler:
Am 19.01.2011 16:41, schrieb Armin Zingler:

I reinstalled the machine. No change. Same problems.

Not trying to annoy anyone.... but, I'm afraid, nothing's
getting better. Could anyone please try this? What happens?

Public Class Form1
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
MyBase.OnLoad(e)

Throw New Exception

End Sub
End Class
 
A

Armin Zingler

Am 27.01.2011 17:04, schrieb Cor:
Armin,

To get it running I had to made it from a kind of console application and
then to change the properties.
(Even created first a sub main which I never do, but that was not needed)

I don't understand. I simply create a new WindowsForms application and paste it.
Otherwise all kind of generic created classes prevents that it even reach
it.

However, I needed to set the by my already to you told exception checkbox to
let it break.

I'm not sure what you mean. What happens if you start it?
Public Class Form1
Inherits System.Windows.Forms.Form

Isn't that in designer.vb?
 
C

Cor

Armin,

I assume I did something very stupid, I now remember me something that I
probably did wrong.

I now created a new project and pasted it.

It runs, it only throw an exception if I set that exceptions checkbox but
that is probably mine.

Success

Cor
 
A

Armin Zingler

Am 27.01.2011 19:25, schrieb Cor:
Armin,

I assume I did something very stupid, I now remember me something that I
probably did wrong.

I now created a new project and pasted it.

Cor,

thanks for trying!
It runs, it only throw an exception if I set that exceptions checkbox but
that is probably mine.

Yours? What happens without the exception checked? I assume it's also a 64 bit system.
I guess the Form is just shown as if no exception occured, right?
 
C

Cor

Yes, Yes

"Armin Zingler" wrote in message
Am 27.01.2011 19:25, schrieb Cor:
Armin,

I assume I did something very stupid, I now remember me something that I
probably did wrong.

I now created a new project and pasted it.

Cor,

thanks for trying!
It runs, it only throw an exception if I set that exceptions checkbox but
that is probably mine.

Yours? What happens without the exception checked? I assume it's also a 64
bit system.
I guess the Form is just shown as if no exception occured, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top