Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memento.update does not always work when an extension is starting up #171827

Closed
karrtikr opened this issue Jan 20, 2023 · 2 comments
Closed

Memento.update does not always work when an extension is starting up #171827

karrtikr opened this issue Jan 20, 2023 · 2 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Jan 20, 2023

Does this issue occur when all extensions are disabled?: Yes/No

Version: 1.75.0-insider (user setup)
OS: Windows_NT x64 10.0.22518

Steps to Reproduce:

See ExtensionContext.globalState: https://code.visualstudio.com/api/references/vscode-api#ExtensionContext:

await globalState.update(<key>, newValue);
const valueAfterUpdate = globalState.get(<key>, undefined);
if (JSON.stringify(valueAfterUpdate) != JSON.stringify(newValue)) {
    // Error: This condition should never be true, but it is being hit.
}

This has been failing for Python extension when type of newValue is string, and in some cases an array object.

Workaround: We've observed that if we reset the storage first, and then try updating it, it works in most cases: (implementation in Python extension)

await globalState.update(<key>, undefined);
await globalState.update(<key>, newValue);
const valueAfterUpdate = globalState.get(<key>, undefined);
if (JSON.stringify(valueAfterUpdate) != JSON.stringify(newValue)) {
    // This condition is not hit.
}

Once the extension completely finishes loading, we do not see this bug.

@bpasero
Copy link
Member

bpasero commented Jan 23, 2023

Does this reproduce in a minimal hello world extension? And if so, please share the code of a minimal extension.

@bpasero bpasero added the info-needed Issue requires more information from poster label Jan 23, 2023
@VSCodeTriageBot
Copy link
Collaborator

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@VSCodeTriageBot VSCodeTriageBot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants