Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application dies suddenly without warning 2

Status
Not open for further replies.

sammye

Programmer
Oct 5, 2007
35
US
Hello,

My app has this funny habit of crashing and burning without the slightest hint of what happened. One moment it is running along (in debug mode) without issue, and then all of a sudden it just disappears. There were no warnings, pop-ups, exceptions caught, etc. I am curious of there are any guesses as to what can cause this behavior.

Normally, if some type of an error occurs while debugging, I get some type of exception and visual studio stops at the line where the problem is. If not that, at least I usually get the MS "send us feedback" pop-up.

For some details, within the app are a number of timers and background worker threads, interaction with a 3rd party pci card, some minor UDP traffic generation, and some serial communication.

Has anyone seen this type of behavior (crashing completely without warning nor notification)? Well, any tips, pointers, and suggestions are more than welcome.
 
I would check the windows event log and see if there is anything in there...

If SQL is involved you could run a SQL trace and/or check the SQL logs...

The only other thing I can think of is narrowing down where in code the app. actually crashes - you could do this by stepping through your code and waiting for the crash, or another way would be to disable parts of your app. if possible, and if/when your code runs without a crash analyse the disabled code for the problem.

Hope I've helped.

Pete
 
do you have some form logging? if not you should.
Code:
public class Global : HttpApplication
{
   public Global()
   {
      Error += LogError;
   }

   private void LogError(object sender, eventargs e)
   {
       Exception exception = Server.GetLastError();
       //code to log exception.
   }
}
there are many ways to log. I like to use log4net and log to a text file and send an email.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the tip on log4net, I've used it before. I'm not using it now, but I do have some logging. I guess it's time to change it from "some" to "a lot".
 
logging is great for development, but it can drastically reduce preformance in production. I really like log4net and logging in an AOP fashion.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
That's actually one thing (performance drag from logging) I'm worried about. I'll likely delete most of it in the end or if/def it. Thanks again.
 
I'll likely delete most of it in the end or if/def it.
there is no need to do that. either use the logger flags or configure log4net to do this automatically.

if you're looking to squeeze every ounce of cpu then it's better to check for logging before creating the message.
if however, the message is a simple string, or preformance is not a direct concern at the moment you can simply log the message and let log4net determine whether to write the message or not.

this is another reason my i like the intercepted logger. it doesn't litter my domain with log statements, and it's very easy to enable/disable. all logging is done in 1 place.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I didn't realize that log4net could be used as an interceptor so I'll do a little more digging into it. Actually, I didn't know there was such thing as an interceptor until an hour or two ago when I happened across PostSharp.
 
log4net doesn't have interceptors, I just use it in conjunction with interceptors. this is usually part of a IoC container. I use Castle Windsor. I have heard of PostSharp but I'm not familiar with it. Structure.Map is another quality IoC. MS has one called Unity. I haven't spent any time looking at that.

With Windsor (maybe post sharp too) you register your objects to the container. the container manages wiring objects together (assisting with DIP). You can also assign interceptors to these registered objects. these interceptors are fired when the method is called.


Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Ahh, gotcha. Well, I'll look more into PostSharp and Castle Windsor then, maybe even ms's unity package. I'm hoping they are not too invasive or time consuming to implement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top