Nasty bug in debug mode in .net execution



    Hi all,
    I am getting a bug when executing my project in visual in debug mode.
    The error is
    Unhandled exception at 0x77f9180c in myprogram.exe: User breakpoint

    can anyone tell me how to overcome this bug.

    I tried using debugger tool gflags.exe, but I don't know how to use it properly.

    Thursday, July 26, 2007 4:52 AM


All replies

  • That's not nearly enough information to diagnose your problem.  You'll at least need to produce a stack trace.  Gflags.exe is useless, you'll need an unmanaged code debugger.  The most typical reason for this kind of problem is that your code landed on an INT3 instruction inside kernel32.dll.  That triggers an automatic breakpoint.  The most typical reason for that is that you've got some unmanaged code in your program that has destroyed the heap.  Fairly classical problem, triggered by overrunning the bounds of a heap allocated block or writing through an uninitialized pointer.  If that's the case, you've got a mighty big problem, the damage is typically done well before you get the break.
    Thursday, July 26, 2007 12:34 PM
  • Hi...


    In case if you have problem starting debugger from VisualStudio. Best way is start the application without using visual studio, and whenever you want to diagnose (even a single .cs file without loading project)  In visual studio open that source file and from menu Debug->Processes->Attach visual studio, set breakpoint and trigger the user interface event to hit the breakpoint.




    Thursday, July 26, 2007 3:12 PM
  • Hi
    Thanks for the reply.
    1.The stack trace shows error in an address pointing at mscorwks.dll.
    2.When I follow the debug>processes and try to attach that process, then  Visual studion says  "cannot attach to the process".
    Friday, July 27, 2007 8:28 AM
  • Any replies ?
    Monday, July 30, 2007 4:27 AM
  • Hi sudhanshu22,


    We'd appreciate if you can post the stack trace here, and also please post the inner exception of the exception you met in details, this will be very useful for troubleshooting this issue.


    And you can check this out: How to: Check an Exception's Inner Exception.


    Thanks for your understanding!

    Monday, July 30, 2007 5:51 AM
  • Try turning on everything in the Tools -> Options -> Debugging : Just-In-Time and Native and see if you get better information about where the exception is happening.

    Monday, July 30, 2007 8:09 PM
  • Hi sudhanshu22,

    We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


    Thank you!

    Thursday, August 02, 2007 2:36 AM
  • Hi guys,
    Sorry for late reply. The issue still exists and now I am not able to run .net in debugger mode.
    The stack trace showed an assembly  line in  mscorwks.dll.
    Sending the logs collected using ntsd command:

    Microsoft (R) Windows User-Mode Debugger  Version 5.1.2600.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    CommandLine: campaignengine -C .\powconfig\Common_Config.ini -N .\powconfig\Netw
    ork_Simulator1_Config.ini -N .\powconfig\Network_Simulator2_Config.ini -P .\powc
    onfig\Power_Supply_Config.ini -S .\powconfig\New_Script.ini
    Loaded dbghelp extension DLL
    The call to LoadLibrary(ext) failed with error 2.
    Please check your debugger configuration and/or network access
    Loaded exts extension DLL
    The call to LoadLibrary(uext) failed with error 2.
    Please check your debugger configuration and/or network access
    Loaded ntsdexts extension DLL
    Symbol search path is: *** Invalid *** : Verify _NT_SYMBOL_PATH setting
    Executable search path is:
    ModLoad: 00400000 0043c000   CampaignEngine.exe
    ModLoad: 7c900000 7c9b0000   ntdll.dll
    ModLoad: 7c800000 7c8f4000   kernel32.dll
    ModLoad: 76ee0000 76f1c000   rasapi32.dll
    ModLoad: 77c10000 77c68000   msvcrt.dll
    ModLoad: 77dd0000 77e6b000   advapi32.dll
    ModLoad: 77e70000 77f01000   rpcrt4.dll
    ModLoad: 76e90000 76ea2000   rasman.dll
    ModLoad: 71ab0000 71ac7000   ws2_32.dll
    ModLoad: 71aa0000 71aa8000   ws2help.dll
    ModLoad: 7e410000 7e4a0000   user32.dll
    ModLoad: 77f10000 77f57000   gdi32.dll
    ModLoad: 5b860000 5b8b4000   netapi32.dll
    ModLoad: 76eb0000 76edf000   tapi32.dll
    ModLoad: 77f60000 77fd6000   shlwapi.dll
    ModLoad: 76e80000 76e8e000   rtutils.dll
    ModLoad: 76b40000 76b6d000   winmm.dll
    ModLoad: 10000000 10026000   TestReportCAPI.dll
    ModLoad: 10200000 10287000   msvcr71d.dll
    ModLoad: 003e0000 003fc000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 71ad0000 71ad9000   wsock32.dll
    ModLoad: 01590000 0159b000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 015a0000 015e5000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 79000000 79045000   mscoree.dll
    ModLoad: 773d0000 774d3000   MicrosoftWindowsCommon-Controls-6.0.2600.2982-comct
    ModLoad: 7c140000 7c357000   MFC71D.dll
    ModLoad: 77120000 771ac000   oleaut32.dll
    ModLoad: 774e0000 7761d000   ole32.dll
    ModLoad: 10480000 1053c000   msvcp71d.dll
    ModLoad: 02260000 0228a000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02290000 022cc000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 63130000 63166000   VISA32.dll
    ModLoad: 63100000 63114000   NIVISV32.dll
    ModLoad: 022d0000 0230e000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02310000 02344000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02350000 0239c000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 023a0000 023e6000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 023f0000 02420000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02420000 02661000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02670000 0267b000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 02680000 026bb000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 763b0000 763f9000   comdlg32.dll
    ModLoad: 5d090000 5d12a000   comctl32.dll
    ModLoad: 7c9c0000 7d1d5000   shell32.dll
    ModLoad: 73000000 73026000   winspool.DRV
    ModLoad: 771b0000 77256000   wininet.dll
    ModLoad: 77a80000 77b14000   crypt32.dll
    ModLoad: 77b20000 77b32000   msasn1.dll
    ModLoad: 026c0000 026cb000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 026d0000 02726000   D:\Arun\Latest Auto\R65972_view2\vb_val_automation\
    ModLoad: 5d360000 5d36e000   image5D360000
    ModLoad: 79e70000 7a3d1000   mscorwks.dll
    ModLoad: 78130000 781cb000   msvcr80.i386.dll
    ModLoad: 60340000 60348000   culture.dll
    ModLoad: 790c0000 79ba8000   mscorlib.dll
    ModLoad: 60340000 60348000   culture.dll
    <mda:msg xmlns:mda="">
           DLL 'D:\Arun\Latest Auto\R65972_view2\vb_val_automation\bin\DebugOBT\
           MotLoggingC.dll' is attempting managed execution inside OS Loader lock. D
    o not
           attempt to run managed code inside a DllMain or image initialization func
           since doing so can cause the application to hang.
      <mda:loaderLockMsg break="true"/>
    Break instruction exception - code 80000003 (first chance)
    eax=00000000 ebx=00000000 ecx=7c91056d edx=00145000 esi=0012de10 edi=00000200
    eip=7a012aa0 esp=0012d084 ebp=0012d0e4 iopl=0         nv up ei pl nz na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for msco
    rwks.dll -
    7a012aa0 cc               int     3
    Wednesday, August 08, 2007 7:03 AM
  • Google "LoaderLock".
    Wednesday, August 08, 2007 2:54 PM
  • what is this "loaderlock" ? I have still not got a solution to my problem.
    Thursday, August 09, 2007 9:46 AM
  • Right now, you'll need a lot of help from the guy that wrote all the unmanaged MFC code.  I'm sure you know his/her name, we don't.  LoaderLock == "I'll do what I'll need to do, good luck to whom takes this project over".
    Thursday, August 09, 2007 11:50 PM
  • Thanks for the comment, but the guys here are same as me and this problem has cropped up recently. Few days ago, we were able to run it in debug mode. Besides, the problem is in mscorwks.dll  which is a microsoft dll.
    Friday, August 10, 2007 9:47 AM
  • Mscorwks.dll is just the messenger.  It is telling you that it detected a loaderlock.  It is your code that caused it.
    Friday, August 10, 2007 5:31 PM
  • Please post this issue in so we can address is and help you with a resolution.


    Tuesday, September 18, 2007 6:52 PM