diff --git a/src/System.Management.Automation/help/HelpNotFoundException.cs b/src/System.Management.Automation/help/HelpNotFoundException.cs index 5b8771886..3cf3a2b19 100644 --- a/src/System.Management.Automation/help/HelpNotFoundException.cs +++ b/src/System.Management.Automation/help/HelpNotFoundException.cs @@ -62,7 +62,11 @@ namespace Microsoft.PowerShell.Commands /// private void CreateErrorRecord() { - _errorRecord = new ErrorRecord(new ParentContainsErrorRecordException(this), "HelpNotFound", ErrorCategory.ResourceUnavailable, null); + string errMessage = string.Format(HelpErrors.HelpNotFound, _helpTopic); + + // Don't do ParentContainsErrorRecordException(this), as this causes recursion, and creates a + // segmentation fault on Linux + _errorRecord = new ErrorRecord(new ParentContainsErrorRecordException(errMessage), "HelpNotFound", ErrorCategory.ResourceUnavailable, null); _errorRecord.ErrorDetails = new ErrorDetails(typeof(HelpNotFoundException).GetTypeInfo().Assembly, "HelpErrors", "HelpNotFound", _helpTopic); }