What is the best way to collect crash data?

后端 未结 6 667
悲哀的现实
悲哀的现实 2020-12-17 02:04

So I am sold on the concept of attempting to collect data automatically from a program - i.e., popping up a dialog box that asks the user to send the report when something g

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 02:35

    From an implementation point of view, does it make sense to put a try/catch loop in my main program.cs file, around where the application is run?

    Sure and always.

    You should use Try/Catch-Blocks wherever you do something critical, that might raise an exception.

    Therefore you can not really stick to a pattern for that, because you should now, when what exception will be raised. Otherwise these are unhandled exceptions, which let your program crash.

    But there are many exceptions, that need not to stop the application entirely, exceptions, that just can be swallowed over, as they are expected and do not critically need the application to stop. Example for that are UnauthorizedAccessExceptions when moving or accessing data with your programm.

    You should try to keep you Try/Catch-Blocks as small as needed, as well as to use not too much of them, because of performance.

    Some out there use Try/Catch for steering the program's execution. That should entirely be avoided wherever possible, cause raising an Exception is performance killer number 1.

提交回复
热议问题