Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I have a nullable decimal property which wraps an XElement value. The setter uses XElement's SetElementValue.
When I try setting this property to a decimal, the HasValue property does not turn to true. When I look at the nonpublic members of the nullable decimal, the value was set correctly, but has_value is still false.
This makes the public value exhibit a System.InvalidOperation Exception: Nullable object must have a value, likely because the public HasValue is equal false.
Somewhere, has_value isn't getting set to true when it should be, when using SetElementValue, causing the property to be nonfunctional.
Based on your description is this code sample similar to yours? It seems to exhibit the correct behavior for me.
XElement element = new XElement("TestNode");
public decimal? DecimalProperty
May I also ask what version of Mono for Android you're using and if you're using Visual Studio or MonoDevelop.
It appears in this case, the debugger was giving me false information. Indeed, grabbing the element value afterwards and putting it in a variable works.
I've found what the actual bug was, but I'll put that in another ticket.
For reference, using the latest 4.06 Mono for Android targeted at Android 2.2 and using Visual Studio 2010