Fix System.MissingMethodException for KeyValuePair Deconstruction#5633
Closed
Fix System.MissingMethodException for KeyValuePair Deconstruction#5633
Conversation
…yfill Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Youssef1313
reviewed
May 22, 2025
Copilot
AI
changed the title
[WIP] System.MissingMethodException: Method not found: 'Void Polyfills.Polyfill.Deconstruct(System.Collections.Generic.KeyValuePair`2<!!0,!!1>, !!0 ByRef, !!1 ByRef)'.
Fix System.MissingMethodException for KeyValuePair Deconstruction
May 22, 2025
Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
Member
|
@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:
|
Member
|
/backport to rel/3.9 |
Contributor
|
Started backporting to rel/3.9: https://github.com/microsoft/testfx/actions/runs/15195038006 |
Member
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses an issue where tests fail with a
System.MissingMethodExceptionwhen using MSTest v3.8.3 with .NET 6 projects. The error occurs because tuple deconstruction ofKeyValuePair<TKey,TValue>requires thePolyfills.Polyfill.Deconstructmethod, 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.