Reputation: 873
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 ..
Upvotes: 0
Views: 645
Reputation: 82096
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.
Upvotes: 1
Reputation: 28698
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.
Upvotes: 1
Reputation: 2178
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.
Upvotes: 0
Reputation: 1899
Try { your code here } Catch (Exception ex) { ex.message=""; } finally {}
Upvotes: 0
Reputation: 38455
you could try
Try
{
your app code here
}
Catch (Exception ex)
{
//Logg ex.ToString()
}
Upvotes: 0