Skip to content

Commit f329683

Browse files
committed
Enable nullable reference types.
1 parent 447c3fb commit f329683

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+612
-574
lines changed

Ix.NET/Source/AsyncQueryableGenerator.t4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ foreach (var m in asyncEnumerableType.GetMethods()
154154
}
155155
}
156156

157-
var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + " " + p.Name + (i == parCount - 1 && lastParameterDefault ? " = default" : "")));
157+
var pars = string.Join(", ", m.GetParameters().Select((p, i) => (i == parCount - 1 && isParams ? "params " : "") + toQuoted(p.ParameterType, i) + (nullableParameterNames.Contains(p.Name) ? "?" : "") + " " + p.Name + (i == parCount - 1 && lastParameterDefault ? " = default" : "")));
158158
var quotedPars = string.Join(", ", m.GetParameters().Select((p, i) => "default(" + toQuoted(p.ParameterType, i) + ")"));
159159

160160
if (m.IsDefined(typeof(System.Runtime.CompilerServices.ExtensionAttribute), true))

Ix.NET/Source/System.Interactive.Async.Providers/System.Interactive.Async.Providers.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<AssemblyTitle>Interactive Extensions - Async Providers Library</AssemblyTitle>
66
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
77
<PackageTags>Ix;Interactive;Extensions;Enumerable;Asynchronous</PackageTags>
8+
<NullableContextOptions>enable</NullableContextOptions>
89
</PropertyGroup>
910

1011
<ItemGroup>
@@ -21,4 +22,8 @@
2122
<Compile Update="System\Linq\AsyncQueryableEx.Generated.cs" DesignTime="True" AutoGen="True" DependentUpon="AsyncQueryableEx.Generated.tt" />
2223
</ItemGroup>
2324

