Closed drewnoakes closed 1 month ago
Test is failing with:
System.TypeLoadException : Method 'ImportMetadata' in type 'Microsoft.Build.Execution.ProjectItemInstance' from assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.
Seems like something related to the package updates here has broken mock object proxy generation. That's a tomorrow problem!
I rebased this PR and it now fails with a similar error:
System.TypeInitializationException : The type initializer for 'Microsoft.Build.Shared.FrameworkLocationHelper' threw an exception. ---- System.MissingMethodException : Method not found: 'Boolean Microsoft.Build.Framework.NativeMethods.get_IsMono()'.
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.
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