Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rethrow exception on RaiseAndSetIfChanged #2035

Merged
merged 5 commits into from May 21, 2019
Merged
Changes from 2 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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);
}
}
}
@@ -392,6 +392,8 @@ internal void NotifyObservable<T>(TSender rxObj, T item, ISubject<T> subject)
{
_thrownExceptions.Value.OnNext(ex);
}

This conversation was marked as resolved by glennawatson

This comment has been minimized.

Copy link
@glennawatson

glennawatson May 21, 2019

Contributor

I would only throw this if there is no _thrownExceptions.IsValueCreated

throw;
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.