locked
VB.NET loader lock RRS feed

  • Question

  • i am converting a vb6 application to vb.net.  .NET is my main exe process and then I have a mixture of a few assemblies (recently converted) and many vb6 dlls that still need to be converted.  My approach is to convert these projects over time but continue to make phased releases of our product.

    This has been going fine until recently we began receiving "loader lock detected" when I exit my application.  Also, it seems that if an error occurs in the vb6 side that a loader lock message is inevitable.

    Has anyone had these issues?  

    Sunday, September 2, 2012 3:45 AM

Answers

  • Read the webpage below.  You execution stack may be mis-alligned when you return from a VB6 dll which is creating the error you are seeing.  The Net library is probably checking the stack pointer when returning from a dll function and finding a problem.  You are probably passing the wrong type parameter to the dll which is causing the problem.  I would attempt to find out exactly where the problem started occuring because it may be ber causing other errors.

    Now getting into a discussion of managed code and unmanaged code.  There is lots of dicussion on the web about managed and unmanaged code.  I want to remain neutral about these discusssions.

    The Marshall class described in the webpage is designed to fix stack issues and memory leaks.  It won't always fix memory leaks.  It also adjusts the stack when it gets mis-alligned, but doesn't fix the real problem.  Stack mis-allignments occur for two reasons

        1) The parameter list doesn't match between the statement that call a function and the function itself.  In you r case if is a dll function.

        2) There is a bug in a dll that can't be fixed because it is from a 3rd party vendor.  The bug could be an exception that isn't being handled properly.

    http://www.codeproject.com/Articles/8642/Exploring-general-functions-of-the-Marshal-class


    jdweng

    • Proposed as answer by Mike Feng Monday, September 3, 2012 10:14 AM
    • Marked as answer by Mike Feng Monday, September 10, 2012 5:48 AM
    Sunday, September 2, 2012 4:24 AM

All replies

  • Read the webpage below.  You execution stack may be mis-alligned when you return from a VB6 dll which is creating the error you are seeing.  The Net library is probably checking the stack pointer when returning from a dll function and finding a problem.  You are probably passing the wrong type parameter to the dll which is causing the problem.  I would attempt to find out exactly where the problem started occuring because it may be ber causing other errors.

    Now getting into a discussion of managed code and unmanaged code.  There is lots of dicussion on the web about managed and unmanaged code.  I want to remain neutral about these discusssions.

    The Marshall class described in the webpage is designed to fix stack issues and memory leaks.  It won't always fix memory leaks.  It also adjusts the stack when it gets mis-alligned, but doesn't fix the real problem.  Stack mis-allignments occur for two reasons

        1) The parameter list doesn't match between the statement that call a function and the function itself.  In you r case if is a dll function.

        2) There is a bug in a dll that can't be fixed because it is from a 3rd party vendor.  The bug could be an exception that isn't being handled properly.

    http://www.codeproject.com/Articles/8642/Exploring-general-functions-of-the-Marshal-class


    jdweng

    • Proposed as answer by Mike Feng Monday, September 3, 2012 10:14 AM
    • Marked as answer by Mike Feng Monday, September 10, 2012 5:48 AM
    Sunday, September 2, 2012 4:24 AM
  • Hi GaCracker,

    Welcome to the MSDN Forum.

    I have marked Joel's reply as answer, if you think it provides no help, please feel free to unmark it and follow up.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, September 10, 2012 5:50 AM