Prevent telemetry host termination on boolean MSTest setting payloads#8189
Prevent telemetry host termination on boolean MSTest setting payloads#8189Copilot wants to merge 4 commits into
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
|
/review |
|
❌ Expert Code Review (command) failed. Please review the logs for details. |
There was a problem hiding this comment.
Pull request overview
This PR hardens telemetry ingestion so boolean payload values no longer terminate debug hosts, and adds regression coverage for boolean telemetry normalization.
Changes:
- Converts boolean telemetry payload values with
AsTelemetryBool(). - Adds a unit test verifying boolean telemetry properties are emitted as telemetry strings.
Show a summary per file
| File | Description |
|---|---|
src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs |
Removes the debug assertion path for boolean telemetry values and serializes them normally. |
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/AppInsightsProviderTests.cs |
Adds regression coverage for logging a boolean telemetry property. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
|
|
||
| await appInsightsProvider.DisposeAsync(); |
|
@copilot address review comments and fix the following issues: @azure-pipelines src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs(87,9): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name '_task' does not exist in the current context @azure-pipelines src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs(264,9): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'RoslynDebug' does not exist in the current context @azure-pipelines src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs(87,9): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name '_task' does not exist in the current context @azure-pipelines src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs(264,9): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'RoslynDebug' does not exist in the current context @azure-pipelines src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs(87,9): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name '_task' does not exist in the current context |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Addressed in a450882.
|
Bug Fix
What was the bug?
Telemetry acceptance runs were failing on Linux Debug with exit code
134becauseAppInsightsProviderhit a debug assertion when a telemetry payload contained abool(mstest.setting.parallelization_enabled). That assertion terminated the host during telemetry ingestion.How did you fix it?
AppInsightsProviderto treatboolpayload values as valid input and serialize them viaAsTelemetryBool()without asserting."true"/"false") while removing a process-killing path in debug builds.AppInsightsProviderTeststhat logs a payload containing a boolean property and verifies the emitted property isTelemetryProperties.True.Testing
AppInsightsProviderTests.Original prompt
Fix the following test failures
@azure-pipelines
azure-pipelines
/ microsoft.testfx (Build Linux Debug)
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs#L259
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs(259,1): error : [MTP_DiscoverTests_SendsTelemetryEvent ("net10.0")] [net11.0] Assert.AreEqual failed. Expected:<0>. Actual:<134>. 'expected' expression: 'exitCode', 'actual' expression: 'testHostResult.ExitCode'. Expression 'AssertExitCodeIs' failed for member 'MTP_DiscoverTests_SendsTelemetryEvent' at line 64 of file '/_/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs'. Output of the test host is:
Command: /mnt/vss/_work/1/s/artifacts/tmp/Debug/testsuite/2vdru/TelemetryTests/bin/Release/net10.0/TelemetryMTPProject --list-tests --diagnostic
ExitCode: 134
StandardOutput:
MSTest v4.3.0-ci (UTC 05/13/2026) [linux-x64 - .NET 10.0.8]
Diagnostic file (level 'Trace' with async flush): /mnt/vss/_work/1/s/artifacts/tmp/Debug/testsuite/2vdru/TelemetryTests/bin/Release/net10.0/TestResults/log_260513163920798.diag
PassingTest
DataDrivenTest (1)
DataDrivenTest (2)
TestWithTimeout
Test discovery summary: found 4 test(s) - /mnt/vss/_work/1/s/artifacts/tmp/Debug/testsuite/2vdru/TelemetryTests/bin/Release/net10.0/TelemetryMTPProject.dll (net10.0|x64)
duration: 1s 265ms
StandardError:
Process terminated.
Assertion failed.
Telemetry entry 'mstest.setting.parallelization_enabled' contains a boolean value, boolean values should always be converted to string using: .AsTelemetryBool()
at Microsoft.Testing.Platform.RoslynDebug.Assert(Boolean b, String message) in //src/Platform/Microsoft.Testing.Platform/Helpers/RoslynDebug.cs:line 21
at Microsoft.Testing.Extensions.Telemetry.AppInsightsProvider.IngestLoopAsync() in //src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs:line 192
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Testing.Extensions.Telemetry.AppInsightsProvider.IngestLoopAsync()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Check failure on line 259 in src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs
@azure-pipelines
azure-pipelines
/ microsoft.testfx (Build Linux Debug)
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs#L259
src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs(259,1): error : [MTP_RunTests_SendsTelemetryWithSettingsAndAttributes ("net10.0")] [net11.0] Assert.AreEqual failed. Expected:<0>. Actual:<134>. 'expected' expression: 'exitCode', 'actual' expression: 'testHostResult.ExitCode'. Expression 'AssertExitCodeIs' failed for member 'MTP_RunTests_SendsTelemetryWithSettingsAndAttributes' at line 31 of file '/_/test/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.cs'. Output of the test host is:
Command: /mnt/vss/_work/1/s/artifacts/tmp/Debug/testsuite/2vdru/TelemetryTests/bin/Release/net10.0/TelemetryMTPProject --diagnostic
ExitCode: 134
StandardOutput:
MSTest v4.3.0-ci (UTC 05/13/2026) [linux-x64 - .NET 10.0.8]
Diagnostic file (level 'Trace' with async flush): /mnt/vss/_work/1/s/artifacts/tmp/Debug/testsuite/2vdru/TelemetryTests/bin/Release/net10.0/TestResults/log_260513163920757.diag
Telemetry
Microsoft Testing Platform collects usage data in order to help us improve your experience. The data is collected by Microsoft and are not shared with anyone.
You can opt-out of telemetry by setting the TESTINGPLATFORM_TELEMETRY_OPTOUT or DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about Microsoft Testing Platform telemetry: https://aka.ms/testingplatform/telemetry
StandardError:
Process terminated.
Assertion Failed
Telemetry entry 'mstest.setting.parallelization_enabled' contains a boolean value, boolean values should always be converted to string using: .AsTelemetryBool()
at Microsoft.Testing.Platform.RoslynDebug.Assert(Boolean b, String message) in //src/Platform/Microsoft.Testing.Platform/Helpers/RoslynDebug.cs:line 21
at Microsoft.Testing.Extensions.Telemetry.AppInsightsProvider.IngestLoopAsync() in //src/Platform/Microsoft.Testing.Extensions.Telemetry/AppInsightsProvider.cs:line 192
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ...
Created from VS Code.