473,881 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disk Full error...on certain file and driectory create/copy methods

VJ
I have these functions in my application.

FileInfo.CopyTo

DirectoryInfo.C reate

File.Copy

Directory.Creat e

Do these methods generate a exception when the DISK is full were they are
trying to create a directory or copy a file? If so what is the exception?

VJ

Nov 20 '05 #1
11 2463
* "VJ" <vi********@yah oo.com> scripsit:
I have these functions in my application.

FileInfo.CopyTo

DirectoryInfo.C reate

File.Copy

Directory.Creat e

Do these methods generate a exception when the DISK is full were they are
trying to create a directory or copy a file? If so what is the exception?


I didn't test it, but maybe an 'IOException'.. .

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hello, VJ:

You can test it using a diskette: Fill it with some files and then test the methods.
Under XP you can assign a user a very small disk quota and fill it for testing.

Anyway .NET doesn't handle disk full conditions very well. If it bothers you, you may test for enough free space before writing to disk.

Regards.
"VJ" <vi********@yah oo.com> escribió en el mensaje news:Ou******** ******@TK2MSFTN GP12.phx.gbl...
| I have these functions in my application.
|
| FileInfo.CopyTo
|
| DirectoryInfo.C reate
|
| File.Copy
|
| Directory.Creat e
|
| Do these methods generate a exception when the DISK is full were they are
| trying to create a directory or copy a file? If so what is the exception?
|
| VJ
|
|
|
Nov 20 '05 #3
Cor
Hi Jose,

that is clever
You can test it using a diskette: Fill it with some files and then test the methods.Under XP you can assign a user a very small disk quota and fill it for

testing.

Cor
Nov 20 '05 #4
Thanks, Cor.

I found something weird:

Class FullDiskTest
Public Shared Sub Main()
Dim arch As System.IO.FileS tream
Dim a(511) As Byte
arch = New System.IO.FileS tream("a:\che.b in", System.IO.FileM ode.OpenOrCreat e)
Try
arch.Seek(13000 00, System.IO.SeekO rigin.Begin) 'Useful from the second time it runs...
Do
arch.Write(a, 0, 512)
Loop
Catch exc As System.Exceptio n
System.Console. WriteLine(exc.T oString)
End Try
'Everything fine until now.
Try
arch.Close() 'Generates a Disk Full exception... and the file is not closed!
Catch exc As System.IO.IOExc eption
System.Console. WriteLine(exc.T oString)
End Try
System.Console. ReadLine()
End Sub
'The program exits with an unhandled exception!
End Class
I have changed the arch.Close() line with theese others:
arch=nothing
System.GC.Colle ct() '(Generates an exception only inside the IDE)
System.GC.WaitF orPendingFinali zers()

Theese last lines generate an unhandled exception (although they are inside the Try block).
The file is not unlocked until the program exits.
It seems to me that a Full Disk Exception is generated when the GC tries to close the file, but the GC doesn't handle the error, neither propagate it to the program.

Well, can anybody test it and tell me if it is the expected behavior?

Regards.
"Cor" <no*@non.com> escribió en el mensaje news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
| Hi Jose,
|
| that is clever
|
| >You can test it using a diskette: Fill it with some files and then test the
| methods.
| >Under XP you can assign a user a very small disk quota and fill it for
| testing.
|
| Cor
|
|
Nov 20 '05 #5
Cor
Hi Jose,

I think you are right.

I did also try it with the streamwriter, to be sure that it was not an
incident.

It seems if that if you try to close after that an error is thrown because
of a diskfull and the command is not executed and then when you try to end
your program, the framework tries again to close it automaticly but has no
room for it and you are even not able to undo your operation.

I did try to catch it in the closing and close event to be sure that there
was no escape and that was not working either.

Cor
Nov 20 '05 #6
Cor
Hi Jose,

I think you are right.

I did also try it with the streamwriter, to be sure that it was not an
incident.

It seems if that if you try to close after that an error is thrown because
of a diskfull and the command is not executed and then when you try to end
your program, the framework tries again to close it automaticly but has no
room for it and you are even not able to undo your operation.

