开发者

Visual C# - Check Exception On Running

开发者 https://www.devze.com 2023-01-29 03:41 出处:网络
some of you have read and answered my questions on this matter before. Well, I had a busy school semester and so I\'m just coming back to this problem now.

some of you have read and answered my questions on this matter before. Well, I had a busy school semester and so I'm just coming back to this problem now. I'm strongly considering rewriting the application I have spoken about before, possibly using something like Java. However, I would like to possibly try to catch whatever unhandled exception is being thrown at the beginning of my program. However, my limited knowledge of C# makes me unsure how to do this. So here is the problem, as I've stated before: I programmed this application using Visual Studio 2010 on Windows 7. The application was intended for Windows XP SP2, however. When I attempt to run the application on the XP machine, it delivers the ol' Send Error Report window. Th开发者_开发问答e program crashes before it is even able to run. So I ran the only debugger available on the machine (which was part of Visual C++) and it mentioned something about an unhandled exception.

So I would like to use a try catch statement to figure out what possible unhandled exception might be being thrown (meaning I'd encase the main method in a try-catch and if an exception is thrown, print to the command line a message)

My issue is...where in my code do I put this?

My code is quite long, so I couldn't post it here. I've linked to it here: http://www.raw-d.com/code.cs


1) you can put your try catch exception in the Main()

2) you can handle AppDomain.UnhandledExpception event

3) Some features of .Net 4 are not available on Xp maybe you are making use of those.

4) Don't switch to java

0

精彩评论

暂无评论...
验证码 换一张
取 消