25+
<ItemGroup>
26+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
27+
</ItemGroup>
28+
2429
</Project>

Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static MethodInfo Distinct__TSource_TKey__3__0(Type TSource, Type TKey)
188188
(s_Distinct__TSource_TKey__3__0 ??
189189
(s_Distinct__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
190190

191-
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
191+
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey>? comparer)
192192
{
193193
if (source == null)
194194
throw new ArgumentNullException(nameof(source));
@@ -204,7 +204,7 @@ private static MethodInfo Distinct__TSource_TKey__3__1(Type TSource, Type TKey)
204204
(s_Distinct__TSource_TKey__3__1 ??
205205
(s_Distinct__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
206206

207-
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
207+
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
208208
{
209209
if (source == null)
210210
throw new ArgumentNullException(nameof(source));
@@ -220,7 +220,7 @@ private static MethodInfo Distinct__TSource_TKey__3__2(Type TSource, Type TKey)
220220
(s_Distinct__TSource_TKey__3__2 ??
221221
(s_Distinct__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(Distinct<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
222222

223-
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
223+
public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey>? comparer)
224224
{
225225
if (source == null)
226226
throw new ArgumentNullException(nameof(source));
@@ -250,7 +250,7 @@ private static MethodInfo DistinctUntilChanged__TSource__2__0(Type TSource) =>
250250
(s_DistinctUntilChanged__TSource__2__0 ??
251251
(s_DistinctUntilChanged__TSource__2__0 = new Func<IAsyncQueryable<object>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
252252

253-
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
253+
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource>? comparer)
254254
{
255255
if (source == null)
256256
throw new ArgumentNullException(nameof(source));
@@ -312,7 +312,7 @@ private static MethodInfo DistinctUntilChanged__TSource_TKey__3__0(Type TSource,
312312
(s_DistinctUntilChanged__TSource_TKey__3__0 ??
313313
(s_DistinctUntilChanged__TSource_TKey__3__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
314314

315-
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
315+
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey>? comparer)
316316
{
317317
if (source == null)
318318
throw new ArgumentNullException(nameof(source));
@@ -328,7 +328,7 @@ private static MethodInfo DistinctUntilChanged__TSource_TKey__3__1(Type TSource,
328328
(s_DistinctUntilChanged__TSource_TKey__3__1 ??
329329
(s_DistinctUntilChanged__TSource_TKey__3__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
330330

331-
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
331+
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
332332
{
333333
if (source == null)
334334
throw new ArgumentNullException(nameof(source));
@@ -344,7 +344,7 @@ private static MethodInfo DistinctUntilChanged__TSource_TKey__3__2(Type TSource,
344344
(s_DistinctUntilChanged__TSource_TKey__3__2 ??
345345
(s_DistinctUntilChanged__TSource_TKey__3__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IEqualityComparer<object>, IAsyncQueryable<object>>(DistinctUntilChanged<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
346346

347-
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
347+
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey>? comparer)
348348
{
349349
if (source == null)
350350
throw new ArgumentNullException(nameof(source));
@@ -700,7 +700,7 @@ private static MethodInfo MaxAsync__TSource__3__0(Type TSource) =>
700700
(s_MaxAsync__TSource__3__0 ??
701701
(s_MaxAsync__TSource__3__0 = new Func<IAsyncQueryable<object>, IComparer<object>, CancellationToken, ValueTask<object>>(MaxAsync<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
702702

703-
public static ValueTask<TSource> MaxAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
703+
public static ValueTask<TSource> MaxAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource>? comparer, CancellationToken cancellationToken = default)
704704
{
705705
if (source == null)
706706
throw new ArgumentNullException(nameof(source));
@@ -762,7 +762,7 @@ private static MethodInfo MaxByAsync__TSource_TKey__4__0(Type TSource, Type TKey
762762
(s_MaxByAsync__TSource_TKey__4__0 ??
763763
(s_MaxByAsync__TSource_TKey__4__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
764764

765-
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
765+
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
766766
{
767767
if (source == null)
768768
throw new ArgumentNullException(nameof(source));
@@ -778,7 +778,7 @@ private static MethodInfo MaxByAsync__TSource_TKey__4__1(Type TSource, Type TKey
778778
(s_MaxByAsync__TSource_TKey__4__1 ??
779779
(s_MaxByAsync__TSource_TKey__4__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
780780

781-
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
781+
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
782782
{
783783
if (source == null)
784784
throw new ArgumentNullException(nameof(source));
@@ -794,7 +794,7 @@ private static MethodInfo MaxByAsync__TSource_TKey__4__2(Type TSource, Type TKey
794794
(s_MaxByAsync__TSource_TKey__4__2 ??
795795
(s_MaxByAsync__TSource_TKey__4__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MaxByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
796796

797-
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
797+
public static ValueTask<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
798798
{
799799
if (source == null)
800800
throw new ArgumentNullException(nameof(source));
@@ -824,7 +824,7 @@ private static MethodInfo MinAsync__TSource__3__0(Type TSource) =>
824824
(s_MinAsync__TSource__3__0 ??
825825
(s_MinAsync__TSource__3__0 = new Func<IAsyncQueryable<object>, IComparer<object>, CancellationToken, ValueTask<object>>(MinAsync<object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource);
826826

827-
public static ValueTask<TSource> MinAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
827+
public static ValueTask<TSource> MinAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource>? comparer, CancellationToken cancellationToken = default)
828828
{
829829
if (source == null)
830830
throw new ArgumentNullException(nameof(source));
@@ -886,7 +886,7 @@ private static MethodInfo MinByAsync__TSource_TKey__4__0(Type TSource, Type TKey
886886
(s_MinByAsync__TSource_TKey__4__0 ??
887887
(s_MinByAsync__TSource_TKey__4__0 = new Func<IAsyncQueryable<object>, Expression<Func<object, CancellationToken, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
888888

889-
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
889+
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
890890
{
891891
if (source == null)
892892
throw new ArgumentNullException(nameof(source));
@@ -902,7 +902,7 @@ private static MethodInfo MinByAsync__TSource_TKey__4__1(Type TSource, Type TKey
902902
(s_MinByAsync__TSource_TKey__4__1 ??
903903
(s_MinByAsync__TSource_TKey__4__1 = new Func<IAsyncQueryable<object>, Expression<Func<object, object>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
904904

905-
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
905+
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
906906
{
907907
if (source == null)
908908
throw new ArgumentNullException(nameof(source));
@@ -918,7 +918,7 @@ private static MethodInfo MinByAsync__TSource_TKey__4__2(Type TSource, Type TKey
918918
(s_MinByAsync__TSource_TKey__4__2 ??
919919
(s_MinByAsync__TSource_TKey__4__2 = new Func<IAsyncQueryable<object>, Expression<Func<object, ValueTask<object>>>, IComparer<object>, CancellationToken, ValueTask<IList<object>>>(MinByAsync<object, object>).GetMethodInfo().GetGenericMethodDefinition())).MakeGenericMethod(TSource, TKey);
920920

921-
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
921+
public static ValueTask<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey>? comparer, CancellationToken cancellationToken = default)
922922
{
923923
if (source == null)
924924
throw new ArgumentNullException(nameof(source));

Ix.NET/Source/System.Interactive.Async.Providers/System/Linq/AsyncQueryableEx.Generated.tt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
// See the LICENSE file in the project root for more information.
44

55
<#@ template debug="false" hostspecific="false" language="C#" #>
6-
<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Threading.Tasks.Extensions.dll" #>
7-
<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net46\System.Linq.Async.dll" #>
8-
<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net46\System.Interactive.Async.dll" #>
6+
<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net461\Microsoft.Bcl.AsyncInterfaces.dll" #>
7+
<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net461\System.Threading.Tasks.Extensions.dll" #>
8+
<#@ assembly name="$(ProjectDir)\..\System.Linq.Async\bin\$(Configuration)\net461\System.Linq.Async.dll" #>
9+
<#@ assembly name="$(ProjectDir)\..\System.Interactive.Async\bin\$(Configuration)\net461\System.Interactive.Async.dll" #>
910
<#@ output extension=".cs" #>
1011
<#
1112
var asyncEnumerableType = typeof(AsyncEnumerableEx);

Ix.NET/Source/System.Interactive.Async/System.Interactive.Async.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<AssemblyTitle>Interactive Extensions - Async Library</AssemblyTitle>
66
<TargetFrameworks>net461;netstandard2.0;netstandard2.1;netcoreapp3.0</TargetFrameworks>
77
<PackageTags>Ix;Interactive;Extensions;Enumerable;Asynchronous</PackageTags>
8+
<NullableContextOptions>enable</NullableContextOptions>
89
</PropertyGroup>
910

1011
<ItemGroup>

Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Amb.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static IAsyncEnumerable<TSource> Amb<TSource>(this IAsyncEnumerable<TSour
2121

2222
async IAsyncEnumerator<TSource> Core(CancellationToken cancellationToken)
2323
{
24-
IAsyncEnumerator<TSource> firstEnumerator = null;
25-
IAsyncEnumerator<TSource> secondEnumerator = null;
24+
IAsyncEnumerator<TSource>? firstEnumerator = null;
25+
IAsyncEnumerator<TSource>? secondEnumerator = null;
2626

27-
Task<bool> firstMoveNext = null;
28-
Task<bool> secondMoveNext = null;
27+
Task<bool>? firstMoveNext = null;
28+
Task<bool>? secondMoveNext = null;
2929

3030
try
3131
{
@@ -228,7 +228,7 @@ public static IAsyncEnumerable<TSource> Amb<TSource>(this IEnumerable<IAsyncEnum
228228
return Amb(sources.ToArray());
229229
}
230230

231-
private static async Task AwaitMoveNextAsyncAndDispose<T>(Task<bool> moveNextAsync, IAsyncEnumerator<T> enumerator)
231+
private static async Task AwaitMoveNextAsyncAndDispose<T>(Task<bool>? moveNextAsync, IAsyncEnumerator<T>? enumerator)
232232
{
233233
if (enumerator != null)
234234
{

Ix.NET/Source/System.Interactive.Async/System/Linq/Operators/Catch.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async IAsyncEnumerator<TSource> Core(CancellationToken cancellationToken)
4141
{
4242
while (true)
4343
{
44-
var c = default(TSource);
44+
TSource c;
4545

4646
try
4747
{
@@ -95,7 +95,7 @@ async IAsyncEnumerator<TSource> Core(CancellationToken cancellationToken)
9595
{
9696
while (true)
9797
{
98-
var c = default(TSource);
98+
TSource c;
9999

100100
try
101101
{
@@ -150,7 +150,7 @@ async IAsyncEnumerator<TSource> Core(CancellationToken cancellationToken)
150150
{
151151
while (true)
152152
{
153-
var c = default(TSource);
153+
TSource c;
154154

155155
try
156156
{
@@ -222,7 +222,7 @@ async IAsyncEnumerator<TSource> Core(CancellationToken cancellationToken)
222222

223223
while (true)
224224
{
225-
var c = default(TSource);
225+
TSource c;
226226

227227
try
228228
{

0 commit comments

Comments
 (0)