Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable/Aggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public _(Func<TSource, TSource, TSource> accumulator, IObserver<TSource> observe
: base(observer)
{
_accumulator = accumulator;
_accumulation = default;
_hasAccumulation = false;
}

public override void OnNext(TSource value)
Expand All @@ -48,11 +46,18 @@ public override void OnNext(TSource value)
}
catch (Exception exception)
{
_accumulation = default;
ForwardOnError(exception);
}
}
}

public override void OnError(Exception error)
{
_accumulation = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
if (!_hasAccumulation)
Expand All @@ -61,7 +66,9 @@ public override void OnCompleted()
}
else
{
ForwardOnNext(_accumulation);
var accumulation = _accumulation;
_accumulation = default;
ForwardOnNext(accumulation);
ForwardOnCompleted();
}
}
Expand Down Expand Up @@ -105,18 +112,22 @@ public override void OnNext(TSource value)
}
catch (Exception exception)
{
_accumulation = default;
ForwardOnError(exception);
}
}

public override void OnError(Exception error)
{
_accumulation = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
ForwardOnNext(_accumulation);
var accumulation = _accumulation;
_accumulation = default;
ForwardOnNext(accumulation);
ForwardOnCompleted();
}
}
Expand Down
27 changes: 20 additions & 7 deletions Rx.NET/Source/src/System.Reactive/Linq/Observable/LastAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ internal sealed class _ : IdentitySink<TSource>
public _(IObserver<TSource> observer)
: base(observer)
{
_value = default;
_seenValue = false;

}

public override void OnNext(TSource value)
Expand All @@ -37,6 +36,12 @@ public override void OnNext(TSource value)
_seenValue = true;
}

public override void OnError(Exception error)
{
_value = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
if (!_seenValue)
Expand All @@ -45,7 +50,9 @@ public override void OnCompleted()
}
else
{
ForwardOnNext(_value);
var value = _value;
_value = default;
ForwardOnNext(value);
ForwardOnCompleted();
}
}
Expand Down Expand Up @@ -77,9 +84,6 @@ public _(Func<TSource, bool> predicate, IObserver<TSource> observer)
: base(observer)
{
_predicate = predicate;

_value = default;
_seenValue = false;
}

public override void OnNext(TSource value)
Expand All @@ -92,6 +96,7 @@ public override void OnNext(TSource value)
}
catch (Exception ex)
{
_value = default;
ForwardOnError(ex);
return;
}
Expand All @@ -103,6 +108,12 @@ public override void OnNext(TSource value)
}
}

public override void OnError(Exception error)
{
_value = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
if (!_seenValue)
Expand All @@ -111,7 +122,9 @@ public override void OnCompleted()
}
else
{
ForwardOnNext(_value);
var value = _value;
_value = default;
ForwardOnNext(value);
ForwardOnCompleted();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ internal sealed class _ : IdentitySink<TSource>
public _(IObserver<TSource> observer)
: base(observer)
{
_value = default;

}

public override void OnNext(TSource value)
{
_value = value;
}

public override void OnError(Exception error)
{
_value = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
ForwardOnNext(_value);
var value = _value;
_value = default;
ForwardOnNext(value);
ForwardOnCompleted();
}
}
Expand Down Expand Up @@ -66,8 +74,6 @@ public _(Func<TSource, bool> predicate, IObserver<TSource> observer)
: base(observer)
{
_predicate = predicate;

_value = default;
}

public override void OnNext(TSource value)
Expand All @@ -80,6 +86,7 @@ public override void OnNext(TSource value)
}
catch (Exception ex)
{
_value = default;
ForwardOnError(ex);
return;
}
Expand All @@ -90,9 +97,17 @@ public override void OnNext(TSource value)
}
}

public override void OnError(Exception error)
{
_value = default;
ForwardOnError(error);
}

public override void OnCompleted()
{
ForwardOnNext(_value);
var value = _value;
_value = default;
ForwardOnNext(value);
ForwardOnCompleted();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618</NoWarn>
<LangVersion>7.1</LangVersion>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed. The LangVersion is set to latest in the Directory.Build.props. This lowers it.

</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void Using_Null()
_d = d;
createInvoked++;
xs = scheduler.CreateColdObservable(
OnNext<long>(100, scheduler.Clock),
OnNext(100, scheduler.Clock),
OnCompleted<long>(200));
return xs;
}
Expand Down