[mono/mono] 3a7e67b4: Fixes CodeDom regression introduced by 66d4b82a871667b3317d4e43b855d1fc1db22108

"Marek Safar ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141b800891d-a38c7722-6243-4f67-a3a2-611b6d4920f5-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/394591e20315...3a7e67b4c580

   Commit: 3a7e67b4c5802a352d3c9578fecfa9848b4e370b
   Author: Marek Safar <[email protected]> (marek-safar)
     Date: 2013-10-14 17:17:52 GMT
      URL: https://github.com/mono/mono/commit/3a7e67b4c5802a352d3c9578fecfa9848b4e370b

Fixes CodeDom regression introduced by 66d4b82a871667b3317d4e43b855d1fc1db22108

Changed paths:
  M mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
  M mcs/class/System/Test/Microsoft.CSharp/CSharpCodeProviderTest.cs

Modified: mcs/class/System/System.CodeDom.Compiler/TempFileCollection.cs
===================================================================
@@ -245,7 +245,7 @@ public void Delete()
 				File.Delete (tmpFile);
 				basepath = null;
 			}
-			if (allDeleted && ownTempDir != null) {
+			if (allDeleted && ownTempDir != null && filenames.Length > 0) {
 				Directory.Delete (ownTempDir, true);
 			}
 		}

Modified: mcs/class/System/Test/Microsoft.CSharp/CSharpCodeProviderTest.cs
===================================================================
@@ -359,7 +359,6 @@ public void CompileFromSource_InMemory ()
 			Assert.AreEqual (tempFile, tempFiles[0], "#5");
 		}
 
-
 		[Test]
 		public void CompileFromSource_InMemory_Twice ()
 		{
@@ -385,6 +384,24 @@ public void CompileFromSource_InMemory_Twice ()
 			Assert.AreEqual (output_1, output_2, "#1");
 		}
 
+
+		[Test]
+		public void CompileFromSource_InMemory_With_Extra_Delete ()
+		{
+			CompilerParameters options = new CompilerParameters ();
+			options.GenerateExecutable = false;
+			options.GenerateInMemory = true;
+
+			ICodeCompiler compiler = _codeProvider.CreateCompiler ();
+
+			var src_1 = "class X { ";
+
+			compiler.CompileAssemblyFromSource (options, src_1);
+
+			options.TempFiles.Delete ();
+			options.TempFiles.Delete ();
+		}
+
 		[Test]
 		public void CompileFromSourceBatch_InMemory ()
 		{


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.