Reputation: 3446
I have written a very simple C# Console Application which will open a Crystal Report, refresh it and save it as a PDF to a specified location.
When running within VS2005 everything runs fine; the pdf file is generated as expected. When I copy the .exe to my root C: drive and run it from the command line I get a dialog box stating that "CrystalGenerator has stopped working" - but the pdf file is still generated! Looking up possible causes of this dialog indicate that an Unhandled Exception has occured but the entire contents of the Main method is contained within a try/catch so that can't be my problem.
Looking in the event log I see a number of entries stating "The substitution string for insert index (%1) could not be found" but cannot find a sensible explanation of what this means.
The upside is that if I copy the file to a box running Server 2003 (where it is intended to run) the command runs without error - but I want to know why the app misbehaves on Vista and how to resolve it.
Thanks in advance.
Upvotes: 1
Views: 4096
Reputation: 3446
Well after a lot of link-chasing it looks like this behaviour is 'By Design'!
StackOverflows own Jeff Atwood experienced the problem (see here) and raised the issue on Microsoft Connect (see here).
Looks like I will be looking for an alternate approach - although the code does work on Server 2003.
Thanks to divo for your suggestions which were very helpful.
Upvotes: 0
Reputation: 175603
If for whatever reason, you are causing a stackoverflow, it cannot be caught, because there is no way to reliably unwind the callstack.
In that situation, your application will behave like you said.
Upvotes: 1
Reputation: 176169
Does it work if you run the app from an elevated command prompt (WinKey followed by pressing cmd followed by Ctrl+Shift+Return)?
It might be that one of processes you are calling requires elevation.
Upvotes: 1