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
An observable property in a nullable class like the one shown here can cause somewhat intractable warnings.
using CommunityToolkit.Mvvm.ComponentModel;using System.Diagnostics.CodeAnalysis;namespace ObservableTest;internalpartialclassTestViewModel:ObservableObject{TestViewModel(){
Helper();}[MemberNotNull(nameof(testString))]privatevoidHelper(){TestString=string.Empty;}[ObservableProperty]privatestringtestString;}
Regression
No response
Steps to reproduce
Create a default MAUI app and add a class like the one shown above.
Observe that the line:
[MemberNotNull(nameof(testString))]
Gets a warning for referring to testString, not TestString, but referring to TestString generates a different warning (CS8618: Non-nullable field 'testString' must contain a non-null value when exiting constructor)
Expected behavior
Either don't warn on this use of testString or allow TestString to be used here.
Screenshots
No response
IDE and version
VS 2022 Preview
IDE version
17.10.0 Preview 1
Nuget packages
CommunityToolkit.Common
CommunityToolkit.Diagnostics
CommunityToolkit.HighPerformance
CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
No, just wanted to report this
The text was updated successfully, but these errors were encountered:
Describe the bug
An observable property in a nullable class like the one shown here can cause somewhat intractable warnings.
Regression
No response
Steps to reproduce
Expected behavior
Either don't warn on this use of testString or allow TestString to be used here.
Screenshots
No response
IDE and version
VS 2022 Preview
IDE version
17.10.0 Preview 1
Nuget packages
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
No, just wanted to report this
The text was updated successfully, but these errors were encountered: