microsoft / AzureStorageExplorer

Easily manage the contents of your storage account with Azure Storage Explorer. Upload, download, and manage blobs, files, queues, tables, and Cosmos DB entities. Gain easy access to manage your virtual machine disks. Work with either Azure Resource Manager or classic storage accounts, plus manage and configure cross-origin resource sharing (CORS) rules.
Creative Commons Attribution 4.0 International
377 stars 87 forks source link

Closing tabs causes shutdown #8235

Closed houlgap closed 1 month ago

houlgap commented 1 month ago

Preflight Checklist

Storage Explorer Version

1.36.0

Regression From

1.35

Architecture

x64

Storage Explorer Build Number

20241012.1

Platform

All

OS Version

Windows 11

Bug Description

Multiple regressions from the prior version having upgraded to version 1.36.

Formatting json files no longer works, it changes but then reverts back to unformatted json.

Closing tabs causes the shutdown of storage explorer even if other tabs still open (also impacted if last tab in split panel is closed)

Steps to Reproduce

  1. Launch storage explorer
  2. Open blob storage container
  3. Preview unformatted json file
  4. right-click select "Format JSON"
  5. Close just opened tab

Actual Experience

When selecting the "Format JSON" option, the formatted json is displayed for a brief moment, before reverting back to unformatted json. On closing the tab (that was opened in a separate panel), Storage explorer is closed, even though the other panel still has tabs.

Expected Experience

I would expect the formatted json to be displayed. I would not expect Storage Explorer to close until all tabs (whether in primary, or secondary panel) are closed.

Additional Context

No response

craxal commented 1 month ago

Splitting this issue to track each separately (see #8250 for JSON formatting issue).

craxal commented 1 month ago

@houlgap Can you elaborate on the shutdown part? Do you mean that the app quits entirely? Can you share your app logs with us?

houlgap commented 1 month ago

Is there a secure way to upload the logs? I have reviewed them but they don't seem to capture any errors.

Attached is a video of the re-pro. https://github.com/user-attachments/assets/29ba1b7f-4a58-4afe-a544-0d2e59c18914

houlgap commented 1 month ago

Here are the trace logs that were collected: StorageExplorerLogs.zip

craxal commented 1 month ago

I am able to reproduce. Problem seems to have started after commit 2711461 when tab lifecycle was introduced. I've narrowed it down to where the panel tries to update the display name when formatting. The problem does not reproduce if the update request is omitted. So we need to figure out what about updating a panel is disrupting its lifecycle.

craxal commented 1 month ago

We've discovered the problem. Code that sets up the <webview> element is run in the update method of a custom Knockout binding. Formatting JSON modifies the display name of the tab. Since the display name of the tab is an observable, the update method runs again, which means the setup code is run again, ultimately creating a new <webview> renderer process. This is why the JSON appears to reset almost immediately and why a crash happens when trying to close the tab.

This feels serious enough for a hotfix, so you should see a fix in 1.36.1 soon.