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

TypeError: Cannot read properties of undefined (reading 'scope') when remove config from non-default profile #186488

Closed
isidorn opened this issue Jun 28, 2023 · 6 comments · Fixed by #186975
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@isidorn
Copy link
Contributor

isidorn commented Jun 28, 2023

Issue filed by @Cosifne

Hi,
I would like to ask about a problem related to the usage of WorkspaceConfiguration.Update()
We received an issue dotnet/vscode-csharp#5714
This happens when the C# extension starts,
we are migrating some old configurations to its new name when using a non-default profile. (This doesn't repro when use default profile)
See the code here:
https://github.com/dotnet/vscode-csharp/blob/ea41fa6d43349a4bd1404f4d8e3d68ee77abea32/src/shared/MigrateOptions.ts#L55

I tested locally and verified the issue in feedback happens when executing await workspaceConfig.update(fromOption, undefined, ConfigurationTarget.Global); during the extension activation.

What I did is created a non-default profile, and put one of our deprecated options in the global profile.
image

Then the error occurs when removing the old configuration see this
configMigrationError
The old configuration is removed in this case.

Is this our misuse of the API or is this a bug in vscode?

@isidorn
Copy link
Contributor Author

isidorn commented Jun 28, 2023

Profile / config - assigning first to @sandy081
Sandeep this is from the C# extension, so if you have additional questions feel free to ask @Cosifne or let me know if I can help in any way.

@sandy081
Copy link
Member

It would be great if we can have a summary of steps to reproduce

@sandy081 sandy081 added the info-needed Issue requires more information from poster label Jun 28, 2023
@isidorn
Copy link
Contributor Author

isidorn commented Jun 28, 2023

@Cosifne can you provide steps please? Thank you

@Cosifne
Copy link
Member

Cosifne commented Jun 28, 2023

My repro step:

  • Install the C# extension in the preview channel.
image
  • Use this sample solution, open it.
    ExtTest2.zip

  • Create a non-default profile.

image
  • Open the profile in json editor. Add these to the JSON.
    "csharp.inlayHints.parameters.enabled" : true,
    "csharp.inlayHints.parameters.forLiteralParameters": true,
    "csharp.inlayHints.parameters.forIndexerParameters": true,
    "csharp.inlayHints.parameters.forObjectCreationParameters": true,
    "csharp.inlayHints.parameters.forOtherParameters": true,
    "csharp.inlayHints.parameters.suppressForParametersThatDifferOnlyBySuffix": true,
    "csharp.inlayHints.parameters.suppressForParametersThatMatchMethodIntent": true,
    "csharp.inlayHints.parameters.suppressForParametersThatMatchArgumentName": true,
    "csharp.inlayHints.types.enabled": true,
    "csharp.inlayHints.types.forImplicitVariableTypes": true,
    "csharp.inlayHints.types.forLambdaParameterTypes": true,
    "csharp.inlayHints.types.forImplicitObjectCreation": true
  • Close VSCode and restart it.
    You can see one configuration is changed.
image C# extension is not activated. And the error log is shown in the extension host output window.
2023-06-28 12:39:15.564 [info] Extension host with pid 10820 exiting with code 0
2023-06-28 12:39:16.166 [info] Extension host with pid 24360 started
2023-06-28 12:39:16.167 [info] Skipping acquiring lock for c:\Users\shech\AppData\Roaming\Code\User\workspaceStorage\0228d75bffaefa4c883611fd9fbbd209.
2023-06-28 12:39:16.221 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2023-06-28 12:39:16.226 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2023-06-28 12:39:16.239 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2023-06-28 12:39:16.429 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-06-28 12:39:16.431 [info] ExtensionService#_doActivateExtension ms-vscode.test-adapter-converter, startup: true, activationEvent: '*', root cause: hbenl.vscode-mocha-test-adapter
2023-06-28 12:39:16.434 [info] ExtensionService#_doActivateExtension vscodevim.vim, startup: true, activationEvent: '*'
2023-06-28 12:39:16.606 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-06-28 12:39:16.625 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-06-28 12:39:16.628 [info] ExtensionService#_doActivateExtension hbenl.vscode-test-explorer, startup: true, activationEvent: '*', root cause: hbenl.vscode-mocha-test-adapter
2023-06-28 12:39:16.674 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2023-06-28 12:39:16.688 [info] ExtensionService#_doActivateExtension hbenl.vscode-mocha-test-adapter, startup: true, activationEvent: '*'
2023-06-28 12:39:16.798 [info] ExtensionService#_doActivateExtension ms-dotnettools.vscode-dotnet-runtime, startup: true, activationEvent: 'workspaceContains:**/*.{csproj,sln,slnf,csx,cake}', root cause: ms-dotnettools.csharp
2023-06-28 12:39:16.876 [info] ExtensionService#_doActivateExtension ms-dotnettools.csharp, startup: true, activationEvent: 'workspaceContains:**/*.{csproj,sln,slnf,csx,cake}'
2023-06-28 12:39:16.911 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-06-28 12:39:17.019 [error] Activating extension ms-dotnettools.csharp failed due to an error:
2023-06-28 12:39:17.019 [error] TypeError: Cannot read properties of undefined (reading 'scope')
    at z.Hb (vscode-file://vscode-app/c:/Users/shech/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2269:74144)
    at async Promise.all (index 0)
    at async Object.q [as settled] (vscode-file://vscode-app/c:/Users/shech/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:97:21518)
    at async z.updateValue (vscode-file://vscode-app/c:/Users/shech/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2269:62177)
2023-06-28 12:39:17.019 [info] Eager extensions activated
2023-06-28 12:39:17.020 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-06-28 12:39:17.023 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-06-28 12:39:17.027 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished'
2023-06-28 12:39:17.034 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
2023-06-28 12:39:17.062 [info] ExtensionService#_doActivateExtension streetsidesoftware.code-spell-checker, startup: false, activationEvent: 'onStartupFinished'

@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues and removed info-needed Issue requires more information from poster labels Jul 4, 2023
@sandy081 sandy081 added this to the July 2023 milestone Jul 4, 2023
@sandy081 sandy081 mentioned this issue Jul 4, 2023
sandy081 added a commit that referenced this issue Jul 4, 2023
sandy081 added a commit that referenced this issue Jul 4, 2023
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 4, 2023
@isidorn
Copy link
Contributor Author

isidorn commented Jul 25, 2023

@Cosifne can you verify that this fix indeed fixes the problem you reported. Thank you!

@Cosifne
Copy link
Member

Cosifne commented Jul 25, 2023

Verified it is solved in 1.81.0-insider

@isidorn isidorn added the verified Verification succeeded label Jul 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants