Skip to content
Permalink
Browse files

fix: Rethrow exception on RaiseAndSetIfChanged (#2035)

  • Loading branch information...
RLittlesII authored and glennawatson committed May 21, 2019
1 parent fda60ac commit 179e19d7eb2c1334e954ff80380ec503de20f546
@@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using DynamicData;
using Xunit;

@@ -196,5 +197,18 @@ public void ReactiveObjectSmokeTest()
output.AssertAreEqual(output_changing);
results.AssertAreEqual(output);
}

[Fact]
public void ReactiveObjectShouldRethrowException()
{
var fixture = new TestFixture();
var observable = fixture.WhenAnyValue(x => x.IsOnlyOneWord).Skip(1);
observable.Subscribe(x => throw new Exception("This is a test."));

var result = Record.Exception(() => fixture.IsOnlyOneWord = "Two Words");

Assert.IsType<Exception>(result);
Assert.Equal("This is a test.", result.Message);
}
}
}
@@ -391,7 +391,10 @@ internal void NotifyObservable<T>(TSender rxObj, T item, ISubject<T> subject)
if (_thrownExceptions.IsValueCreated)
{
_thrownExceptions.Value.OnNext(ex);
return;
}

throw;
}
}
}

0 comments on commit 179e19d

Please sign in to comment.
You can’t perform that action at this time.