Hi,
Let's say I create new composition container in main appdomain and add there an instance of Class1. Then i create Class2 in another app-domain and try to composite it.
When my exports have no metadata - all works fine.
[Export(typeof(IClass1))]
public class Class1 : MarshalByRefObject, IClass1
{
// ...
}
public class Class2 : MarshalByRefObject
{
[ImportMany] IEnumerable<Lazy<IClass1>> Classes1 { get; set; }
// ...
}
But when i add some metadata to it i get exception that metadata can't be passed via app domain bounds since it is not marked as [Serializable].
[Export(typeof(IClass1))]
public class Class1 : MarshalByRefObject, IClass1
{
// ...
}
public class Class2 : MarshalByRefObject
{
[ImportMany] IEnumerable<Lazy<IClass1, IMetadata>> Classes1 { get; set; }
// ...
}
AFAIK, Metadata is just dictionary which is not serializable - that's why it happens.
It would be nice to fix that in the next release