-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TrxLogger throws on certain platforms #4736
Comments
dotMorten
added a commit
to dotMorten/vstest
that referenced
this issue
Nov 5, 2023
dotMorten
added a commit
to dotMorten/MSTestX
that referenced
this issue
Nov 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
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:vstest/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs
Line 413 in 9e360a6
Screenshot from trx failling with callstack:
Environment
iOS and Android
The text was updated successfully, but these errors were encountered: