@@ -16,7 +16,6 @@ public static void NotifyingProperty()
1616namespace N
1717{
1818 using System.ComponentModel;
19- using System.Runtime.CompilerServices;
2019
2120 public class C : INotifyPropertyChanged
2221 {
@@ -59,9 +58,6 @@ public static void WithBackingFieldStatementBodies()
5958 var code = @"
6059namespace N
6160{
62- using System.ComponentModel;
63- using System.Runtime.CompilerServices;
64-
6561 public class C
6662 {
6763 private int p;
@@ -83,9 +79,6 @@ public static void WithBackingFieldStatementBodiesAssigningTwice()
8379 var code = @"
8480namespace N
8581{
86- using System.ComponentModel;
87- using System.Runtime.CompilerServices;
88-
8982 public class C
9083 {
9184 private int p;
@@ -111,9 +104,6 @@ public static void WithBackingFieldExpressionBodies()
111104 var code = @"
112105namespace N
113106{
114- using System.ComponentModel;
115- using System.Runtime.CompilerServices;
116-
117107 public class C
118108 {
119109 private int p;
@@ -379,24 +369,24 @@ namespace N
379369{
380370 public class C<T> : I
381371 {
382- private T p;
372+ private T? p;
383373
384- public T P
374+ public T? P
385375 {
386376 get => this.p;
387377 set => this.p = value;
388378 }
389379
390- object I.P
380+ object? I.P
391381 {
392382 get => this.p;
393- set => this.P = (T)value;
383+ set => this.P = (T? )value;
394384 }
395385 }
396386
397387 interface I
398388 {
399- object P { get; set; }
389+ object? P { get; set; }
400390 }
401391}" ;
402392
@@ -508,7 +498,6 @@ public static void IntPropertiesAssignsPropertyReturnField()
508498namespace ValidCode
509499{
510500 using System.ComponentModel;
511- using System.Globalization;
512501 using System.Runtime.CompilerServices;
513502
514503 public class C : INotifyPropertyChanged
@@ -556,7 +545,6 @@ public static void IntPropertiesAssignsFieldReturnsProperty()
556545namespace ValidCode
557546{
558547 using System.ComponentModel;
559- using System.Globalization;
560548 using System.Runtime.CompilerServices;
561549
562550 public class C : INotifyPropertyChanged
@@ -648,6 +636,8 @@ protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName
648636 public static void Issue102 ( )
649637 {
650638 var code = @"
639+ #nullable disable
640+ #pragma warning disable CS0649
651641namespace ValidCode.Repros
652642{
653643 using System;
@@ -668,7 +658,7 @@ public sealed class C<T> : INotifyPropertyChanged, IDisposable, IC
668658 private T source;
669659 private bool disposed;
670660
671- public event PropertyChangedEventHandler? PropertyChanged;
661+ public event PropertyChangedEventHandler PropertyChanged;
672662
673663 public T Source
674664 {
@@ -711,7 +701,7 @@ INotifyPropertyChanged IC.Source
711701 set => this.Source = (T)value;
712702 }
713703
714- private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
704+ private void OnPropertyChanged([CallerMemberName] string propertyName = null)
715705 {
716706 this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
717707 }
@@ -751,6 +741,7 @@ public void Dispose()
751741 public static void TrySet ( )
752742 {
753743 var code = @"
744+ #pragma warning disable CS0169
754745namespace N
755746{
756747 using System.Collections.Generic;
@@ -796,10 +787,10 @@ protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName
796787 public static void IgnoreWhenNotGettingSame ( )
797788 {
798789 var code = @"
790+ #pragma warning disable CS0649
799791namespace N
800792{
801793 using System.ComponentModel;
802- using System.Runtime.CompilerServices;
803794
804795 public class C : INotifyPropertyChanged
805796 {
0 commit comments