[Ironruby-core] Bug in mscorlib, IronRuby, NewtonSoft.json..... or my code?

Mark Rendle mark at markrendle.net
Thu Jun 3 04:51:07 EDT 2010


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

On Wed, Jun 2, 2010 at 11:01 PM, Ben Hall <ben2004uk at googlemail.com> wrote:

> 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:in `IndexOf'
>        from mscorlib:0:in `IndexOf'
>        from mscorlib:0:in `IndexOf'
>        from Newtonsoft.Json:0:in `CheckForCircularReference'
>        from Newtonsoft.Json:0:in `SerializeList'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `SerializeISerializable'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `SerializeISerializable'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `WriteMemberInfoProperty'
>        from Newtonsoft.Json:0:in `SerializeObject'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `WriteMemberInfoProperty'
>        from Newtonsoft.Json:0:in `SerializeObject'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `SerializeISerializable'
>        from Newtonsoft.Json:0:in `SerializeValue'
>        from Newtonsoft.Json:0:in `Serialize'
>        from Newtonsoft.Json:0:in `SerializeInternal'
>        from Newtonsoft.Json:0:in `SerializeObject'
>        from Newtonsoft.Json:0:in `SerializeObject'
>        from (ir):1
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100603/22fdbbaf/attachment.html>


More information about the Ironruby-core mailing list