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

System.TypeLoadException: Could not load type of field 'Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace:TraceSourceLevelsMap' (1) due to #4671

Closed
Romfos opened this issue Aug 15, 2023 · 6 comments

Comments

@Romfos
Copy link

Romfos commented Aug 15, 2023

Hi,

MSTest v3 Stop working for linux

Nuget:

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

Build link link:
https://github.com/Romfos/AutoTests.Framework/actions/runs/5866367920/job/15905047692

Testhost process for source(s) '/home/runner/work/AutoTests.Framework/AutoTests.Framework/src/AutoTests.Framework.Tests/bin/Debug/net462/AutoTests.Framework.Tests.dll' exited with error: Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace' threw an exception. ---> System.TypeLoadException: Could not load type of field 'Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace:TraceSourceLevelsMap' (1) due to: Could not resolve type with token 01000019 from typeref (expected class 'System.Diagnostics.TraceLevel' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e0[89](https://github.com/Romfos/AutoTests.Framework/actions/runs/5866367920/job/15905047692#step:5:90)') assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Diagnostics.TraceLevel member:(null)
   --- End of inner exception stack trace ---
  at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main (System.String[] args) [0x00033] in <af8fc7b1c76049579919cce3f8e01556>:0 
Error:  FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace' threw an exception. ---> System.TypeLoadException: Could not load type of field 'Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace:TraceSourceLevelsMap' (1) due to: Could not resolve type with token 01000019 from typeref (expected class 'System.Diagnostics.TraceLevel' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Diagnostics.TraceLevel member:(null)
   --- End of inner exception stack trace ---
  at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main (System.String[] args) [0x00033] in <af8fc7b1c76049579[91](https://github.com/Romfos/AutoTests.Framework/actions/runs/5866367920/job/15905047692#step:5:92)9cce3f8e01556>:0 
. Please check the diagnostic logs for more information.
@bejax
Copy link

bejax commented Aug 17, 2023

Run into the same problem, but I think it's more likely to be a problem with vstest, see issue #4657.

@Evangelink
Copy link
Member

Hi @Romfos,

Was the code working before? Have you only bumped MSTest or have you changed something else (e.g. version of VS, version of test SDK...)? I see you are using net462, are you using the AppDomain feature?

Is it possible to have a small reproducer for us to investigate the issue?

@Romfos
Copy link
Author

Romfos commented Aug 24, 2023

Hi @Evangelink , yes, please:

repo
https://github.com/Romfos/mstest-repo

build:
https://github.com/Romfos/mstest-repo/actions/runs/5961090424/job/16169633189

note: looks like issue started after .net sdk latest patch applying

@Evangelink
Copy link
Member

Thanks for the quick reply, I confirm that I can repro the issue (only on Linux and net462):

image

I will investigate the issue.

@Evangelink Evangelink transferred this issue from microsoft/testfx Aug 24, 2023
@Evangelink
Copy link
Member

I have transfered the issue to vstest repo because I have confirmed issue is linked to it. Uninstalling .NET 7 fixes the issue.

@nohwnd
Copy link
Member

nohwnd commented Aug 24, 2023

This is probably the same issue as #4549 and #4627, we inserted fix for that into servicing on 7.0.401, and it should be in the next service release. (this has links to the insertion pr #4549 (comment))

@nohwnd nohwnd closed this as completed Aug 24, 2023
shinji-san added a commit to shinji-san/SecretSharingDotNet that referenced this issue Sep 9, 2023
Workaround for the following issues with the Microsoft.TestPlatform.ObjectModel package:
- microsoft/vstest#4549
- microsoft/vstest#4671
- microsoft/vstest#4627

Resolves: No entry
shinji-san added a commit to shinji-san/SecretSharingDotNet that referenced this issue Sep 16, 2023
The new versions fix the issue #4671:
microsoft/vstest#4671

Resolves: No enty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants