Skip to content

Commit c374b75

Browse files
authored
Merge branch 'main' into IxAsyncCancellation
2 parents 10bab71 + 2b51e70 commit c374b75

File tree

1,231 files changed

+16103
-10071
lines changed

Some content is hidden

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

1,231 files changed

+16103
-10071
lines changed

.github/ISSUE_TEMPLATE/issue_ix.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: Issue report for Ix
3+
about: Creates an issue report regarding a bug, question or feature request for Ix.NET
4+
title: ''
5+
labels: '[area] Ix'
6+
assignees: ''
7+
---
8+
Hello and thank you for using dotnet/reactive. Please select a category and detail your issue by answering the questions there:
9+
10+
#### Bug
11+
12+
Despite our best efforts, bugs can slip into releases or corner cases forgotten about. We will try our best to remedy the situation
13+
and/or provide workarounds. Note that certain (odd) behaviors are by design and as such are not considered bugs.
14+
15+
> Which subcomponent library (Ix, Async.Ix)?
16+
17+
> Which library version?
18+
19+
> What are the platform(s), environment(s) and related component version(s)?
20+
21+
> What is the use case or problem?
22+
23+
> What is the expected outcome?
24+
25+
> What is the actual outcome?
26+
27+
> What is the stacktrace of the exception(s) if any?
28+
29+
> Do you have a code snippet or project that reproduces the problem?
30+
31+
#### Question
32+
33+
Before you ask us a question, please note that dotnet/reactive is maintained by a handful of dedicated people voluntarily and in their free time.
34+
You could help us tremendously by first searching for some keywords related to your question with your favorite search engine,
35+
our [issue list](https://github.com/dotnet/reactive/issues) or the related [stackoverflow.com](https://stackoverflow.com) keywords (such as
36+
[ienumerable](https://stackoverflow.com/questions/tagged/ienumerable) and
37+
[iasyncenumerable](https://stackoverflow.com/questions/tagged/iasyncenumerable)
38+
). Please also consider asking questions, such as **"How do I do X?"** or **"Where can I find Y?"**, under one of these tags on *StackOverflow* instead.
39+
40+
In case you have not found an answer or your question is not really suited for *StackOverflow*, you are welcome to ask it here.
41+
42+
> What is the context of your question or problem?
43+
44+
> What is the question or problem you try to solve?
45+
46+
> What were the (original) requirements you tried to solve?
47+
48+
> What have you tried so far, what code have you written so far?
49+
50+
#### Feature request
51+
52+
The dotnet/reactive hosts fundamental components and operators for `IObservable`, `IEnumerable` and `IAsyncEnumerable`, and as such, to be and
53+
to stay as a dependable family of libraries, we have to carefully consider what new features to include. Therefore, before asking for a new component,
54+
operator or feature, please consider the following cases and resolutions first:
55+
56+
a) **New source factory method.** Static factory methods creating an instance of the types mentioned above can live in any class in any library
57+
without too much inconvenience. Please consider hosting such factory methods outside dotnet/reactive.
58+
59+
b) **New instance method/operator.** The .NET world features extension methods which gives the flexibility to have fluent API expansions in
60+
your local project or any third party library. Please consider hosting such methods outside dotnet/reactive too.
61+
62+
c) **Support for or bridge to other 1st or 3rd party components.** These are considered on a specific case-by-case basis but generally,
63+
please consider hosting such support/bridge code outside dotnet/reactive.
64+
65+
d) **New reactive/interactive base type or concept.** Components requiring changes or introduction of new protocols (for example, flow control,
66+
item lifecycle, async) are generally better suited for their own 3rd party library hosting and interoperation should be provided, via the standard
67+
types mentioned above, there.
68+
69+
e) **Behavior change on an existing operator.** Such changes involve a lot of risks for existing users, therefore, usually, it is better to introduce
70+
a completely new component or operator, for which see points a)..d) again.
71+
72+
Considering the points above, please describe the feature or behavior you would like dotnet/reactive included:
73+
74+
> Which subcomponent library (Ix, Async.Ix)?
75+
76+
> Which next library version (i.e., patch, minor or major)?
77+
78+
> What are the platform(s), environment(s) and related component version(s)?
79+
80+
> How commonly is this feature needed (one project, several projects, company-wide, global)?
81+
82+
> Please describe the feature.

.github/ISSUE_TEMPLATE/issue_rx.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: Issue report for Rx
3+
about: Creates an issue report regarding a bug, question or feature request for Rx.NET
4+
title: ''
5+
labels: '[area] Rx'
6+
assignees: ''
7+
---
8+
Hello and thank you for using dotnet/reactive. Please select a category and detail your issue by answering the questions there:
9+
10+
#### Bug
11+
12+
Despite our best efforts, bugs can slip into releases or corner cases forgotten about. We will try our best to remedy the situation
13+
and/or provide workarounds. Note that certain (odd) behaviors are by design and as such are not considered bugs.
14+
15+
> Which library version?
16+
17+
> What are the platform(s), environment(s) and related component version(s)?
18+
19+
> What is the use case or problem?
20+
21+
> What is the expected outcome?
22+
23+
> What is the actual outcome?
24+
25+
> What is the stacktrace of the exception(s) if any?
26+
27+
> Do you have a code snippet or project that reproduces the problem?
28+
29+
#### Question
30+
31+
Before you ask us a question, please note that dotnet/reactive is maintained by a handful of dedicated people voluntarily and in their free time.
32+
You could help us tremendously by first searching for some keywords related to your question with your favorite search engine,
33+
our [issue list](https://github.com/dotnet/reactive/issues) or the related [stackoverflow.com](https://stackoverflow.com) keywords (such as
34+
[system.reactive](https://stackoverflow.com/questions/tagged/system.reactive)
35+
). Please also consider asking questions, such as **"How do I do X?"** or **"Where can I find Y?"**, under one of these tags on *StackOverflow* instead.
36+
37+
In case you have not found an answer or your question is not really suited for *StackOverflow*, you are welcome to ask it here.
38+
39+
> What is the context of your question or problem?
40+
41+
> What is the question or problem you try to solve?
42+
43+
> What were the (original) requirements you tried to solve?
44+
45+
> What have you tried so far, what code have you written so far?
46+
47+
#### Feature request
48+
49+
The dotnet/reactive hosts fundamental components and operators for `IObservable`, `IEnumerable` and `IAsyncEnumerable`, and as such, to be and
50+
to stay as a dependable family of libraries, we have to carefully consider what new features to include. Therefore, before asking for a new component,
51+
operator or feature, please consider the following cases and resolutions first:
52+
53+
a) **New source factory method.** Static factory methods creating an instance of the types mentioned above can live in any class in any library
54+
without too much inconvenience. Please consider hosting such factory methods outside dotnet/reactive.
55+
56+
b) **New instance method/operator.** The .NET world features extension methods which gives the flexibility to have fluent API expansions in
57+
your local project or any third party library. Please consider hosting such methods outside dotnet/reactive too.
58+
59+
c) **Support for or bridge to other 1st or 3rd party components.** These are considered on a specific case-by-case basis but generally,
60+
please consider hosting such support/bridge code outside dotnet/reactive.
61+
62+
d) **New reactive/interactive base type or concept.** Components requiring changes or introduction of new protocols (for example, flow control,
63+
item lifecycle, async) are generally better suited for their own 3rd party library hosting and interoperation should be provided, via the standard
64+
types mentioned above, there.
65+
66+
e) **Behavior change on an existing operator.** Such changes involve a lot of risks for existing users, therefore, usually, it is better to introduce
67+
a completely new component or operator, for which see points a)..d) again.
68+
69+
Considering the points above, please describe the feature or behavior you would like dotnet/reactive included:
70+
71+
> Which next library version (i.e., patch, minor or major)?
72+
73+
> What are the platform(s), environment(s) and related component version(s)?
74+
75+
> How commonly is this feature needed (one project, several projects, company-wide, global)?
76+
77+
> Please describe the feature.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Hello and thank you for contributing to dotnet/reactive. Before you proceed by creating a pull request (PR):
2+
3+
> Please make sure your contribution is in line with the project's [licensing model](https://github.com/dotnet/reactive/blob/master/LICENSE) and
4+
your employment allows you to contribute to open source.
5+
6+
> Please sign the [Contributor License Agreement](https://cla.dotnetfoundation.org/dotnet/reactive?pullRequest=1101) in case the CLA bot asks you
7+
for being a new contributor.
8+
9+
> Please make sure you target the `master` branch when creating the PR.
10+
11+
What is the nature of your contribution?
12+
13+
#### Bugfix
14+
15+
> Please describe what and how the bug manifested itself and what kind of fix did you implement.
16+
> Practically, you are writing these descriptions for the search engines so others can find the resolution easier.
17+
18+
> Please reference the related issue(s) to the original bug report (example: `Fixes #X`, `Resolves #X`).
19+
> Note that some behaviors are by design and are not bugs. If you are unsure, please open an [issue](https://github.com/dotnet/reactive/issues) first.
20+
21+
> Please include the relevant unit test(s) that verify the fix works.
22+
> It is recommended you write the unit test(s) first to see they failed before your fix; however, there is
23+
> no need to post a PR to demonstrate this failure stage. Please post in a state where the issue is resolved.
24+
25+
#### Enhancement
26+
27+
> Please consider opening an [issue](https://github.com/dotnet/reactive/issues) first to discuss the kind and impact of the enhancement first,
28+
> if such issue doesn't exist yet. Also please check if there was a consensus about accepting such an enhancement.
29+
30+
> Please describe how, what and why the enhancement is implemented.
31+
> Practically, you are writing these descriptions for the search engines so others can find the change details easier.
32+
33+
> Please reference the related issue(s) to the original issue report (example: `Fixes #X`, `Resolves #X`).
34+
35+
> Please include the relevant unit test(s) or benchmark(s) that show or verify the enhancement works.
36+
37+
#### Feature request
38+
39+
> We strongly recommend opening an [issue](https://github.com/dotnet/reactive/issues) first to discuss the nature and impact of the request first.
40+
> If such an issue already exists, please check if there was a consensus and approval for accepting a contribution.
41+
42+
> Please describe what request is about, how it works in general and what possible corner cases it or the user should consider.
43+
> Please include some basic usage examples of the important components and/or overloads.
44+
> Practically, you are writing these descriptions for the search engines so others can find out about the new feature easier.
45+
46+
> Please reference the related issue(s) to the original issue report (example: `Resolves #X`).
47+
48+
> Please include unit tests that verify the behavior of the new feature. Please make sure the code coverage is reasonably high with the new code.
49+
> Depending on the feature, you may want to include actual multi-threaded test cases to verify the correct async behavior, however,
50+
> please be mindful of the time such tests take and try to stay under a few seconds.

AsyncRx.NET/ApiCompare/ApiCompare.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

AsyncRx.NET/ApiCompare/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Licensed to the .NET Foundation under one or more agreements.
2-
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
2+
// The .NET Foundation licenses this file to you under the MIT License.
33
// See the LICENSE file in the project root for more information.
44

55
using System;

AsyncRx.NET/Playground/Playground.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

AsyncRx.NET/Playground/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Licensed to the .NET Foundation under one or more agreements.
2-
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
2+
// The .NET Foundation licenses this file to you under the MIT License.
33
// See the LICENSE file in the project root for more information.
44

55
using System;
@@ -261,17 +261,17 @@ static IAsyncObserver<T> Print<T>()
261261
x =>
262262
{
263263
Console.WriteLine(x);
264-
return Task.CompletedTask;
264+
return default;
265265
},
266266
ex =>
267267
{
268268
Console.WriteLine("Error: " + ex);
269-
return Task.CompletedTask;
269+
return default;
270270
},
271271
() =>
272272
{
273273
Console.WriteLine("Completed");
274-
return Task.CompletedTask;
274+
return default;
275275
}
276276
);
277277
}

AsyncRx.NET/System.Reactive.Async.Concurrency/System.Reactive.Async.Concurrency.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>netstandard2.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

AsyncRx.NET/System.Reactive.Async.Concurrency/System/Reactive/Concurrency/AsyncScheduler.cs

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Licensed to the .NET Foundation under one or more agreements.
2-
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
2+
// The .NET Foundation licenses this file to you under the MIT License.
33
// See the LICENSE file in the project root for more information.
44

55
using System.Runtime.ExceptionServices;
@@ -52,7 +52,27 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
5252
return new TaskAwaitable<T>(task, false, scheduler, token);
5353
}
5454

55-
public static async Task Delay(this IAsyncScheduler scheduler, TimeSpan dueTime, CancellationToken token = default(CancellationToken))
55+
public static IAwaitable RendezVous(this ValueTask task, IAsyncScheduler scheduler) => RendezVous(task, scheduler, CancellationToken.None);
56+
57+
public static IAwaitable RendezVous(this ValueTask task, IAsyncScheduler scheduler, CancellationToken token)
58+
{
59+
if (scheduler == null)
60+
throw new ArgumentNullException(nameof(scheduler));
61+
62+
return new ValueTaskAwaitable(task, false, scheduler, token);
63+
}
64+
65+
public static IAwaitable<T> RendezVous<T>(this ValueTask<T> task, IAsyncScheduler scheduler) => RendezVous(task, scheduler, CancellationToken.None);
66+
67+
public static IAwaitable<T> RendezVous<T>(this ValueTask<T> task, IAsyncScheduler scheduler, CancellationToken token)
68+
{
69+
if (scheduler == null)
70+
throw new ArgumentNullException(nameof(scheduler));
71+
72+
return new ValueTaskAwaitable<T>(task, false, scheduler, token);
73+
}
74+
75+
public static async ValueTask Delay(this IAsyncScheduler scheduler, TimeSpan dueTime, CancellationToken token = default)
5676
{
5777
if (scheduler == null)
5878
throw new ArgumentNullException(nameof(scheduler));
@@ -70,7 +90,7 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
7090
tcs.SetResult(true);
7191
}
7292

73-
return Task.CompletedTask;
93+
return default;
7494
}, dueTime);
7595

