Skip to content

JanZeman/BugSense-WP8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BugSense for Windows Phone 8

Mou icon

Installing the library

Install the BugSense NuGet package using the Package Manager Console.

PM> Install-Package BugSense.WP8

For Windows 8 run the following:

    PM> Install-Package BugSense.W8

You can also use the Package Management Dialog in Visual Studio to install the BugSense.WP8 package.

Package Manager

Initialize the plugin

Then, all you need to do is go inside you App.xaml.cs file and add the code below inside the constructor. Don't forget to use your Project API key that you'll find it in your dashboard!

Note: If you are in debugging mode (ex. Step-by-Step) BugSense Handler will recognize that and will not send the exception. This happens because when you are debugging your app, Visual Studio does a great job on letting you know where the error is.

public App()
{
     // Standard XAML initialization
     InitializeComponent();

     // Phone-specific initialization
     InitializePhoneApplication();

     // Language display initialization
     InitializeLanguage();

     // Initialize BugSense
     BugSenseHandler.Instance.Init(this, "YOUR_API_KEY");
}

Now you can ship your application and stay cool. We will make sure you won't miss a bug.

End User Communication

When an error occurs the user is informed by a slick Popup. This option is customizable. You can:

  • Display a Fix Notification when a user experiences an error that is been fixed in new versions of the app
  • Display nothing and just keep the application running.
  • Display a popup with customizable Title and Body.
  • Display a confirmation popup with customizable Title and Body allowing the user to decide if he wants to send the error report. An example screenshot is displayed below:

Fix Notification

Advanced Settings

Track an event

BugSenseHandler.Instance.SendEvent("anEvent");

You can also use BugSense to log handled exceptions and send useful Metadata

try
{
    throw new IndexOutOfRangeException();
}
catch (Exception exc)
{
    BugSenseHandler.AddToLogData("account", "Explorer");
    BugSenseHandler.AddToLogData("level", "9");
    BugSenseHandler.Instance.LogError(exc);
}

// Without extra data
try
{
    throw new Exception("error");
}
catch (Exception exc)
{
    BugSenseHandler.Instance.LogException(exc);
}

// With extra data: single key-value pair
try
{
    throw new Exception("error");
}
catch (Exception exc)
{
    BugSenseHandler.Instance.LogException(exc, "level", "5");
}

// With extra data: dictionary
try
{
    throw new Exception("error");
}
catch (Exception exc)
{
    BugSenseHandler.Instance.LogException(exc,
       new Dictionary<string, string>()
           {
                { "account", "Explorer" },
                { "level", "9"}
           });
}

Monitor if async Tasks have been completed successfully

// Check is a task if task is faulted and log task exception if it failed

Task t = new Task(() =>
{
   int x = 5;
   int y = 0;
   int z = x / y;
});

t.Start();
BugSenseHandler.CheckTaskFault("mathtask", t);

Add Breadcrumbs and meta data to crash reports

// Adding custom extra to be sent with the crash

BugSenseHandler.AddToExtraData("xtra1key", "xtra1val");
BugSenseHandler.AddToExtraData("xtra2key", "xtra2val");

// Leave a breadcrump

BugSenseHandler.LeaveBreadcrumb("Fetch friends");

Set a method to be executed before the app crashes (ex. save state)

public App()
{
  // Global handler for uncaught exceptions.
  BugSenseHandler.Instance.Init(this, "YOUR_API_KEY");
  BugSenseHandler.SetLastBreath(MyMethod);
 
  // ...do more stuff...
}
 
private void MyMethod()
{
  //do stuff here, ex. save state etc ...
}

Track an event

/* Send event */
BugSenseHandler.Instance.SendEvent("anEvent");

Use BugSense along with the VisualStudio debugger

public App()
{
  // Global handler for uncaught exceptions.
  BugSenseHandler.Instance.Init(this, "YOUR_API_KEY", new NotificationOptions() { HandleWhileDebugging = true });
}

On-line documentation browser

About

Windows Phone 8 & Windows 8 BugSense SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published