I did try to catch it in the closing and close event to be sure that there
was no escape and that was not working either.

Cor
Nov 20 '05 #7
* "Cor" <no*@non.com> scripsit:
It seems if that if you try to close after that an error is thrown because
of a diskfull and the command is not executed and then when you try to end
your program, the framework tries again to close it automaticly but has no
room for it and you are even not able to undo your operation.


'StreamWriter' uses a buffer, that's why the error doesn't show up
directly when writing into the file. Calling the 'Close' method will
make data in the buffer persistent, then an error may occur.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
Cor
Hi Herfried,

And what is the solution?

I did delete the close and then the error shows up direct, but what to
prevent the error but take some actions?

Cor
It seems if that if you try to close after that an error is thrown because of a diskfull and the command is not executed and then when you try to end your program, the framework tries again to close it automaticly but has no room for it and you are even not able to undo your operation.


'StreamWriter' uses a buffer, that's why the error doesn't show up
directly when writing into the file. Calling the 'Close' method will
make data in the buffer persistent, then an error may occur.

Nov 20 '05 #9
* "Cor" <no*@non.com> scripsit:
And what is the solution?

I did delete the close and then the error shows up direct, but what to
prevent the error but take some actions?


If I would know a solution, I would have posted it.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10

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

Similar topics

2
2960
by: Nate | last post by:
Hello, I am trying to recover a SQL Server 7 database from another hard disk drive that has a corrupted Windows 2000 Advanced Server installation. I am not able to repair the corrupted Windows 2000 Advanced Server installation but the file system is intact. I have installed a new copy of SQL Server 7 onto a new hard disk and have used the sp_attach_db system stored procedure to attach the database from the old hard drive into the new...
15
11569
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to MSACCESS.EXE, tries them all, takes the first one it finds, and dies if none is found. Seems to me like at some time or another I was able to clone this .BAT file and implement it with no path. Something about MSACCESS being a registered application.
6
2941
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When it finds files with a specific extension, it queries a SQL Server database to determine what workstation will be the destination of a File.Copy. 3. It copies those files to the appropriate workstations on the LAN,
2
1793
by: jatphat | last post by:
Somebody help me. How do i copy my Access database from one location on my hard disk to another . i tried file.copy(source, distination ) but the file would not move. i always get this error message "Another process is using the destinationFileName" . thanks
10
2348
by: eastcoastguyz | last post by:
(I've not done C prorgamming in such a long time, I have forgotten how to do this.) I'm writing a program, where it fopens a file with "a+", and I want to be able to continue writing to this file, but I want the program to exit(1) if the disk is full or some other write failure. I would like to see a C code example. Thanks in advance!
18
18769
by: NEWSGROUPS | last post by:
I work for a large organization were my team has developed 2 very substantial databases in Access 2000. These databases have been working fine for the last 6 years with minimal issues or problems. About 1 week ago today we have started experiencing the error "Microsoft Visual Basic Run Time Error 3043 Disk or Network Error" just about every day around the same time each day (activity starts to increase at this time in the databases)....
9
6233
by: sturnfie | last post by:
Hi all, I am attempting to write a tool that would get (via something of a stopwatch action) the amount of time it takes to copy a file from a local disk to a connected USB drive on a Windows XP machine. When I run this tool, I am getting average speeds that are faster than what is theoretically possible over a full-speed USB connection (the disk is enumerated at Full speed, not High Speed).
3
4339
by: xeqister | last post by:
Hi, I have a DB2 database (version 7) running on Windows 2000 server and recently facing problem to backup my database. I got an error "Disk was full" after half way running the backup. My database size is about 10GB, I have tried to backup the database into a DDS tape (20GB) or hardisk (100GB free space) but still getting the same error. So, there is no possibility that the backup media is full. Anyway, here's part of db2diag.log file...
10
6174
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the front end db, everyone accesses the back-end db via a network share. To preface, non Terminal Server users (4 or 5 in office) never have this problem. There are two Terminal Servers running win 2000, both basically identical. This error affects...
0
9928
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11100
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9554
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7110
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5781
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4597
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 we have to send another system
2
4196
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.