Skip to content

Commit 57bcb6e

Browse files
authored
Merge pull request #818 from danielcweber/rel/v4.1.1
Prepare bugfix release 4.1.1. Contains #806, #807, #809, #816.
2 parents 1888ca8 + 2baca57 commit 57bcb6e

File tree

10 files changed

+101
-6
lines changed

10 files changed

+101
-6
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project>
22
<!-- This props all need to be set in targets as they depend on the values set earlier -->
33
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
4-
<DefineConstants>$(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;DESKTOPCLR</DefineConstants>
4+
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;DESKTOPCLR</DefineConstants>
55
</PropertyGroup>
66
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0'">
77
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
88
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
99
<DefineConstants>$(DefineConstants);NO_CODE_COVERAGE_ATTRIBUTE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;NO_SERIALIZABLE;CRIPPLED_REFLECTION;NO_THREAD;WINDOWS</DefineConstants>
1010
</PropertyGroup>
1111
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
12-
<DefineConstants>$(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;WINDOWS</DefineConstants>
12+
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING;WINDOWS</DefineConstants>
1313
</PropertyGroup>
1414
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp2.0'">
15-
<DefineConstants>$(DefineConstants);HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING</DefineConstants>
15+
<DefineConstants>$(DefineConstants);HAS_TRACE;HAS_WINRT;PREFER_ASYNC;HAS_TPL46;NO_REMOTING</DefineConstants>
1616
</PropertyGroup>
1717
</Project>

Rx.NET/Source/src/Microsoft.Reactive.Testing/TestScheduler.cs

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

55
using System;
6+
using System.Diagnostics;
67
using System.Reactive;
78
using System.Reactive.Concurrency;
89
using System.Reactive.Disposables;
@@ -12,6 +13,10 @@ namespace Microsoft.Reactive.Testing
1213
/// <summary>
1314
/// Virtual time scheduler used for testing applications and libraries built using Reactive Extensions.
1415
/// </summary>
16+
[DebuggerDisplay("\\{ " +
17+
nameof(Clock) + " = {" + nameof(Clock) + "} " +
18+
nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " +
19+
"\\}")]
1520
public class TestScheduler : VirtualTimeScheduler<long, long>
1621
{
1722
/// <summary>

Rx.NET/Source/src/System.Reactive/Concurrency/HistoricalScheduler.cs

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

55
using System.Collections.Generic;
6+
using System.Diagnostics;
67

78
namespace System.Reactive.Concurrency
89
{
@@ -67,6 +68,10 @@ protected override DateTimeOffset Add(DateTimeOffset absolute, TimeSpan relative
6768
/// <summary>
6869
/// Provides a virtual time scheduler that uses <see cref="DateTimeOffset"/> for absolute time and <see cref="TimeSpan"/> for relative time.
6970
/// </summary>
71+
[DebuggerDisplay("\\{ " +
72+
nameof(Clock) + " = {" + nameof(Clock) + "} " +
73+
nameof(Now) + " = {" + nameof(Now) + ".ToString(\"O\")} " +
74+
"\\}")]
7075
public class HistoricalScheduler : HistoricalSchedulerBase
7176
{
7277
private readonly SchedulerQueue<DateTimeOffset> _queue = new SchedulerQueue<DateTimeOffset>();

Rx.NET/Source/src/System.Reactive/Internal/HalfSerializer.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information.
44

5+
using System.Diagnostics;
56
using System.Threading;
67

78
namespace System.Reactive
@@ -47,6 +48,10 @@ public static void ForwardOnNext<T>(ISink<T> sink, T item, ref int wip, ref Exce
4748
}
4849
}
4950
}
51+
#if (HAS_TRACE)
52+
else if (error == null)
53+
Trace.TraceWarning("OnNext called while another OnNext call was in progress on the same Observer.");
54+
#endif
5055
}
5156

5257
/// <summary>

Rx.NET/Source/src/System.Reactive/Linq/Observable/Zip.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,11 @@ private void OnCompleted(int index)
661661
}
662662
else
663663
{
664-
_subscriptions[index].Dispose();
664+
var subscriptions = Volatile.Read(ref _subscriptions);
665+
if (subscriptions != null && subscriptions != Array.Empty<IDisposable>())
666+
{
667+
Disposable.TryDispose(ref subscriptions[index]);
668+
}
665669
}
666670
}
667671
}

Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Creation.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ public void Dispose()
155155

