If this is the same issue that I had, check: http://www.codeplex.com/Json/Thread/View.aspx?ThreadId=18188
2008/12/12 Jan Limpens <[email protected]> > > I see, the JSONSerializer stumbles over all those nh proxies. That's > kind of bad, how is this handled by the AR folks? > With a reasonably complex model one would have to download the whole > database to meet the requirements of the serializer. I'd much prefer > it would shut up and serialize whats actually there and not die on a > thing like that. Seems its back to (anonymous or not) DTOs, if you > want to use that guy... > > > On Fri, Dec 12, 2008 at 10:49 AM, Colin Ramsay <[email protected]> > wrote: > > > > This is a problem with the underlying newtonsoft library and is to do > > with the NH proxy - objects coming from NH will inherit from a > > dynamically created class. Have a search on the newtonsoft codeplex > > site, I'm sure Lee Henson posted another solution on there. > > > > On Fri, Dec 12, 2008 at 12:41 PM, Jan Limpens <[email protected]> > wrote: > >> > >> Hey guys, > >> > >> quite many times (always?), when I try to serialize a nhibernate > >> entity with the JSONReturnBinder, I receive this exception: > >> > >> Method may only be called on a Type for which Type.IsGenericParameter is > true. > >> Description: An unhandled exception occurred during the execution of > >> the current web request. Please review the stack trace for more > >> information about the error and where it originated in the code. > >> > >> Exception Details: System.InvalidOperationException: Method may only > >> be called on a Type for which Type.IsGenericParameter is true. > >> > >> Source Error: > >> > >> Line 36: > >> Line 37: StringWriter writer = new > StringWriter(); > >> Line 38: serializer.Serialize(writer, target); > >> Line 39: > >> Line 40: return > writer.GetStringBuilder().ToString(); > >> > >> > >> Source File: > c:\data\castle\MonoRail\Castle.MonoRail.Framework\Services\NewtonsoftJSONSerializer.cs > >> Line: 38 > >> > >> I can come around this by converting my nhibernate entities into > >> anonymous objects, most of the time, but it would help me, if I > >> understood, exactly what caused the exception. Anyone has got this > >> insight? > >> > >> -- > >> Jan > >> > >> > > >> > > > > > > > > > > > -- > Jan > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
