File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1797,4 +1797,30 @@ private sealed partial class ModelWithDependentPropertyAndNoPropertyChanging
17971797
17981798 public string ? FullName => "" ;
17991799 }
1800+
1801+ #if NET6_0_OR_GREATER
1802+ // See https://github.com/CommunityToolkit/dotnet/issues/939
1803+ public partial class ModelWithSecondaryPropertySetFromGeneratedSetter_DoesNotWarn : ObservableObject
1804+ {
1805+ [ ObservableProperty ]
1806+ [ set : MemberNotNull( nameof ( B ) ) ]
1807+ private string a ;
1808+
1809+ // This type validates forwarding attributes on generated accessors. In particular, there should
1810+ // be no nullability warning on this constructor (CS8618), thanks to 'MemberNotNullAttribute("B")'
1811+ // being forwarded to the generated setter in the generated property (see linked issue).
1812+ public ModelWithSecondaryPropertySetFromGeneratedSetter_DoesNotWarn ( )
1813+ {
1814+ A = "" ;
1815+ }
1816+
1817+ public string B { get ; private set ; }
1818+
1819+ [ MemberNotNull ( nameof ( B ) ) ]
1820+ partial void OnAChanged ( string ? oldValue , string newValue )
1821+ {
1822+ B = "" ;
1823+ }
1824+ }
1825+ #endif
18001826}
You can’t perform that action at this time.
0 commit comments