You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a clean/efficient way to add type checking to the min/max check in ValidatorBase.cs? Currently if your min/max value is a different type from your editor's value type, it throws an exception that gets caught and hidden in ValidatorBase.IsValidValue(). So the user ends up in a loop of being unable to exit the cell - either by modifying the value or pressing ESC.
Simple example code that when you start an edit of the first cell, you can never exit edit mode for the cell:
This is because ValidatorBase throws a System.ArgumentException: 'Object must be of type Int32.' from the CompareTo() because the l_Min and p_Value are different types (int and double):
In my example changing to MinimumValue = 0.0 for the first cell solves the issue.
The simple solution is to just always use the same type for the min/max as the value type. But for the case of doubles or non-32 bit integers there's the chance that it could slip through like this example, and which the current behavior of silently eating the exception it makes it difficult to figure out why it's happening without digging into the source code.
Perhaps a check on the min/max value variable's type to see if they're convertible to the value type before calling the CompareTo() function? Or maybe a check in the property setters? Or is there a way to modify the code to allow the exception or reason why it's not valid to be seen?
The text was updated successfully, but these errors were encountered:
Is there a clean/efficient way to add type checking to the min/max check in
ValidatorBase.cs
? Currently if your min/max value is a different type from your editor's value type, it throws an exception that gets caught and hidden inValidatorBase.IsValidValue()
. So the user ends up in a loop of being unable to exit the cell - either by modifying the value or pressing ESC.Simple example code that when you start an edit of the first cell, you can never exit edit mode for the cell:
This is because ValidatorBase throws a
System.ArgumentException: 'Object must be of type Int32.'
from theCompareTo()
because thel_Min
andp_Value
are different types (int
anddouble
):In my example changing to
MinimumValue = 0.0
for the first cell solves the issue.The simple solution is to just always use the same type for the min/max as the value type. But for the case of doubles or non-32 bit integers there's the chance that it could slip through like this example, and which the current behavior of silently eating the exception it makes it difficult to figure out why it's happening without digging into the source code.
Perhaps a check on the min/max value variable's type to see if they're convertible to the value type before calling the
CompareTo()
function? Or maybe a check in the property setters? Or is there a way to modify the code to allow the exception or reason why it's not valid to be seen?The text was updated successfully, but these errors were encountered: