Jan 21, 2013 at 7:53 PM
Edited Jan 21, 2013 at 8:16 PM
I tried following the instructions as well as a few other things but it didn't help. I did some more debugging and managed to trace the issue further. In short, I have a dummy method which is not called but it resides in the Windows Runtime Component. Another
method in this component is called by the C#/XAML UI. The dummy method has some code to instantiate an effect but again, this code is not called at all. The following line is causing all the grief:
m_spriteBatch->Begin(); //m_spriteBatch is a SpriteBatch instance
As soon as I invoke the DLL that contains this line, the application crashes with the error below. If I remove this one line of code, the application runs correctly.
The error I get when I attach a debugger is: "MediaCapture.exe has triggered a breakpoint". Even though I haven't added that breakpoint it is in the "implements.h" file, in the following method:
// This indicates that there were two instances of the module created or race conditon during module creation
// If you are creating object with new/delete please make sure that you haven't created more than one module
// and you disabled static initalization with __WRL_DISABLE_STATIC_INITIALIZE__
// otherwise please initialize/create module in main()
__WRL_ASSERT__(::InterlockedCompareExchangePointer(reinterpret_cast<void* volatile*>(&module_), this, nullptr) == nullptr &&
"The module was already instantiated");
SRWLOCK initSRWLOCK = SRWLOCK_INIT;
__WRL_ASSERT__(reinterpret_cast<SRWLOCK*>(&moduleLock_)->Ptr == initSRWLOCK.Ptr && "Different value for moduleLock_ than SRWLOCK_INIT");
module_ = this;
The breakpoint is at the __WRL_ASSERT__ line. Any thoughts on what could be causing this? I found a few articles online but none seem to resolve the issue.
For example, I found the exact same problem here but the resolution steps described doesn't help me.
Let me know if this forum isn't the correct place for this question. I figured since the error happens when I call SpriteBatch->Begin(); you might've seen this issue before.
Thanks in advance,