Skip to content

Commit 9dd9322

Browse files
authored
Remove unused GUID detection code from console host (#18871)
1 parent 7afe843 commit 9dd9322

2 files changed

Lines changed: 0 additions & 58 deletions

File tree

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostUserInterface.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,9 +1206,6 @@ internal string WrapToCurrentWindowWidth(string text)
12061206
/// </exception>
12071207
public override void WriteDebugLine(string message)
12081208
{
1209-
// don't lock here as WriteLine is already protected.
1210-
message = HostUtilities.RemoveGuidFromMessage(message, out _);
1211-
12121209
// We should write debug to error stream only if debug is redirected.)
12131210
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
12141211
{
@@ -1266,9 +1263,6 @@ public override void WriteInformation(InformationRecord record)
12661263
/// </exception>
12671264
public override void WriteVerboseLine(string message)
12681265
{
1269-
// don't lock here as WriteLine is already protected.
1270-
message = HostUtilities.RemoveGuidFromMessage(message, out _);
1271-
12721266
// NTRAID#Windows OS Bugs-1061752-2004/12/15-sburns should read a skin setting here...)
12731267
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
12741268
{
@@ -1309,9 +1303,6 @@ public override void WriteVerboseLine(string message)
13091303
/// </exception>
13101304
public override void WriteWarningLine(string message)
13111305
{
1312-
// don't lock here as WriteLine is already protected.
1313-
message = HostUtilities.RemoveGuidFromMessage(message, out _);
1314-
13151306
// NTRAID#Windows OS Bugs-1061752-2004/12/15-sburns should read a skin setting here...)
13161307
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
13171308
{
@@ -1346,13 +1337,6 @@ public override void WriteProgress(long sourceId, ProgressRecord record)
13461337
return;
13471338
}
13481339

1349-
bool matchPattern;
1350-
string currentOperation = HostUtilities.RemoveIdentifierInfoFromMessage(record.CurrentOperation, out matchPattern);
1351-
if (matchPattern)
1352-
{
1353-
record = new ProgressRecord(record) { CurrentOperation = currentOperation };
1354-
}
1355-
13561340
// We allow only one thread at a time to update the progress state.)
13571341
if (_parent.ErrorFormat == Serialization.DataFormat.XML)
13581342
{

src/System.Management.Automation/engine/hostifaces/HostUtilities.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -519,48 +519,6 @@ internal static List<string> GetSuggestion(HistoryInfo lastHistory, object lastE
519519
return returnSuggestions;
520520
}
521521

522-
/// <summary>
523-
/// Remove the GUID from the message if the message is in the pre-defined format.
524-
/// </summary>
525-
/// <param name="message"></param>
526-
/// <param name="matchPattern"></param>
527-
/// <returns></returns>
528-
internal static string RemoveGuidFromMessage(string message, out bool matchPattern)
529-
{
530-
matchPattern = false;
531-
if (string.IsNullOrEmpty(message))
532-
return message;
533-
534-
const string pattern = @"^([\d\w]{8}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{12}:).*";
535-
Match matchResult = Regex.Match(message, pattern);
536-
if (matchResult.Success)
537-
{
538-
string partToRemove = matchResult.Groups[1].Captures[0].Value;
539-
message = message.Remove(0, partToRemove.Length);
540-
matchPattern = true;
541-
}
542-
543-
return message;
544-
}
545-
546-
internal static string RemoveIdentifierInfoFromMessage(string message, out bool matchPattern)
547-
{
548-
matchPattern = false;
549-
if (string.IsNullOrEmpty(message))
550-
return message;
551-
552-
const string pattern = @"^([\d\w]{8}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{4}\-[\d\w]{12}:\[.*\]:).*";
553-
Match matchResult = Regex.Match(message, pattern);
554-
if (matchResult.Success)
555-
{
556-
string partToRemove = matchResult.Groups[1].Captures[0].Value;
557-
message = message.Remove(0, partToRemove.Length);
558-
matchPattern = true;
559-
}
560-
561-
return message;
562-
}
563-
564522
/// <summary>
565523
/// Create suggestion with string rule and scriptblock suggestion.
566524
/// </summary>

0 commit comments

Comments
 (0)