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
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to