Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubleshooting with a .NET application that doesn't start

Tags:

.net

debugging

I have a recurrent issue with .NET applications that don't start (on others systems than mine). The fact is that I cannot, unfortunately, always create a smoothly running package. Therefore I often have to send a ZIP file of my Debug or Release folder.

My real problem is that these applications doesn't tell WHY they're not starting. I just get no exception at all if I start them from the command line, neither in the EventLog, or even if I try to print on the output the result of a Try Catch block on all my application... am I missing something?

Most of the time, it's missing libraries, or security related issues. But it would be nice to find what exactly is going on painlessly :D

like image 761
TigrouMeow Avatar asked May 14 '09 06:05

TigrouMeow


People also ask

How would you diagnose the poor performance from a .NET application?

The best way to monitor the performance of your ASP.NET application is with an application performance management (APM) solution. Retrace tracks the performance of your application down to the code level and provides detailed reporting of ASP.NET application performance.


2 Answers

Have you tried looking at the fusion logs? Suzanne Cook has an article on this here.

Another thing to do (to minimise silent errors): minimise your Main method; the reason for this is that JIT works per-method, and if it can't JIT Main it can't use your exception handling:

/* for winform, you still new [STAThread] here */
static void Main() {
  try {
     MainCore();
  } catch (Exception ex) {
     // shout about it
  }
}

[MethodImpl(MethodImplOptions.NoInlining)] // usually overkill
static void MainCore() {
  // real code
}
like image 197
Marc Gravell Avatar answered Oct 02 '22 23:10

Marc Gravell


Take a look at the Assembly Binding Log Viewer.

like image 27
Michael Damatov Avatar answered Oct 03 '22 01:10

Michael Damatov