troubleshooting Question

Stack overflow problem -- Help needed

Avatar of frosty5656
frosty5656 asked on
.NET ProgrammingVisual Basic.NET
4 Comments1 Solution670 ViewsLast Modified:

  I am working with VB.NET in a windows form.

  I am trying to write a program that loops through several FTP connections. Here is the snippet of code that I am having problems with:

--- Code: ---

                Dim listRequest As FtpWebRequest 'FTP request
                Dim listResponse As FtpWebResponse 'FTP response

                'establishing connection and requesting response
                listRequest = CType(WebRequest.Create(path), FtpWebRequest)
                listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails

                listResponse = CType(listRequest.GetResponse(), FtpWebResponse) 'stack overflow exception is thrown on this line

--- End code ---

This code is looped through when each FTP connection is established. The code works well until about the 1900th loop then i get a stack overflow error thrown.

My question is why am I getting a stack overflow error? I don't see how a stack overflow can occur with the above code.

Exact error message: "An unhandled exception of type 'System.StackOverflowException' occurred in System.dll"

Any help would be appreciated.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros