Search

ScriptBlock GetNewClosure do not inherit strict mode. by PetSerAl

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)
1
User(s) can reproduce this bug
Set-StrictMode -Version Latest
$SB={$NonExistedVariable}
$SB_NC=$SB.GetNewClosure()
&$SB #Error
&$SB_NC #No error
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

I don't know if this issue existed previously
Reproduction Steps
 
Expected Results
 
File Attachments
0 attachments
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