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

    Question

  •  

    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

     

    Wednesday, April 09, 2008 12:03 AM

All replies

  • 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
    Monday, May 04, 2009 5:30 PM
  • 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
    Tuesday, December 22, 2009 1:22 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

    Thursday, April 08, 2010 6:42 PM
  • 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

    Friday, September 30, 2011 3:29 AM
  • 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

    Monday, October 24, 2011 7:10 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, November 24, 2011 5:16 PM
  • Great advice thank you.

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

    Thursday, December 15, 2011 9:10 AM
  • 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, January 27, 2012 2:14 PM
  • 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!
    Friday, April 13, 2012 9:58 AM
  • Hey, That was a sweet tip!

    I also thought I haden't changed my code...and all of a sudden a saw this message!

    I been in the bussiness for so many years,but this was totaly new for me.
    Thanks to your post I solved my issue in minutes...

    And yes, I had changed my code, but memory is sometimes short!

    /Thomas

    Saturday, December 21, 2013 4:19 PM
  • Wow! It points right to it without a ton of almost meaningless stack snooping. Thanks.

    Dave

    Wednesday, February 26, 2014 6:52 PM