Implement error-return mechanisms for. NET programs

Source: Internet
Author: User
Program | Error I believe that every responsible programmer will do a lot of testing before releasing his own program. However, this does not guarantee that the program will not have any problems when using different users, Microsoft's software is often hung up! Collecting all the wrong information is very helpful for our future improvements or upgrades, and there is a mechanism for error returns.
I do a control that automatically captures the exception, just add it to the first form of the program, and it can pop up an error return dialog box when the user's action is exceptional, and then the user chooses whether or not to return (in return, the detailed error message is emailed to you).
Download here: Http://www.dz9703.com/download/CaptureException.rar
Here are a few points of the solution, not very clear to see the source code it
1. Errors in the procedure are varied, but all exceptions are inherited from System.Exception;
2. All form runs are initiated from the Application.Run () in the main () method.
There is a threadexception event in 3.Application that fires when the program runs with an exception
4. The other is the control to make and send mail the Dongdong.
Attention:
1. This is done now (added to the first form of the program), only to ensure that the exception after the normal start of the capture program, the most perfect way is to define the Treadexception event before the Application.Run () method executes.
2. The way I return is through the classes in the System.Web.Mail to email, WIN98 may fail on the machine. Of course, also not need to use the way of email, also can Winsock to write Ah, if you want to do very perfect words.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.