Consider the following code (or see first attachment):
https://gist.github.com/1120414
The second call to Execute(scope1) fails with NullReferenceException. When I make variable i global ($i), there is no exception, if I use no custom scope there is no exception.
The bug occurs even if I do not use Dictionary to initilize the scope.
Stack trace is:
https://gist.github.com/1120408