Skip to content

Fix subscribe methods not using latest registered exception handler #329

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/R3/ObservableSubscribeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public static IDisposable Subscribe<T>(this Observable<T> source)
[DebuggerStepThrough]
public static IDisposable Subscribe<T>(this Observable<T> source, Action<T> onNext)
{
return source.Subscribe(new AnonymousObserver<T>(onNext, ObservableSystem.GetUnhandledExceptionHandler(), Stubs.HandleResult));
return source.Subscribe(new AnonymousObserver<T>(onNext, (ex) => ObservableSystem.GetUnhandledExceptionHandler().Invoke(ex), Stubs.HandleResult));
}

[DebuggerStepThrough]
public static IDisposable Subscribe<T>(this Observable<T> source, Action<T> onNext, Action<Result> onCompleted)
{
return source.Subscribe(new AnonymousObserver<T>(onNext, ObservableSystem.GetUnhandledExceptionHandler(), onCompleted));
return source.Subscribe(new AnonymousObserver<T>(onNext, (ex) => ObservableSystem.GetUnhandledExceptionHandler().Invoke(ex), onCompleted));
}

[DebuggerStepThrough]
Expand Down
4 changes: 2 additions & 2 deletions src/R3/Operators/SubscribeAwait.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ public static partial class ObservableExtensions
/// <param name="maxConcurrent">This option is only valid for AwaitOperation.Parallel and AwaitOperation.SequentialParallel. It sets the number of concurrent executions. If set to -1, there is no limit.</param>
public static IDisposable SubscribeAwait<T>(this Observable<T> source, Func<T, CancellationToken, ValueTask> onNextAsync, AwaitOperation awaitOperation = AwaitOperation.Sequential, bool configureAwait = true, bool cancelOnCompleted = false, int maxConcurrent = -1)
{
return SubscribeAwait(source, onNextAsync, ObservableSystem.GetUnhandledExceptionHandler(), Stubs.HandleResult, awaitOperation, configureAwait, cancelOnCompleted, maxConcurrent);
return SubscribeAwait(source, onNextAsync, (ex) => ObservableSystem.GetUnhandledExceptionHandler().Invoke(ex), Stubs.HandleResult, awaitOperation, configureAwait, cancelOnCompleted, maxConcurrent);
}

/// <param name="maxConcurrent">This option is only valid for AwaitOperation.Parallel and AwaitOperation.SequentialParallel. It sets the number of concurrent executions. If set to -1, there is no limit.</param>
public static IDisposable SubscribeAwait<T>(this Observable<T> source, Func<T, CancellationToken, ValueTask> onNextAsync, Action<Result> onCompleted, AwaitOperation awaitOperation = AwaitOperation.Sequential, bool configureAwait = true, bool cancelOnCompleted = false, int maxConcurrent = -1)
{
return SubscribeAwait(source, onNextAsync, ObservableSystem.GetUnhandledExceptionHandler(), onCompleted, awaitOperation, configureAwait, cancelOnCompleted, maxConcurrent);
return SubscribeAwait(source, onNextAsync, (ex) => ObservableSystem.GetUnhandledExceptionHandler().Invoke(ex), onCompleted, awaitOperation, configureAwait, cancelOnCompleted, maxConcurrent);
}

/// <param name="maxConcurrent">This option is only valid for AwaitOperation.Parallel and AwaitOperation.SequentialParallel. It sets the number of concurrent executions. If set to -1, there is no limit.</param>
Expand Down