This library will detect all unhandled exceptions in WPF based applications and report them to the Coderr service (or your account at https://coderr.io).
For more information about Coderr, visit our homepage.
- Download and install the Coderr Community Server, use our feaure complete Coderr Premise Server, or use our Cloud Service (free up 1000 error reports / month).
- Install this client library (using nuget
coderr.client.wpf
) - Configure the credentials from your Coderr account in your
App.xaml.cs
.
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// Coderr configuration
var uri = new Uri("https://report.coderr.io/");
Err.Configuration.Credentials(uri,
"yourAppKey",
"yourSharedSecret");
// to catch unhandled exceptions
Err.Configuration.CatchWpfExceptions();
// different types of configuration options
Err.Configuration.UserInteraction.AskUserForDetails = true;
Err.Configuration.UserInteraction.AskUserForPermission = true;
Err.Configuration.UserInteraction.AskForEmailAddress = true;
base.OnStartup(e);
}
}
Simply catch an exception and report it:
public void UpdatePost(int uid, ForumPost post)
{
try
{
_service.Update(uid, post);
}
catch (Exception ex)
{
Err.Report(ex, new{ UserId = uid, ForumPost = post });
}
}
The context information will be attached as: