0
Vote

Cannot serialize expressions that include captured variables

description

captured variables are compiled into private sealed classes and therefore cannot be serialized - trying to serializing such an expression fails

comments

ericksoa wrote Aug 15, 2008 at 3:47 AM

I think for now we just have to accept this as a limitation.

mwpowellnm wrote Sep 4, 2011 at 2:55 PM

it's been awhile since this was last commented on. can you clarify what this means? if I understand it rightly, if I capture a local variable int i = 3 in my Lambda Expression prior to serializing, I should be unable to compile or necessarily invoke the same Lambda Expression when I deserialize it... unless I've also got an int i in the same scope as that? thank you... if so, it seems to me variables that can be "seen" is a reasonable "limitation" operating with Lambdas, and necessarily disciplines developers to make proper use of them.

wrote Feb 14, 2013 at 1:45 AM