Home Dashboard Directory Help
Search

ScriptBlock GetNewClosure do not inherit strict mode. by PetSerAl


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 776656
Opened: 1/15/2013 10:39:52 PM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

Set-StrictMode -Version Latest
$SB={$NonExistedVariable}
$SB_NC=$SB.GetNewClosure()
&$SB #Error
&$SB_NC #No error
Details
Sign in to post a comment.
Sign in to post a workaround.
Posted by PetSerAl on 1/15/2013 at 10:42 PM
Set-StrictMode -Version Latest
$SB={$NonExistedVariable}
$SB_NC=$SB.GetNewClosure()
.$SB_NC.Module.NewBoundScriptBlock({Set-StrictMode -Version Latest})
&$SB #Error
&$SB_NC #Error