runtime: [WINARM][Regression] Fail to run the command – & “C:\Program Files (x86)\dotnet\dotnet.exe" test --framework net7.0 --diag:loga.txt

Note: 1.It’s regression issue. It doesn’t repro on dotnet-sdk-7.0.100-preview.5.22225.1-win-arm64. 2. Repro VM: vsengarmsfx041

Builds info: dotnet-runtime-3.1.26-win-x64 dotnet-sdk-6.0.400-preview.22314.17-win-x64 dotnet-sdk-7.0.100-preview.6.22314.18-win-arm64 dotnet-sdk-7.0.100-preview.6.22314.18-win-x64 dotnet-sdk-7.0.100-preview.6.22314.18-win-x86

Build Link: https://aka.ms/dotnet/7.0.1xx/daily/dotnet-sdk-win-arm64.exe https://aka.ms/dotnet/7.0.1xx/daily/dotnet-sdk-win-x64.exe https://aka.ms/dotnet/7.0.1xx/daily/dotnet-sdk-win-x86.exe https://aka.ms/dotnet/6.0.4xx/daily/dotnet-sdk-win-x64.exe https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-3.1.26-windows-x64-installer

Steps: Execute the following commands by Powershell:

  1. $env:DOTNET_MULTILEVEL_LOOKUP=0
  2. ls env:
  3. dotnet new mstest
  4. Update file UnitTest1.cs with
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections;
using System.Diagnostics;
using System.Text;
 
namespace CreateScenarioForVendors
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            StringBuilder builder = new StringBuilder();
 
            builder.AppendLine();
            builder.AppendLine();
            foreach (DictionaryEntry var in Environment.GetEnvironmentVariables())
            {
                if(var.Key.ToString().StartsWith("DOTNET_"))
                {
                    builder.AppendLine($"{var.Key.ToString()} {var.Value}");
                }
            }
            builder.AppendLine();
            builder.AppendLine();
            builder.AppendLine($"ProcessArchitecture {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString()}");
            builder.AppendLine($"Location {typeof(object).Assembly.Location}");
            builder.AppendLine($"Process name {Process.GetCurrentProcess().Modules[0].FileName}");
 
            throw new Exception(builder.ToString());
        }
    }
}

Update the project file in in this way

<Project Sdk="Microsoft.NET.Sdk">
 
  <PropertyGroup>
    <TargetFrameworks>net7.0;netcoreapp3.1</TargetFrameworks>
    <IsPackable>false</IsPackable>
  <LangVersion>latest</LangVersion>
  </PropertyGroup>
 
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version=" 17.1.0-preview-20211130-02" />
    <PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
    <PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
    <PackageReference Include="coverlet.collector" Version="3.1.0" />
  </ItemGroup>
 
</Project>
  1. dotnet test --framework net7.0 --diag:loga.txt
  2. &“C:\Program Files (x86)\dotnet\dotnet.exe” test --framework net7.0 --diag:logna.txt

Expected Result: The command should be run normally as following: image

Actual Results: Fail to run the command – & “C:\Program Files (x86)\dotnet\dotnet.exe" test --framework net7.0 --diag:logna.txt image

–Log:

PS C:\Users\v-wenjj\Desktop\mstest> dotnet test --framework net7.0 --diag:loga.txt
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.100-preview.6.22314.18\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierIn
ference.targets(219,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support
-policy [C:\Users\v-wenjj\Desktop\mstest\mstest.csproj]
  mstest -> C:\Users\v-wenjj\Desktop\mstest\bin\Debug\net7.0\mstest.dll
Test run for C:\Users\v-wenjj\Desktop\mstest\bin\Debug\net7.0\mstest.dll (.NETCoreApp,Version=v7.0)
Microsoft (R) Test Execution Command Line Tool Version 17.3.0-preview-20220610-03 (arm64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Logging Vstest Diagnostics in file: C:\Users\v-wenjj\Desktop\mstest\loga.txt
A total of 1 test files matched the specified pattern.
  Failed TestMethod1 [36 ms]
  Error Message:
   Test method CreateScenarioForVendors.UnitTest1.TestMethod1 threw exception:
System.Exception:

DOTNET_HOST_PATH C:\Program Files\dotnet\dotnet.exe
DOTNET_MULTILEVEL_LOOKUP 0


ProcessArchitecture Arm64
Location C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.0-preview.6.22312.1\System.Private.CoreLib.dll
Process name C:\Program Files\dotnet\dotnet.exe

  Stack Trace:
      at CreateScenarioForVendors.UnitTest1.TestMethod1() in C:\Users\v-wenjj\Desktop\mstest\UnitTest1.cs:line 32
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)


Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: 58 ms - mstest.dll (net7.0)
PS C:\Users\v-wenjj\Desktop\mstest> &"C:\Program Files (x86)\dotnet\dotnet.exe" test --framework net7.0 --diag:logna.txt
  Determining projects to restore...
C:\Program Files (x86)\dotnet\sdk\7.0.100-preview.6.22314.18\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFramewo
rkInference.targets(54,5): "[MSBuild]::GetTargetFrameworkIdentifier(netcoreapp3.1)" canno
t be evaluated. Exception has been thrown by the target of an invocation. [C:\Users\v-wenjj\Desktop\mstest\mstest.cspro
j]

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (16 by maintainers)

Most upvoted comments

Note to self: Maybe we can improve logging here.