0.0 0


I’m getting close to finishing my first Cocos2d-x game (2.2.1). Seeing an occasional DX error message when testing with actual device in debug mode:

DXGI ERROR: IDXGIFactory::CreateSwapChain: Window is not at foreground. [ MISCELLANEOUS ERROR #1000: ]

This happens in-game, the game doesn’t crash and runs happily before and after the message pops up. It is also not consistent or reproducible. During some testing sessions it will show once and other times not at all. I’m a bit concerned that my app may fail store certification because of it, whatever this problem is. Any pointers would be appreciated?


Bump! Anyone can explain what this message even means or where it is generated?

I’ve checked carefully for resource leaks and nothing, but message still shows up.


Errors in D3D may results from many reasons, are you in a debug mode? check the use of D3D11_CREATE_DEVICE_DEBUG in Direct3DBase::CreateDeviceResources(), you might need to add _DEBUG to Preprocessor and find more infos next step.It’s always a good idea to test with the debug layer turned on, keep an eye on the output pane in Visual Studio, and fix any issues it complains about. And tell me your progress, Thanks.


Thanks for your suggestions chenjc. My game project is in debug mode, e.g. _DEBUG is set in pre-processor. I do not get any additional error output. Because Direct3DBase.cpp is external setting a breakpoint in CreateDeviceResources() has no effect so I’m unable to step through the DX related code to see exactly where this happens.

But, from what I can see there is only one place in Direct3DBase.cpp where a swap chain is created, at line 148 in Direct3DBase::CreateWindowSizeDependentResources():

Windows::UI::Core::CoreWindow^ window = m_window.Get();
            nullptr, // Allow on all displays.

I also just discovered that this issue occurs in the HelloCpp project too. Run it on a WP8 device in VS2012 debug mode. Press and hold the back button until the app window is zoomed out then re-activate the app again by clicking on its window. This may have to be repeated several times but at some point this error message message should pop up in the console output window.


Update: Also tested HelloCpp in cocos2d-x 2.2.2, same thing happens. This can be reproduced by following instructions in my previous post; back key->tap app window->repeat as many times as necessary.

As mentioned, I also see it in-game with the app running and no hardware keys pressed.

Update2: Same thing with SimpleGame demo and cc 2.2.2. This looks to be reproducible across the board so obviously not my code at fault.


I asked MS OPEN TECH for help, they will investigate and replyed this will not prevent app certification. The WP* TestCPP app passes the App Certification Tests.


Many thanks chehjc, that is good news. I’ve posted an issue on MS Open Tech’s github about this so we’ll see what happens.