Hi all,
I'm working on a project that involves some home-made (de-)serialization code, and I have run into some issues with the deserializing of a List. The following code is throwing a NullReferenceException on the second line, even though the var list
is not null, and happily reports Count = 0
when hovering my mouse over it.
System.Collections.IList list = ((System.Collections.IList)obj);
list.Add(val);
My variables are being instantiated a bit weird, so maybe that has got something to do with it? This is the code involved.
System.Runtime.Serialization.FormatterServices.GetUninitializedObject(type);
Where type
is
System.Type.GetType("System.Collections.Generic.List`1[[Networking.Client, Networking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Any help would be much appreciated :)