Bug 16422 - Evaluator.Evaluate Issue using variables inside an Action or Func
Summary: Evaluator.Evaluate Issue using variables inside an Action or Func
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 3.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-11-24 11:08 UTC by benb7760
Modified: 2013-12-11 14:08 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Visual studio project showing bug (3.15 MB, application/x-zip-compressed)
2013-11-24 11:08 UTC, benb7760
Details

Description benb7760 2013-11-24 11:08:57 UTC
Created attachment 5521 [details]
Visual studio project showing bug

I am using Evaluator.Evaluate to return a Func. Inside that func i declare a variable, then another func which attempts to use this variable. Trying to use the variable inside a new Func causes an Internal Compiler Error
Comment 1 Marek Safar 2013-12-11 14:08:03 UTC
This is caused by not cloning LocalInfo's, it then points to wrong (not cloned) block. Changing this would require to make same extra cloning of TopLevelBlock names cache as we do for labels.

This can be workarounded by assigning the new to variable. E.g. changing the code to

"var temp = new Func<int>(()=>{"+......

Note You need to log in before you can comment on or make changes to this bug.