Thursday, April 17, 2008 3:20 PM
Thursday, April 17, 2008 3:37 PM
There could be a number of things.
1) how many processes after does it do this?
2) What is your code? Please do post your code so we can look at it and hopefully help you
I think it maybe something to do with your coding causing the error. I could be wrong however but sounds like it because something somewhere is calling the same function/method over and over and over and over........overflowing the stack hence why you get this exception.
Thursday, April 17, 2008 4:07 PM
I removed most of the code, and in the simplest form given belwo, I am still getting the error. Here is the code:
For Each FileName As String In My.Computer.FileSystem.GetFiles(My.Application.CommandLineArgs(0), FileIO.SearchOption.SearchTopLevelOnly, "*")
If InStr(FileName, "997", CompareMethod.Text) > 0 Then
Console.WriteLine("-- this is 997 --")
It gives me the same error when I run it on a directory which has 310 files. If I run it on a directory which has only 20 files, it works fine from IDE and from command line.
Thursday, April 17, 2008 4:55 PM
ok, code improvements can be done here. Use the .NET Classes for comparing strings rather than using the old method instr. use String.compare instead, as its better, improved and you upgrade your .NET Skills also ;-)
I have just ran this code with over 3000 files and works great. I believe your code somewhere else is causing a problem, can you post the FULL code please?
Thursday, April 17, 2008 5:41 PM
Thank you for the tip, I will update my code.
I created a new Project with just the code I have posted above and same issue. So, I did some more research and found that the code works fine if I run it against a folder on local computer. What I am trying to do is run it against a folder which resides on our server. It works fine on local machine with same files, but if I move the files over to network share and run it against them, I get the StackOverflowException from command line but not from IDE. Also, if I delete some files from the folder and just leave few, it works, but not if I have all 310 files in it.
I can try to compile it on another machine if you think that will solve the problem? I just need to install Express edition on it.
Thursday, April 17, 2008 6:16 PM
I find that interesting on why it works fine locally but when accessing files on a network machine, it would cause that error. It should be the same process as if you were accessing files locally.
StackOverFlowException happens when within your code, you are calling a method repetitively, or even a property calling on itself as its stack is flowed over (over flow). So its entirely based on your own code I believe and 99% confident in that area.
Feel free to send the entire project as is via my email in my profile and i will be sure to see and post the solution, should I find one.
I find it interesting and see what I can do.
Friday, April 18, 2008 10:49 AM
After doing some more debuging, I found that it is not issue with server either, seems to have something to do with the time it takes for server to responsd. Lets say, if I run the same program from PC-A to the SERVER-A where both are at the same site, it works, but if I move the program to another site on PC-B which is connected via T1 line to SERVER-A, then it gives the StackOverlowException if there are lots of files in the folder.
I might send the entire project to you after I am done with it so you can review. For now, I am creating a batch file, which will first copy the files from server to local PC, process them, and then copy them back to the server. This seems to be working.
Thank you very much for your help.
Tuesday, April 22, 2008 6:36 AMModeratorHi Naveedb,
To troubleshoot this issue, we really need the source code and the detailed steps to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. Please supply the detailed steps and the simplest sample to let us reproduce your scenario.