473,419 Members | 1,824 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,419 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 1748
"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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.