Skip to content

fix: outdated execution path for COM activation#50471

Merged
VerteDinde merged 2 commits intoelectron:mainfrom
bitdisaster:fix-shortcut-auto-generation
Mar 26, 2026
Merged

fix: outdated execution path for COM activation#50471
VerteDinde merged 2 commits intoelectron:mainfrom
bitdisaster:fix-shortcut-auto-generation

Conversation

@bitdisaster
Copy link
Copy Markdown
Contributor

@bitdisaster bitdisaster commented Mar 25, 2026

Description of Change

I identified a problem with missing icons on Windows. Electron PR /pull/48132 introduced COM activation. COM activation requires the ToastCLSID to be stored in a shortcut in the start menu. The PR enforces that shortcut creation. see EnsureShortcut()
Unfortunately this is not compatible with Squirrel auto-updating. The shortcut in C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs is created with the current executable. E.g. C:\Users\<user>\AppData\Local\my-app\app-1.0.0\myapp.exe An update will kick in and the new version is C:\Users\<user>\AppData\Local\my-app\app-2.0.0\mayapp.exe The shortcut will never be updated but C:\Users\<user>\AppData\Local\my-app\app-1.0.0\mayapp.exe  will be deleted when the next update comes in. Now the shortcut is dead and eventually Explorers icon cashing catches up to the missing exe and the shortcut and the executable no longer shows an icon in the taskbar.
image

This PR should fix this.

  • detects changes in exe path and updates shortcut
  • detects Stub / launcher layout: if the running binary lives under a versioned folder but a stub exists one directory up with the same filename (Squirrel.Windows & and wix-msi), the shortcut targets the stub so the path stays stable across updates and pinned shortcuts don't break.
  • detects app folder version changes and updates working directories

However there are still some fundamental problems that are not addressed but would need some rethinking and API changes.

  1. Apps might want to manage there own shortcuts in start menu. Squirrel packager for example creates shortcuts. Now we have duplicated shortcuts.
  2. A more rare edge case is two apps have the same name and would fight with each other over the same shortcut.

Checklist

Release Notes

Notes: Fixed an issue where an app shortcut may lose its icon after auto-updating on Windows.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 25, 2026
@bitdisaster bitdisaster marked this pull request as draft March 25, 2026 00:04
@bitdisaster bitdisaster changed the title fix: outdated execution path fix: outdated execution path for COM activation Mar 25, 2026
@VerteDinde VerteDinde added semver/patch backwards-compatible bug fixes target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 25, 2026
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 26, 2026
@bitdisaster bitdisaster marked this pull request as ready for review March 26, 2026 02:29
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 26, 2026
Copy link
Copy Markdown
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and testing looks good to fix the original shortcut issue 👍

@VerteDinde VerteDinde enabled auto-merge (squash) March 26, 2026 16:32
@VerteDinde VerteDinde merged commit ae6b219 into electron:main Mar 26, 2026
68 of 70 checks passed
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 26, 2026

Release Notes Persisted

Fixed an issue where an app shortcut may lose its icon after auto-updating on Windows.

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 26, 2026

I was unable to backport this PR to "39-x-y" cleanly;
you will need to perform this backport manually.

@trop trop bot added needs-manual-bp/39-x-y and removed target/39-x-y PR should also be added to the "39-x-y" branch. labels Mar 26, 2026
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 26, 2026

I have automatically backported this PR to "42-x-y", please check out #50517

@trop trop bot added in-flight/42-x-y and removed target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 26, 2026
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 26, 2026

I have automatically backported this PR to "40-x-y", please check out #50518

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 26, 2026

I have automatically backported this PR to "41-x-y", please check out #50519

@trop trop bot removed the target/40-x-y PR should also be added to the "40-x-y" branch. label Mar 26, 2026
@trop trop bot added in-flight/41-x-y merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. and removed target/41-x-y PR should also be added to the "41-x-y" branch. in-flight/40-x-y in-flight/41-x-y in-flight/42-x-y labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. needs-manual-bp/39-x-y new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants