[Mono-list] Not implemented exceptions in Getters

Dave Curylo curylod at asme.org
Sun Jul 13 03:31:15 UTC 2014

Hello, there.  I don't know enough about what you're trying to do to be
able to propose a viable option, just trying to help you out, and if you
can't set the properties on deserialization, it seems worthless to
serialize them.  Anyway, you're clearly not serializing a hashtable of
string:string.  Doing so requires no custom serialization and as you
pointed out, your stack trace shows the exception serializing FieldInfo.
 But if you're writing something that is so tightly coupled to .NET that
you're serializing reflection types, then why bother with JSON

On Saturday, July 12, 2014, Kevin Connell <kevin at connells.net> wrote:

> Ummm.. dont think its a viable option to not serialize get only
> properties.
> I have been able to work around it but it's just stupid to have had to
> create a custom serialization routine for string:string in a hashtable.
> Hello.
> On Jul 12, 2014 9:08 PM, "Dave Curylo" <curylod at asme.org
> <javascript:_e(%7B%7D,'cvml','curylod at asme.org');>> wrote:
>> Git blame shows Marek Safar added those properties.  They are needed for
>> .NET 4.0 compatibility, but since mono does not support code access
>> security, they can't really be supported.  The argument could be made for
>> these to return false since everything running under mono essentially runs
>> as fully trusted and nothing gets special treatment as "security critical"
>> code.  Code access security is not implemented, but then at least these
>> properties could be.
>> To solve your immediate problem, you could provide a custom
>> IContractResolver and tell it to ignore get-only properties, which would
>> cover these that aren't implemented.  Chances are good if you're
>> serializing types you can't control, you'll eventually need this sort of
>> customization anyway.  See here for an example:
>> http://stackoverflow.com/questions/18543482/c-sharp-is-there-a-way-to-ignore-get-only-properties-in-json-net-serializer-with
>> On Saturday, July 12, 2014, Kevin Connell <kevin at connells.net
>> <javascript:_e(%7B%7D,'cvml','kevin at connells.net');>> wrote:
>>> https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Reflection/FieldInfo.cs
>>> Line 281
>>> Sorry, Not sure on the process for a pull request, but its a getter on a
>>> public property with a throw in the main branch,and its the same property
>>> that is indicated in the stack trace I sent.
>>> cc:author
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140712/5cb3c0b9/attachment.html>

More information about the Mono-list mailing list