dotnet-coverage collect --server-mode leaks coverage across tests when using snapshot -r
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Comienza con el flujo documentado de server-mode y reproduce el problema usando los comandos listados collect, connect, snapshot -r, merge y shutdown para Test A y Test B. Inspecciona las salidas sin procesar de los snapshots antes del procesamiento de merge o mapper; se considera terminado cuando cada snapshot contiene únicamente la cobertura recopilada desde el reset anterior sin corromper el archivo .coverage.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
We are observing that in a long-lived server-mode session, calling snapshot -r does not appear to fully clear prior coverage state. Coverage from an earlier test is still present in the next snapshot, and the raw .coverage file is already corrupted before any mapper/parsing logic executes. This is causing to collect the per test coverage when the test cases needs to run in sequence.
Steps:
- Start a shared coverage session:
cmd : dotnet-coverage collect --server-mode --background --session-id
2. Connect and run Test A in that same session:
cmd : dotnet-coverage connect dotnet test
3. Snapshot Test A with reset:
cmd : dotnet-coverage snapshot -r -o -t
dotnet-coverage merge -o -f xml
4. Connect and run Test B in the same session:
cmd : dotnet-coverage connect dotnet test
5. Snapshot Test B with reset:
cmd : dotnet-coverage snapshot -r -o -t
dotnet-coverage merge -o -f xml
6. Observe coverage contamination between Test A and Test B.
7. Shut down the server at the end
cmd: dotnet-coverage shutdown -t
Expected:
Each snapshot should produce coverage for only the test that executed since the previous reset. The -r option should clear the previous coverage state after creating the snapshot.
Actual:
The second snapshot still contains coverage from the earlier test or from a previous unrelated run. The raw .coverage output is already incorrect before mapper logic runs, which indicates the issue is in the coverage engine/server-mode reset behavior and not in downstream parsing.
Impact:
Incorrect coverage attribution, false pass/fail evidence, broken file-to-test mapping.
Note:
This issue is specific to dotnet-coverage collect --server-mode with repeated snapshot -r calls in the same process/session. It is not the same as MTP JSON-RPC server mode (--server / --server jsonrpc), which is a separate feature for IDE/tooling integration. The bug is therefore in the coverage collector/server-mode flow, not in the MTP test runner or mapper logic.
Relevant docs:
https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-code-coverage
https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-server-mode
https://github.com/microsoft/codecoverage
- 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/codecoverage
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
microsoft/codecoverage#252 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
microsoft/codecoverage#251 ·
-
[BUG] Intermittent Windows 0xC0000005 crashes in MTP test hosts with CodeCoverage on .NET 10Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/codecoverage#249 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/codecoverage#220 · 2 comentarios ·
-
False positive branch coverageAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
microsoft/codecoverage#218 ·
Todos los issues de microsoft/codecoverage
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
MicrosoftLearning/PL-400_Microsoft-Power-Platform-Developer#231 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
joinrpg/joinrpg-net#5313 ·
Los mantenedores suelen responder en 1 día
-
[12.x] FixIncorrectOwnerIdRelationships can delete legitimate library roots when UserView shares the same pathPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día