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

Fix the KeybindingResetDetector #60494

Merged

Conversation

jasonmalinowski
Copy link
Member

We switched VisualStudioInfoBar to no longer be a MEF service in 347cd02, but this was still importing it. It's now a helper type, so create it instead.

We switched VisualStudioInfoBar to no longer be a MEF service in
347cd02, but this was still importing
it. It's now a helper type, so create it instead.
@CyrusNajmabadi
Copy link
Member

We switched VisualStudioInfoBar to no longer be a MEF service in 347cd02, but this was still importing it.

How did that not break everything? e.g. i would have expected some sort of exceptions happening that should have caused problems. Do we have an exception hole somewhere?

@@ -91,13 +92,13 @@ internal sealed class KeybindingResetDetector : ForegroundThreadAffinitizedObjec
public KeybindingResetDetector(
IThreadingContext threadingContext,
IGlobalOptionService globalOptions,
VisualStudioInfoBar infoBarService,
Copy link
Member

Choose a reason for hiding this comment

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

i don't get it. shouldn't this have broken mef? how was this type getting instantiated? and how did this not break anything else importing KeybindingResetDetector?

Copy link
Member Author

@jasonmalinowski jasonmalinowski Mar 31, 2022

Choose a reason for hiding this comment

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

This type is only instantiated here:

// Initialize keybinding reset detector
await ComponentModel.DefaultExportProvider.GetExportedValue<KeybindingReset.KeybindingResetDetector>().InitializeAsync().ConfigureAwait(true);
which is just a general "let's initialize it". Nothing else MEF imports this.

Copy link
Member

Choose a reason for hiding this comment

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

This line is hiding it:

LoadComponentsBackgroundAsync(cancellationToken).Forget();
. It's just a Forget - no fault or anything.

Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

Something doesn't make sense to me here.

@jasonmalinowski
Copy link
Member Author

@CyrusNajmabadi: It throws exceptions here:

// Initialize keybinding reset detector
await ComponentModel.DefaultExportProvider.GetExportedValue<KeybindingReset.KeybindingResetDetector>().InitializeAsync().ConfigureAwait(true);

Which is a fire-and-forget path.

@CyrusNajmabadi
Copy link
Member

bleaghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.

@jasonmalinowski
Copy link
Member Author

@CyrusNajmabadi Updated to report non-fatal telemetry if that throws.

@jasonmalinowski
Copy link
Member Author

Some testing makes us think this feature is more generally broken; until we understand why we'll merge this for 17.3 to avoid the MEF composition issue, and we'll need to investigate further.

@jasonmalinowski jasonmalinowski merged commit 0560ba2 into dotnet:main Apr 13, 2022
@jasonmalinowski jasonmalinowski deleted the fix-keybinding-reset-detector branch April 13, 2022 20:46
@ghost ghost added this to the Next milestone Apr 13, 2022
@dibarbet dibarbet modified the milestones: Next, 17.3.P1 Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants