microsoft / microsoft/WindowsAppSDK

Re-registering AppInstance causes Key to be invalid

Open
#4,420 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Lifecycle
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

Describe the bug

If you have an app instance which unregisters itself, and then calls AppInstance.findOrRegisterKey it "succesfully" registers, but then the Key is not valid (it returns ""). This means that a subsequent process will come along and call AppInstance.findOrRegiserKey, which will end up returning null

Steps to reproduce the bug
  1. call AppInstance.FindOrRegisterKey("myKey")`
  2. call AppInstance.GetCurrent().UnregisterKey
  3. call AppInstance.FindOrRegisterKey("myKey")
  4. launch second instance of application, notice that the call from step (1) will return null
Expected behavior

FindOrRegisterKey will return the proper instance

Screenshots

No response

NuGet package version

Windows App SDK 1.5.3: 1.5.240428000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

No response

Additional context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the packaged MSIX flow with AppInstance.FindOrRegisterKey and AppInstance.GetCurrent().UnregisterKey on Windows App SDK 1.5.3, following the four listed steps. Compare the returned key and instance from the first registration, re-registration, and second application instance; done means re-registration returns a valid key and the later FindOrRegisterKey returns the proper instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.