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

fixes: some null annotation #6754

Conversation

workgroupengineering
Copy link
Contributor

What does the pull request do?

What is the current behavior?

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@workgroupengineering
Copy link
Contributor Author

Can be null?

/// <summary>
/// Gets the application's focus manager.
/// </summary>
/// <value>
/// The application's focus manager.
/// </value>
public IFocusManager FocusManager
{
get;
private set;
}
/// <summary>
/// Gets the application's input manager.
/// </summary>
/// <value>
/// The application's input manager.
/// </value>
public InputManager InputManager
{
get;
private set;
}

@workgroupengineering workgroupengineering force-pushed the fixes/Some_Null_Annotation_And_Warning branch from 6f6767b to 2264402 Compare October 19, 2021 08:48
@grokys
Copy link
Member

grokys commented Oct 19, 2021

Note that C# now supports T? to mean "non-null for value types, nullable for reference types" - it has very similar semantics to [AllowNull] but can be used in a type parameter.

This wasn't supported when a lot of this code was written which is why it wasn't used before.

Regarding the warnings that are due to a C# bug - I'd suggest leaving them as warnings for now - we're hopefully going to be updating our SDK soon which should fix them.

@maxkatz6
Copy link
Member

@workgroupengineering we have updated SDK to 5.0, should it be reviewed?

@workgroupengineering
Copy link
Contributor Author

I am unsure how to correct these warnings.

##[warning]/home/vsts/work/1/s/src/Avalonia.Controls/Application.cs(64,16): warning CS8618: Non-nullable property 'FocusManager' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/home/vsts/work/1/s/src/Avalonia.Controls/Avalonia.Controls.csproj]
##[warning]/home/vsts/work/1/s/src/Avalonia.Controls/Application.cs(64,16): warning CS8618: Non-nullable property 'InputManager' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/home/vsts/work/1/s/src/Avalonia.Controls/Avalonia.Controls.csproj]

before the RegisterServices method is called they can have a null value. I do not know whether to suppress the warning or declare them as nullable.

@maxkatz6 maxkatz6 enabled auto-merge November 22, 2021 21:05
@maxkatz6 maxkatz6 merged commit 4f31cfc into AvaloniaUI:master Nov 22, 2021
@workgroupengineering workgroupengineering deleted the fixes/Some_Null_Annotation_And_Warning branch November 22, 2021 21:33
danwalmsley pushed a commit that referenced this pull request Nov 23, 2021
…notation_And_Warning

fixes: some null annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants