Strange behaviour with mixed-mode C++ program

  • Thread starter Thread starter ralphsieminsky
  • Start date Start date
R

ralphsieminsky

I am seeing a strange behavior with a managed/unmanaged C++ program.

The program is a large application made of DLLs, COM components,
and an exe. When I recompile the exe with /clr a problem occurs: at
some point, deep down the stack far from main() and far from the
managed to native transition, a call to IXMLDOMNode::selectSingleNode
through a ComPtr<IXMLDOMNode> fails. Under the debugger, several
"First-chance exception - interface not registered" messages appear
at that point.

This happens only in Release mode, under Debug mode everything
works fine. What's even stranger is that in Release mode, if I make
the
program a bit slower by requiring that the user clicks an OK MessageBox
before the call to selectSingleNode is made, then the call succeeds.
It is systematic, no MessageBox the call fails, MessageBox the call
succeeds. The rest of the program is is unchanged.

I suspect that there is a nasty bug somewhere in my program, but is
there anything done under the covers at the .NET level that could
explain this ? Like some background processing of loaded libraries
when the exe is compiled with /clr ?....

Thanks for any insight.

Best,
Ralph
 
Back
Top