Description
I'm using the TrxLogger to generate TRX reports on the devices I run the unit tests on (Android, iOS etc), but the TRX logger throws an exception when logging the final testrun complete message.
This is because it for some reason writes to the console, but also tries to set the text color of the console:
|
Console.ForegroundColor = previousForegroundColor; |
Setting the foreground color isn't supported on several platforms, as indicated here:
https://learn.microsoft.com/en-us/dotnet/api/system.console.foregroundcolor?view=net-7.0
The call should be guarded with a platform check. It would also be nice to be able to set the output level to None so nothing is writting to the console at all, since it doesn't make sense on some platforms.
Steps to reproduce
Use the TRX logger on iOS or Android. Call OnTestRunComplete on the TrxWriter.
Expected behavior
No PlatformNotSupported exception is thrown
Actual behavior
PlatformNotSupported exception, when TRX Logger hits this:
|
ConsoleOutput.Instance.Information(false, resultsFileMessage); |
Screenshot from trx failling with callstack:

Environment
iOS and Android
Description
I'm using the TrxLogger to generate TRX reports on the devices I run the unit tests on (Android, iOS etc), but the TRX logger throws an exception when logging the final testrun complete message.
This is because it for some reason writes to the console, but also tries to set the text color of the console:
vstest/src/Microsoft.TestPlatform.CoreUtilities/Output/OutputExtensions.cs
Line 127 in 9e360a6
Setting the foreground color isn't supported on several platforms, as indicated here:
https://learn.microsoft.com/en-us/dotnet/api/system.console.foregroundcolor?view=net-7.0
The call should be guarded with a platform check. It would also be nice to be able to set the output level to
Noneso nothing is writting to the console at all, since it doesn't make sense on some platforms.Steps to reproduce
Use the TRX logger on iOS or Android. Call
OnTestRunCompleteon the TrxWriter.Expected behavior
No PlatformNotSupported exception is thrown
Actual behavior
PlatformNotSupportedexception, when TRX Logger hits this:vstest/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs
Line 413 in 9e360a6
Screenshot from trx failling with callstack:

Environment
iOS and Android