Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 739833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:26:45+00:00 2026-05-14T08:26:45+00:00

I am working on porting a VB6 application to C# (Winforms 3.5) and while

  • 0

I am working on porting a VB6 application to C# (Winforms 3.5) and while doing so I’m trying to break up the functionality into various classes (ie database class, data validation class, string manipulation class).

Right now when I attempt to run the program in Debug mode the program pauses and then crashes with a StackOverFlowException. VS 2008 suggests a infinite recursion cause.

I have been trying to trace what might be causing this recursion and right now my only hypothesis is that class initializations (which I do in the header(?) of each class).

My thought is this:

  • mainForm initializes classA
  • classA initializes classB
  • classB initializes classA
  • ….

Does this make sense or should I be looking elsewhere?

UPDATE1 (a code sample):

mainForm

namespace john
{
    public partial class frmLogin : Form
    {
    stringCustom sc = new sc();

stringCustom

namespace john
{
   class stringCustom
   {
       retrieveValues rv = new retrieveValues();

retrieveValues

namespace john
{
    class retrieveValues
    {
    stringCustom sc = new stringCustom();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T08:26:46+00:00Added an answer on May 14, 2026 at 8:26 am

    9 times out of 10, infinite recursion bugs are caused by bad property accessors:

    public class BrokenClass
    {
        private string name;
    
        public string Name
        {
            get { return name; }
            set { Name = value; }  // <--- Whoops
        }
    }
    

    I’ve also had it happen when doing major refactorings with method overloads; sometimes you accidentally end up with a method calling itself when it’s supposed to call a different overloaded method.

    Either way, you should be able to tell by looking at the call stack for the exception and checking for a repeating pattern. If you see one, then your problem is somewhere in that loop.

    Edit – well, based on your example code, you definitely have infinite recursion in the initializers. I have no idea what that code is supposed to be doing, but it’s never going to terminate. StringCustom immediately creates RetrieveValues which immediately creates another StringCustom, and so on.

    This is one reason why circular class dependencies are typically considered a code smell. Whenever you see ClassA depending on ClassB and ClassB depending on ClassA then you should try to refactor; the exception is if ClassB is entirely owned and managed by ClassA (i.e. an inner class), which is clearly not the case here. You need to eliminate one of the dependencies somehow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on porting a Visual C++ application to GCC (should build on MingW
In the application I'm working on porting to the web, we currently dynamically access
I've been working on a project of porting an old solaris CL program to
Right now I am porting a VB6 project over to C# and keep getting
I'm working on a drupal site where I allow users to login while at
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project at the moment and we have to implement soft deletion
Working on a somewhat complex page for configuring customers at work. The setup is
Working on a project that parses a log of events, and then updates a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.