فهرست منبع

Fix a few more cases.

Bart De Smet 6 سال پیش
والد
کامیت
ec03272aea

+ 3 - 1
Ix.NET/Source/FasterLinq/Program.cs

@@ -1,7 +1,9 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the Apache 2.0 License.
 // See the LICENSE file in the project root for more information. 
 
+#nullable disable
+
 using System;
 using System.Collections;
 using System.Collections.Generic;

+ 0 - 2
Ix.NET/Source/System.Interactive.Async.Providers.Tests/System.Interactive.Async.Providers.Tests.csproj

@@ -5,7 +5,6 @@
     <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -24,7 +23,6 @@
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
-
     <PackageReference Include="xunit" Version="2.4.1" />
   </ItemGroup>
 

+ 1 - 3
Ix.NET/Source/System.Interactive.Tests/System.Interactive.Tests.csproj

@@ -2,10 +2,9 @@
 
   <PropertyGroup>
     <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
-    <NoWarn>$(NoWarn);CS0618</NoWarn>
+    <NoWarn>$(NoWarn);CS0618;CS8603;CS8625</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -23,7 +22,6 @@
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
     <PackageReference Include="FluentAssertions" Version="5.9.0" />
-    
     <PackageReference Include="xunit" Version="2.4.1" />
   </ItemGroup>
 

+ 6 - 6
Ix.NET/Source/System.Interactive.Tests/System/Linq/Operators/Using.cs

@@ -26,12 +26,12 @@ namespace Tests
             Assert.Null(d);
 
             var d1 = default(MyDisposable);
-            xs.ForEach(_ => { d1 = d; Assert.NotNull(d1); Assert.False(d1.Done); });
-            Assert.True(d1.Done);
+            xs.ForEach(_ => { d1 = d; Assert.NotNull(d1); Assert.False(d1!.Done); });
+            Assert.True(d1!.Done);
 
             var d2 = default(MyDisposable);
-            xs.ForEach(_ => { d2 = d; Assert.NotNull(d2); Assert.False(d2.Done); });
-            Assert.True(d2.Done);
+            xs.ForEach(_ => { d2 = d; Assert.NotNull(d2); Assert.False(d2!.Done); });
+            Assert.True(d2!.Done);
 
             Assert.NotSame(d1, d2);
         }
@@ -45,7 +45,7 @@ namespace Tests
             Assert.Null(d);
 
             AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
+            Assert.True(d!.Done);
         }
 
         [Fact]
@@ -57,7 +57,7 @@ namespace Tests
             Assert.Null(d);
 
             AssertThrows<MyException>(() => xs.ForEach(_ => { }));
-            Assert.True(d.Done);
+            Assert.True(d!.Done);
         }
 
         private sealed class MyDisposable : IDisposable

+ 2 - 2
Ix.NET/Source/System.Interactive/System/Linq/Operators/Catch.cs

@@ -82,7 +82,7 @@ namespace System.Linq
             {
                 while (true)
                 {
-                    var c = default(TSource);
+                    TSource c;
 
                     try
                     {
@@ -121,7 +121,7 @@ namespace System.Linq
 
                 while (true)
                 {
-                    var c = default(TSource);
+                    TSource c;
 
                     try
                     {

+ 1 - 1
Ix.NET/Source/System.Interactive/System/Linq/Operators/Memoize.cs

@@ -115,7 +115,7 @@ namespace System.Linq
         {
             private IRefCountList<T> _buffer;
             private bool _disposed;
-            private Exception _error;
+            private Exception? _error;
             private IEnumerator<T> _source;
             private bool _stopped;
 

+ 6 - 4
Ix.NET/Source/System.Interactive/System/Linq/Operators/Publish.cs

@@ -61,9 +61,11 @@ namespace System.Linq
 
         private sealed class PublishedBuffer<T> : IBuffer<T>
         {
+            private readonly object _gate = new object();
+
             private RefCountList<T> _buffer;
             private bool _disposed;
-            private Exception _error;
+            private Exception? _error;
             private IEnumerator<T> _source;
             private bool _stopped;
 
@@ -81,7 +83,7 @@ namespace System.Linq
                 }
 
                 var i = default(int);
-                lock (_source)
+                lock (_gate)
                 {
                     i = _buffer.Count;
                     _buffer.ReaderCount++;
@@ -102,7 +104,7 @@ namespace System.Linq
 
             public void Dispose()
             {
-                lock (_source)
+                lock (_gate)
                 {
                     if (!_disposed)
                     {
@@ -131,7 +133,7 @@ namespace System.Linq
                         var hasValue = default(bool);
                         var current = default(T);
 
-                        lock (_source)
+                        lock (_gate)
                         {
                             if (i >= _buffer.Count)
                             {

+ 2 - 2
Ix.NET/Source/System.Interactive/System/Linq/Yielder.cs

@@ -9,7 +9,7 @@ namespace System.Linq
     internal sealed class Yielder<T> : IYielder<T>, IAwaitable, IAwaiter
     {
         private readonly Action<Yielder<T>> _create;
-        private Action _continuation;
+        private Action? _continuation;
         private bool _hasValue;
         private bool _running;
         private bool _stopped;
@@ -62,7 +62,7 @@ namespace System.Linq
             else
             {
                 _hasValue = false;
-                _continuation();
+                _continuation!();
             }
 
             return !_stopped && _hasValue;

+ 0 - 1
Ix.NET/Source/System.Linq.Async.Queryable.Tests/System.Linq.Async.Queryable.Tests.csproj

@@ -5,7 +5,6 @@
     <NoWarn>$(NoWarn);CS0618</NoWarn>
   </PropertyGroup>
 
-
   <ItemGroup>
     <Content Include="xunit.runner.json">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>