Share via

I have a StackOverflow exception in Visual Studio

Scot King 116 Reputation points
2026-01-11T02:34:20.2133333+00:00

I need someone to login to my computer via live share and help me uncover the reason for this issue. My page is an amortization calculator for the mortgage industry. The calculator works fine when the original loan amount is not changed however when the loan amount is changed, fees have to be recalculated and I have a helper function for this. There appears to be recursion taking place and I cannot isolate where it is coming from.


Moved from: Community Center | Not monitored

Developer technologies | Visual Studio | Debugging

2 answers

Sort by: Most helpful
  1. Shivam Chauhan 0 Reputation points Microsoft Employee
    2026-03-16T19:43:50.23+00:00

    Hi Scot,

    A StackOverflow exception usually indicates unintended recursion or a loop of method calls that keeps calling itself without a proper exit condition.

    Since the issue occurs when the loan amount changes and fees are recalculated, it’s likely that the helper function for recalculating fees is triggering the same calculation or event again, causing a recursive loop.

    A few things you may want to check:

    1. Event Handlers / Property Setters Ensure that updating the loan amount or recalculated fees is not triggering the same change event or property setter again.

    2. Recursive Method Calls Review the helper function and confirm it is not indirectly calling itself through another method.

    3. Data Binding Loops If this is tied to UI binding (e.g., property changed events), updating a value inside the handler may be triggering the handler repeatedly.

    4. Add Logging / Breakpoints Place breakpoints or logging inside the helper method and any related setters/events to see the call stack sequence and identify the repeated call.

    5. Guard Conditions You may need a simple guard flag (e.g., isRecalculating) to prevent the calculation from being triggered again while it is already running.

    If you’re able to share the helper function and where it is being called, it would be easier to pinpoint the exact recursion causing the StackOverflow.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.