-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Remove RoslynServiceExtensions.GetServiceAsync #77799
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ public StubVsServiceExporter( | |
[Import(typeof(SAsyncServiceProvider))] IAsyncServiceProvider2 asyncServiceProvider, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @davkean's bug specifically calls out IAsyncServiceProvider3, do we need to move to those newer interface here or are we good? His comment makes me think all the methods will eventually call the right thing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding is that the implementations on each of the interfaces will do the right thing, and that there is no need to explicitly use the "3" interface. |
||
JoinableTaskContext joinableTaskContext) | ||
{ | ||
_serviceGetter = new AsyncLazy<TInterface>(() => asyncServiceProvider.GetServiceAsync<TService, TInterface>(joinableTaskContext.Factory, throwOnFailure: true)!, joinableTaskContext.Factory); | ||
_serviceGetter = new AsyncLazy<TInterface>(() => asyncServiceProvider.GetServiceAsync<TService, TInterface>(throwOnFailure: true, CancellationToken.None)!, joinableTaskContext.Factory); | ||
} | ||
|
||
/// <inheritdoc /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,9 @@ private void EnsureSubscribedToSolutionEvents() | |
{ | ||
Task.Run(async () => | ||
{ | ||
var shellService = await _serviceProvider.GetServiceAsync<SVsSolution, IVsSolution>(_threadingContext.JoinableTaskFactory).ConfigureAwait(true); | ||
var shellService = await _serviceProvider.GetServiceAsync<SVsSolution, IVsSolution>(throwOnFailure: true, _threadingContext.DisposalToken).ConfigureAwait(true); | ||
await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(_threadingContext.DisposalToken); | ||
shellService.AdviseSolutionEvents(this, out _); | ||
shellService!.AdviseSolutionEvents(this, out _); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should be putting the ! on the fetching so that way the nullable suppression is closer to the place where the throwOnFailure: true is. Or it's unfortunate if we can't get that nullable annotated in some way to make this simpler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like there is a version of GetServiceAsync that only takes in a CancellationToken and assumes throwOnFailure is true and has null annotated the return values. Switched over to use that when possible. |
||
}, _threadingContext.DisposalToken); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be banned too, or the message updated for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look into these methods, so I'd rather not remove or change their message