Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#203 6 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp

Direzione di ricerca

Inizia riproducendo il malfunzionamento con il progetto .NET 10 descritto in global.json eseguendo dotnet test --coverage --coverage-output-format cobertura, quindi confrontalo con dotnet test senza coverage. Traccia il percorso di pulizia di Microsoft Testing Platform e CodeCoverage, incluso il punto di ingresso dotnet-coverage collect. Il lavoro è completato quando viene generata la coverage, la pulizia termina senza BadImageFormatException e il processo termina con il codice 0.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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"
Lingua principale
C#
Stelle
125
Fork
17
Merge medio
1h 15m
PR unite (30g)
2

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/codecoverage

Tutte le issue di microsoft/codecoverage

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.