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
"Cannot read property 'adapter' of undefined" #69147
Comments
(Experimental duplicate detection) |
@DanTup does this reproduce with insiders? Since two weeks that should handle missing adapter more graceful |
With Insiders I see this instead:
Is that expected? |
Better. What are your steps to reproduce this? |
When you switch SDK in the Dart extension, we dispose all of the providers and re-create them. We do it by enumerating through them calling dispose, then just re-calling the context.subscriptions.push(vs.commands.registerCommand("_dart.reloadExtension", (_) => {
log("Performing silent extension reload...");
deactivate(true);
const toDispose = context.subscriptions.slice();
context.subscriptions.length = 0;
for (const sub of toDispose) {
try {
sub.dispose();
} catch (e) {
logError(e);
}
}
activate(context, true);
log("Done!");
})); |
So, from looking at both stack traces this happens with code actions and document symbols |
Oh yeah, I didn't even spot the stacks were different. I'll do some testing tomorrow when the next Insiders build is available. Thanks! |
The "no adapter found" message from Code Actions is the only error I seem to be able to repro today in Insiders. I'll do some more testing once that's fixed to see if I can find any more. Thanks! |
I will revert my change because of a regression it introduced |
I have pushed another change for document symbols |
Document symbols still looks good to me in latest Insiders - with Outline + Breadcrumb visible and constantly switching SDK, the only one printing errors is CodeActions. |
Repo in main VS Code codebase:
diff --git a/extensions/typescript-language-features/src/features/quickFix.ts b/extensions/typescript-language-features/src/features/quickFix.ts
index 91c3f3b326..7ac5e5dc79 100644
--- a/extensions/typescript-language-features/src/features/quickFix.ts
+++ b/extensions/typescript-language-features/src/features/quickFix.ts
@@ -326,8 +326,17 @@ export function register(
diagnosticsManager: DiagnosticsManager,
telemetryReporter: TelemetryReporter
) {
- return new VersionDependentRegistration(client, API.v213, () =>
- vscode.languages.registerCodeActionsProvider(selector,
- new TypeScriptQuickFixProvider(client, fileConfigurationManager, commandManager, diagnosticsManager, telemetryReporter),
- TypeScriptQuickFixProvider.metadata));
+ let sub: undefined | vscode.Disposable = undefined;
+
+ setInterval(() => {
+ if (sub) {
+ sub.dispose();
+ }
+ sub = new VersionDependentRegistration(client, API.v213, () => {
+ return vscode.languages.registerCodeActionsProvider(selector,
+ new TypeScriptQuickFixProvider(client, fileConfigurationManager, commandManager, diagnosticsManager, telemetryReporter),
+ TypeScriptQuickFixProvider.metadata);
+ });
+ }, 10);
+
} Bug |
@jrieken I can't seem to fix this error fully for the example above that re-registers a provider every 10 milliseconds. The same pattern also still breaks document symbol providers. Is this worth worrying about? |
I'd ignore it, since everything is async between two processes it's the way it is. We should maybe be more graceful when a provider isn't around, like resolving with |
@DanTup Can you please test the latest insiders build to see if you can still hit these errors in more normal scenarios |
I was using this Insiders from today: 2019-03-19T06:07:09.890Z |
Fixes microsoft#69147 Due to the asynchronous communication between the exthost and main process, there may be cases where we request data from a provider that has been unregistered. This currently logs an error. This change adds a fallback value that we can return instead when the adapter is missing.
Thanks, not seeing any errors switching Dart SDKs in insiders now 👍 |
I saw this previously in #66322 in provideCodeActions which was fixed, but I've just seen the same thing on stable in provideDocumentSymbols:
I guess it should have the same fix (and based on the comments in that issue, Hovers may also need it?).
I was more aware of what I was doing to repro it this time... The Dart extension has code to restart itself when certain config changes (for example, the path to the Dart SDK). We run through all of the providers we created and dispose them, and then re-create them using the new SDK server client.
Based on @jrieken's comment at #66322 (comment) I guess that if this happens while there are outstanding requests, this error could occur.
The text was updated successfully, but these errors were encountered: