Note that there are some explanatory texts on larger screens.

plurals
  1. PO64bit exceptions in WndProc silently fail
    text
    copied!<p>The following code will give a hard fail when run under Windows 7 32bit:</p> <pre><code>void CTestView::OnDraw(CDC* /*pDC*/) { *(int*)0 = 0; // Crash CTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: add draw code for native data here } </code></pre> <p>However, if I try this on Windows 7 64bit, I just get this in the output window:</p> <blockquote> <p>First-chance exception at 0x13929384 in Test.exe: 0xC0000005: Access violation writing location 0x00000000.<br> First-chance exception at 0x77c6ee42 in Test.exe: 0xC0150010: The activation context being deactivated is not active for the current thread of execution.</p> </blockquote> <p>What is the reason for this? I know it's a hardware exception (<a href="http://msdn.microsoft.com/en-us/library/aa363082.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa363082.aspx</a>), but why the difference when ran under 32bit and 64bit? And what can I do to correctly handle these kind of errors? Because they should really be trapped and fixed, as opposed to what currently happens which is Windows just carries on pumping messages to the application and let's it run (so the user and the developers are completely unaware any problems have actually occurred). </p> <p><strong>Update:</strong> Our regular crash reporting software uses <code>SetUnhandledExceptionFilter</code> but that doesn't get called on x64 for hardware exceptions inside a WndProc. Does anyone have any information on this, or a workaround?</p> <p><strong>Update2:</strong> I've reported the issue at Microsoft Connect:<br> <a href="https://connect.microsoft.com/VisualStudio/feedback/details/550944/hardware-exceptions-on-x64-machines-are-silently-caught-in-wndproc-messages" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/details/550944/hardware-exceptions-on-x64-machines-are-silently-caught-in-wndproc-messages</a> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload