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

Ivan Porto Carrero ivan at cloudslide.net
Thu Jun 3 00:55:38 EDT 2010


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 Carrero

On Thu, Jun 3, 2010 at 12:01 AM, 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/35b8e27e/attachment.html>


More information about the Ironruby-core mailing list