Click here to Skip to main content
15,307,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai i am developing a wpf application it contains three windows list controls and tree etc, and i am using database also for the data's to display in UI, i am not much expert in WPF so will u suggest me what are the ways are there to handle exceptions for UI and backend data's as well as suggest for crash report where it happen why?.

What I have tried:

i have tried try catch exceptions in my application.
Updated 15-Mar-21 21:41pm

search this article WPF-ExceptionViewer on this site.
WPF ExceptionViewer[^]
Best regards
A try...catch block is the way you do it:
   ... code which may cause a problem ...
catch (exceptionType exceptionVariable)
   ... code to handle the exception ...
The exceptionVariable allows you to access information on why the exception happened.
The exceptionType allows you to handle just the exceptions you can deal with: for all exceptions use Exception, but you could handle just SQL database exceptions with the SqlException class:
catch (SqlException ex)
You should use the most specific Exception you can handle.

For more information, read up on try-catch - C# Reference | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900