Enhance DI integration and update dependencies#57
Conversation
Improves and documents extension methods for integrating ReactiveUI with various DI containers (Autofac, DryIoc, Microsoft DI, Ninject) in Avalonia applications. Updates test mocks to match expanded IDependencyResolver interface. Refactors and documents AppBuilderExtensions and related classes for clarity and extensibility. Updates dependencies: Avalonia to 11.3.11, Splat to 19.2.1, and ReactiveUI to 23.1.0-beta.1.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
+ Coverage 59.86% 66.32% +6.46%
==========================================
Files 16 16
Lines 715 582 -133
Branches 103 91 -12
==========================================
- Hits 428 386 -42
+ Misses 263 174 -89
+ Partials 24 22 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates ReactiveUI.Avalonia to newer Avalonia/Splat/ReactiveUI versions and refactors the Avalonia integration APIs (notably DI + builder setup), with corresponding test/mocking updates and extensive XML doc improvements.
Changes:
- Update central package versions (Avalonia 11.3.11, Splat 19.2.1, ReactiveUI 23.1.0-beta.1).
- Refactor
AppBuilderintegration APIs to useReactiveUIBuildercallbacks and improve DI container integration + view registration. - Update bindings/activation helpers and unit tests to match updated ReactiveUI/Splat interfaces and behaviors.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ReactiveUI.Avalonia/ViewModelViewHost.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/RoutedViewHost.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/ReactiveWindow.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/ReactiveUserControl.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/ReactiveUI.Avalonia.csproj | Adds many project-level global usings to replace per-file usings. |
| src/ReactiveUI.Avalonia/AvaloniaScheduler.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/AvaloniaObjectReactiveExtensions.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/AvaloniaObjectObservableForProperty.cs | Doc comment updates; minor helper doc added. |
| src/ReactiveUI.Avalonia/AvaloniaCreatesCommandBinding.cs | Refactors command binding API; adds new overloads and documentation. |
| src/ReactiveUI.Avalonia/AvaloniaActivationForViewFetcher.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/AutoSuspendHelper.cs | Switches to RxSuspension.SuspensionHost; doc updates. |
| src/ReactiveUI.Avalonia/AutoDataTemplateBindingHook.cs | Doc comment updates; relies on new global usings. |
| src/ReactiveUI.Avalonia/AppBuilderExtensions.cs | Refactors ReactiveUI setup/DI integration + view registration surface. |
| src/ReactiveUI.Avalonia.Tests/UseReactiveUIWithDIContainerTests.cs | Updates dummy resolver + call sites for new DI/builder signatures. |
| src/ReactiveUI.Avalonia.Tests/AvaloniaCreatesCommandBindingTests.cs | Updates tests to new generic binding APIs and nullability. |
| src/ReactiveUI.Avalonia.Tests/AutoSuspendHelperTests.cs | Updates to RxSuspension.SuspensionHost. |
| src/ReactiveUI.Avalonia.Tests/AutoDataTemplateBindingHookTests.cs | Initializes builder state explicitly before hooks run. |
| src/ReactiveUI.Avalonia.Tests/AppBuilderExtensionsTests.cs | Updates to new UseReactiveUI signature. |
| src/ReactiveUI.Avalonia.Ninject/AvaloniaMixins.cs | Updates DI integration method signature/docs to match new builder pattern. |
| src/ReactiveUI.Avalonia.Microsoft1.Tests/AvaloniaMixinsMicrosoftTests.cs | Updates dummy resolver + call sites for new DI/builder signatures. |
| src/ReactiveUI.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs | Updates DI integration method signature/docs to match new builder pattern. |
| src/ReactiveUI.Avalonia.DryIoc1.Tests/AvaloniaMixinsDryIocTests.cs | Updates call sites and contract-related registration expectations. |
| src/ReactiveUI.Avalonia.DryIoc1.Tests/AvaloniaMixinsDryIocMoreTests.cs | Updates call sites for new DI/builder signatures. |
| src/ReactiveUI.Avalonia.DryIoc/AvaloniaMixins.cs | Updates DI integration method signature/docs to match new builder pattern. |
| src/ReactiveUI.Avalonia.Autofac/AvaloniaMixins.cs | Updates DI integration method signature/docs to match new builder pattern. |
| src/Directory.Packages.props | Central version bumps for Avalonia/Splat/ReactiveUI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public static AppBuilder UseReactiveUI(this AppBuilder builder, Action<ReactiveUIBuilder> withReactiveUIBuilder) | ||
| { |
There was a problem hiding this comment.
Public API change: the parameterless UseReactiveUI(this AppBuilder builder) overload appears to have been removed, and UseReactiveUIWithDIContainer now requires an extra configureReactiveUI argument. If maintaining source compatibility is important for this package, consider reintroducing overloads that preserve the previous signatures (delegating to the new implementations with a no-op callback).
src/ReactiveUI.Avalonia.Microsoft.Extensions.DependencyInjection/AvaloniaMixins.cs
Show resolved
Hide resolved
Refactored AutoSuspendHelperTests setup to use ReactiveUIBuilder and WithSuspensionHost for improved test isolation. Updated AppBuilderExtensions to chain WithSuspensionHost<Unit>() in the builder configuration.
Method signatures in AvaloniaCreatesCommandBinding.cs have been reformatted to use multi-line parameter lists for improved readability. The BindCommandToObject overload with custom event handlers now returns Disposable.Empty instead of throwing NotImplementedException.
Corrected the summary comment in the ReactiveWindow constructor to fix a line break and improve readability.
Corrected a line break in the XML documentation comment for the RoutedViewHost constructor to improve readability and maintain consistency.
Removed an unnecessary period at the end of the first sentence in the XML documentation for the ViewModelViewHost constructor to improve consistency and style.
What kind of change does this PR introduce?
update
What is the current behavior?
Works with ReactiveUI 22.1.1
What is the new behavior?
Improves and documents extension methods for integrating ReactiveUI with various DI containers (Autofac, DryIoc, Microsoft DI, Ninject) in Avalonia applications. Updates test mocks to match expanded IDependencyResolver interface. Refactors and documents AppBuilderExtensions and related classes for clarity and extensibility. Updates dependencies: Avalonia to 11.3.11, Splat to 19.2.1, and ReactiveUI to 23.1.0-beta.1.
What might this PR break?
Splat Breaking changes
Registration of simple types now honours the contract when given and will not return an item registered with a contract when GetServices() is called.
Please check if the PR fulfills these requirements
Other information: