Skip to content

System.MissingMethodException: Method not found: 'Void Polyfills.Polyfill.Deconstruct(System.Collections.Generic.KeyValuePair`2<!!0,!!1>, !!0 ByRef, !!1 ByRef)'. #5579

@bt-Knodel

Description

@bt-Knodel

Describe the bug

We just recently attempted an upgrade of MSTest from 3.6.1 to 3.8.3. Unfortunately, all tests are now failing with a missing method exception. I looked for previous reports and there are similar, but this one is still present after 3.8.3 it seems?

Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings.
Starting test discovery for requested test run
Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings.
========== Starting test discovery ==========
Connecting to client host '127.0.0.1' port '64555'
Runsettings datacollectors are not supported by Microsoft.Testing.Platform and will be ignored
Runsettings attribute 'MaxCpuCount' is not supported by Microsoft.Testing.Platform and will be ignored
========== Test discovery finished: 8113 Tests found in 6.7 sec ==========
Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings.
Code coverage is not supported while debugging tests. Code coverage has been disabled for this debug session.
========== Starting test run ==========
Connecting to client host '127.0.0.1' port '64559'
Test Parallelization enabled for C:\repos\BTNet\BusinessLogic.Managers.Tests\bin\x64\Debug\net6.0\win-x64\BusinessLogic.Managers.Tests.dll (Workers: 16, Scope: MethodLevel)
System.MissingMethodException: Method not found: 'Void Polyfills.Polyfill.Deconstruct(System.Collections.Generic.KeyValuePair`2<!!0,!!1>, !!0 ByRef, !!1 ByRef)'.
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.GetTestContextProperties(IDictionary`2 tcmProperties, IDictionary`2 sourceLevelParameters)
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsWithTestRunnerAsync(IEnumerable`1 tests, ITestExecutionRecorder testExecutionRecorder, String source, IDictionary`2 sourceLevelParameters, UnitTestRunner testRunner, Boolean usesAppDomains) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 552
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.<>c__DisplayClass18_1.<<ExecuteTestsInSourceAsync>b__8>d.MoveNext() in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 462
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSourceAsync(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 474
Process: C:\repos\BTNet\BusinessLogic.Managers.Tests\bin\x64\Debug\net6.0\win-x64\BusinessLogic.Managers.Tests.dll, Exception: StreamJsonRpc.RemoteInvocationException: System.MissingMethodException: Method not found: 'Void Polyfills.Polyfill.Deconstruct(System.Collections.Generic.KeyValuePair`2<!!0,!!1>, !!0 ByRef, !!1 ByRef)'.
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.GetTestContextProperties(IDictionary`2 tcmProperties, IDictionary`2 sourceLevelParameters)
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsWithTestRunnerAsync(IEnumerable`1 tests, ITestExecutionRecorder testExecutionRecorder, String source, IDictionary`2 sourceLevelParameters, UnitTestRunner testRunner, Boolean usesAppDomains) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 552
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.<>c__DisplayClass18_1.<<ExecuteTestsInSourceAsync>b__8>d.MoveNext() in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 462
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSourceAsync(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 474
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsAsync(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, Boolean isDeploymentDone) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 274
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTestsAsync(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle, TestRunCancellationToken cancellationToken) in /_/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs:line 250
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.<>c__DisplayClass11_0.<<RunTestsAsync>b__0>d.MoveNext() in /_/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs:line 101
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.<>c__DisplayClass13_0.<<RunTestsFromRightContextAsync>g__DoRunTestsAsync|0>d.MoveNext() in /_/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs:line 158
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTestsFromRightContextAsync(IFrameworkHandle frameworkHandle, Func`2 runTestsAction) in /_/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs:line 147
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTestsAsync(IEnumerable`1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle, IConfiguration configuration) in /_/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs:line 101
   at Microsoft.VisualStudio.TestTools.UnitTesting.MSTestBridgedTestFramework.SynchronizedRunTestsAsync(VSTestRunTestExecutionRequest request, IMessageBus messageBus, CancellationToken cancellationToken) in /_/src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/MSTestBridgedTestFramework.cs:line 56
   at Microsoft.Testing.Extensions.VSTestBridge.SynchronizedSingleSessionVSTestBridgedTestFramework.<>c__DisplayClass22_0.<<ExecuteRequestAsync>b__0>d.MoveNext() in /_/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/SynchronizedSingleSessionVSTestAndTestAnywhereAdapter.cs:line 166
--- End of stack trace from previous location ---
   at Microsoft.Testing.Extensions.VSTestBridge.SynchronizedSingleSessionVSTestBridgedTestFramework.ExecuteRequestWithRequestCountGuardAsync(Func`1 asyncFunc) in /_/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/SynchronizedSingleSessionVSTestAndTestAnywhereAdapter.cs:line 188
   at Microsoft.Testing.Extensions.VSTestBridge.VSTestBridgedTestFrameworkBase.ExecuteRequestAsync(ExecuteRequestContext context) in /_/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/VSTestBridgedTestFrameworkBase.cs:line 91
   at Microsoft.Testing.Platform.Requests.TestHostTestFrameworkInvoker.ExecuteRequestAsync(ITestFramework testFramework, TestExecutionRequest request, IMessageBus messageBus, CancellationToken cancellationToken) in /_/src/Platform/Microsoft.Testing.Platform/Requests/TestHostTestFrameworkInvoker.cs:line 72
   at Microsoft.Testing.Platform.Requests.TestHostTestFrameworkInvoker.ExecuteAsync(ITestFramework testFramework, ClientInfo client, CancellationToken cancellationToken) in /_/src/Platform/Microsoft.Testing.Platform/Requests/TestHostTestFrameworkInvoker.cs:line 61
   at Microsoft.Testing.Platform.Hosts.CommonTestHost.ExecuteRequestAsync(ProxyOutputDevice outputDevice, ITestSessionContext testSessionInfo, ServiceProvider serviceProvider, BaseMessageBus baseMessageBus, ITestFramework testFramework, ClientInfo client) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs:line 136
   at Microsoft.Testing.Platform.Hosts.ServerTestHost.ExecuteRequestAsync(RequestArgsBase args, String method, ServiceProvider perRequestServiceProvider) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/ServerTestHost.cs:line 502
   at Microsoft.Testing.Platform.Hosts.ServerTestHost.ExecuteRequestAsync(RequestArgsBase args, String method, ServiceProvider perRequestServiceProvider) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/ServerTestHost.cs:line 534
   at Microsoft.Testing.Platform.Hosts.ServerTestHost.HandleRequestCoreAsync(RequestMessage message, RpcInvocationState rpcInvocationState) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/ServerTestHost.cs:line 428
   at Microsoft.Testing.Platform.Hosts.ServerTestHost.HandleRequestAsync(RequestMessage request, CancellationToken serverClosing) in /_/src/Platform/Microsoft.Testing.Platform/Hosts/ServerTestHost.cs:line 334
   at StreamJsonRpc.JsonRpc.InvokeCoreAsync[TResult](RequestId id, String targetName, IReadOnlyList`1 arguments, IReadOnlyList`1 positionalArgumentDeclaredTypes, IReadOnlyDictionary`2 namedArgumentDeclaredTypes, CancellationToken cancellationToken, Boolean isParameterObject)
   at Microsoft.VisualStudio.TestWindow.Internal.RemoteAgent.TestingPlatform.RpcClient.RunTestsWithFilterAsync(Guid runId, TestNode[] testNodes, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Threading.ThreadingTools.WithCancellationSlow[T](Task`1 task, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestWindow.Internal.RemoteAgent.TestingPlatform.Clients.TestingPlatformClient.ExecuteRpcCallAsync[T](Func`1 rpcFunction, CancellationToken cancellationToken)
RPC server exception:
: 

========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 13.9 sec ==========

Steps To Reproduce

  1. Setup a shared reference library (Ex. Testing.Common) targetting .NET Standard 2.0, referencing MSTest via package reference:

<PackageReference Include="MSTest" Version="3.8.3" />

  1. Setup a tests project targeting .NET 6.0 using the project style:

<Project Sdk="MSTest.Sdk/3.8.3>

  1. Add a reference to the shared .NET Standard 2.0 project to the tests project

  2. Attempt to run any test in .NET 6.0 project, receive exception

Expected behavior

Actual behavior

Additional context

We have a mix of projects using .NET 6 and .NET Framework 4.8. The ones failing are exclusively the .NET 6 tests, .NET Framework 4.8 appears to be fine. We do not specify an explicit language version for C# for any of these tests. Additionally, I attempted to install PolyFill nuget package to what MSTest uses and it does not appear to resolve it

Note: We have converted all projects to the SDK style. Each test project has this definition:

<Project Sdk="MSTest.Sdk/3.8.3;Microsoft.NET.Sdk.Publish">

Metadata

Metadata

Labels

Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions