Skip to content

$paramStopPSFFunction Leak To Global Scope #697

@mattcargile

Description

@mattcargile

Would you be willing to add a Remove-Variable paramStopPSFFunction after Stop-PSFFunction but before return to _ErrorScript on these classes? This is my guess as to why this variable pops up in my global scope.

private string _ErrorScript = @"
param (
$__PSFramework__Message,
$__PSFramework__Exception,
$__PSFramework__Target,
$__PSFramework__Continue,
$__PSFramework__ContinueLabel,
$__PSFramework__FunctionName,
$__PSFramework__ModuleName,
$__PSFramework__File,
$__PSFramework__Line,
$__PSFramework__Cmdlet,
$__PSFramework__EnableException
)
$paramStopPSFFunction = @{
Message = $__PSFramework__Message
Exception = $__PSFramework__Exception
Target = $__PSFramework__Target
Continue = $__PSFramework__Continue
FunctionName = $__PSFramework__FunctionName
ModuleName = $__PSFramework__ModuleName
File = $__PSFramework__File
Line = $__PSFramework__Line
Cmdlet = $__PSFramework__Cmdlet
EnableException = $__PSFramework__EnableException
StepsUpward = 1
}
if ($__PSFramework__ContinueLabel) { $paramStopPSFFunction['ContinueLabel'] = $__PSFramework__ContinueLabel }
Stop-PSFFunction @paramStopPSFFunction
return
";

private string _ErrorScript = @"
param (
$__PSFramework__Message,
$__PSFramework__Exception,
$__PSFramework__FunctionName,
$__PSFramework__ModuleName,
$__PSFramework__File,
$__PSFramework__Line,
$__PSFramework__Cmdlet,
$__PSFramework__EnableException
)
$paramStopPSFFunction = @{
Message = $__PSFramework__Message
Exception = $__PSFramework__Exception
FunctionName = $__PSFramework__FunctionName
ModuleName = $__PSFramework__ModuleName
File = $__PSFramework__File
Line = $__PSFramework__Line
Cmdlet = $__PSFramework__Cmdlet
EnableException = $__PSFramework__EnableException
StepsUpward = 1
}
Stop-PSFFunction @paramStopPSFFunction
return
";

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions