views:

146

answers:

2

In VS 2008 when I try to step into the

return new Triangles(element, mesh);

line, I get the following error the first time

DLL 'C:\Windows\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

After the first time stepping through the code, I do not get any warnings and everything works great.

In 2010 when I get to the same line, the program hangs on the first time through (just like the warning states can happen in 2008)

There are no DirectX calls that I am aware of around this area. How can I better debug this issue and what do I need to do to resolve it?

Thanks

  • Answer - Hopefully this will help some other people. I was able to get my solution in VS 2010 to work like the VS 2008 solution by creating an app.config file.

    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
    </startup>
    
A: 

That's a known problem with DirectX... from 2004.

Install the latest version of the DirectX SDK and you should be good to go.

Stephen Cleary
With the latest DirectX SDK installed I still get the warning and that is OK. The problem is that in 2010, I do not even get the Loader Lock warning, the program just hangs. Thanks for trying though.
Ryan
Did you change the referenced dlls to the updated versions?
Stephen Cleary
I was able to find the answer and it is now edited in my question. Thanks for looking into it.
Ryan
You can actually post (and accept) your own answer.
Stephen Cleary
A: 
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
</startup>
Ryan