-
Notifications
You must be signed in to change notification settings - Fork 282
Fix System.MissingMethodException for KeyValuePair Deconstruction #5633
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
Conversation
…yfill Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
src/Adapter/MSTest.TestAdapter/Execution/TestRunCancellationToken.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
@nohwnd While it's still mysterious why restore isn't behaving as we would expect in the original issue, and we didn't get a binlog from the customer, I think this change is reasonable enough to avoid potential issues. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5633 +/- ##
==========================================
- Coverage 76.51% 74.05% -2.46%
==========================================
Files 602 602
Lines 36561 36560 -1
==========================================
- Hits 27974 27074 -900
- Misses 8587 9486 +899
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
/backport to rel/3.9 |
Started backporting to rel/3.9: https://github.com/microsoft/testfx/actions/runs/15195038006 |
I think it's too fragile to allow MSTest.TestAdapter netstandard2.0 assembly to be used with MSTest.TestFramework. I'm going to close this PR. The backport was merged already but it doesn't harm as well. |
Overview
This PR addresses an issue where tests fail with a
System.MissingMethodException
when using MSTest v3.8.3 with .NET 6 projects. The error occurs because tuple deconstruction ofKeyValuePair<TKey,TValue>
requires thePolyfills.Polyfill.Deconstruct
method, which is not available in the netstandard2.0 version of the assembly when used with .NET 6 projects.Problem
The error occurs in the following scenario:
Error message:
Changes
The changes replace tuple deconstruction pattern with traditional KeyValuePair access:
In TestExecutionManager.cs:
foreach ((TestProperty key, object? value) in tcmProperties)
to use standard KeyValuePair syntaxforeach ((string key, object value) in sourceLevelParameters)
to use standard KeyValuePair syntaxIn TestRunCancellationToken.cs:
In DeploymentItemUtility.cs:
foreach ((string? key, string? value) in deploymentItemsData)
to use standard KeyValuePair syntaxThese changes avoid the need for the Polyfill.Deconstruct method while maintaining the same functionality.
Fixes #5579.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
pkgs.dev.azure.com
/home/REDACTED/work/testfx/testfx/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/testfx/testfx/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/testfx/testfx/artifacts/toolset/10.0.0-beta.25229.4.txt
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.