Determine Why an Action, Controller or Editor is Inactive
9 min to read
When building an application, you may need to determine why an Action or Controller is not active (visible) in a particular Window. An Action may be deactivated or disabled for various reasons: Security System permissions, the current View is read-only, an inconvenient object type of the current View, and other specific parameters. The current View may also be made read-only for different reasons. A thorough debugging may be required to ascertain the actual reason. For this purpose, the eXpressApp Framework provides the Diagnostic Info Action. This Action shows a window with essential information on all Controllers and Actions loaded to the Application Model on the current View, and validation rules applied to the View. This information will assist you with finding issues and fixing them. This topic details how to add the Diagnostic Info Action to your application and use it to get the required information.
The Diagnostic Info Action is implemented in the DevExpress.ExpressApp.SystemModule.DiagnosticInfoController and is contained in the Diagnostic Action Container. The images below demonstrates the Diagnostic Info Action location on various Templates.
The Diagnostic Info Action is a SingleChoiceAction. When clicking this Action's item, a dialog Window with the DiagnosticInfoObject_DetailView Detail View will be invoked. The DiagnosticInfoObject.AsText property contains information in an XML format.
Analyze the DiagnosticInfo Action Output
Below are the steps required to determine why an Action is disabled.
If the Active or Enabled attributes for the Controller or Action element return "False", research each individual item under the nested ActiveList and EnabledList elements. The Key attribute of each property shortly describes the reason identifier. A superposition of all Value attributes for these nested items form the resulting Active or Enabled value for the parent Action or its Controller.
The information presented in the invoked window when the Actions Info item is selected includes the following.
Specifies the current Window's context name and Template's type name.
The information presented in the window invoked when the Rules Info item is selected includes the following.
Lists all validation rules registered in the Application Model.
Custom Diagnostic Information on Actions
You can supply custom diagnostic information on an Action. To do this, use the ActionBase.DiagnosticInfo property. Its value will be assigned to the AdditionalInfo item within the Controllers | Controller | Actions | Action section. In the following code, the DiagnosticInfo property is specified for the SetPriorityAction from the SetProprityController, which is implemented in the MainDemo (see Add an Action with Option Selection)):
Public Partial Class SetPriorityController
Private Sub SetPriorityController_AfterConstruction(ByVal sender As Object, ByVal e As EventArgs)
SetPriorityAction.DiagnosticInfo += Constants.vbCrLf & "Hello!"
The diagnostic info snippet below demonstrates the state of the SetPriorityController and its SetPriorityAction when a Contact is displayed in the main Window.