views:

172

answers:

5

I have sample exe say console.exe on "programfiles\myAppFolder" .It serves the purpose of logging the message to eventviewer

EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,  234);

I need to call this exe on un-install of appcn from NSIS script .However it gives me an error always that "thisappConsole has encountered a problem and needs to close. We are sorry for the inconvenience."

Even browsing to the path "programfiles\myAppFolder\thisappConsole.exe" and manually clicking on it to execute even throws the same error. I do have admin access to m/c.

Can anyone help me with this.

If I put any other simple console app without any additional "using statements". it works fine ..

+1  A: 

Sounds to me like your event log application is throwing an unhandled exception, quite ironic considering it is an application for logging events!

I would put my money on it being a permissions issue as the event log needs to access the registry. As a work-around try running your application as an Admin. Would be handy to handle the AppDomain.UnhandledException event and log the exception.

James
A: 

you could try

Try
{
  your app code here
}
Catch (Exception ex)
{
  //Logg ex.ToString()
}
Petoj
its failing to initialize..the exeception is not throwing inside the application..
Andy
@Andy it still sounds like an unhandled exception in some code that's running whenever your app starts.
AndyC
A: 

Try { your code here } Catch (Exception ex) { ex.message=""; } finally {}

KareemSaad
A: 

Check to be sure you have the same version of the .Net framework installed on that machine, and also any referenced .dll's are in the same folder as the .exe.

Jacob Ewald
+1  A: 

Press F5.

This will run the programme in the debugger, and you the unhandled exception will be displayed on screen. It will give a exception type, message, and line number.

Kirk Broadhurst