7696
using (token.Register(() => task.DisposeAsync()))
@@ -79,7 +99,7 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
7999
}
80100
}
81101

82-
public static async Task Delay(this IAsyncScheduler scheduler, DateTimeOffset dueTime, CancellationToken token = default(CancellationToken))
102+
public static async ValueTask Delay(this IAsyncScheduler scheduler, DateTimeOffset dueTime, CancellationToken token = default)
83103
{
84104
if (scheduler == null)
85105
throw new ArgumentNullException(nameof(scheduler));
@@ -97,7 +117,7 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
97117
tcs.SetResult(true);
98118
}
99119

100-
return Task.CompletedTask;
120+
return default;
101121
}, dueTime);
102122

103123
using (token.Register(() => task.DisposeAsync()))
@@ -106,7 +126,7 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
106126
}
107127
}
108128

109-
public static async Task ExecuteAsync(this IAsyncScheduler scheduler, Func<CancellationToken, Task> action, CancellationToken token = default(CancellationToken))
129+
public static async ValueTask ExecuteAsync(this IAsyncScheduler scheduler, Func<CancellationToken, ValueTask> action, CancellationToken token = default)
110130
{
111131
var tcs = new TaskCompletionSource<object>();
112132

@@ -148,7 +168,7 @@ public static IAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler sch
148168
}
149169
}
150170

