[Mono-bugs] [Bug 74740][Nor] New - Unhandled Exception: System.IO.IOException: Win32 IO returned 997. Path: /tmp/file.txt.94.txt

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Apr 2005 13:21:01 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=74740

--- shadow/74740	2005-04-26 13:21:01.000000000 -0400
+++ shadow/74740.tmp.12576	2005-04-26 13:21:01.000000000 -0400
@@ -0,0 +1,109 @@
+Bug#: 74740
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: io-layer
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bmaurer@users.sf.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Unhandled Exception: System.IO.IOException: Win32 IO returned 997. Path: /tmp/file.txt.94.txt
+
+If I run the following (modified from bug 72792), I get
+
+Unhandled Exception: System.IO.IOException: Win32 IO returned 997. Path:
+/tmp/file.txt.94.txt
+in <0x000ca> System.IO.File:Exists (System.String path)
+in <0x000f7> System.IO.File:Copy (System.String src, System.String dest,
+Boolean overwrite)
+in <0x0001f> System.IO.File:Copy (System.String sourceFilename,
+System.String destFilename)
+in <0x0005e> System.IO.FileInfo:CopyTo (System.String path, Boolean overwrite)
+in (wrapper remoting-invoke-with-check) System.IO.FileInfo:CopyTo (string,bool)
+in <0x000ea> ConsoleApplication13.Threadclass:Filecopytoarchive
+(System.String strPathfilesource, System.String strPathfilenametarget)
+in <0x00038> ConsoleApplication13.Threadclass:Process ()
+in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void ()
+
+
+using System;
+using System.IO;
+using System.Threading;
+
+class Class1
+{
+	static void Main(string[] args)
+	{
+
+		string f = args[0];
+		for (int i = 0; i < 10; i ++)
+		{
+			Threadclass th = new Threadclass();
+			th.Pathfilesource = f;
+			th.Filename = Path.GetTempFileName ();
+			th.Start();
+		}
+	}	
+}
+class Threadclass
+{
+	public string Filename;
+	public string Pathfilesource;
+	
+
+	public void Start() { new Thread (new ThreadStart(Process)).Start(); }
+
+	private void Process()
+	{
+		while (true)
+			Filecopytoarchive(Pathfilesource, Filename);
+	}
+
+	private void Filecopytoarchive(string strPathfilesource, string
+strPathfilenametarget)
+	{
+		bool bolPathexists = Checkpathname(strPathfilenametarget);
+
+		if (!bolPathexists)
+		{
+			System.IO.FileInfo fi = new FileInfo(strPathfilenametarget);
+			string strPathname = fi.DirectoryName;
+			bolPathexists = Createpath(strPathname);
+		}
+		System.IO.FileInfo fi2 = new System.IO.FileInfo(strPathfilesource);
+		fi2.CopyTo(strPathfilenametarget, true);
+	}
+
+
+
+	private  bool Checkpathname(string strPathfile)
+	{
+		try {
+			System.IO.FileInfo fi = new System.IO.FileInfo(strPathfile);
+			return fi.Directory.Exists;
+		} catch (System.IO.IOException e) {
+			Console.WriteLine("Checkpathname: " + e.Message);
+			return false;
+		}
+	}
+
+
+	private  bool Createpath(string strDirectory)
+	{
+		try {
+			Directory.CreateDirectory(strDirectory);
+			return true;
+		} catch (System.IO.IOException e) {
+			Console.WriteLine("Createpath: " + e.Message);
+			return false;
+		}
+
+	}
+}