Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. What's up with this new Loader Lock exception?

What's up with this new Loader Lock exception?

Scheduled Pinned Locked Moved C#
csharpannouncementc++visual-studiodebugging
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dxben
    wrote on last edited by
    #1

    I'm getting an exception that looks like below when my debug C# app calls into my debug C++ dll (which uses the MS CRT, debug dll). Apparently if I go to the Menu>Debug>Exceptions>Managed Debugging Assistants and unchecked Loader Lock checkbox, the exception goes away but I get a message saying that I'm trying to use a dll that's loading the CRT without a manifest file. This must all be part of this new manifest side-by-side stuff that is introduced in VS2K5. However I am not getting this problem when I run the release build of my solution and I cannot for the life of me figure out what Microsoft wants you to do here. All I want to do is call into my dll, why has this become so hard to do in the new version of VS.NET ?? Loader Lock was detected: 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. -- modified at 18:14 Monday 5th December, 2005

    L 1 Reply Last reply
    0
    • D dxben

      I'm getting an exception that looks like below when my debug C# app calls into my debug C++ dll (which uses the MS CRT, debug dll). Apparently if I go to the Menu>Debug>Exceptions>Managed Debugging Assistants and unchecked Loader Lock checkbox, the exception goes away but I get a message saying that I'm trying to use a dll that's loading the CRT without a manifest file. This must all be part of this new manifest side-by-side stuff that is introduced in VS2K5. However I am not getting this problem when I run the release build of my solution and I cannot for the life of me figure out what Microsoft wants you to do here. All I want to do is call into my dll, why has this become so hard to do in the new version of VS.NET ?? Loader Lock was detected: 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. -- modified at 18:14 Monday 5th December, 2005

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      Compile the assembly with /NOENTRY (IIRC). IOW you cant use managed code inside DllMain. xacc.ide-0.1 released! Download and screenshots

      D 1 Reply Last reply
      0
      • L leppie

        Compile the assembly with /NOENTRY (IIRC). IOW you cant use managed code inside DllMain. xacc.ide-0.1 released! Download and screenshots

        D Offline
        D Offline
        dxben
        wrote on last edited by
        #3

        Well that changed the way the error was thrown, but it looks to be throwing the same error. Here's what it is saying: Managed Debugging Assistant 'LoaderLock' has detected a problem in 'D:\Dev\throwaway\pinvoke\pinvoke\bin\Debug\pinvoke.exe'. Additional Information: 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.[/code] Here is what my DllMain looks like, but again why isn't this happening with my release version? `BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }`

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups