Unhandled exceptions are almost exclusively dropped when you dereference a null pointer. The ClearRenderTargetView()
is an instance method of a validly initialized (immediate) context, or
ID3D11DeviceContext::ClearRenderTargetView(...)
If you didn't make the trivial mistakes of not initializing the render target view or calling OMGetRenderTargets(...)
instead of OMSetRenderTargets(...)
, I am absolutely certain that your context is null. Per your statement, you explicitly deny making these mistakes.
Use assert
to verify my claim, that your context is indeed NULL. Since it works in your driver constructor and doesn't later when it is used as a member of your application class, you're probably not supplying a proper copy assignment operator in your driver class, that's why it drops an unhandled exception box, it initializes the context and then doesn't persist due to a missed reference copy. While the object is being initialized, it is partially valid, that's why it works that one time.
This is just a hypothesis, I'm pretty certain, but due to the lack of code on your part, I can only use my imagination and logic. Report back if you need further assistance.