Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null check missing before calling a method marked with 'NotNull' attribute #200

Closed
wants to merge 1 commit into from

Conversation

deanchalk
Copy link

Was looking through the code and noticed a missing null check where the method to be called is marked as NotNull

@hughbe
Copy link
Contributor

hughbe commented Dec 22, 2018

I don't see this as much of an improvement. It's also breaking:

We used to get the following error messages:
System.NotSupportedException : 'DateTimeValueSerializer' ValueSerializer cannot convert from '(null)''

Now we'd get an ArgumentException

Following tests confirm current behaviour:

[Theory]
[InlineData(null)]
[InlineData(1)]
public void ConvertFrom_InvalidObject_ThrowsNotSupportedException(object value)
{
    var type = new XamlType(typeof(DateTime), new XamlSchemaContext());
    TypeConverter converter = type.TypeConverter.ConverterInstance;
    Assert.Throws<NotSupportedException>(() => converter.ConvertFrom(value));
}

@deanchalk
Copy link
Author

community feels this isnt valid code, so closed the request

@ghost ghost locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants