Bug in mscorlib, IronRuby, NewtonSoft.json..... or my code?

Hi,

I’m trying to use a third party library which has a dependency on
NewtonSoft.json. I create a class within IronRuby and attempt to
serialise the object to Json however it throws a null reference
exception from within mscorlib.

Any ideas?? Example is below:

Thanks

Ben

class Company
attr_accessor :Name, :Id
end

c = Company.new
c.Name = ‘test’

require ‘Newtonsoft.Json’
include Newtonsoft::Json
JsonConvert.serialize_object c

mscorlib:0:in Equals': Object reference not set to an instance of an object. (System::NullReferenceException) from mscorlib:0:inIndexOf’
from mscorlib:0:in IndexOf' from mscorlib:0:inIndexOf’
from Newtonsoft.Json:0:in CheckForCircularReference' from Newtonsoft.Json:0:inSerializeList’
from Newtonsoft.Json:0:in SerializeValue' from Newtonsoft.Json:0:inSerializeISerializable’
from Newtonsoft.Json:0:in SerializeValue' from Newtonsoft.Json:0:inSerializeISerializable’
from Newtonsoft.Json:0:in SerializeValue' from Newtonsoft.Json:0:inWriteMemberInfoProperty’
from Newtonsoft.Json:0:in SerializeObject' from Newtonsoft.Json:0:inSerializeValue’
from Newtonsoft.Json:0:in WriteMemberInfoProperty' from Newtonsoft.Json:0:inSerializeObject’
from Newtonsoft.Json:0:in SerializeValue' from Newtonsoft.Json:0:inSerializeISerializable’
from Newtonsoft.Json:0:in SerializeValue' from Newtonsoft.Json:0:inSerialize’
from Newtonsoft.Json:0:in SerializeInternal' from Newtonsoft.Json:0:inSerializeObject’
from Newtonsoft.Json:0:in `SerializeObject’
from (ir):1

make the class backed by a real .NET Type not a ruby type and the
serializer
will work again

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.

I’m halfway through a library which serializes dynamic types to JSON. I
guess that should work in this case; I’ll post when it’s done.

Cheers,
Mark