Closed zhiyuanliang-ms closed 2 months ago
/AzurePipeline run
Incorrect nullable
What makes the nullable incorrect here?
What makes the nullable incorrect here?
@rossgrambo I am trying to fix these build warnings:
Microsoft.FeatureManagement -> C:\Users\zhiyuanliang\OneDrive - Microsoft\Desktop\Dev\FM\src\Microsoft.FeatureManagement\bin\Debug\netstandard2.1\Microsoft.FeatureManagement.dll
C:\Users\zhiyuanliang\OneDrive - Microsoft\Desktop\Dev\FM\examples\TargetingConsoleApp\Identity\User.cs(10,23): warning CS8618: Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\Users\zhiyuanliang\OneDri
ve - Microsoft\Desktop\Dev\FM\examples\TargetingConsoleApp\TargetingConsoleApp.csproj]
C:\Users\zhiyuanliang\OneDrive - Microsoft\Desktop\Dev\FM\examples\TargetingConsoleApp\Identity\User.cs(12,36): warning CS8618: Non-nullable property 'Groups' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\Users\zhiyuanliang\On
eDrive - Microsoft\Desktop\Dev\FM\examples\TargetingConsoleApp\TargetingConsoleApp.csproj]
C:\Users\zhiyuanliang\OneDrive - Microsoft\Desktop\Dev\FM\examples\TargetingConsoleApp\Identity\InMemoryUserRepository.cs(94,20): warning CS8619: Nullability of reference types in value of type 'Task<User?>' doesn't match target type 'Task
There is inconsistent usage of nullable type. There are two options to fix these build warnings:
I prefer the second option.
/AzurePipeline run
I see. We're setting nullable true but not using the nullable ? everywhere where applicable.
<nullable>true</nullable>
is automatically added in new projects. I'd prefer we keep it and add the question marks where needed.
@rossgrambo
I'd prefer we keep it and add the question marks where needed.
Then, too many changes are needed, especially for FeatureFlagDemo project. I don't think it's worthy because our feature management projects don't set
@rossgrambo I will follow this PR #305 I will revert the change for RazorPages but keep the changes for other example projects.
Why this PR?
Fix xUnit1031 warning.
Remove nullable property in example projects.
Visible changes
Update testcases to use async&await.
Update property.