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 / C++ / MFC
  4. Exception 0x406d1388

Exception 0x406d1388

Scheduled Pinned Locked Moved C / C++ / MFC
dotnetannouncementcsharpc++question
6 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.
  • P Offline
    P Offline
    Phil J Pearson
    wrote on last edited by
    #1

    I have a large, complex app MFC with /CLR, Unicode, uses several dll's including one .NET assembly. Release build works perfectly on dev machine. Deployed to target machine with .NET Framework 2.0 and all necessary dependencies. It crashes immediately every time in kernel32.dll with exception 0x406d1388. Further examination with depends.exe shows that the caller was advapi32.dll but I can't get much more info. This happens on WinXP SP2 and on Win2k SP4. It seems that the exception is the one normally used to set a thread name so it makes no sense to me that it's causing a crash. :confused: If I run the app (same release version) by remote debugging from VS2005 it all works properly. :mad: I've built a simpler test app to try to reproduce use as much as possible of the same environment (MFC, CLR, dll's and so on) and it also works perfectly. :(( Please can someone give me a clue???????? Regards, Phil

    T P 2 Replies Last reply
    0
    • P Phil J Pearson

      I have a large, complex app MFC with /CLR, Unicode, uses several dll's including one .NET assembly. Release build works perfectly on dev machine. Deployed to target machine with .NET Framework 2.0 and all necessary dependencies. It crashes immediately every time in kernel32.dll with exception 0x406d1388. Further examination with depends.exe shows that the caller was advapi32.dll but I can't get much more info. This happens on WinXP SP2 and on Win2k SP4. It seems that the exception is the one normally used to set a thread name so it makes no sense to me that it's causing a crash. :confused: If I run the app (same release version) by remote debugging from VS2005 it all works properly. :mad: I've built a simpler test app to try to reproduce use as much as possible of the same environment (MFC, CLR, dll's and so on) and it also works perfectly. :(( Please can someone give me a clue???????? Regards, Phil

      T Offline
      T Offline
      Toby Opferman
      wrote on last edited by
      #2

      You will need to get symbols and get a stack trace so you can find out what the actual call is. 8bc7c0ec02c0e404c0cc0680f7018827ebee

      P 2 Replies Last reply
      0
      • T Toby Opferman

        You will need to get symbols and get a stack trace so you can find out what the actual call is. 8bc7c0ec02c0e404c0cc0680f7018827ebee

        P Offline
        P Offline
        Phil J Pearson
        wrote on last edited by
        #3

        Thanks for the reply. That's proving $%^@# difficult! The problem seems to occur at some stage in the runtime initialisation. If I run the programme under VS2005 it won't fail. I set it to break on the exception but it never sees it. If I jit debug it the process wakes up and continues faultless as soon as the debugger attaches. WinDbg sometimes sees the exception but I can't get any sense out of the call stack. I can't set breakpoints using WinDbg because it corrupts the code somehow and complains about "invalid x86 breakpoint in IL stream". Any ideas ... ? Regards, Phil

        1 Reply Last reply
        0
        • P Phil J Pearson

          I have a large, complex app MFC with /CLR, Unicode, uses several dll's including one .NET assembly. Release build works perfectly on dev machine. Deployed to target machine with .NET Framework 2.0 and all necessary dependencies. It crashes immediately every time in kernel32.dll with exception 0x406d1388. Further examination with depends.exe shows that the caller was advapi32.dll but I can't get much more info. This happens on WinXP SP2 and on Win2k SP4. It seems that the exception is the one normally used to set a thread name so it makes no sense to me that it's causing a crash. :confused: If I run the app (same release version) by remote debugging from VS2005 it all works properly. :mad: I've built a simpler test app to try to reproduce use as much as possible of the same environment (MFC, CLR, dll's and so on) and it also works perfectly. :(( Please can someone give me a clue???????? Regards, Phil

          P Offline
          P Offline
          Phil J Pearson
          wrote on last edited by
          #4

          Eureka! I have found it! After hours of trying various debuggers and debugging strategies, countless cups of good strong tea and not a few words of frustration and annoyance I have located and fixed the problem. Buried deep in my own initialisation code, in a place I haven't visited for years and had forgotten all about is a call to a function called SetThreadName which uses exception 0x406d1388 :-O. This was being compiled as managed code so the framework was seeing the exception even before the catch block in the same function. The solution was simply to mark that function as unmanaged (and then drink more tea :) ). Phil

          T 1 Reply Last reply
          0
          • T Toby Opferman

            You will need to get symbols and get a stack trace so you can find out what the actual call is. 8bc7c0ec02c0e404c0cc0680f7018827ebee

            P Offline
            P Offline
            Phil J Pearson
            wrote on last edited by
            #5

            I have fixed it. Please see my reply to the original post for details. Thanks again for your interest. Phil

            1 Reply Last reply
            0
            • P Phil J Pearson

              Eureka! I have found it! After hours of trying various debuggers and debugging strategies, countless cups of good strong tea and not a few words of frustration and annoyance I have located and fixed the problem. Buried deep in my own initialisation code, in a place I haven't visited for years and had forgotten all about is a call to a function called SetThreadName which uses exception 0x406d1388 :-O. This was being compiled as managed code so the framework was seeing the exception even before the catch block in the same function. The solution was simply to mark that function as unmanaged (and then drink more tea :) ). Phil

              T Offline
              T Offline
              Toby Opferman
              wrote on last edited by
              #6

              Never use managed code :) 8bc7c0ec02c0e404c0cc0680f7018827ebee

              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