jeudi 17 décembre 2015

Updating dictionary in a marshalled object

i have a problem updating dictionary that is a property of a MarshallByRef object. My marshalled object is a configuration object that has some basic datatypes and aforementioned dictionary. Is is created on one AppDomain and passed to the other appdomain as an interface.

public clas FFIConfiguration : MarshalByRefObject, IUserConfig
{
    public string UserName {get;set;}
    public DateTime ExecutionTime {get;set;}
    public Dictionary<String, String> ParametersDict { get; set; }
}

This object is passed to another Appdomain where it is used as an interface like this:

IUserConfig config = parameterPassedAsMarshalled;
config.ExecutionTime = DateTime.Now;
config.ParametersDict.Add("Key",Value");
config.ParametersDict["Key"] = "Some other value";

When i try to set any of the int, string or datetime properties it works as charm. But when i add anything to the Dictionary it remains unchanged.

I can serialize the dictionary and store it as string then deserialize it later, but i would really like to avoid this. Is there any other solution to the problem?





Aucun commentaire:

Enregistrer un commentaire