locked
Visual Studio 2012 Unit testing native c++ crashes due to stack overflow. RRS feed

  • Question

  •  

    Hello,

    I'm trying to set up the designated unit test for the code coverage analysis. As far as I understand, the code coverage feature that comes with VS 2012 premium only works under the unit testing framwork.

    My ultimate goal is to perform analysis on code coverage on all paths as if you are running executable with arguments. So, I wanted to give a try by setting up an unit test that resembles the main routine along with the hard-coded arguments. It worked as expected and results were promising up until the unit testing framework crashed.

    When complex subroutines were instantiated and huge stack memory got allocated, unit testing framework crashed with an error saying “stack overflow”. I changed the stack size of the .dll of its own unit test but it didn’t do anything.

    Is there a way to increase the stack size of unit testing framework itself?

    Thanks,

    Tuesday, July 23, 2013 7:54 PM

All replies

  • Hello,

    To increase stack space and avoid the error with QTAgent.exe crashing during tests, you can try to add the following REG_DWORD key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\EnterpriseTools\QualityTools\Agent\MaximumTestThreadStackSize and then set it to a greater value such as 1000000 (decimal) to check the result.

    Best regards,


    Amanda Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, July 24, 2013 9:23 AM
  • Thanks for your help.

    I followed your guidance but it didn't resolve the original issue.

    The problem I'm seeing is the following:

    Message: Exception Code:
    C00000FD

    StackTrace:

    _chkstk()

    It appears _chkstk() crashes when allocating stack memory within unit testing framework.

    Regards,




    • Edited by cyoon Wednesday, July 24, 2013 5:31 PM typo3
    Wednesday, July 24, 2013 5:24 PM
  • Hello,

    What is ‘unit test framework crashed’? If possible, you can describe what you see in details.

     I assume that you mean VS crashes. I suggest that you try the same scenario on another machine with better performance to check if you still can get this issue.

    If it still can occur, please collect the test log information based on this blog and then post here so that we can further look at this issue:

    http://blogs.microsoft.co.il/blogs/shair/archive/2010/05/23/how-to-enable-visual-studio-2010-log.aspx

    Since you are using VS2012, you should go to C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config

    Best regards,


    Amanda Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 25, 2013 2:26 AM
  • It appears that the test log doesn't contain any useful information that I'm trying to explain.

    Here is the snippet from the test log.
    ==Information on bunch of projects loaded followed by==
    ...
    ...
    [, PID 11236, TID 8628, 2013/07/25 18:57:22.139] Informational: ------ Discover test started ------
    [, PID 11236, TID 7260, 2013/07/25 18:57:23.588] Informational: ========== Discover test finished: 134 found (0:00:01.4521452) ==========
    [, PID 11236, TID 5992, 2013/07/25 18:57:29.456] Entering OnSelectionChanged
    [, PID 11236, TID 6440, 2013/07/25 18:57:29.530] Informational: ------ Run test started ------
    [, PID 11236, TID 5992, 2013/07/25 18:57:35.074] Entering OnSelectionChanged
    [, PID 11236, TID 5992, 2013/07/25 18:57:36.179] Entering OnSelectionChanged
    [, PID 11236, TID 6440, 2013/07/25 18:57:41.963] Informational: ========== Run test finished: 1 run (0:00:12.431243) ==========
    [, PID 11236, TID 8236, 2013/07/25 18:58:59.303] Informational: ------ Run test started ------
    [, PID 11236, TID 8236, 2013/07/25 18:59:00.339] Informational: ========== Run test finished: 1 run (0:00:01.0361036) ==========

    ================================================================= 

    What is actually occurring is that the unit test framework crashed during the following process.

    Processes:
    vstest.executionengine.x86.exe 7492 C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe vstest.executionengine.x86 Break Managed (v4.5, v4.0), Native Default

    Call Stack

     Microsoft.VisualStudio.TestTools.CppUnitTestFramework.Executor.dll!Microsoft::VisualStudio::CppUnitTestFramework::CTestExecutionContext::CallClassMethod()  + 0x6e bytes 
      Microsoft.VisualStudio.TestTools.CppUnitTestFramework.Executor.dll!Microsoft::VisualStudio::CppUnitTestFramework::CTestRunner::Run()  + 0x2fb bytes 
      Microsoft.VisualStudio.TestTools.CppUnitTestFramework.Executor.dll!Microsoft::VisualStudio::CppUnitTestFramework::CExecutorHelper::RunTestCaseImpl()  + 0x30a bytes 
      Microsoft.VisualStudio.TestTools.CppUnitTestFramework.Executor.dll!Microsoft::VisualStudio::CppUnitTestFramework::CExecutorHelper::RunTestCase()  + 0x46 bytes 
      Microsoft.VisualStudio.TestTools.CppUnitTestFramework.Executor.dll!CComExecutor::RunTestCase()  + 0x4d bytes 
      [External Code] 

    Thursday, July 25, 2013 7:10 PM
  • Hi,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Best regards,


    Amanda Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 26, 2013 10:04 AM
  • I know two years passed since this question was made but I'm running the same issue with VS 2013. Is there any way to solve this?
    Thursday, April 28, 2016 6:56 AM
  • Same issue for me in VS 2013.

    It is really an anoying and blockin issue.

    Wednesday, August 9, 2017 12:41 PM