Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

  • Replaced recursive implementation of BuildExceptionString with iterative approach using while loop
  • Added comprehensive tests to verify identical behavior between recursive and iterative versions
  • Prevents potential stack overflow issues with deeply nested exceptions

Changes Made

  • Modified: ExceptionExtensions.cs:BuildExceptionString() - Rewrote from recursive to iterative implementation
  • Added: ExceptionExtensionsTests.cs - Comprehensive test suite including edge cases and deep nesting tests
  • Added: using System.Collections.Generic; - Required for List in iterative implementation

Testing

  • All existing tests continue to pass ✅
  • Added 4 new comprehensive tests covering:
    • Single exception formatting
    • Nested exception formatting
    • Edge case handling
    • Deep nesting (100 levels) without stack overflow

Verification

The iterative implementation produces identical output to the recursive version while avoiding potential stack overflow issues with deeply nested exception chains.

🤖 Generated with Claude Code


Resolves #22

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #22
@konard konard self-assigned this Sep 14, 2025
…ursion

- Replace recursive implementation with iterative version using while loop
- Add comprehensive tests to verify identical behavior
- Prevent potential stack overflow issues with deeply nested exceptions
- Maintain exact same output format and behavior as original recursive version

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Rewrite without recursion and test that it works the same Rewrite BuildExceptionString without recursion Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 09:43
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.

Rewrite without recursion and test that it works the same

1 participant