Access violation not caught/trapped by Visual Studio or Dr Watson

Discussion in 'C++' started by Greg B, Apr 23, 2004.

  1. Greg B

    Greg B Guest

    Created a simple Win32 application (using Visual Studio wizard)...
    Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
    Pack 5.

    At the start of 'WinMain' function, added the following two lines:

    char* ptr = NULL;
    *ptr = 'b';

    Built the crashTestApp.exe in both Release and Debug configurations.
    When trying to run the .exe in Windows Explorer on the same machine
    (Windows XP, SP 1), get:

    'crashTestApp.exe has encountered a problem and needs to close. We
    are sorry for the inconvenience.' messagebox, with an option to Debug.
    When I copy the crash executables (Debug and Release versions) onto a
    clean Windows 2000 Server machine and run them, I get a similar
    message box popping up (but by default it is Dr Watson, and therefore
    I don't get a chance to debug). If I then install the same version of
    Visual Studio (6.0, Enterprise edition) and Service Pack 5 for Visual
    Studio on that machine and run the .exes again, I am once again able
    to debug.

    Now, this is where it is starting to get weird...

    A friend of mine in United States has a Windows 2000 Server machine
    (which happens to be hosting a Citrix Metaframe Server). He has
    installed Microsoft Visual Studio 6.0 Professional (notice the
    difference) and Service Pack 5 on that machine, and then obtained the
    crash executables from me. But, when he attempts to execute them,
    there is no message box popping up at all. 'Just-in-time debugging'
    checkbox in Visual Studio Tools->Options->Debug tab is checked.
    If we uncheck that box, close Visual Studio and run the crash
    executables, once again nothing seems to occur (i.e. they are launched
    and terminated quietly). Doesn't appear to be anything in the Event
    Viewer either.

    Interestingly enough, if my friend creates a simple Win32 app on his
    machine and uses the same code for 'WinMain' (i.e. with the access
    violation lines), builds it in Release/Debug modes and then tries
    running it, everything works as expected (he gets a messagebox
    notifying him of the access violation, and giving him a chance to
    debug). If he then disables 'Just-in-time debugging' for Visual Studio
    and runs his own-built application, then Dr Watson notification pops
    up (and there's an appropriate message in the Event Viewer)

    Now, could someone suggest as to why this is happening and how I can
    go about solving this issue. Is the problem in the way I build my
    executables? Is it the difference in the Visual Studio versions
    (Enterprise vs Professional)? Is it because I'm building on XP and
    he's running it on 2000 Server? Is it because of some (security)
    policy settings on my friend's machine? Is it because I am 20 hours
    ahead in the timezone and the binaries I've sent to him have
    creation/modification date in the future? Is it because of some
    permissions issue (i.e. the executable he builds himself he has rights
    to debug, while for my one he doesn't?). Is it because Visual Studio
    is installed in the Citrix Metaframe Server environment? (then again,
    when I repeated the same steps with my local Citrix Metaframe server
    setup, everything worked a treat)

    I know I could probably attach a debugger to a running process but
    that would be my last resort if everything else fails...

    Any help/ideas would be much appreciated
    regards,
    Greg
    Greg B, Apr 23, 2004
    #1
    1. Advertising

  2. Greg B

    Unforgiven Guest

    "Greg B" <> wrote in message
    news:...
    > Created a simple Win32 application (using Visual Studio wizard)...
    > Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
    > Pack 5.


    This is off topic here. Try one of the microsoft.public.vc.* newsgroups.

    --
    Unforgiven
    Unforgiven, Apr 23, 2004
    #2
    1. Advertising

  3. "Greg B" <> wrote in message
    news:...
    > Created a simple Win32 application (using Visual Studio wizard)...
    > Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
    > Pack 5.
    >
    > At the start of 'WinMain' function, added the following two lines:
    >
    > char* ptr = NULL;
    > *ptr = 'b';
    >
    > Built the crashTestApp.exe in both Release and Debug configurations.
    > When trying to run the .exe in Windows Explorer on the same machine
    > (Windows XP, SP 1), get:
    >

    [snip]
    >
    > Any help/ideas would be much appreciated
    > regards,
    > Greg


    The only C++ answer to your question is that you have invoked undefined
    behaviour and therefore anything could happen. If you want a Windows answer
    to your question ask on a Windows programming group such as
    news:comp.os.ms-windows.programmer.win32

    john
    John Harrison, Apr 23, 2004
    #3
  4. Greg B

    JKop Guest

    Greg B posted:

    > Created a simple Win32 application (using Visual Studio wizard)...
    > Am using Visual Studio (Enterprise Edition) 6.0, as well as Service
    > Pack 5.
    >
    > At the start of 'WinMain' function, added the following two lines:
    >
    > char* ptr = NULL;
    > *ptr = 'b';
    >
    > Built the crashTestApp.exe in both Release and Debug

    configurations.
    > When trying to run the .exe in Windows Explorer on the same machine
    > (Windows XP, SP 1), get:
    >
    > 'crashTestApp.exe has encountered a problem and needs to close. We
    > are sorry for the inconvenience.' messagebox, with an option to

    Debug.
    > When I copy the crash executables (Debug and Release versions) onto

    a
    > clean Windows 2000 Server machine and run them, I get a similar
    > message box popping up (but by default it is Dr Watson, and

    therefore
    > I don't get a chance to debug). If I then install the same version

    of
    > Visual Studio (6.0, Enterprise edition) and Service Pack 5 for

    Visual
    > Studio on that machine and run the .exes again, I am once again

    able
    > to debug.
    >
    > Now, this is where it is starting to get weird...
    >
    > A friend of mine in United States has a Windows 2000 Server machine
    > (which happens to be hosting a Citrix Metaframe Server). He has
    > installed Microsoft Visual Studio 6.0 Professional (notice the
    > difference) and Service Pack 5 on that machine, and then obtained

    the
    > crash executables from me. But, when he attempts to execute them,
    > there is no message box popping up at all. 'Just-in-time debugging'
    > checkbox in Visual Studio Tools->Options->Debug tab is checked.
    > If we uncheck that box, close Visual Studio and run the crash
    > executables, once again nothing seems to occur (i.e. they are

    launched
    > and terminated quietly). Doesn't appear to be anything in the Event
    > Viewer either.
    >
    > Interestingly enough, if my friend creates a simple Win32 app on

    his
    > machine and uses the same code for 'WinMain' (i.e. with the access
    > violation lines), builds it in Release/Debug modes and then tries
    > running it, everything works as expected (he gets a messagebox
    > notifying him of the access violation, and giving him a chance to
    > debug). If he then disables 'Just-in-time debugging' for Visual

    Studio
    > and runs his own-built application, then Dr Watson notification

    pops
    > up (and there's an appropriate message in the Event Viewer)
    >
    > Now, could someone suggest as to why this is happening and how I

    can
    > go about solving this issue. Is the problem in the way I build my
    > executables? Is it the difference in the Visual Studio versions
    > (Enterprise vs Professional)? Is it because I'm building on XP and
    > he's running it on 2000 Server? Is it because of some (security)
    > policy settings on my friend's machine? Is it because I am 20 hours
    > ahead in the timezone and the binaries I've sent to him have
    > creation/modification date in the future? Is it because of some
    > permissions issue (i.e. the executable he builds himself he has

    rights
    > to debug, while for my one he doesn't?). Is it because Visual

    Studio
    > is installed in the Citrix Metaframe Server environment? (then

    again,
    > when I repeated the same steps with my local Citrix Metaframe

    server
    > setup, everything worked a treat)
    >
    > I know I could probably attach a debugger to a running process but
    > that would be my last resort if everything else fails...
    >
    > Any help/ideas would be much appreciated
    > regards,
    > Greg


    I'm new here and even I find that dumb. It's like hitting someone in
    the head with a sledgehammer and then asking why or why not they're
    spasming.
    JKop, Apr 23, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    487
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    626
    Thirumalai
    May 22, 2006
  3. =?iso-8859-1?q?Lars_Bj=F8nnes?=
    Replies:
    1
    Views:
    415
    =?iso-8859-1?q?Lars_Bj=F8nnes?=
    Oct 16, 2003
  4. Replies:
    3
    Views:
    402
    Claudio Grondi
    Sep 6, 2005
  5. RichardOnRails

    Undefined local var hash not trapped

    RichardOnRails, Jan 2, 2011, in forum: Ruby
    Replies:
    3
    Views:
    102
    Dhruva Sagar
    Jan 2, 2011
Loading...

Share This Page