-
Notifications
You must be signed in to change notification settings - Fork 10
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
Nullable #2
Comments
First of all, thank you for your feedback, I am always open to comments/feedback. I like the idea to support "Nullable Reference Types", I will include this feature ASAP. Here is my proposal (Taking the string type as an example): If we try to assign "typeof(string?)" as "declaringType" parameter to the method "BindableProperty.Create", we will receive a compilation error, then based on the documentation the nullable reference types are a compile-time feature, that means we can set that parameter like "declaringType = typeof(string)" instead of "declaringType = typeof(string?)".
|
Hi @VladislavAntonyuk , I just sent a new release (Version 0.8.0) that includes the new functionality to support "Nullable Reference Types" Here is the commit. Again, I am always open to comments/feedback, Thanks !! |
Hi @rrmanzano. Thank you for the fix. Unfortunately, I receive this error: CS8669 The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. You can add |
I will create a PR |
Hiya, I'm not seeing this feature functioning as intend in 0.9.2 I.e., I am running .NET 7 and I have the following class: public partial class OpenShiftViewModel : BindableObject
{
[AutoBindable()]
private readonly string? _facility;
[AutoBindable]
private readonly string? _department;
} And the output looks like such: public partial class OpenShiftViewModel
{
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.9.2.0")]
public static readonly Microsoft.Maui.Controls.BindableProperty FacilityProperty =
Microsoft.Maui.Controls.BindableProperty.Create(
nameof(Facility),
typeof(string),
typeof(OpenShiftViewModel),
defaultValue: default(string));
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.9.2.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public string Facility
{
get => (string)GetValue(FacilityProperty);
set => SetValue(FacilityProperty, value);
}
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.9.2.0")]
public static readonly Microsoft.Maui.Controls.BindableProperty DepartmentProperty =
Microsoft.Maui.Controls.BindableProperty.Create(
nameof(Department),
typeof(string),
typeof(OpenShiftViewModel),
defaultValue: default(string));
[global::System.CodeDom.Compiler.GeneratedCode("Maui.BindableProperty.Generator.Core.BindableProperty.AutoBindablePropertyGenerator", "0.9.2.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public string Department
{
get => (string)GetValue(DepartmentProperty);
set => SetValue(DepartmentProperty, value);
}
} Am I missing some here? |
Hi, @tmose1106 looks like there is an issue in the latest version (0.9.2.0), let me take a look, and If that is an issue I will send a fix ASAP. |
Hi, @tmose1106 thank you for your feedback, the fix is ready in version 0.9.3, you can find it here: |
make code compatible with C# 8 nullable: https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/nullable-reference-types
The text was updated successfully, but these errors were encountered: