Supporting Troubleshooting
"Troubleshooting Mode", is a way of helping designers find issues in their projects.
Enabling "Troubleshooting Mode" on the publish screen has the following effects on a project:
- Invisible data sources will be made visible: This enables quickly seeing the data that is being received for a form to verify it is coming through correctly
- Variables will be made visible: To double check that variable logic, especially formulas, is producing the expected result
- Mandatory questions will not be enforced: For unimpeded navigation around the form to get to trouble areas
- A summary of Actions run will be displayed after form submission, for troubleshooting Action execution
- Data source errors will be displayed: For seeing what went wrong in communication with a data source.
- Other minor helping information, including any Extensions that support Troubleshooting Mode
Note:
Details of the error will only be displayed in the following situations:
a) The license of your instance is "Demo" or "Test".
b) Theappsettings.json
option "ShowDatasourceTroubleshootingErrors" is enabled
Troubleshooting Types
To support troubleshooting in an extension, use the TroubleshootingType property on the WizardSession object.
TroubleshootingType has three states:
NoTroubleshooting - The project has not been published in Troubleshooting Mode.
Troubleshooting messages should not be shown
HalfMessages - The project has been published in Troubleshooting Mode, the license is not "Demo" or "Test", and the ShowDatasourceTroubleshootingErrors option has not been enabled in appsettings.json
Troubleshooting messages should be shown, but potentially private information that possibly shouldn't be shown to a designer, should not be displayed. The product example of this is for a data source error - the error coming from the data source may expose information that a designer shouldn't have access to.
FullMessages - The project has been published in Troubleshooting Mode, the license is "Demo" or "Test", or the ShowDatasourceTroubleshootingErrors option has been enabled in appsettings.json
Example:
In a custom question, you may have a try/catch block, and on an error, you want to display useful information to help designers diagnose the problem, but only if they are allowed to see it. Your catch block may look something like this:
catch (Exception ex)
{
if (properties.Context.Wizard.TroubleshootingType == Model.TroubleshootingType.NoTroubleshooting)
{
// Do nothing
}
else if (properties.Context.Wizard.TroubleshootingType == Model.TroubleshootingType.HalfMessages)
{
DisplayMessage("There was a problem in the custom question. For detailed information add \"ShowDatasourceTroubleshootingErrors\": \"True\" to the AppSettings section of your appsettings.json file");
}
else if (properties.Context.Wizard.TroubleshootingType == Model.TroubleshootingType.FullMessages)
{
DisplayMessage(ex.Message);
}
}
Updated almost 5 years ago