We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8403059 commit f6b0b96Copy full SHA for f6b0b96
src/Common/ColorAndFormat/PSStyle.cs
@@ -31,7 +31,15 @@ public sealed class PSStyle
31
/// <param name="host">PowerShell Console Host</param>
32
public static void Initialize(PSHost host)
33
{
34
- _isEscapeSequenceSupported = host?.UI?.SupportsVirtualTerminal;
+ try
35
+ {
36
+ _isEscapeSequenceSupported = host?.UI?.SupportsVirtualTerminal;
37
+ }
38
+ catch (System.Exception) {
39
+ // Ignore exception and set _isEscapeSequenceSupported to null.
40
+ // The getter of SupportsVirtualTerminal can throw a null reference exception in automation runbooks.
41
+ // see https://github.com/Azure/azure-powershell/issues/26155
42
43
}
44
45
/// <summary>
0 commit comments