microsoft / vstest

Visual Studio Test Platform is the runner and engine that powers test explorer and vstest.console.
MIT License
869 stars 316 forks source link

Blame dotnet test - System.IO.FileNotFoundException #5127

Open ViktorHofer opened 3 days ago

ViktorHofer commented 3 days ago

Manually moved over from https://github.com/dotnet/runtime/issues/104285. Filed by @cschuchardt88

Description

When running command dotnet test --blame-crash-collect-always, this command crashes with an exception.

Data collector 'Blame' message: System.IO.FileNotFoundException: Collect dump was enabled but no dump file was generated.
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcessDumpUtility.GetDumpFiles(Boolean warnOnNoDumpFiles, Boolean processCrashed) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs:line 84
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector.SessionEndedHandler(Object sender, SessionEndEventArgs args) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs:line 534.

Reproduction Steps

  1. Run dotnet test --blame-crash-collect-always on a solution. Repo here https://github.com/neo-project/neo

Expected behavior

To generate a file of collection dump.

Enables collecting crash dump on expected as well as unexpected testhost exit.

Actual behavior

Data collector 'Blame' message: System.IO.FileNotFoundException: Collect dump was enabled but no dump file was generated.
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcessDumpUtility.GetDumpFiles(Boolean warnOnNoDumpFiles, Boolean processCrashed) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs:line 84
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector.SessionEndedHandler(Object sender, SessionEndEventArgs args) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs:line 534.

Regression?

Unknown

Known Workarounds

N/A

Configuration

Windows 11 Pro x64 dotnet: 8.0.302

Other information

dotnet test --blame-crash --blame-crash-collect-always
  Determining projects to restore...
  All projects are up-to-date for restore.
  Neo.ConsoleService -> R:\github\cschuchardt88\neo\bin\Neo.ConsoleService\netstandard2.1\Neo.ConsoleService.dll
  Neo.VM -> R:\github\cschuchardt88\neo\bin\Neo.VM\netstandard2.1\Neo.VM.dll
  Neo.VM -> R:\github\cschuchardt88\neo\bin\Neo.VM\net8.0\Neo.VM.dll
  Neo.Json -> R:\github\cschuchardt88\neo\bin\Neo.Json\net8.0\Neo.Json.dll
  Neo.Json -> R:\github\cschuchardt88\neo\bin\Neo.Json\netstandard2.1\Neo.Json.dll
  Neo.ConsoleService -> R:\github\cschuchardt88\neo\bin\Neo.ConsoleService\net8.0\Neo.ConsoleService.dll
  Neo.Cryptography.BLS12_381 -> R:\github\cschuchardt88\neo\bin\Neo.Cryptography.BLS12_381\netstandard2.1\Neo.Cryptography.BLS12_381.dll
  Neo.Extensions -> R:\github\cschuchardt88\neo\bin\Neo.Extensions\netstandard2.1\Neo.Extensions.dll
  Neo.Extensions -> R:\github\cschuchardt88\neo\bin\Neo.Extensions\net8.0\Neo.Extensions.dll
  Neo.Cryptography.BLS12_381 -> R:\github\cschuchardt88\neo\bin\Neo.Cryptography.BLS12_381\net8.0\Neo.Cryptography.BLS12_381.dll
  Neo.VM.Benchmarks -> R:\github\cschuchardt88\neo\benchmarks\Neo.VM.Benchmarks\bin\Debug\net8.0\Neo.VM.Benchmarks.dll
  Neo.VM.Tests -> R:\github\cschuchardt88\neo\tests\Neo.VM.Tests\bin\Debug\net8.0\Neo.VM.Tests.dll
  Neo.Json.UnitTests -> R:\github\cschuchardt88\neo\tests\Neo.Json.UnitTests\bin\Debug\net8.0\Neo.Json.UnitTests.dll
  Neo.IO -> R:\github\cschuchardt88\neo\bin\Neo.IO\net8.0\Neo.IO.dll
  [coverlet] _mapping file name: 'CoverletSourceRootsMapping_Neo.VM.Tests'
  [coverlet] _mapping file name: 'CoverletSourceRootsMapping_Neo.Json.UnitTests'
  Neo.IO -> R:\github\cschuchardt88\neo\bin\Neo.IO\netstandard2.1\Neo.IO.dll
  Neo.ConsoleService.Tests -> R:\github\cschuchardt88\neo\tests\Neo.ConsoleService.Tests\bin\Debug\net8.0\Neo.ConsoleService.Tests.dll
  [coverlet] _mapping file name: 'CoverletSourceRootsMapping_Neo.ConsoleService.Tests'
  Neo -> R:\github\cschuchardt88\neo\bin\Neo\netstandard2.1\Neo.dll
Test run for R:\github\cschuchardt88\neo\tests\Neo.Json.UnitTests\bin\Debug\net8.0\Neo.Json.UnitTests.dll (.NETCoreApp,Version=v8.0)
Test run for R:\github\cschuchardt88\neo\tests\Neo.ConsoleService.Tests\bin\Debug\net8.0\Neo.ConsoleService.Tests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.10.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Microsoft (R) Test Execution Command Line Tool Version 17.10.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
A total of 1 test files matched the specified pattern.
Test run for R:\github\cschuchardt88\neo\tests\Neo.VM.Tests\bin\Debug\net8.0\Neo.VM.Tests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.10.0 (x64)
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Data collector 'Blame' message: System.IO.FileNotFoundException: Collect dump was enabled but no dump file was generated.
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcessDumpUtility.GetDumpFiles(Boolean warnOnNoDumpFiles, Boolean processCrashed) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs:line 84
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector.SessionEndedHandler(Object sender, SessionEndEventArgs args) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs:line 534.

Passed!  - Failed:     0, Passed:     5, Skipped:     0, Total:     5, Duration: 690 ms - Neo.ConsoleService.Tests.dll (net8.0)
  [coverlet]
  Calculating coverage result...
   Generating report 'R:\github\cschuchardt88\neo\tests\Neo.ConsoleService.Tests\TestResults\coverage.info'

+--------------------+--------+--------+--------+
| Module             | Line   | Branch | Method |
+--------------------+--------+--------+--------+
| Neo.ConsoleService | 15.66% | 13.04% | 19.4%  |
+--------------------+--------+--------+--------+

+---------+--------+--------+--------+
|         | Line   | Branch | Method |
+---------+--------+--------+--------+
| Total   | 15.66% | 13.04% | 19.4%  |
+---------+--------+--------+--------+
| Average | 15.66% | 13.04% | 19.39% |
+---------+--------+--------+--------+

Data collector 'Blame' message: System.IO.FileNotFoundException: Collect dump was enabled but no dump file was generated.
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.ProcessDumpUtility.GetDumpFiles(Boolean warnOnNoDumpFiles, Boolean processCrashed) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs:line 84
   at Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector.SessionEndedHandler(Object sender, SessionEndEventArgs args) in /_/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs:line 534.
nohwnd commented 3 days ago

@cschuchardt88 this option is remnant of .NET Framework, and it only works when you force the run to use ProcDump even for .NET, by setting: VSTEST_DUMP_FORCEPROCDUMP=1. And even then it is not 100%.

Also you should see the message as a warning and not an exception.