Closed Rybasum closed 2 years ago
Are you sure the warnings come only if CompiledBindings.MAUI nuget is included?
Maybe you receive this warning:
warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
Than you should set
in the files where you use ? suffix.
You receive this warning, of cause, also without CompiledBindings.MAUI nuget
Otherwise, can you upload a project to reproduce the issue?
Yes, without including CompiledBindings.MAUI there are no warnings. Yes, the warnings I get are the ones you mentioned. I don't write #nullable enable at the top of every .cs file, because this option is set globally in the projects, with the <Nullable>enable</Nullable>
line. It's hard to now go on now and add #nullable enable in every file, as the project has several hundreds of files.
I can't give you the whole solution (it has 23 projects), I'll try to create a separate small one to investigate this. Thanks for replying.
Steps to reproduce:
namespace BindingsTest;
class Test { }
public partial class MainPage : ContentPage { readonly Test? m_test; int count = 0;
public MainPage()
{
InitializeComponent();
}
private void OnCounterClicked(object sender, EventArgs e)
{
...
}
}
Then build the solution. No warnings.
4. Add the CompiledBindings.MAUI nuget and build again. There are several warnings warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
I hope this helps.
Thank you for reporting the issue! It will be fixed in the next version.
It works now (version 1.0.12), thank you for fixing it. Also, thanks for this amazing package!
In a MAUI project with nullable checks enabled, including the CompiledBindings.MAUI nuget seems to override this setting and disables the nullable checks. This results in tonnes of warnings, for every .cs file that uses the ? suffix (like string? myString). FYI, an example library project could be like this:
Thank you for creating this fantastic project, I hope this can be resolved easily!