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?
--
Armin
"Armin Zingler" <az.n...@freenet.de> wrote in message
news:8ogs36...@mid.uni-berlin.de...
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.
--
Tom Shelton
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 news:8ogs36...@mid.uni-berlin.de...
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.
--
Armin
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.....
--
Armin
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.
--
Armin
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. :-(
--
Armin
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%28VS.85%29.aspx
Also, see this function:
SetErrorMode Function
http://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx
How to call:
SetErrorMode(SetErrorMode(SEM_NOGPFAULTERRORBOX) Or SEM_NOGPFAULTERRORBOX)
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%28VS.85%29.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.
--
Armin
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!
--
Armin
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.
--
Armin
I reinstalled the machine. No change. Same problems.
--
Armin
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
--
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 news:8qdft8...@mid.uni-berlin.de...
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?
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
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?
--
Armin
"Armin Zingler" wrote in message news:8qdsp9...@mid.uni-berlin.de...
:)
ok, thanks
--
Armin