[Mono-dev] Regression in XmlSerializer Specified fields since PR 1257

David Curylo curylod at asme.org
Wed Apr 1 05:04:22 UTC 2015

PR #1257 seems to be causing a new regression for me since upgrading from 3.8.0 to 3.12.1 (this PR was merged before 3.10.0).  Xml serialization from SOAP responses where {V}Specified values would need to be set are no longer reliably set.  The only way to get them to work reliably seems to be if I add ShouldSerialize{V} methods.  It seems to go back to this commit.


It seems that in some cases, the {V}Specified boolean isn’t getting set.  It’s sporadic for me when this issue actually occurs, so I don’t yet have an isolated test case, but looking through the code, this logic doesn’t seem right to me:

public bool IsValueSpecifiedSettable () { 
    return ((PropertyInfo) _specifiedMember).CanWrite;
    return ((FieldInfo) _specifiedMember).IsInitOnly;


If it’s a writable property we return true, but if it's a read-only field, we also return true?  I think we’d want to return false if it were a read-only field and since mine (and probably everyone’s) {V}Specified fields are generated public boolean fields, then this results in a false so specified doesn’t get set.  I’m guessing there is some other race going on because it is set sometimes, not others.  Anyone else having issues with {V}Specified fields since this fix?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150401/da917c9e/attachment.html>

More information about the Mono-devel-list mailing list