Add [Serializable] and serialization constructor to ConcurrentObserverCallsException#127
Merged
ChrisPulman merged 2 commits intoCP_UpdatePackagesfrom Feb 28, 2026
Merged
Conversation
2 tasks
…entObserverCallsException Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update async library based on review feedback
Add [Serializable] and serialization constructor to ConcurrentObserverCallsException
Feb 28, 2026
ChrisPulman
approved these changes
Feb 28, 2026
ChrisPulman
added a commit
that referenced
this pull request
Feb 28, 2026
* Bump packages; fix async test subscriptions Update package versions in Directory.Packages.props (Polyfill -> 9.12.0, Microsoft.NET.Test.Sdk -> 18.3.0, TUnit -> 1.17.54, Verify.TUnit -> 31.13.2, Microsoft.Testing.Extensions.CodeCoverage -> 18.5.1, etc.) and remove some older test package entries. Refactor ReactiveExtensionsTests to reliably track and await async subscription handlers: replace inline async Subscribe callbacks with a tasks list and a local HandleAsync wrapper that disposes the sync token in a finally block, then await Task.WhenAll(tasks) to avoid race conditions and flakiness in the tests. * Add scheduler support to SyncTimer and tests Change SyncTimer to key timers by both TimeSpan and IScheduler, add an overload SyncTimer(TimeSpan, IScheduler) and keep a fallback to Scheduler.Default. Validate scheduler is non-null and create the underlying Observable.Timer with the provided scheduler so timers can be shared per scheduler. Update tests to use TestScheduler (pass it into SyncTimer and OnErrorRetry), and replace async wait helpers with scheduler.AdvanceBy to make timing deterministic. * Modernize async library and test fixes Apply modern C# updates and various test fixes across the async library. Highlights: - Update .github documentation target frameworks and add RCS1047 to NoWarn in Directory.Build.props. - Bump copyright years from 2019-2025 to 2019-2026 in many source files. - Add conditional ArgumentNullException.ThrowIfNull / ThrowIfLessThan checks for .NET 8+ and use Lock on newer frameworks where appropriate to improve null-safety and reliability. - Expand ConcurrentObserverCallsException into a full exception class with standard constructors. - Minor API/implementation cleanups: suppress CA2000 where needed, simplify nullable/collection initializations, expression-bodied test methods, additional disposals in tests, and other small refactors to reduce analyzer warnings and improve robustness. * Add ArgumentExceptionHelper and centralize null checks Introduce Internal/ArgumentExceptionHelper with ThrowIfNull and ThrowIfNullOrEmpty helpers and replace scattered NET8/legacy null-check conditionals across the Async and Reactive extensions with calls to ArgumentExceptionHelper.ThrowIfNull. This centralizes argument validation (removing many #if NET8_0_OR_GREATER blocks), streamlines a few checks (e.g. Timeout and WaitForCondition), and reduces duplication across numerous operator/subject/observable implementations. * Add [Serializable] and serialization constructor to ConcurrentObserverCallsException (#127) * Initial plan * Add [Serializable] attribute and serialization constructor to ConcurrentObserverCallsException Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com> * Move RCS1047 suppression to .editorconfig Set dotnet_diagnostic.RCS1047.severity = none in .editorconfig and remove RCS1047 from the NoWarn list in src/Directory.Build.props. This centralizes the analyzer configuration in .editorconfig and avoids duplicate suppression in MSBuild. * Fix WhenOnDisposeAsyncSourceFails_ThenCallbackInvoked to actually assert callback invocation (#128) * Initial plan * Add disposeCallbackInvoked flag assertion in WhenOnDisposeAsyncSourceFails_ThenCallbackInvoked test Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Custom exception types targeting .NET Framework (net462/net472/net481) must be marked
[Serializable]and include a protected serialization constructor to satisfy the standardExceptionpattern and avoid analyzer warnings.Changes
[Serializable]— Added toConcurrentObserverCallsExceptionclass declarationprotected ConcurrentObserverCallsException(SerializationInfo, StreamingContext)gated behind#if NETFRAMEWORKsinceBinaryFormatter-based serialization is only relevant on .NET Framework; not needed (and obsolete) on modern .NETusing System.Runtime.Serialization;scoped to#if NETFRAMEWORKto avoid pulling in the namespace on modern TFMs💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.