Report issue

Implementation of “report issue” functionality for end users/testers

Estimated reading time: 2 mins

Last edited: 04 Nov 2019

In this chapter you will learn how to use RevDeBug API to create a “Report Issue” button. In most applications such button would simply open up a form, to be filled up with details about the issue. It’s mundane for the user, and he won’t probably do this. And if so, there is a possibility, that user doesn’t really know what happend, and the description isn’t really accurate and it’s not very helpful in solving the issue.

RevDeBug API has a functionality, that allows you to trigger the Snapshot Recording (a short recording of code execution). The objective of this chapter is to use RevDeBug API to create a “Report Issue” button, that will send you a Snapshot Recording of what happened to your user just before he decided to submit a report.

Enable Snapshot Recording

First you need to add RevDeBug to your application. To do this, follow this chapter about API installation.

Now that RevDeBug has been added to your application, it is very important to rebuild your application. Otherwise you won’t be able to complete the next step, which is enabling the Snapshot Recorder mode.

After the successful rebuild, in the output folder there should be a file named RevDeBug.setup. Open it and make sure, that ConnectivityType value is OnEvent

RevDeBug.setup
Repository.Port=42742;
Repository.Address=127.0.0.1;
Application.Name=Starter;
SolutionName=RDBShowRoom;
ConnectivityType=OnEvent;
Release=;
BacklogSize=1000;

Also take notice of the BacklogSize value. On default it is set to 1000 which means, that in case of a crash, RevDeBug will record 1000 events before it. This data retention value is fully customizable and it purely depends on your needs.

Report Issue button implementation

Finally, we can implement the “Report Issue” button functionality. For example, let’s fire the Snapshot creating method on Button_Click:

MainWindow.xaml.cs

  private void Button_Click(object sender, RoutedEventArgs e){ 
    RevDeBug.Api.CrashRecorder.Api.StoreSnapshot("Snapshot Name");
  }
  

And that’s it! As you can see in the code above, you can fully modify the Snapshot name. It would be perfect, if this name was relevant to its content - whether it is current date, username or description of the issue. In the next part you will learn how to customize the Snapshot name.

Custom Snapshot name

To easier identify the snapshot, it is crucial for it to have a more descriptive name than “Snapshot Name”. For example, we could ask the user to enter the custom name with some identification data.

MainWindow.xaml.cs

  private string AskUserForRecordingName() {
    return Microsoft.VisualBasic.Interaction
        .InputBox("Name of the recording", "Enter the name of the recording",
                  "DefaultRecordingName", 200, 200); 
  }

  private void Button_Click(object sender, RoutedEventArgs e){
        string recordingName = AskUserForRecordingName();
        RevDeBug.Api.CrashRecorder.Api.StoreSnapshot(recordingName);
  }