Merge pull request #889 from PowerShell/help

Fixes seg fault when Get-Help cannot find topic
This commit is contained in:
Andy Schwartzmeyer committed 2016-04-21 14:54:16 -07:00
commit 71ac45467e
1 file changed
+5 -1
@@ -62,7 +62,11 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
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);
}