microsoft / codecoverage

MIT License
79 stars 11 forks source link

Calculator example sample 08 on Apple M1 gives "No code coverage data available. Profiler was not initialized." #125

Closed sjasperse closed 2 months ago

sjasperse commented 3 months ago

I am hoping to use a scenario similar to the example in samples/Calculator/scenarios/scenario08, but I am receiving a "No code coverage data available. Profiler was not initialized." message when running the script. This happens on my machine, and in a mcr.microsoft.com/dotnet/sdk:8.0 container on my machine.

sample01 seems to work fine.

Any advice for me? This is my first under-the-hood foray into code coverage.

Processor: Apple M1 Pro OS: Sonoma 14.5 Output:

$ dotnet-coverage collect -f cobertura "dotnet run --no-build add 10 24"
Microsoft (R) Code Coverage Command Line Tool (arm64)
Copyright (c) Microsoft Corporation. All rights reserved.

SessionId: 46e2a3bf-b5c3-42b2-ab44-832b5120c3bc
34
No code coverage data available. Profiler was not initialized.
Code coverage results: output.cobertura.xml.

Log file:

2024-06-28 16:30:36.898 -04:00 [INF] Starting collection for session id: 46e2a3bf-b5c3-42b2-ab44-832b5120c3bc
2024-06-28 16:30:36.913 -04:00 [INF] ConsoleStaticNativeInstrumenterFactory.Create:  not found.
2024-06-28 16:30:36.918 -04:00 [INF] ReportGenerator.LoadGenerators. OutputType: cobertura
2024-06-28 16:30:36.930 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: acquired lock. Creating new connection.
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: Created new connection. Number of connections: 0
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: acquired lock. Creating new connection.
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: Created new connection. Number of connections: 0
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: acquired lock. Creating new connection.
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: Created new connection. Number of connections: 0
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: acquired lock. Creating new connection.
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: Created new connection. Number of connections: 0
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: acquired lock. Creating new connection.
2024-06-28 16:30:36.936 -04:00 [INF] PipeConnectionsManager.OpenConnectionInternal: Created new connection. Number of connections: 0
2024-06-28 16:30:36.938 -04:00 [VRB] Configuring environment variable key: CODE_COVERAGE_SESSION_NAME, value: 46e2a3bf-b5c3-42b2-ab44-832b5120c3bc
2024-06-28 16:30:36.938 -04:00 [VRB] Configuring environment variable key: CODE_COVERAGE_PIPE_COUNT, value: 1
2024-06-28 16:30:36.938 -04:00 [VRB] Configuring environment variable key: CODE_COVERAGE_PIPE_PATH, value: /var/folders/wl/7vszwbkx7_qfppwxsr3vkxr00000gn/T/46e2a3bf-b5c3-42b2-ab44-832b5120c3bc/.pipe
2024-06-28 16:30:36.938 -04:00 [VRB] Configuring environment variable key: MicrosoftInstrumentationEngine_DisableCodeSignatureValidation, value: 1
2024-06-28 16:30:36.938 -04:00 [VRB] Configuring environment variable key: CODE_COVERAGE_FLAGS, value: 6
2024-06-28 16:30:36.939 -04:00 [VRB] ProcessFactory: Starting process: fileName: dotnet, arguments: run --no-build add 10 24
2024-06-28 16:30:36.984 -04:00 [INF] Started process id: 39157
2024-06-28 16:30:37.281 -04:00 [INF] Process ID 39157 exited.
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.WaitForDisconnection: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.WaitForDisconnection: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.WaitForDisconnection: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.WaitForDisconnection: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.WaitForDisconnection: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.Stop: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.Stop: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.Stop: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.Stop: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.283 -04:00 [VRB] PipeConnection.Stop: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.286 -04:00 [INF] CoberturaReportGenerator.GenerateReport: number of packages: 0 modules: 0
2024-06-28 16:30:37.287 -04:00 [INF] Report generator: CoberturaReportGenerator, output file: output.cobertura.xml
2024-06-28 16:30:37.288 -04:00 [VRB] PipeConnection.Stop: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.288 -04:00 [VRB] PipeConnection.Stop: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.288 -04:00 [VRB] PipeConnection.Stop: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.288 -04:00 [VRB] PipeConnection.Stop: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.288 -04:00 [VRB] PipeConnection.Stop: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.291 -04:00 [INF] LoggerBase.OnShutdown: Logger is shutting down.
2024-06-28 16:30:37.291 -04:00 [WRN] CollectCommandHandler.Collect: No code coverage data available. Profiler was not initialized.
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.292 -04:00 [VRB] PipeConnection.Stop: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.293 -04:00 [VRB] PipeConnection.Stop: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.293 -04:00 [VRB] PipeConnection.Stop: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.293 -04:00 [VRB] PipeConnection.Stop: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.293 -04:00 [VRB] PipeConnection.Stop: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.294 -04:00 [INF] PipeConnection.OnClientConnected: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 connection was not made. Exception: Pipe is broken.
2024-06-28 16:30:37.294 -04:00 [INF] PipeConnection.OnClientConnected: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 connection was not made. Exception: Pipe is broken.
2024-06-28 16:30:37.294 -04:00 [VRB] PipeConnection.OnClientConnected: 6385d1a7-eb7a-4136-b86b-a2ef5816e0e0 finished
2024-06-28 16:30:37.294 -04:00 [INF] PipeConnection.OnClientConnected: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 connection was not made. Exception: Pipe is broken.
2024-06-28 16:30:37.294 -04:00 [VRB] PipeConnection.OnClientConnected: f5477ae0-1259-4d20-b2ff-ded7a8a478d5 finished
2024-06-28 16:30:37.294 -04:00 [INF] PipeConnection.OnClientConnected: 7527d74e-1381-44c6-8a66-65fa67415336 connection was not made. Exception: Pipe is broken.
2024-06-28 16:30:37.294 -04:00 [VRB] PipeConnection.OnClientConnected: 7527d74e-1381-44c6-8a66-65fa67415336 finished
2024-06-28 16:30:37.294 -04:00 [VRB] PipeConnection.OnClientConnected: 86f2f3ec-0603-4eaa-8fb1-a5ba04ba5860 finished
2024-06-28 16:30:37.296 -04:00 [INF] PipeConnection.OnClientConnected: a84d05b5-171c-4492-ab71-534d1251a1fb connection was not made. Exception: Operation canceled
2024-06-28 16:30:37.296 -04:00 [VRB] PipeConnection.OnClientConnected: a84d05b5-171c-4492-ab71-534d1251a1fb finished
2024-06-28 16:30:37.298 -04:00 [VRB] Cleanup session directory folder '/var/folders/wl/7vszwbkx7_qfppwxsr3vkxr00000gn/T/46e2a3bf-b5c3-42b2-ab44-832b5120c3bc'
fhnaseer commented 3 months ago

Are you able to run Scenario 08 Code coverage for console application and Scenario 09 Code coverage for console application - static instrumentation?

jakubch1 commented 2 months ago

Dynamic instrumentation is not supported on macOS arm64. You have to specify --include-files REGEX to enable static instrumentation.