Umair-Shahzad

Hi,

I'm trying to call a method which exists in Form1.cs file from a UserControl file called UserControl1.cs . This is how i'm doing it:

Form1 inst = new Form1();
inst.server_Start();

Now when I run the program, i get the above mentioned Exception. However, when i remove Form1 inst = new Form1(); along with the method call, the program runs just fine. What should I do



Re: Visual C# General StackOverflowException was unhandled.

John.Doe

Just to state the obvious:

Somewhere in the constructor of Form1 or the server_Start call is something like an endless recursion or similar that overflows your stack. Debug and fix it...





Re: Visual C# General StackOverflowException was unhandled.

Peter Ritchie

server_Start() is causing a stack overflow.  This is usually called by an infinite recursive call.

If you post the source to this method someone might be able to offer some guidance.




Re: Visual C# General StackOverflowException was unhandled.

Umair-Shahzad

Thankyou for replying guys. The code inside that particular method which i was calling was stuck inside an infinite loop; tcplistener, it kept waiting for clients to connect...Cheers.