Dotfuscator User's Guide
Collecting User-specified Exception Report Information

When using Exception Tracking, Dotfuscator can be configured to obtain explicit user consent and to collect comment and contact information from the user. These are provided in the form of key-value pairs that are read at runtime during the construction of an exception report message.

To provide this user-specified report information, specify a ReportInfoSource on the attribute corresponding to the message you wish to send.

Dotfuscator uses the ReportInfoSource to generate code that gathers the key-value pairs at runtime. The ReportInfoSource is an IDictionary or IDictionary<string,string> valued property, method, field, or when using method-level exception tracking, method argument; it is the developer's responsibility to ensure that a correct values are available in the ReportInfoSource at the time the an exception is detected.

Using the Built-in Exception Report Dialog as the ReportInfoSource

Dotfuscator can inject a pre-made Exception Report Dialog to ease configuration for most scenarios and provide a consistent user experience for exception reporting. To use the built-in dialog, your assembly must target version 1.1 (or higher) of the .NET Framework, or Silverlight version 2 (or higher). To instruct Dotfuscator to use the built-in dialog as the ReportInfoSource, set the ReportInfoSourceElement value to “DefaultAction”.

When using the built-in dialog on the .NET Framework, the dialog will be constructed and displayed using the Windows Forms API. This may have unintended consequences for console or service applications; it may be preferable to use a custom ReportInfoSource in these situations. If your assembly does not already reference the appropriate Windows Forms libraries, references will be added.

Using a Custom ReportInfoSource

The ExceptionTrackAttribute defines three properties for specifying a ReportInfoSource:

These properties are described in detail in the ExceptionTrack section of the custom attribute reference.

There are three key-value pairs that may be included in the dictionary provided by the ReportInfoSource:

Any key-value pairs other than those described above will be ignored.

Collecting user-specified report information is optional. If the retrieved dictionary is null, does not contain a consent key, or the value for the consent key is null or does not parse to a boolean, the global PreEmptive Analytics opt-in setting is respected. If the comment or contact keys are omitted, the resulting PreEmptive Analytics message does not include this information. See Entry Point Attributes for more information about the global PreEmptive Analytics opt-in setting.

Sample Exception Track attribute usage with ReportInfoSource defined as a method called "GetDictionary":

Exception Track Attribute Usage with ReportInfoSource
Copy Code
   ReportInfoSourceElement = SourceElements.Method,
   ReportInfoSourceName = "GetDictionary"
private void Foo() {

// Creates and populates a dictionary with user-specified report information
public IDictionary<string, string> GetDictionary() {
  Dictionary<string, string> dict = new Dictionary<string, string>();
  dict.Add("consent", "true");
  dict.Add("comment", "The Foo() method threw an exception.");
  dict.Add("contact", "");
  return dict;



© 2017 PreEmptive Solutions, LLC. All Rights Reserved.