By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,579 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,579 IT Pros & Developers. It's quick & easy.

Code Execution Just Stops

P: n/a
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?
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


Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Adrian Enders" <en******@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/>

Nov 21 '05 #2

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
"Adrian Enders" <en******@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/>


A good thought, but not it, thanks. You did get me looking at permissions
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!
Nov 21 '05 #3

P: n/a
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/is...T/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.

Nov 21 '05 #4

P: n/a

""Peter Huang" [MSFT]" <v-******@online.microsoft.com> wrote in message
news:Kv**************@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/is...T/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.


Thanks for the input. I am using "System.Timers.Timer" class. And the
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
Nov 21 '05 #5

P: n/a
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.

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.