# AUR0901

### **Error message**

Failed to close all dialogs when deactivating the application, There are still `yyyy` open dialog(s).

### **Parameters**

Number of open dialogs

### Error explanation

This error occurs when the application is being deactivated (e.g., stopped or torn down), but there are still dialogs open. The dialog service attempts to close all open dialogs automatically during deactivation, but one or more dialogs failed to close.

### Common causes

* A dialog component's `canDeactivate` hook returned `false` or a promise that rejected, preventing the dialog from closing.
* An error occurred during the dialog closing process.
* Dialogs were opened but never closed.

### How to fix

* Ensure all dialogs are properly closed before the application deactivates. Check the `canDeactivate` logic in your dialog components.
* Handle potential errors in dialog `deactivate` hooks or `dialog.close()` calls.
* Review the logic that opens dialogs to ensure they are eventually closed.

### Debugging tips

* Check the application deactivation lifecycle (`AppTask.deactivating`).
* Inspect the `canDeactivate` hooks of the components used in the open dialogs.
* Check the console for errors that might have occurred during dialog closing attempts.
* Use `IDialogService.controllers` to inspect the state of open dialogs before deactivation.