156156
public void OnCompleted()
157157
{
158-
_observer.OnCompleted();
159158
}
160159

161160
public void OnError(Exception error)
@@ -233,7 +232,6 @@ public void Dispose()
233232

234233
public void OnCompleted()
235234
{
236-
_observer.OnCompleted();
237235
}
238236

239237
public void OnError(Exception error)

Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Core.approved.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ namespace System.Reactive.Concurrency
267267
public System.IDisposable SchedulePeriodic<TState>(TState state, System.TimeSpan period, System.Func<TState, TState> action) { }
268268
public override System.Reactive.Concurrency.IStopwatch StartStopwatch() { }
269269
}
270+
[System.Diagnostics.DebuggerDisplayAttribute("\\{ Clock = {Clock} Now = {Now.ToString(\"O\")} \\}")]
270271
public class HistoricalScheduler : System.Reactive.Concurrency.HistoricalSchedulerBase
271272
{
272273
public HistoricalScheduler() { }

Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api/ApiApprovalTests.Testing.approved.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ namespace Microsoft.Reactive.Testing
7171
public override int GetHashCode() { }
7272
public override string ToString() { }
7373
}
74+
[System.Diagnostics.DebuggerDisplayAttribute("\\{ Clock = {Clock} Now = {Now.ToString(\"O\")} \\}")]
7475
public class TestScheduler : System.Reactive.Concurrency.VirtualTimeScheduler<long, long>
7576
{
7677
public TestScheduler() { }

Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/CreateAsyncTest.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,5 +705,46 @@ public void CreateAsync_Action_Token()
705705
Assert.True(lst.Take(10).SequenceEqual(Enumerable.Repeat(42, 10)));
706706
}
707707

708+
709+
[Fact]
710+
public void CreateWithTaskDisposable_NoPrematureTermination()
711+
{
712+
var obs = Observable.Create<int>(async o =>
713+
{
714+
// avoid warning on async o due to no await
715+
await Task.CompletedTask;
716+
717+
var inner = Observable.Range(1, 3);
718+
719+
return inner.Subscribe(x =>
720+
{
721+
o.OnNext(x);
722+
});
723+
});
724+
725+
var result = obs.Take(1).Wait();
726+
}
727+
728+
[Fact]
729+
public void CreateWithTaskAction_NoPrematureTermination()
730+
{
731+
var obs = Observable.Create<int>(async o =>
732+
{
733+
// avoid warning on async o due to no await
734+
await Task.CompletedTask;
735+
736+
var inner = Observable.Range(1, 3);
737+
738+
var d = inner.Subscribe(x =>
739+
{
740+
o.OnNext(x);
741+
});
742+
743+
Action a = () => d.Dispose();
744+
return a;
745+
});
746+
747+
var result = obs.Take(1).Wait();
748+
}
708749
}
709750
}

Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/ZipTest.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4448,6 +4448,41 @@ public void Zip_AtLeastOneThrows4()
44484448

44494449
#endregion
44504450

4451+
[Fact]
4452+
public void Zip2WithImmediateReturn()
4453+
{
4454+
Observable.Zip<Unit, Unit, Unit>(
4455+
Observable.Return(Unit.Default),
4456+
Observable.Return(Unit.Default),
4457+
(_, __) => Unit.Default
4458+
)
4459+
.Subscribe(_ => { });
4460+
}
4461+
4462+
[Fact]
4463+
public void Zip3WithImmediateReturn()
4464+
{
4465+
Observable.Zip<Unit, Unit, Unit, Unit>(
4466+
Observable.Return(Unit.Default),
4467+
Observable.Return(Unit.Default),
4468+
Observable.Return(Unit.Default),
4469+
(_, __, ___) => Unit.Default
4470+
)
4471+
.Subscribe(_ => { });
4472+
}
4473+
4474+
[Fact]
4475+
public void ZipEnumerableWithImmediateReturn()
4476+
{
4477+
Enumerable.Range(0, 100)
4478+
.Select(_ => Observable.Return(Unit.Default))
4479+
.Zip()
4480+
.Subscribe(_ =>
4481+
{
4482+
4483+
}
4484+
);
4485+
}
44514486
}
44524487
#pragma warning restore IDE0039 // Use local function
44534488
}

0 commit comments

Comments
 (0)