-
Notifications
You must be signed in to change notification settings - Fork 397
Description
Describe the bug
.NetNano, accessing DegreesCelcuis of a Default(Temperature) throws NotImplemented Exception.
An unhandled exception of type 'System.NotImplementedException' occurred in UnitsNet.Temperature.dll
Additional information: Can not convert 0 to base units.
To Reproduce
Steps to reproduce the behavior (just an example):
- Create .NetNano project and add UnitsNet.
Execute this code
var x = default(Temperature);
Debug.WriteLine($"{x.DegreesCelsius}");
Behavior
Throws
An unhandled exception of type 'System.NotImplementedException' occurred in UnitsNet.Temperature.dll
Additional information: Can not convert 0 to base units.
Expected behavior
I understand this is a design decision: It wasn't clear that the value is actually a default(Temperature)
If you look at the additional context below, you can see how I bumped into it and the problem that created it.
Maybe a clearer message that the value is a default or unassigned. Does it need an "IsValid" or "IsAssigned" member? Something about "No value assigned to Temperature". Should there be a Temperature.Default member?
Additional context
I found this because another clause assigned its property to default(Temperature) which I stored and tried to access later, resulting in this error.
It just not easy to see or detect that the class is a default(Temperature) and not an actually assigned valid value)