Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BadImageFormatException crash after tests complete with --coverage on .NET 10 + NUnit

オープン
#203 コメント 6 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp

調査の方向性

まず、global.json に記載された .NET 10 プロジェクトで dotnet test --coverage --coverage-output-format cobertura を実行して失敗を再現し、その後、coverage なしの dotnet test と比較します。dotnet-coverage collect のエントリポイントを含め、Microsoft Testing Platform と CodeCoverage のクリーンアップ経路を追跡します。coverage が生成され、BadImageFormatException が発生せずにクリーンアップが完了し、プロセスがコード 0 で終了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description

When running tests with --coverage flag using Microsoft Testing Platform (MTP) on .NET 10 with NUnit, tests pass successfully and the coverage file is generated, but the process crashes during async cleanup with BadImageFormatException: Index not found.

Environment

  • OS: Ubuntu Linux (GitHub Actions runner) and macOS ARM64
  • .NET SDK: 10.0.101
  • Test Framework: NUnit 4.4.0
  • Test Adapter: NUnit3TestAdapter 6.1.0
  • MTP Packages:
    • Microsoft.Testing.Platform.MSBuild 2.0.2
    • Microsoft.Testing.Extensions.Telemetry 2.0.2
    • Microsoft.Testing.Extensions.CodeCoverage 18.3.1 and 18.3.2 (both crash)

Reproduction

  1. Create a .NET 10 test project with NUnit and MTP enabled
  2. Configure global.json with "test": { "runner": "Microsoft.Testing.Platform" }
  3. Run: dotnet test --coverage --coverage-output-format cobertura

Expected Behavior

Tests complete and process exits with code 0.

Actual Behavior

Tests pass (762 passed in our case), coverage file IS generated, but then:

NUnit Adapter 6.1.0.0: Test execution complete

Error output: Unhandled exception. System.BadImageFormatException: Index not found. (0x80131124)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__124_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

In process file artifacts produced:
  - /path/to/TestResults/<guid>.cobertura.xml

Test run summary: Failed!
  error: 1
  total: 764
  failed: 0
  succeeded: 762
  skipped: 2

Exit code: 134 (SIGABRT)

Workaround

Running without --coverage flag works fine:

dotnet test  # Works, exit code 0
dotnet test --coverage  # Crashes with exit code 134

Notes

  • The crash occurs AFTER tests complete and coverage file is written
  • The exception is in async cleanup/finalization phase
  • Tested with both CodeCoverage 18.3.1 and 18.3.2 - same crash
  • dotnet-coverage collect CLI tool also shows "Profiler was not initialized"
主要言語
C#
スター
125
フォーク
17
平均マージ
1時間 15分
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/codecoverage のほかの issue

microsoft/codecoverage の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。