Visual Studio Developer Center > Visual Studio vNext Forums > Visual C++ General > 0xC015000F: The activation context being deactivated is not the most recently activated one.

Proposed Answer 0xC015000F: The activation context being deactivated is not the most recently activated one.

  • Wednesday, April 09, 2008 12:03 AM
     
     

     

    Hi All,

     

    This problem probably can be posted in different forums as well, because I see it happened every where when I start searching for the solution over the internet: VB, VC#, even some commercial applications, which probably used .NET to develop.

     

    Any way, I developed my application using C/C++, so I figure this probably the best forum for me to post, and am hoping that you can help me to resolve the problem.

     

    I have a C/C++ Windows program that has been running fine.  Suddently, just over the weekend, I compile and running it from home (I took the laptop home), it bombs out and gives me the following error:

     

    "0xC015000F: The activation context being deactivated is not the most recently activated one."

     

    I was totally surprise, because I knew for sure that I did not change any source code after 5:00 pm Friday after I took the laptop home.  The next Monday, I brought the laptop back to work, snap it into the dock-station, do a clean build, and the same error happen.  I looked at the update to see if our Microsoft friend happen to update my laptop with some ...updates, but there was none.

     

    I searched on the internet and learned that a lot of people have had the same problem that I am having now, but none gives me the solution.

     

    Note that if I compile for 32 bit, the program runs fine...

     

    Can anyone provide a light?

     

    Thanks

     

    DQ

     

All Replies

  • Monday, May 04, 2009 5:30 PM
     
     
    Hello;
    I have the same problem and I found this solution which works fine:

    CWinApp::InitInstance();
    afxAmbientActCtx = FALSE; // <<-- Add this line


    I hope this would help you.
    Good luck.


    Nacereddine
  • Tuesday, December 22, 2009 1:22 PM
     
     Proposed Answer
    This error message often occurs when a function being called in a DLL terminates unexpectedly (usually via an uncaught exception). I just ran into a similar problem and managed to find the problem by getting VS2005 to throw _all_ Win32 exceptions during a debug session. To do that open the Exceptions dialog from Debug | Exceptions... and check the entire branch "Win32 Exception".

    In my case a method in my DLL was trying to dereference a NULL pointer. The exception didn't cause a crash (later processing assigned a valid value to the pointer) but it DID break the activation context handling.

    Use of afxAmbientActCtx = FALSE should only be used if you really know what you are doing - it may simply mask a real problem (one that's just as likely to come back and bite you months later :-)



    Hope this turns out to be useful for somebody...


    John
    • Proposed As Answer by the_steiny Thursday, March 10, 2011 2:46 AM
    •  
  • Thursday, April 08, 2010 6:42 PM
     
     

    Yes, it was useful for me. I just got the same error.

    Turning on all the Win32 exceptions caused it to point right at the problem - an access violation (aka writing to a NULL pointer).

    Thanks for the good advice.

    Mark

  • Friday, September 30, 2011 3:29 AM
     
     

    Hi the_steiny,

    you did just help me (and this is 2 years later) - your tip on setting "Win32 Exception" led me to my problem immediately.

     

    Thanks a lot!

    Mike

  • Monday, October 24, 2011 7:10 PM
     
     

    Setting the Win32 exceptions worked great for me!   I was trying to release a handle that was init'd with a debug mem value....

     

    Thanks,

     

    Richard

  • Thursday, November 24, 2011 5:16 PM
     
     

    I'm using VS2008 and I got the same problem - I was using an invalid pointer and it caused a crash, but only later in a different DLL.   I thought about blaming that other DLL's developer, good thing your post kept me from putting my foot in my mouth :) 

    I don't understand why by default not all Win32 exceptions are being trapped by the debugger though, this is likely causing many bugs to go on undetected.

  • Thursday, December 15, 2011 9:10 AM
     
     

    Great advice thank you.

    My problem turned out to  be caused by a stack overflow in some of my display code.

  • Friday, January 27, 2012 2:14 PM
     
     
    Still excellent advice after more than 2 years, on vs 2010.  You must not work for micro$soft, else you wouldn't have given provided such a useful answer.
  • Friday, April 13, 2012 9:58 AM
     
     
    Thanksyou thankyou thankyou! I spend a good couple of hours trying to work this out and turning the exception catching on found the problem straight away! If you were here I'd kiss you!