Skip to content

7.0.400 break: dotnet test fails on linux+mono #34986

@AArnott

Description

@AArnott

Describe the bug

Bumping our .NET SDK version from 7.0.302 to 7.0.400 breaks test runs on linux that target net472 with this error:

Could not resolve type with token 01000019 from typeref (expected class 'System.Diagnostics.TraceLevel' in assembly 'System

To Reproduce

I suppose you just have to run dotnet test on a net472 targeted project on linux while using the 7.0.400 .NET SDK.
You can use commit ab81e30daef1910300ec50c745d62588763e6869 from the Library.Template repo to repro it.

AArnott/Library.Template#216

Exceptions (if any)

Test run for /home/vsts/work/1/s/bin/Library.Tests/Release/net472/Library.Tests.dll (.NETFramework,Version=v4.7.2)
Microsoft (R) Test Execution Command Line Tool Version 17.7.0-preview-23364-03+bc17bb9693cfc4778ded51aa0ab7f1065433f989 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Logging Vstest Diagnostics in file: /home/vsts/work/1/a/test_logs/diag.log
A total of 1 test files matched the specified pattern.
Testhost process for source(s) '/home/vsts/work/1/s/bin/Library.Tests/Release/net472/Library.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=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 <6059d047aaf14e749a5c8d73c69afc94>: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 <6059d047aaf14e749a5c8d73c69afc94>:0 
. Please check the diagnostic logs for more information.

Further technical details

.NET SDK:
 Version:   7.0.400
 Commit:    73bf45718d

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /opt/hostedtoolcache/dotnet/sdk/7.0.400/

Host:
  Version:      7.0.10
  Architecture: x64
  Commit:       a6dbb800a4

.NET SDKs installed:
  7.0.400 [/opt/hostedtoolcache/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.10 [/opt/hostedtoolcache/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.21 [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.10 [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/opt/hostedtoolcache/dotnet]

global.json file:
  /home/vsts/work/1/s/global.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions