Skip to content

Commit a8ff550

Browse files
authored
Housekeeping: add pragma warnings disables
* Add pragma warning disable 8600, 8605, 8603, 8613, 8619 * Add CS prefix, comment * Add CS prefix, comment Co-authored-by: kronic <kronic@softland.ru>
1 parent 31d3961 commit a8ff550

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

src/ReactiveUI.Tests/ReactiveObject/Mocks/OaphNameOfTestFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ public class OaphNameOfTestFixture : TestFixture
1919
public OaphNameOfTestFixture()
2020
{
2121
this.WhenAnyValue(x => x.IsOnlyOneWord).Select(x => x ?? string.Empty).Select(x => x.Length >= 3 ? x.Substring(0, 3) : x).ToProperty(this, nameof(FirstThreeLettersOfOneWord), out _firstThreeLettersOfOneWord);
22-
22+
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
2323
_lastThreeLettersOfOneWord = this.WhenAnyValue(x => x.IsOnlyOneWord).Select(x => x ?? string.Empty).Select(x => x.Length >= 3 ? x.Substring(x.Length - 3, 3) : x).ToProperty(this, nameof(LastThreeLettersOfOneWord));
24+
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
2425
}
2526

2627
[IgnoreDataMember]

src/ReactiveUI.Tests/Routing/Mocks/TestScreen.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public class TestScreen : ReactiveObject, IScreen
1818
public RoutingState? Router
1919
{
2020
#pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
21+
#pragma warning disable CS8613 // Nullability of reference types in return type doesn't match implicitly implemented member.
2122
get => _router;
23+
#pragma warning restore CS8613 // Nullability of reference types in return type doesn't match implicitly implemented member.
2224
#pragma warning restore CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
2325
set => this.RaiseAndSetIfChanged(ref _router, value);
2426
}

src/ReactiveUI.Tests/WhenAny/WhenAnyObservableTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public void NullObservablesDoNotCauseExceptions()
2525
fixture.Command1 = null;
2626

2727
// these are the overloads of WhenAnyObservable that perform a Merge
28+
#pragma warning disable CS8603 // Possible null reference return.
2829
fixture.WhenAnyObservable(x => x.Command1).Subscribe();
2930
fixture.WhenAnyObservable(x => x.Command1, x => x.Command1).Subscribe();
3031
fixture.WhenAnyObservable(x => x.Command1, x => x.Command1, x => x.Command1).Subscribe();
@@ -48,6 +49,7 @@ public void NullObservablesDoNotCauseExceptions()
4849
fixture.WhenAnyObservable(x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, (zero, one, two, three, four, five, six, seven, eight) => Unit.Default).Subscribe();
4950
fixture.WhenAnyObservable(x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, (zero, one, two, three, four, five, six, seven, eight, nine) => Unit.Default).Subscribe();
5051
fixture.WhenAnyObservable(x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, x => x.Command1, (zero, one, two, three, four, five, six, seven, eight, nine, ten) => Unit.Default).Subscribe();
52+
#pragma warning restore CS8603 // Possible null reference return.
5153
}
5254

5355
[Fact]
@@ -56,7 +58,9 @@ public async Task WhenAnyObservableSmokeTestCombining()
5658
var fixture = new TestWhenAnyObsViewModel();
5759

5860
var list = new List<string>();
61+
#pragma warning disable CS8603 // Possible null reference return.
5962
fixture.WhenAnyObservable(x => x.Command3, x => x.Command1, (s, i) => s + " : " + i).ObserveOn(ImmediateScheduler.Instance).Subscribe(list.Add);
63+
#pragma warning restore CS8603 // Possible null reference return.
6064

6165
Assert.Equal(0, list.Count);
6266

@@ -86,7 +90,9 @@ public async Task WhenAnyObservableSmokeTestMerging()
8690
var fixture = new TestWhenAnyObsViewModel();
8791

8892
var list = new List<int>();
93+
#pragma warning disable CS8603 // Possible null reference return.
8994
fixture.WhenAnyObservable(x => x.Command1, x => x.Command2).ObserveOn(ImmediateScheduler.Instance).Subscribe(list.Add);
95+
#pragma warning restore CS8603 // Possible null reference return.
9096

9197
Assert.Equal(0, list.Count);
9298

@@ -113,7 +119,9 @@ public async Task WhenAnyObservableSmokeTestMerging()
113119
public void WhenAnyObservableWithNullObjectShouldUpdateWhenObjectIsntNullAnymore()
114120
{
115121
var fixture = new TestWhenAnyObsViewModel();
122+
#pragma warning disable CS8603 // Possible null reference return.
116123
fixture.WhenAnyObservable(x => x.Changes).Bind(out var output).ObserveOn(ImmediateScheduler.Instance).Subscribe();
124+
#pragma warning restore CS8603 // Possible null reference return.
117125

118126
Assert.Equal(0, output.Count);
119127

src/ReactiveUI.Uno/CoreDispatcherScheduler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ private IDisposable ScheduleSlow<TState>(TState state, TimeSpan dueTime, Func<IS
178178
finally
179179
{
180180
t.Stop();
181+
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
181182
action = null;
183+
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
182184
}
183185
}
184186
};

src/ReactiveUI/Bindings/Property/PropertyBinderImplementation.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ bool VmToViewFunc(TVMProp vmValue, out TVProp vValue)
7373
{
7474
var result = vmToViewConverter.TryConvert(vmValue, typeof(TVProp), conversionHint, out object? tmp);
7575

76+
#pragma warning disable CS8605 // Unboxing a possibly null value.
7677
vValue = result ? (TVProp)tmp : default;
78+
#pragma warning restore CS8605 // Unboxing a possibly null value.
7779
return result;
7880
}
7981

8082
bool ViewToVmFunc(TVProp vValue, out TVMProp vmValue)
8183
{
8284
var result = viewToVMConverter.TryConvert(vValue, typeof(TVMProp), conversionHint, out object? tmp);
8385

86+
#pragma warning disable CS8605 // Unboxing a possibly null value.
8487
vmValue = result ? (TVMProp)tmp : default;
88+
#pragma warning restore CS8605 // Unboxing a possibly null value.
8589
return result;
8690
}
8791
#pragma warning restore CS8601 // Possible null reference assignment.

src/ReactiveUI/Expression/Reflection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ public static bool TryGetValueForPropertyChain<TValue>(out TValue changeValue, o
249249

250250
Expression lastExpression = expressions.Last();
251251
#pragma warning disable CS8601 // Possible null reference assignment.
252+
#pragma warning disable CS8605 // Unboxing a possibly null value.
252253
changeValue = (TValue)GetValueFetcherOrThrow(lastExpression.GetMemberInfo())(current, lastExpression.GetArgumentsArray());
254+
#pragma warning restore CS8605 // Unboxing a possibly null value.
253255
#pragma warning restore CS8601 // Possible null reference assignment.
254256
return true;
255257
}

0 commit comments

Comments
 (0)