CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2011
    Posts
    4

    Application has stopped working error - program randomly hangs

    Hello,

    I am running into some problems with a program that I've written and I need some help. It is a C# .NET 2.0 Winforms application. It is being executed from a network drive, and runs under Windows XP
    and Windows 7. The platform target is x86. It does some SQL queries, reading and writing to a file stored on a network using SQLite. There are certain operations, which are not repeatable, in which the
    user will click and the program will simply stall, going into the hourglass (or spinning circle). Usually when this happens, the program will crash with "The application has stopped working" error. I have an
    exception handler, but apparently it is not catching the problem.

    What measures can I take to find out the problematic code? Or to correct the errors? The users of the program get frustrated when the crashes occur as it slows down their work.

    Thanks
    Mike

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Application has stopped working error - program randomly hangs

    Is it possible that it is getting into an endless loop?
    Always use [code][/code] tags when posting code.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Application has stopped working error - program randomly hangs

    You need to log trace statements to a log file so you can determine where the app is getting stuck. Btw, do several instances of the app write to the same network file? If so, is there a file locking issue?

  4. #4
    Join Date
    Apr 2014
    Location
    in northeast ohio
    Posts
    94

    Re: Application has stopped working error - program randomly hangs

    make sure you are flushing and closing a reading or writing stream
    if you are not wrapping the file writing operation with a using statement
    or setting flags to write and read from to individually
    if that is your intention you must have permissions as well as
    setting the streams and file and read write flags appropriately
    that can often cause a very late exception

    a infinant loop can be detected breakpoint wise with a cheap trick i sometimes use
    by placing a dummy method
    thru-out the area of suspect code
    with a break point on a dummy if line within that method
    int n = 1;
    DummyMethod(int amount)
    {
    n ++;
    if(n > amount)
    {
    // breakpoint me then place method thru out suspect areas
    string s = "holy moly im being called more then i should be";
    // if fired remove it at each place till you find the one causing it
    }
    }
    Last edited by willmotil; November 29th, 2014 at 08:14 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured