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
I'm trying to declare a property for a custom YearMonthPicker. I'm adding a string property, and I'm expecting it not to be null because I'll be providing a default value. However, even tho the property itself is not marked as nullable, the generated code is:
/// <summary>
/// Default value: "MMMM yyyy"
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("DependencyPropertyGenerator", "1.4.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public string? StringFormat
{
get => (string?)GetValue(StringFormatProperty);
set => SetValue(StringFormatProperty, value);
}
Yes, in general this sounds logical.
But there are two ways here - make a Nullable parameter for the attribute with the default value true and the ability to make it false
Or make the property non-nullable automatically if DefaultValue is set. There may be problems here if under certain conditions this property may be null sometimes.
I was thinking that, to guarantee a non-null value, a coerce-value callback should also be provided. Maybe having a NonNullable property could make the DefaultValue and Coerce method required, with the correct nullability for the method...
Describe the bug
I'm trying to declare a property for a custom YearMonthPicker. I'm adding a string property, and I'm expecting it not to be null because I'll be providing a default value. However, even tho the property itself is not marked as nullable, the generated code is:
Steps to reproduce the bug
Declare a class, and add the following attribute:
Expected behavior
Screenshots
No response
NuGet package version
1.4.0
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: