Prevent telemetry host termination on boolean MSTest setting payloads#8189
Draft
Copilot wants to merge 2 commits into
Draft
Prevent telemetry host termination on boolean MSTest setting payloads#8189Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix test failures in Assert.AreEqual for telemetry events
Prevent telemetry host termination on boolean MSTest setting payloads
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.