AzureStorageExplorer icon indicating copy to clipboard operation
AzureStorageExplorer copied to clipboard

Nothing happens when opening 'About' panel

Open v-kellyluo opened this issue 1 year ago • 1 comments

Storage Explorer Version: 1.35.0-dev (98) Build Number: 20240611.1 Branch: main Platform/OS: Windows11/Windows 10/Linux Ubuntu 22.04/MacOS Sonoma 14.5(Apple M1 Pro) Architecture: arm64/x64/x64/arm64 How Found: From running test cases Regression From: Previous release (1.34.0)

Steps to Reproduce

  1. Launch Storage Explorer -> Click 'Help -> About'.
  2. Check whether 'About' panel appears.

Expected Experience

'About' panel appears.

Actual Experience

Nothing happens.

v-kellyluo avatar Jun 11 '24 06:06 v-kellyluo

This only reproduces in pipeline builds, not local dev builds. An error is getting thrown when attempting to call Telemetry.getUserId:

[2024-06-11T17:15:03.444Z] (renderer:25968) <ERRO> UNHANDLED PROMISE REJECTION in renderer window:  Error [TypeError]: Cannot read properties of undefined (reading 'Telemetry.getUserId')

I dug further, and from what I can gather, the module/file containing the Telemetry provider is found and being imported, but for some inexplicable reason, the provider is undefined; none of the function implementations are being loaded. The only cause I can think of that may be in play is the use of mutable variable declarations (var or let) that ESBuild is handling strangely. I'll try a test build to see if that's true.

craxal avatar Jun 11 '24 17:06 craxal

@v-kellyluo Is this still reproducing for you?

craxal avatar Jul 16 '24 23:07 craxal

@craxal, Yes, this issue still reproduces on our side.

v-kellyluo avatar Jul 17 '24 02:07 v-kellyluo

I can confirm that this occurs in packed local builds as well, so at least I don't have to queue a full build to test changes.

To reiterate, the problem is the result of the telemetry provider not being properly initialized with its function implementations. The source function is called, which in turn requires the provider module, and an object with a TelemetryProvider property is returned, but that property is undefined. Curiously, it seems the module doesn't finish "executing". That is, it stops mid-import. I'm currently digging down to find out at which point the import/require chain fails.

I suspect this issue originated from the change that added support for function-based provider sources in order to work better with ESBuild.

craxal avatar Jul 18 '24 00:07 craxal

I narrowed down the issue to the @vscode/deviceid import in AppInsightsTelemetryReporter. The module contains native code, which could be related to why the problem only occurs when the app is packaged/bundled. Fortunately, switching to a dynamic import resolves the issue.

craxal avatar Jul 18 '24 18:07 craxal

The problem is truly rooted in a missing dependency of a native module. We assumed all dependencies of native modules were used only to build them, so we stripped them out when packaging. This is obviously not true in the case (Storage Explorer telemetry depends on @vscode/deviceid which depends on uuid). Making sure the runtime dependency is not stripped out fixes the issue.

craxal avatar Jul 19 '24 00:07 craxal

Verified this issue on the build 20240719.6. Fixed. image

v-kellyluo avatar Jul 19 '24 01:07 v-kellyluo