Re: Notifying the user of what action to take when a SecurityException was unhandled
From: Nicole Calinoiu (calinoiu)
Date: Fri, 7 Oct 2005 10:30:51 -0400
In addition to the possibilities already raised by Dominick, does your Main
method perhaps include a call into a type or member protected by a link
demand for a CAS permission? (Link demands are processed at JIT-time, so
failing a link demand in your Main method would prevent any of your code
from running.) If you're not sure whether or not your Main method contains
such a call, you can easily test it (at least in debug mode, where your code
won't be subject to inlining) by splitting out the contents of your Main
method into a separate method. e.g.:
private static void Main(string args)
private static void DoMainStuff(string args)
// Everything that used to be in your Main method goes here.
"Jim" <firstname.lastname@example.org> wrote in message
> I've looked at the article and the suggestions here, but the problem
> persists: an exception is thrown before any of my code has had a chance to
> execute. This means that I'm unable to attach exception handlers because
> the first line of my static main is never reached.
> I should note that I'm using VS 2005 Beta 2 and the 2.0 Framework (Build
> Jeffrey Tan[MSFT] wrote:
>> Hi Jim,
>> Thanks for your post.
>> In addtion to Nick Hertl's reply, there is an article talked about how to
>> handle unhandled exception in .Net, for your information:
>> "Unexpected Errors in Managed Applications"
>> Hope this helps
>> Best regards,
>> Jeffrey Tan
>> Microsoft Online Partner Support
>> Get Secure! - www.microsoft.com/security
>> This posting is provided "as is" with no warranties and confers no