ekonbenefits / impromptu-interface

Static interface to dynamic implementation (duck casting). Uses the DLR combined with Reflect.Emit.
Apache License 2.0
655 stars 67 forks source link

Generating serilizable proxies #18

Closed HEskandari closed 8 years ago

HEskandari commented 8 years ago

I'm using the library to proxy an object as an interface, e.g.

[Serializable]
public class MyDTO
{
   Guid Id { get; set; }
}

public interface MyInterface 
{
   Guid Id { get; }
}

var obj = new MyDTO(...);
var interf = obj.ActLike<MyInterface>();

It works fine and proxy is generated as expected but the problem is that my DTO is serializable as I need to pass it around AppDomain boundaries but the generated proxy is non-serializable.

Is this supported or is it a bug? Any way I can work around it?

HEskandari commented 8 years ago

Scratch that...after digging into the problem turned out to be AppDomain related issue.