|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Code Execution Just StopsI have a pretty simple call to a network directory that looks something like this ... Dim dirFolder As System.IO.DirectoryInfo dirFolder = New System.IO.DirectoryInfo(sFilePath) Dim filFiles() As System.IO.FileInfo filFiles = dirFolder.GetFiles("*.xml") filFiles should contain all XML files in the sFilePath directory. The problem that I am having is that code execution simply stops on the last line, even when running in debug. Period. I have tried surrounding this with a Try Catch Finally block ... no exceptions are captured. Code execution simply stops. It won't even advance to the next line of code. Has anyone ever seen anything like this? Background: This is a windows service application. I am simply trying to parse through all XML files in a specified directory. Am I doing something wrong that I am not aware of? Above all of that, why does the code just stop? I haven't even seen this kind of behavior in VB6. I have to admit, I am a little uncomfortable with just halting execution. Thanks. Adrian Programmer/Analyst
Show quote
Hide quote
"Adrian Enders" <ender***@royalneighbors.org> schrieb: How long did you wait? Maybe the application is attempting to access the >I have something that I have never seen before in a MS development product. > I have a pretty simple call to a network directory that looks something > like > this ... > > Dim dirFolder As System.IO.DirectoryInfo > > dirFolder = New System.IO.DirectoryInfo(sFilePath) > > Dim filFiles() As System.IO.FileInfo > > filFiles = dirFolder.GetFiles("*.xml") > > > > filFiles should contain all XML files in the sFilePath directory. The > problem that I am having is that code execution simply stops on the last > line, even when running in debug. Period. I have tried surrounding this > with > a Try Catch Finally block ... no exceptions are captured. Code execution > simply stops. It won't even advance to the next line of code. Has anyone > ever seen anything like this? Background: This is a windows service > application. I am simply trying to parse through all XML files in a > specified directory. Am I doing something wrong that I am not aware of? network directory and waits until a timeout occurs because it cannot reach it (missing privileges?). -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message A good thought, but not it, thanks. You did get me looking at permissionsnews:e$C4BSwNFHA.2580@TK2MSFTNGP09.phx.gbl... > "Adrian Enders" <ender***@royalneighbors.org> schrieb: > >I have something that I have never seen before in a MS development product. > > I have a pretty simple call to a network directory that looks something > > like > > this ... > > > > Dim dirFolder As System.IO.DirectoryInfo > > > > dirFolder = New System.IO.DirectoryInfo(sFilePath) > > > > Dim filFiles() As System.IO.FileInfo > > > > filFiles = dirFolder.GetFiles("*.xml") > > > > > > > > filFiles should contain all XML files in the sFilePath directory. The > > problem that I am having is that code execution simply stops on the last > > line, even when running in debug. Period. I have tried surrounding this > > with > > a Try Catch Finally block ... no exceptions are captured. Code execution > > simply stops. It won't even advance to the next line of code. Has anyone > > ever seen anything like this? Background: This is a windows service > > application. I am simply trying to parse through all XML files in a > > specified directory. Am I doing something wrong that I am not aware of? > > How long did you wait? Maybe the application is attempting to access the > network directory and waits until a timeout occurs because it cannot reach > it (missing privileges?). > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> > though. I have it running now ... it was the log in settings for the service itself that did not have permissions to the that directory. By changing the log in for the service itself, instead of letting it default to "Local System", I was able to get the code to continue. I do not understand why there was no exception, no error. The code simply stopped executing, until it was time to fire again. I have this service set up on a timer that checks a database to see if it is time to process. The timer event would fire, but the code would just stop. Then the timer would fire again ... weird. And disconcerting. Thanks for the help! Hi
I agree with Herfried's suggestion. Because this is a network shared folder, and the OS will consider the network connection status, there will be a timeout if we have permission or network connection issue. For the timer issue, I think you may try to take a look at the article below about the three kinds of timer in .NET framework. Unlike the System.Windows.Forms.Timer, the System.Timers.Timer class will, by default, call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool. http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx If you still have any concern, please feel free to post here. Best regards, Peter Huang Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Show quote
Hide quote
""Peter Huang" [MSFT]" <v-phu***@online.microsoft.com> wrote in message Thanks for the input. I am using "System.Timers.Timer" class. And thenews:Kv11ZgyNFHA.1184@TK2MSFTNGXA03.phx.gbl... > Hi > > I agree with Herfried's suggestion. > Because this is a network shared folder, and the OS will consider the > network connection status, there will be a timeout if we have permission or > network connection issue. > For the timer issue, I think you may try to take a look at the article > below about the three kinds of timer in .NET framework. > > Unlike the System.Windows.Forms.Timer, the System.Timers.Timer class will, > by default, call your timer event handler on a worker thread obtained from > the common language runtime (CLR) thread pool. > http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx > > If you still have any concern, please feel free to post here. > > Best regards, > > Peter Huang > Microsoft Online Partner Support > > Get Secure! - www.microsoft.com/security > This posting is provided "AS IS" with no warranties, and confers no rights. > correct answer was permissions. But why does code execution just stop? I have waited well past a timeout phase. There never is an error returned to the code and code execution still just stops. At the timeout point I should at least get an error that I can trap ... "Permission Denied", "You do not have access ...", something. I get nothing. Code just stops until the next timer event is fired. I am going to see if I can figure this out once this project is complete. :) Thanks for the assist gentlemen! Much appreciated. Adrian Hi
Thanks for your feedback. I think why the code stoped is because the .NET code is trying to access to an underlying file system and the file system will try to redirect the request to the network shared folder which is served by the other machine's Server Service. I think windows consider the components stand alone, Also the .NET class is high abstracted, which will conceal some information from the lower level class. From the MSDN, we know that the public FileInfo[] GetFiles() method did not define any exceptions. So I think the information may have been caught. Because it think it is the low level functional class to handle the network/security or else issue. The public FileInfo[] GetFiles(); will just return the file list. So I think the timeout is the network sharing provider's job to handle and the System.Timers.Timer is running on the system's thread pool so it will continue running. If you still have any concern, please feel free to post here. Best regards, Peter Huang Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights.
Opening Forms.
sorting files retrieved by OpenFileDialog Total seconds of day VB.Net Joining Paradox and SQL Server Table? two dlls + arguments Binding a combo box MDI Child Form ? Using Comm dll file in vb.net 2003 error Cannot compile program written by another user on my PC Who is logged on Win2003 Server? |
|||||||||||||||||||||||