Skip to content

Fix StackOverflowException in WithFallbackConverter (issue #4293)#4294

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-stackoverflowexception-4293
Draft

Fix StackOverflowException in WithFallbackConverter (issue #4293)#4294
Copilot wants to merge 2 commits intomainfrom
copilot/fix-stackoverflowexception-4293

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

WithFallbackConverter (and related converter extension methods) in BuilderMixins.cs called builder.WithFallbackConverter(...) on a parameter typed as IReactiveUIBuilder. Since the interface didn't declare these methods, C# resolved the call to the same extension method — infinite recursion. The bug surfaced when chaining after WithWpf(), which returns IReactiveUIBuilder rather than the concrete ReactiveUIBuilder:

// StackOverflowException before this fix
RxAppBuilder.CreateReactiveUIBuilder()
    .WithWpf()                                           // returns IReactiveUIBuilder
    .WithFallbackConverter(new DefaultFallbackConverter()) // recursed into itself
    .BuildApp();

Changes

  • IReactiveUIBuilder — Added 9 missing converter method declarations: WithConverter (×4 overloads), WithFallbackConverter (×2), WithSetMethodConverter (×2), and WithConvertersFrom. ReactiveUIBuilder already implements all of them; the interface was simply missing these signatures, preventing proper virtual dispatch from the extension methods.

  • ReactiveUIBuilderConverterTests — Added 5 tests for WithFallbackConverter, including a regression test (WithFallbackConverter_ViaInterfaceTypedVariable_DoesNotRecurse) that exercises the method through an IReactiveUIBuilder-typed variable to guard against this class of recursion bug.

  • API approval snapshots — Updated DotNet8_0, DotNet9_0, and DotNet10_0 verified API files to reflect the expanded interface surface.

Original prompt

Create a fix for the StackOverflowException reported in issue #4293 in reactiveui/ReactiveUI, where calling RxAppBuilder.CreateReactiveUIBuilder().WithWpf().WithFallbackConverter(new DefaultFallbackConverter()).BuildApp(); causes infinite recursion/stack overflow in ReactiveUI.Builder.BuilderMixins.WithFallbackConverter.

Requirements:

  1. Identify the root cause of the recursion between the WithFallbackConverter overload(s) in src/ReactiveUI/Mixins/BuilderMixins.cs (stack trace indicates repeated calls around lines ~1278-1279).
  2. Implement a code change that prevents recursion and correctly registers/sets the provided IBindingFallbackConverter so a default fallback converter is used with WPF.
  3. Add/extend unit tests to cover:
    • WithFallbackConverter successfully sets a non-null converter without recursion.
    • Calling WithFallbackConverter(new DefaultFallbackConverter()) followed by BuildApp() does not throw and results in the expected converter being used.
    • A regression test that would fail with the previous recursive implementation (e.g., ensure the method does not call itself).
  4. Ensure tests run in CI for the repository’s existing test framework.
  5. Review any repository-specific guidance in the Claude/agent instruction files (e.g., CLAUDE.md, .github/copilot-instructions.md, .github/agents/**, or similar) and follow conventions for coding style, testing patterns, and PR expectations.
  6. Update any relevant documentation or changelog entries if the project conventions require it.

Reference:

Deliverables:

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…er methods to IReactiveUIBuilder interface

Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix StackOverflowException in WithFallbackConverter method Fix StackOverflowException in WithFallbackConverter (issue #4293) Feb 22, 2026
Copilot AI requested a review from glennawatson February 22, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants