473,379 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Code Execution Just Stops

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
5 1746
"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

"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
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

""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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Hemanth | last post by:
Hello there, I'm trying to read an excel worksheet (with more than 5000 rows and 30 columns) using PHP. I'm using the "excelreader" script I found over the web -...
2
by: Janna Deegan | last post by:
Hello all, First off, if there is a better place to post for an answer to this question, please feel free to point me there. I have some very strange behavior happening with my System.web.mail...
18
by: Simon | last post by:
I was of the impression that code placed after a Try...Catch block was only executed if there was no exception thrown. I've got some VB.net code as part of a Windows form that executes even...
1
by: Celldss | last post by:
I have a .Net service (VB - 1.1 SP1) deployed in our environment that is experiencing an odd issue. The service does a series of file & registry based checks, logs to the event log and uploads the...
5
by: Cord-Heinrich Pahlmann | last post by:
Hi, I'm wondering when php executes the code. I have a little script which takes around 10 seconds execution time. In those 10 seconds the script does a lot of mysql_queries and changes some...
4
by: GD | last post by:
Hi, I have the following C# code in a page: Response.ContentType = "APPLICATION/OCTET-STREAM"; Response.AppendHeader("Content-Disposition", "Attachment; Filename=\"C:\\Download.txt\"" FileInfo...
5
by: Guillermo Antonio Amaral Bastidas | last post by:
Hi everybody, I have a quick and probably dumb question, keep in mind I just dumped my old love FastCGI + Perl for it's younger hotter friend PHP5. If the user calls a time consuming script...
7
by: Andrew Poulos | last post by:
If I have code that looks like this ajax = function(str) { var val = ""; // do some stuff here return val; }; var foo = ajax("string");
3
by: E. Kwong | last post by:
I have a For loop to insert record to a SQL server database, like: For Each item As ListItem In cblxyz.Items If (item.Selected) Then .... do something Try srcxyz.Insert() Catch SQLExp As...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.