www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11033] New: Visual-D seems to catch exceptions, which breaks the flow of code while debugging


           Summary: Visual-D seems to catch exceptions, which breaks the
                    flow of code while debugging
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: VisualD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de

--- Comment #0 from Rainer Schuetze <r.sagitario gmx.de> 2013-09-13 13:36:00
PDT ---
original report: http://www.dsource.org/projects/visuald/ticket/275

reported 07/29/13 01:26:04 by TurkeyMan for version 0.3.36
bug in Language Service


In this example, when running the code in VisualD, in the second call to
apiHandler, it throws inside a.loadFrom(...) and VD pops up the "an exception
has been thrown" box.
If I click 'continue', rather than entering the catch() block, it just
continues to writeln "got args", and then enters testFunc2() passing invalid
arguments, since it threw while parsing the args...
Does VD catch the exception at the moment it's thrown and then stop unwinding
when you press continue?
Something very strange happens here. Problem is, I can't debug (or even run) my
app. There seems to be no workaround.
I turned off D exceptions in Debug->Exceptions...->D Exceptions, but it still
pops up the dialog box to inform me of the exception, and interferes with the
code flow.
I think this is a critical bug. I can't actually continue working with VD with
this present :/

Comment 1: 07/29/13 03:13:38  by sagitario

It all depends...
Win64: the exception handling by dmd is not the standard exception handling so
the debugger does not know anything about it. I guess you are using win32 here.
The "D exceptions" are only used by mago, the VS debugger does not know about
these (see also 
http://www.dsource.org/projects/visuald/wiki/Tour/Debugger). You can add your
new exception in the "modulename.WLServException" to the list of exceptions to
configure catching on throw or not.
To configure the exception handling for the VS debugger, you have to add a
Win32 exception with code 0xE0440001. The installer is supposed to do this, but
it seems to be missing...
Another issue is that you cannot step out of an exception, i.e. into the catch
block (see issue 42). You have to set a breakpoint in the catch block (which
does not seem to work with mago in your example).
I tried your code (VS2010, win32, VS debugger) and it seems to work for me.

Comment 2: 07/29/13 05:13:23  by TurkeyMan

I see.
I'm using win32/Mago actually.
I'll switch to the VS debugger and see how I go (I forgot about that option!)
So you're saying that in win32/mago, you don't notice that it failed to catch?
Why can't I turn the exceptions off?
Breakpoints in the catch don't fire, because it never enters the catch, it
continues in the current scope with the data in an error state.
The writeln's reveal the flow of the code is different than expected.

Comment 3: 08/15/13 07:05:27  by TurkeyMan

I still think this is an absolute critical issue. It needs to be addressed by
the appropriate party. I'm not sure where the source of the problem is. Is it
with mago?
Code that executes differently under the debugger is impossible to debug.

Comment 4: 08/21/13 15:56:10  by sagitario

Just saw a post on the news group that links to this microsoft hotfix:
Maybe this is causing your problems?

Comment 5: 08/28/13 09:56:44  by TurkeyMan

Don't think so. I'm on Win8.
It just seems to be that there's some sort of catch that occurs to pop up the
"an exception has been thrown" dialog box, and from there, if i continue, it
continues as if the exception was caught at the source, rather than unwinding
to the enclosing catch statement. It's probably a Mago problem.

Comment 6: 08/28/13 13:25:53  by sagitario

I also guess it is a mago problem. Maybe you can ping Aldo, according to the
svn revision log, he seems to have continued working on mago.

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2013