Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#203 6 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp

Línea de trabajo

Comienza reproduciendo el fallo con el proyecto .NET 10 descrito en global.json ejecutando dotnet test --coverage --coverage-output-format cobertura; después, compáralo con dotnet test sin coverage. Traza la ruta de limpieza de Microsoft Testing Platform y CodeCoverage, incluido el punto de entrada dotnet-coverage collect. Se considera terminado cuando se genera coverage, la limpieza se completa sin BadImageFormatException y el proceso termina con el código 0.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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"
Lenguaje dominante
C#
Estrellas
125
Forks
17
Merge medio
1 h 15 min
PR fusionados (30 d)
2

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/codecoverage

Todos los issues de microsoft/codecoverage

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.