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

Formatting JSON in preview isn't working #8250

Closed craxal closed 1 month ago

craxal 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

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

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.

Expected Experience

I would expect the formatted json to be displayed.

Additional Context

No response

craxal commented 1 month ago

@houlgap Just to get some details, how long is this brief moment? I assume this happens for every JSON file you try? Do you have app logs you can share?

houlgap commented 1 month ago

The formatted json is displayed for a fraction of a second, and it happens for every json file I have attempted so far. Here is a video of the repro https://github.com/user-attachments/assets/63e5ffb3-e98a-47e9-8103-f00e17b07a79

Is there a secure way to upload the logs? I have reviewed them but they don't seem to capture anything relevant to this issue.

craxal commented 1 month ago

@houlgap Sensitive information is redacted automatically from the logs, so you can share them safely here. If you're still concerned, you can share them privately by sending them to sehelp at microsoft dot com.

craxal commented 1 month ago

I am also able to reproduce this. I've also noticed the "Format JSON" command does not change to "Restore JSON", so something is causing it to revert back immediately.

houlgap commented 1 month ago

See trace logs attached StorageExplorerLogs.zip

craxal commented 1 month ago

Problem seems to have started after commit 2711461 when tab lifecycle was introduced. No idea why this would affect the Monaco editor....

I believe this has the same root cause as #8235.

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.