Loader lock error

后端 未结 9 1550
孤独总比滥情好
孤独总比滥情好 2020-12-02 07:34

I am building on C++ dll, by writing code in C#.

I get an error, saying

LoaderLock was detected Message: Attempting managed execution insid

相关标签:
9条回答
  • 2020-12-02 07:54

    The setting path in my visual studio 2017 instance is Debug -> Windows -> Exception Settings . The exception settings "window" showed up in the bottom tab group (as opposed to a separate window), took me a while to notice it. Search for "loader".

    0 讨论(0)
  • 2020-12-02 07:57

    Press ctr d+e Then Expend Managed Debugging Assistants Node. Then Unchecked the LoaderLock.

    Hope this will help you.

    0 讨论(0)
  • 2020-12-02 08:01

    This problem occurs because of the way in which the debugger in Visual Studio runs managed applications that use Microsoft Foundation Classes version 8.0 in one or more DLL files.

    Have a thorough reading at: http://msdn.microsoft.com/en-us/library/aa290048(vs.71).aspx

    0 讨论(0)
  • 2020-12-02 08:05

    The general idea of loader lock: The system runs the code in DllMain inside a lock (as in - synchronization lock). Therefore, running non-trivial code inside DllMain is "asking for a deadlock", as described here.

    The question is, why are you trying to run code inside DllMain? Is it crucial that this code run inside the context of DllMain or can you spawn a new thread and run the code in it, and not wait for the code to finish execution inside DllMain?

    I believe that the problem with manged code specifically, is that running managed code might involves loading the CLR and suchlike and there's no knowing what could happen there that would result in a deadlock... I would not heed the advice of "disable this warning" if I were you because most chances are you'll find your applications hangs unexpectedly under some scenarios.

    0 讨论(0)
  • 2020-12-02 08:07

    kindly remind those VS2017 users that you need to disable "exception helper" instead of "exception assistant"(before VS2017) to prevent from loader lock error, which setting path is Debug->Exception. Just ran int to this problem and wasted 2 hours searching for solutions...

    0 讨论(0)
  • 2020-12-02 08:11

    you need to go to menu Debug -> Exceptions, open the Managed Debugging Assistants, find LoaderLock and uncheck

    http://goo.gl/TGAHV

    0 讨论(0)
提交回复
热议问题