none
VS2012, D3D11, AA and Illegal Instruction exception

    Question

  • I am currently trying to track down an issue we are having that seems to be specific to VS2012. At some point yesterday, a small number of PCs in our office started getting Illegal Instruction exceptions when calling CreateSwapChain, without modifying any code, changing any settings or installing any software. The exceptions only fire when run from VS2012 with the native code debugger. I wasn't sure where to post this as it is a very specific problem spanning D3D and VS, but given the problem seems to be related to the VS debugger I opted to post it here.

    Here are some things we have been able to verify:
    * Software: Windows 7 Pro x64, VS2012 Pro (RTM 11.0.50727.1 RTMREL), also confirmed that our AV is not causing issues
    * Hardware: High end i7 PCs with a range of NVIDIA graphics cards - with a range of driver versions
    * We are using D3D11 with non-managed, C++ code compiling to a 64bit binary. Very little code is executed before we init D3D
    * The problem does not happen in 32bit, only 64bit
    * Updating, changing driver versions doesn't make a difference
    * It happens with/without D3D debugging, and there are no errors or warnings when it is active
    * There were no code changes to make the problem start happening, it was working before lunch and it stopped working after
    * It does not happen on all PCs, just a handful
    * If we disable anti-aliasing then the problem goes away, any sample count >1 reproduces the issue
    * It happens when creating the D3D11 device in full screen mode only, it does not happen in windowed mode.
    * It happens only when specifically the VS2012 debugger is attached (and only when debugging native code with symbols available, if I set the debugger type to script/managed etc then it doesn't happen)
    * It happens when using the VS2012 GPU Diagnostics as well, but not when using the profiler.
    * I've verified that the problem does not happen when debugging through VS2010, VS2008 or WinDbg. I've also tried with AppVerifier and that does not repro the issue.
    * The issue can also be reproduced if the app is started without a debugger, then attached to by VS2012 and then alt+enter is pressed to enter full screen.
    * The problem PCs have been rebooted multiple times.
    * I did a system restore to the day before it started happening and this did not fix the issue
    * I got desperate and set the time back to before the issue started happening, unsurprisingly this didn't fix the issue either.

    * The following errors are visible on all PCs (even the ones not exhibiting the problem), if we disable AA they go away:
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031E360.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031E8C0.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031EB90.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031EED0.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031E360.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031E8C0.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031EB90.
    First-chance exception at 0x000007FEFD209E5D in OurExe.exe: Microsoft C++ exception: _com_error at memory location 0x000000000031EED0.

    Callstack:
    d3d11.dll!CUseCountedObject<class NOutermost::CDeviceChild>::UCReleaseUse(void) Unknown
    fffffffffffffffe() Unknown
    0000000000000020() Unknown
    00000000003b9b98() Unknown
    d3d11.dll!CResource<struct ID3D11Buffer>::LUCCompleteLayerConstruction(void) Unknown
    d3d11.dll!NOutermost::CDeviceChild::LUCCompleteLayerConstruction(void) Unknown
    d3d11.dll!NDXGI::CResource::LUCCompleteLayerConstruction(void) Unknown
    d3d11.dll!NOutermost::CDeviceChild::LUCCompleteLayerConstruction(void) Unknown
    d3d11.dll!NOutermost::CDeviceChild::FinalConstruct(struct NOutermost::CDeviceChild::TConstructorArgs const &) Unknown
    d3d11.dll!CDelegatingUseCountedObject<class NOutermost::CDeviceChild>::CreateInstance(struct NOutermost::CDeviceChild::TConstructorArgs const &,class NOutermost::CDevice *,void *,void *,struct _GUID const &,void * *) Unknown
    d3d11.dll!NOutermost::CDevice::CreateLayeredChild(unsigned int,void const *,unsigned __int64,struct ID3D11LayeredUseCounted *,struct _GUID const &,void * *) Unknown
    d3d11.dll!NDXGI::CDevice::CreateSurfaceInternal(struct IUseCounted *,struct DXGI_SURFACE_DESC const *,unsigned int,unsigned int,void *,struct IDXGISurface * *) Unknown
    dxgi.dll!CDXGISwapChainBase<struct IDXGISwapChain>::CreateDriverCompatiblePrimary(class CDXGIOutput *,struct DXGI_MODE_DESC const *,unsigned int,struct DXGI_SURFACE_DESC &,class CDDI_PRIMARY_DESC &) Unknown
    dxgi.dll!CDXGISwapChainBase<struct IDXGISwapChain>::CreateFullscreenObjects(class CDXGIOutput *,struct DXGI_MODE_DESC const *,unsigned int) Unknown
    dxgi.dll!CDXGISwapChainBase<struct IDXGISwapChain>::ScenarioEnterOrLeaveFullscreen(class CDXGIOutput *,bool) Unknown
    dxgi.dll!CDXGISwapChainBase<struct IDXGISwapChain>::SetFullscreenState(int,struct IDXGIOutput *) Unknown
    dxgi.dll!CDXGIFactory::CreateSwapChainImpl<class CDXGISwapChain>(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC *,class CDXGIOutput *,void * *) Unknown
    dxgi.dll!CDXGIFactory::CreateSwapChain(struct IUnknown *,struct DXGI_SWAP_CHAIN_DESC *,struct IDXGISwapChain * *) Unknown
    <our code>

    Swap Chain Desc (as consts, it actually enumerates the values):

    sSwapChainDesc.BufferCount = 2;
    sSwapChainDesc.BufferDesc.Width = 1920;
    sSwapChainDesc.BufferDesc.Height = 1080;
    sSwapChainDesc.BufferDesc.RefreshRate.Numerator = 60; /*Monitor is actually 60Hz not 59.94Hz*/
    sSwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
    sSwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    sSwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    sSwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
    sSwapChainDesc.OutputWindow = hWnd;
    sSwapChainDesc.SampleDesc.Count = 4;
    sSwapChainDesc.SampleDesc.Quality = 12;
    sSwapChainDesc.Windowed = FALSE;
    sSwapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

    I've managed to replicate the error in a test case by using this sample as a base: http://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef. Extract, set the config to Debug|x64, build and debug from VS2012 to repro the issue.

    What's weird is that this suddenly just started happening seemingly for no reason, exes built before lunch started exhibiting the problem when running after lunch. We would be very grateful if some clever soul was able to shed some light on this head scratcher!

    Test case: https://dl.dropbox.com/u/21806/LinkedTo/VS2012D3DIllegalInstruction.zip

                                       
    • Edited by icStatic Monday, January 28, 2013 12:01 PM Added test case link
    Monday, January 28, 2013 12:01 PM

Answers

  • Progress! Apparently the issue has already been fixed in VS2012 Update 1, so if anyone else has trouble, upgrade to that.
    • Marked as answer by icStatic Thursday, January 31, 2013 11:28 AM
    Thursday, January 31, 2013 11:28 AM

All replies

  • Hi icStatic,

    Thank you for posting in the MSDN forum.

    Based on your description, it is related to the VS debugger tool, but it is also related to the dx dev, it will need more DX professional knowledge, so to help you resolve this issue, my suggestion is that you could post this issue to this forum: http://xboxforums.create.msdn.com/forums/default.aspx?GroupID=7 forum, there you would get dedicated support from the DirectX experts. Thanks for your understanding.

    Sincerely,


    Jack Zhai [MSFT]
    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.

    Tuesday, January 29, 2013 7:13 AM
  • Thanks Jack, as we are registered Xbox developers I've contacted private support. They have managed to repro the issue and we suspect it is a problem with the debugger. I'll report back if I get a resolution.
    Wednesday, January 30, 2013 12:20 PM
  • Hi icStatic,

    I look forward to hearing from you.

    But if DirectX experts could repro this issue, and make sure that it is not related to this specific app(maybe you could check whether all apps have the same issue), and make sure that it is the VS debugger tool issue, you can submit this feedback to Microsoft Connect feedback portal: http://connect.microsoft.com, Microsoft engineers will evaluate them seriously. If you submit the report, you could share the link here, so people who met the same issue could vote it. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    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, January 31, 2013 6:40 AM
  • Progress! Apparently the issue has already been fixed in VS2012 Update 1, so if anyone else has trouble, upgrade to that.
    • Marked as answer by icStatic Thursday, January 31, 2013 11:28 AM
    Thursday, January 31, 2013 11:28 AM
  • Hi icStatic,

    Glad to see this issue has been resolved and thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

    Have a nice weekend,


    Jack Zhai [MSFT]
    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, February 01, 2013 1:35 AM