Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7128395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:08:03+00:00 2026-05-28T11:08:03+00:00

I’ve been tracking down a really insidious bug at work. The event that seems

  • 0

I’ve been tracking down a really insidious bug at work. The event that seems to cause the very strange behavior I’ve been tracking down appears to be an exception being thrown while processing a timer callback. The exception is NOT handled by any of my code, therefore I would expect the debugger to be notified of the unhandled exception and alert me with a nice obnoxous pop-up. No, instead the “first chance” exception message traces out to the debugger and everything silently moves on.

I’ve written up the following program that demonstrates this issue:

#include "stdafx.h"
#include <Windows.h>

class FooExcept
{
};

VOID CALLBACK Timer(HWND hwnd,
    UINT uMsg,
    UINT_PTR idEvent,
    DWORD dwTime)
{
    printf("Here\n");
    throw FooExcept();
    printf("Also Here\n");
}


int _tmain(int argc, _TCHAR* argv[])
{
    SetTimer(0, 0, 1000, Timer);

    int bRet;
    HWND hWnd;
    MSG msg;
    // Standard Win32 message pump
    while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
    { 
        if (bRet == -1)
        {
            // handle the error and possibly exit
        }
        else
        {
            TranslateMessage(&msg); 
            DispatchMessage(&msg); 
        }
    }

    return 0;
}

The output of this program to the Visual Studio Output window is this repeated:

First-chance exception at 0x76dbb9bc in TimerTest.exe: Microsoft C++ exception: FooExcept at memory location 0x0034f743..

Of course my project is MUCH more complicated and is printing out a lot of TRACE information to the debugger. Its easy for first-chance exception to get lost in the output.

HOWEVER

That’s not my concern. This is clearly an exception Im not handling. Is Windows surreptitiously deciding to handle this for me? Why? If not, why isn’t it giving me a blatant pop-up alerting me of the unhandled exception? Such a pop-up could have saved me days of debugging.

This behavior seems consistent between XP/VS 2008 and Win7/VS 2010.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:08:04+00:00Added an answer on May 28, 2026 at 11:08 am

    This has been been fixed, to some degree (see below), in Windows 7 SP1.

    In article http://support.microsoft.com/kb/976038 you will find mention of a bugfix and explanation how to use it to disable this behaviour. You have to either:

    • set process options in the registry or
    • call function SetProcessUserModeExceptionPolicy exported by kernel32.dll

    I have verified in Updates in Win7 and WS08R2 SP1.xls that this bugfix is indeed included in Windows 7 Service Pack 1, so all you have to do is to enable it (assuming you are lucky enough to have Windows 7 SP1 already installed).

    As for explanation why this has been done, well we can just guess some ill-advised attempt to prevent legacy application from crashing in the name of backwards compatibility.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.