151-
public static async Task<TResult> ExecuteAsync<TResult>(this IAsyncScheduler scheduler, Func<CancellationToken, Task<TResult>> action, CancellationToken token = default(CancellationToken))
171+
public static async ValueTask<TResult> ExecuteAsync<TResult>(this IAsyncScheduler scheduler, Func<CancellationToken, ValueTask<TResult>> action, CancellationToken token = default)
152172
{
153173
var tcs = new TaskCompletionSource<TResult>();
154174

@@ -196,8 +216,6 @@ private sealed class RendezVousAwaitable : IAwaitable, IAwaiter // PERF: Can we
196216
{
197217
private readonly IAsyncScheduler _scheduler;
198218
private readonly CancellationToken _token;
199-
200-
private bool _done;
201219
private ExceptionDispatchInfo _error;
202220

203221
public RendezVousAwaitable(IAsyncScheduler scheduler, CancellationToken token)
@@ -206,13 +224,13 @@ public RendezVousAwaitable(IAsyncScheduler scheduler, CancellationToken token)
206224
_token = token;
207225
}
208226

209-
public bool IsCompleted => _done;
227+
public bool IsCompleted { get; private set; }
210228

211229
public IAwaiter GetAwaiter() => this;
212230

213231
public void GetResult()
214232
{
215-
if (!_done)
233+
if (!IsCompleted)
216234
{
217235
throw new InvalidOperationException(); // REVIEW: No support for blocking.
218236
}
@@ -237,10 +255,10 @@ public void OnCompleted(Action continuation)
237255
}
238256
finally
239257
{
240-
_done = true;
258+
IsCompleted = true;
241259
}
242260

243-
return Task.CompletedTask;
261+
return default;
244262
}, _token);
245263
}
246264
}

0 commit comments

Comments
 (0)