-
Notifications
You must be signed in to change notification settings - Fork 392
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
Avoid main thread switch in UpToDateCheckHost #9458
Avoid main thread switch in UpToDateCheckHost #9458
Conversation
Test is failing with:
Seems like something related to the package updates here has broken mock object proxy generation. That's a tomorrow problem! |
Change: - From `_vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_IsInCommandLineMode, ...)` - To `vsAppId.GetProperty((int)__VSAPROPID10.VSAPROPID_IsInCommandLineMode, ...)` The latter is free-threaded, as described in: https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/40079/Free-threaded-replacements Also, `IVsAppCommandLine` is free-threaded, so don't use `IVsUIService` for that, as given in: https://github.com/microsoft/VSSDK-Analyzers/blob/614165cfdca3245dd8c19530bd054e24cd80be32/src/Microsoft.VisualStudio.SDK.Analyzers.CodeFixes/build/AdditionalFiles/vs-threading.MembersRequiringMainThread.txt#L84 Together, these changes mean we don't need to switch to the main thread in `UpToDateCheckHost`.
2c5eb96
to
7e694fb
Compare
Avoids TypeLoadExceptions during test runs.
I rebased this PR and it now fails with a similar error:
It seems like we have an unexpected version of MSBuild DLLs at runtime. I've added an explicit reference to a version of MSBuild to try and fix this. Unfortunately the problem does not reproduce locally. |
We now explicitly reference the version of MSBuild used in these tests, which makes CI pass. |
...crosoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/UpToDate/UpToDateCheckHost.cs
Outdated
Show resolved
Hide resolved
…cute It seems likely that we would get multiple requests to the up-to-date check as we're called per-project, and many projects can build in parallel. Better to only do this work once.
AsyncLazy doesn't pass a cancellation token to the func. I tried to work around this with a CTS, but that doesn't work. If one caller cancels, it'll cancel all other callers, which isn't correct. Instead, we remove cancellation from the GetService calls, as these are cheap and cancellation is unlikely. Anyone waiting on the value would be correctly cancelled still.
Replaces API usage:
_vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_IsInCommandLineMode, ...)
vsAppId.GetProperty((int)__VSAPROPID10.VSAPROPID_IsInCommandLineMode, ...)
The latter is free-threaded, as described in: https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/40079/Free-threaded-replacements
This requires bumping several VS packages to 17.11, in order to use
__VSAPROPID10.VSAPROPID_IsInCommandLineMode
.Also,
IVsAppCommandLine
is free-threaded, so don't useIVsUIService
for that, as given in: https://github.com/microsoft/VSSDK-Analyzers/blob/614165cfdca3245dd8c19530bd054e24cd80be32/src/Microsoft.VisualStudio.SDK.Analyzers.CodeFixes/build/AdditionalFiles/vs-threading.MembersRequiringMainThread.txt#L84Together, these changes mean we don't need to switch to the main thread in
UpToDateCheckHost
👍Microsoft Reviewers: Open in CodeFlow