Skip to content

Commit 6734b71

Browse files
dotMortennohwnd
andauthored
Add platform guard (#4737)
Co-authored-by: Jakub Jareš <[email protected]>
1 parent 29edc28 commit 6734b71

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Microsoft.TestPlatform.CoreUtilities/Output/OutputExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ private static void SetColorForAction(ConsoleColor foregroundColor, Action actio
116116
return;
117117
}
118118

119+
#if NET5_0_OR_GREATER
120+
if (OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsBrowser() || OperatingSystem.IsTvOS())
121+
{
122+
// Console color not supported on these platforms.
123+
action.Invoke();
124+
return;
125+
}
126+
#endif
127+
119128
var previousForegroundColor = Console.ForegroundColor;
120129
try
121130
{

0 commit comments

Comments
 (0)