Skip to content
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

[MSTest][Discovery] MSTestPlayground.exe Failed to discover tests from assembly (After upgrade from 2.1.2 to 2.2.8) #1019

Closed
nir-boger opened this issue Dec 4, 2021 · 2 comments · Fixed by #1064
Assignees
Labels

Comments

@nir-boger
Copy link

Description

Getting the following error while trying to run MSTests that are being hosted in a console application assembly

Microsoft (R) Test Execution Command Line Tool Version 16.11.0 Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait... A total of 1 test files matched the specified pattern. [MSTest][Discovery][MSTestPlayground.exe] Failed to discover tests from assembly MSTestPlayground.exe. Reason:It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead. No test is available in C:\Users\niboger\source\repos\MSTestPlayground\bin\Debug\MSTestPlayground.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

Additionally, path to test adapters can be specified using /TestAdapterPath command. Example /TestAdapterPath:.

Steps to reproduce

I've created this repo for reproduction: https://github.com/nir-boger/ms-test-v2.2.8-bug

Expected behavior

1 Test being executed and passed

Actual behavior

No tests were executed

Environment

  • Win11
  • 16.11.0
  • 2.2.8
@cervengoc
Copy link

Same here, I'm trying to run unit tests within a project having exe output type. Using 2.1.2 everything works just fine, but with 2.2.7 and 2.2.8 I get the same error.

@Lumoryel
Copy link

Lumoryel commented Feb 1, 2022

Same for me, 2.2.5 still works but from 2.2.6 on it's not working anymore.

Haplois added a commit that referenced this issue Apr 12, 2022
Reflection only loading for executable files was preventing us to discover and run tests because of different attribute reading mechanism. Now loading assemblies entirely, regardless of type.

 - Fixes #1019
@Haplois Haplois self-assigned this Apr 12, 2022
@Haplois Haplois added sprint and removed sprint labels Apr 12, 2022
Haplois added a commit that referenced this issue Apr 12, 2022
Reflection only loading for executable files was preventing us to discover and run tests because of different attribute reading mechanism. Now loading assemblies entirely, regardless of type.

 - Fixes #1019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants