Repository navigation
Releases: OoLunar/AsyncEvents
Release list
v2.1.0
v2.0.4
v2.0.3
v2.0.2
This release fixes the following exception:
System.InvalidOperationException: Sequence contains no elements.
at OoLunar.AsyncEvents.AsyncEventClosures.AsyncEventMultiPreHandler`1.InvokeAsync(TAsyncEventArgs eventArgs)
at OoLunar.AsyncEvents.AsyncEvent`1.InvokeAsync(TEventArgs eventArgs)
v2.0.1
v2.0.0
AsyncEventContainer/AsyncEvent
All modifications to pre/post handlers are now thread safe to prevent the following error message:
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
IAsyncEvent(<T>)
These two interfaces now contain default implementations, though inheriting from AsyncEvent<T> is still recommended.
AsyncEvent<T>
The AsyncEvent<T> class has been split up. Previously there were three constructors, two of which enabled parallelization behavior that was disabled by default. That behavior has now been moved into the ParallelAsyncEvent<T> class, which may be desired when registering/executing multiple long-running event handlers.
DebugAsyncEvent<T>
This class is very helpful for debugging why specific handlers are not executing. While generally very helpful to use during development, there is a significant performance impact when doing so (+120% in base execution time, 704 + (64 * handlerCount) bytes in memory usage).
ParallelAsyncEvent<T>
Helpful when executing several long running event handlers, this async event type only executes handlers in parallel when the total amount of registered pre/post handlers (exclusive) exceeds MinimumParallelHandlerCount, which is specified only in the constructor. By default, MinimumParallelHandlerCount is set to Environment.ProcessorCount, however it can be overridden. The event handlers are grouped together by priority and executed in batches to ensure behavior relying on another event handler's priority is preserved.
Benchmarks/Tests
Benchmarking and testing have been completely rewritten from scratch, now executing the same logic for different async event types. This ensures consistent behavior and allows for easier spotting of regressions. Unfortunately there are now 402 total benchmarks, so it's recommended to filter out the benchmarks you're not interested in seeing reports for.
v1.4.0
v1.3.0
v1.2.0
This releases adds two new interfaces: IAsyncEvent and IAsyncEvent<in TEventArgs>.
IAsyncEvent
A non-generic version of IAsyncEvent<TEventArgs>. This interface is used to allow the invocation of an IAsyncEvent<TEventArgs> without knowing the type of the event arguments. The main purpose of this interface is to allow the invocation of an IAsyncEvent<TEventArgs> through a non-generic interface, which is useful when the type of the event arguments is not known at compile-time, but may be discovered at runtime through reflection or other similar means.
The event arguments passed to the methods of this interface will be casted to the type of the event arguments of the IAsyncEvent<TEventArgs> implementation. Please ensure that the event arguments passed to the methods of this interface are of the correct type.
IAsyncEvent<in TEventArgs>
This is meant to be an interface requested through DI as requesting the direct class is generally regarded as bad practice.