473,480 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

EOF Occurs Early

I have an interesting problem with file IO, maybe even a bug in the CLR.

I call a method that uses an XmlReader to loop through 4 MB XML files and
store the text in a database. I select the files in a file select dialog and
loop through the filename array, calling the XmlReader method each time.

If I input one file, everything works properly. If I input several files,
the first file is not read completely. The rest are then processed
correctly. It doesn't matter which file is the first file selected, it
always results in incomplete data from that file. In fact, it always drops
off at the same record each time, about a quarter way through the file.

I checked with the debugger, and when the file hits the record where it
drops out, the XmlReader reports end of file.

Has anyone heard of a similar problem as this? Any ideas how I might fix or
workaround the problem?

I tried adding a FileStream to the XmlReader but it didn't help.

--
Regards,

Fred Chateau
http://hotelmotelnow.com
Jun 6 '07 #1
4 1252
I got some more information to go with this.

You can select four files and all files are processed correctly. Seven or
more files causes the first one to drop out early. Does this make sense to
anyone because it doesn't make sense to me? The files are being processed
one at a time, I think. It's just the filenames that are held in an array
until the method is called.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Fred Chateau" <we*******@hotelmotelnow.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have an interesting problem with file IO, maybe even a bug in the CLR.

I call a method that uses an XmlReader to loop through 4 MB XML files and
store the text in a database. I select the files in a file select dialog
and loop through the filename array, calling the XmlReader method each
time.

If I input one file, everything works properly. If I input several files,
the first file is not read completely. The rest are then processed
correctly. It doesn't matter which file is the first file selected, it
always results in incomplete data from that file. In fact, it always drops
off at the same record each time, about a quarter way through the file.

I checked with the debugger, and when the file hits the record where it
drops out, the XmlReader reports end of file.

Has anyone heard of a similar problem as this? Any ideas how I might fix
or workaround the problem?

I tried adding a FileStream to the XmlReader but it didn't help.

--
Regards,

Fred Chateau
http://hotelmotelnow.com


Jun 6 '07 #2
I added back the FileStream in order to see more information about the file
in the debugger. When five or more files are selected, the first file shows
a different file size than it actually is.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Fred Chateau" <we*******@hotelmotelnow.comwrote in message
news:eW**************@TK2MSFTNGP06.phx.gbl...
>I got some more information to go with this.

You can select four files and all files are processed correctly. Seven or
more files causes the first one to drop out early. Does this make sense to
anyone because it doesn't make sense to me? The files are being processed
one at a time, I think. It's just the filenames that are held in an array
until the method is called.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Fred Chateau" <we*******@hotelmotelnow.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>I have an interesting problem with file IO, maybe even a bug in the CLR.

I call a method that uses an XmlReader to loop through 4 MB XML files and
store the text in a database. I select the files in a file select dialog
and loop through the filename array, calling the XmlReader method each
time.

If I input one file, everything works properly. If I input several files,
the first file is not read completely. The rest are then processed
correctly. It doesn't matter which file is the first file selected, it
always results in incomplete data from that file. In fact, it always
drops off at the same record each time, about a quarter way through the
file.

I checked with the debugger, and when the file hits the record where it
drops out, the XmlReader reports end of file.

Has anyone heard of a similar problem as this? Any ideas how I might fix
or workaround the problem?

I tried adding a FileStream to the XmlReader but it didn't help.

--
Regards,

Fred Chateau
http://hotelmotelnow.com



Jun 6 '07 #3
Fred Chateau <we*******@hotelmotelnow.comwrote:
I added back the FileStream in order to see more information about the file
in the debugger. When five or more files are selected, the first file shows
a different file size than it actually is.
Without seeing any code, it's going to be virtually impossible to get
any further on this.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jun 6 '07 #4
I found it. Apparently one of the files (the last file) is shorter than the
rest. What I discovered is that when you load multiple files into the
OpenFileDialog, no matter what order you select them, apparently the dialog
loads them from the smallest file to the largest.

Even though the standard filename sorting order is different, it doesn't
seem to make any difference. In this case, the file was named xxx014.xml and
it loaded before xxx001.xml.

--
Regards,

Fred Chateau
http://hotelmotelnow.com

"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP*********************@msnews.microsoft.com. ..
Fred Chateau <we*******@hotelmotelnow.comwrote:
>I added back the FileStream in order to see more information about the
file
in the debugger. When five or more files are selected, the first file
shows
a different file size than it actually is.

Without seeing any code, it's going to be virtually impossible to get
any further on this.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Jun 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1589
by: Guido van Rossum | last post by:
Info ---- This is a reminder that the deadline for early bird registration for PyCon DC 2004 is February 1, 2004. Early bird registration is $175; after that, it will be $250 through March 17,...
4
3491
by: Olaf Meding | last post by:
Is there a way to find out if I am using early or late binding given the reference ("excel" in the example below) returned by Dispatch()? >>> import win32com.client >>> excel =...
2
6627
by: Mystery Man | last post by:
We are developing a C# application that has many interfaces to the Microsoft suite (eg Word, Excel, Outlook, Powerpoint, etc). We need to support Office 97, 2000, 2002 and any future versions. ...
19
3447
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use...
5
1090
by: mortb | last post by:
Hi, I'm overriding OnUload in my pages. I've put the Connection.Close in the method. But I have noticed that the method is run twice if I do a Response.Redirect in the page. Do some one know...
2
1018
by: Marc Miles | last post by:
I have a composite server control whose main entry is the OnLoad method. During my processing, if an error occurs, I want to halt any further processing immediately after the error occurs. I'm...
1
1705
by: Roland | last post by:
Hello, I'm trying to use Sparx Systems Enterprise Architect OLE automation interface. There is no problem to get early binding interface using Microsoft Visual Basic. But using win32com makepy...
11
2537
by: Tempo | last post by:
Hello. I am getting the error that is displayed below, and I know exactly why it occurs. I posted some of my program's code below, and if you look at it you will see that the error terminates the...
3
16037
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile...
0
6903
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
7071
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...
0
6861
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
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
170
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.