why my program breaks?

This is a discussion on why my program breaks? within the C# Programming forums, part of the General Programming Boards category; Hello everyone, My operation is like this, I am using WinDbg to set a breakpoint to method foo. Here is ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    why my program breaks?

    Hello everyone,


    My operation is like this, I am using WinDbg to set a breakpoint to method foo. Here is what I did.

    Code:
    0:000> !bpmd TestDebug.exe TestDebug.Program.foo
    Adding pending breakpoints...
    0:000> lm
    start             end                 module name
    00000000`00400000 00000000`00408000   TestDebug C (private pdb symbols)  D:\Visual Studio 2008\Projects\TestDebug\TestDebug\bin\Debug\TestDebug.pdb
    
    0:000> g
    (1b0.5c4): CLR exception - code e0434f4d (first chance)
    (1b0.5c4): CLR exception - code e0434f4d (!!! second chance !!!)
    KERNEL32!RaiseException+0x5c:
    00000000`77d4dd10 4881c4c8000000  add     rsp,0C8h
     
    But when pressing g, and the program stops, then I pressed k to display the current stack. I found there is no my code in the stack. The seems the stop execution is not because of breakpoint (because no break point  hit information)? I am so confused. Any ideas?
     
    namespace TestDebug
    {
        class Program
        {
            static void foo()
            {
                int a = 100;
                throw new Exception ("Hello Exception Debug");
            }
            
            static void Main(string[] args)
            {
                foo();
            }
        }
    }

    thanks in advance,
    George

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    You are throwing an error and not catching it.
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace TestDebug
    {
        class Program
        {
            
            static void foo()
            
           {
               try
               {
                   int a = 100;
                   throw new Exception("Hello Exception Debug");
               }
               catch
               {
                   Console.Write("Caught");
               }
            }
    
    
    
            static void Main(string[] args)
            {
                foo();
            }
        }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21