Method FromAsyncSafe
FromAsyncSafe<T>(Func<Task<T>>)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<T> FromAsyncSafe<T>(Func<Task<T>> actionAsync)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | actionAsync | Asynchronous action to convert. |
Returns
Type | Description |
---|---|
IObservable<T> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe<T>(Func<Task<T>>, IScheduler)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<T> FromAsyncSafe<T>(Func<Task<T>> actionAsync, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | actionAsync | Asynchronous action to convert. |
IScheduler | scheduler | Scheduler on which to notify observers. |
Returns
Type | Description |
---|---|
IObservable<T> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe(Func<Task>)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<Unit> FromAsyncSafe(Func<Task> actionAsync)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | actionAsync | Asynchronous action to convert. |
Returns
Type | Description |
---|---|
IObservable<Unit> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe(Func<Task>, IScheduler)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<Unit> FromAsyncSafe(Func<Task> actionAsync, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<Task> | actionAsync | Asynchronous action to convert. |
IScheduler | scheduler | Scheduler on which to notify observers. |
Returns
Type | Description |
---|---|
IObservable<Unit> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe(Func<CancellationToken, Task>)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<Unit> FromAsyncSafe(Func<CancellationToken, Task> actionAsync)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task> | actionAsync | Asynchronous action to convert. |
Returns
Type | Description |
---|---|
IObservable<Unit> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe(Func<CancellationToken, Task>, IScheduler)
Converts an asynchronous action into an observable sequence. Each subscription to the resulting sequence causes the action to be started. The CancellationToken passed to the asynchronous action is tied to the observable sequence's subscription that triggered the action's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<Unit> FromAsyncSafe(Func<CancellationToken, Task> actionAsync, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task> | actionAsync | Asynchronous action to convert. |
IScheduler | scheduler | Scheduler on which to notify observers. |
Returns
Type | Description |
---|---|
IObservable<Unit> | An observable sequence exposing a Unit value upon completion of the action, or an exception. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe<TResult>(Func<CancellationToken, Task<TResult>>)
Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started. The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<TResult> FromAsyncSafe<TResult>(Func<CancellationToken, Task<TResult>> functionAsync)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task<TResult>> | functionAsync | Asynchronous function to convert. |
Returns
Type | Description |
---|---|
IObservable<TResult> | An observable sequence exposing the result of invoking the function, or an exception. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result returned by the asynchronous function. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
FromAsyncSafe<TResult>(Func<CancellationToken, Task<TResult>>, IScheduler)
Converts an asynchronous function into an observable sequence. Each subscription to the resulting sequence causes the function to be started. The CancellationToken passed to the asynchronous function is tied to the observable sequence's subscription that triggered the function's invocation and can be used for best-effort cancellation. Sets ignoreExceptionsAfterUnsubscribe to true to ignore post-unsub exceptions which tend to be propagated to app domain and crash the app
Declaration
public static IObservable<TResult> FromAsyncSafe<TResult>(Func<CancellationToken, Task<TResult>> functionAsync, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task<TResult>> | functionAsync | Asynchronous function to convert. |
IScheduler | scheduler | Scheduler on which to notify observers. |
Returns
Type | Description |
---|---|
IObservable<TResult> | An observable sequence exposing the result of invoking the function, or an exception. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result returned by the asynchronous function. |
Remarks
When a subscription to the resulting sequence is disposed, the CancellationToken that was fed to the asynchronous function will be signaled.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|