ZoRo
ZoRo

Reputation: 421

How to monitor a c# program

I have a simple c# program (fw 4.5 developed with vs2015). The program uses few forms, basic controls and windows media player api.

When I run the program from the vs2015 (by hitting F5) it runs fine. When I try to run it from the file system (By going to the "release" directory under my project directory) by double clicking it, it just loads and loads but nothing happens. I get no error and the program does not start to run.

I have a try/catch in the start thet should popup a message or write to log file but still I get nothing.

Is there a way to monitor my program to check where it fails or what it`s trying to do that crash it?

(I tried compatebility mode, didn't work).

--EDIT-- I have Avira anti virus install on that computer

Thanks.

Upvotes: 2

Views: 127

Answers (2)

ZoRo
ZoRo

Reputation: 421

Well, Thanks to @Martheen idea, I tried disabling my anti virus (I have Avira) and it seem to work.

I don't know why it was blocked and Avira did not inform me about the blocking but after disabling Avira, my program run smooth. When enabling Avira again, My program stoped running. After tring this a few time with both debug and release versions, I can confirm that disabling Avira (Right click on Avira icon in taskbar, Choose "Disable") fix my problem.

Upvotes: 0

A. Petrochuk
A. Petrochuk

Reputation: 68

In you Program.cs

static void Main()
{
    AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
    ....
}

and add static method to log an exception

    private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        _logger.Error(.....);
    }

Upvotes: 1

Related Questions