VS Hanging

Whenever i try to debug my application, Visual Studio Express passes after the compilation, and then nothing happens. After a shrot while a message appears telling me to wait, and if VS is waiting on another program, would i like to go to it. This has me perplexed, as i have no idea what is going on.

I was not doing this constantly though so i continues with my coding, but toaday when i went to compile it, it complained of managed code trying to be executed in an OSLoader lock. I now I did not muck up my code, as all I removed was a single COnsole.Write Line command.The code generating this was in one of the files VS had generated for me.

Any help in fixing this much appreciated,

Mike


Answer this question

VS Hanging

  • imdqa

    I'm not up to speed on DirectX but the Manager class appears to enumerate hardware devices. I'd expect it to load some kind of driver to interrogate the device capabilities. That driver could easily generate the loader lock warning. Note that it is a false warning and your program doesn't deadlock, the framework is actually already initialized. It just *could* generate a deadlock if that driver was used from unmanaged code.

    You ought to let the know the DirectX team about this. Not sure how to get in touch with them, it doesn't appear to be done through regular Product Feedback.

    If the MDA warning annoys you, check this MSDN article on how to disable the MDA.


  • nglow

    Its intermittent, somtimes i have no reouble for a few days, and then every time i compile. I compiles, and then stops at the debug stage. I used task manager to do a bit more digging and I see MyProgram.vshost.exe added to the list when i start the debug. It is listed as using 0% of my processor resources. I think it runs fine when i chose to run without debug, but because its intermittent i have no real way of knowing.

    I created a new project and this appeared to run ok, bbut again their is no way to tell.

    Any ideas

    Mike

  • Zep--

    does this happen on any project or just 1 specific project What happens if you create another project and do the same thing

    What happens if you disable your anti virus software Does it work better now



  • Coridas

    I have now disabled the option as suggested, and recieved a message saying that securtiy debugging would be disabled. I dont know what this is, so am unsure of what this means. The compile went fine but when debugging, it gave me a warning straight away about "LoaderLock was detected".

    The full message was:

    DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX.Direct3D\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.Direct3D.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.

    The Application.Run method is highlighted and this was automatically generated code. I sthere anything I have done wrong I am told by the help I may be using managed and unmanged code, but was not aware of it.

    Any help much appreciated,

    Mike

  • Javier Martinez

    I have futher debugged my code, and dicovered the line that caused my program to generate the LoaderLock error is:

    int adapterOrdinal = Manager.Adapters.Default.Adapter;

    The loaderlock error is first reported with this in effect. I am unsure why it is being generated as I have not changed this code section, and it was previously running fine. Any suggestions

    Mike

  • Mr_White

    It was the automatically generated code that caused it in the prgram file. The only 3rd party file I am usign is the Managed DirectX. Thanks for the suggestions and Ill let you know how I get on.

    Thank you,

    Mike

  • Cesar Francisco

    Thanks for that, I scanned the DirwectX forum, and found an answer. It seems to be generated erroneously when you disable the hosting process, and the only know solution is to turn of MDA's. I did that and now my code seem to be running along happily! Thanks to everyone who commented,

    Mike

  • Senthil Ramadoss

    The first problem you describe is fairly common and all editions of VS2005 suffer from this. We've never been able to find a good diagnosis. One thing to try is to change a debug option: Project + properties, Debug tab, scroll to bottom and turn off "Enable the Visual Studio hosting process".

    The 2nd problem you describe is more serious. You'll get a MDA warning when the debugger sees a DLL trying to initialize the .NET framework in its DllMain() entry point. Unfortunately, these warnings also tend to be inaccurate; no lock will occur if the framework is already initialized. If it were real, your program will deadlock immediate after startup and you'll hear a 'ding' on the PC's speakers. Look for a 3rd party component to cause this problem.


  • VS Hanging