From 9182fabcac4b71b901856e36f97b08c8946a2622 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Lopez Date: Wed, 24 Apr 2019 09:48:17 -0700 Subject: [PATCH 1/4] Add remark to Directory.Move about exception thrown in all platforms. --- xml/System.IO/Directory.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xml/System.IO/Directory.xml b/xml/System.IO/Directory.xml index 3e1a4800368..13eaee0fbf5 100644 --- a/xml/System.IO/Directory.xml +++ b/xml/System.IO/Directory.xml @@ -3458,7 +3458,8 @@ Directory::CreateDirectory("Public\\Html"); The path to the new location for . If is a file, then must also be a file name. Moves a file or a directory and its contents to a new location. - + will occur. For example, an exception will occur if you try to move c:\mydir to c:\public, and c:\public already exists. Alternatively, you could specify "c:\\\public\\\mydir" as the `destDirName` parameter, provided that "mydir" does not exist under "c:\\\public", or specify a new directory name such as "c:\\\newdir". @@ -3476,7 +3477,12 @@ Directory::CreateDirectory("Public\\Html"); [!code-csharp[System.IO.Directory#14](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs#14)] [!code-vb[System.IO.Directory#14](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Directory/VB/class6.vb#14)] - + + +> [!NOTE] + +> Starting on .NET Core 3.0, the method will throw in all platforms when the `destDirName` already exists. Before 3.0, the exception was only thrown in Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename). + ]]> An attempt was made to move a directory to a different volume. From e81c38ea15971520687f0e154f3913a81c0b4bed Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Lopez Date: Wed, 24 Apr 2019 09:50:20 -0700 Subject: [PATCH 2/4] Add remark to Directory.Move about exception thrown in all platforms. --- xml/System.IO/Directory.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xml/System.IO/Directory.xml b/xml/System.IO/Directory.xml index 13eaee0fbf5..e1304906b4d 100644 --- a/xml/System.IO/Directory.xml +++ b/xml/System.IO/Directory.xml @@ -3458,8 +3458,7 @@ Directory::CreateDirectory("Public\\Html"); The path to the new location for . If is a file, then must also be a file name. Moves a file or a directory and its contents to a new location. - - will occur. For example, an exception will occur if you try to move c:\mydir to c:\public, and c:\public already exists. Alternatively, you could specify "c:\\\public\\\mydir" as the `destDirName` parameter, provided that "mydir" does not exist under "c:\\\public", or specify a new directory name such as "c:\\\newdir". From d73161b3cf09b1baa8931a79652e4f16bfd01d19 Mon Sep 17 00:00:00 2001 From: Ron Petrusha Date: Thu, 25 Apr 2019 10:00:13 -0700 Subject: [PATCH 3/4] Apply suggestions from code review Suggestions provided by rpetrusha. Co-Authored-By: carlossanlop <1175054+carlossanlop@users.noreply.github.com> --- xml/System.IO/Directory.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xml/System.IO/Directory.xml b/xml/System.IO/Directory.xml index e1304906b4d..26429366288 100644 --- a/xml/System.IO/Directory.xml +++ b/xml/System.IO/Directory.xml @@ -3479,8 +3479,7 @@ Directory::CreateDirectory("Public\\Html"); > [!NOTE] - -> Starting on .NET Core 3.0, the method will throw in all platforms when the `destDirName` already exists. Before 3.0, the exception was only thrown in Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename). +> Starting with .NET Core 3.0, the `Move` method throws an in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename). ]]> @@ -4148,4 +4147,4 @@ Directory::CreateDirectory("Public\\Html"); - \ No newline at end of file + From 7597825137dcedd06fbd5cef5fc9e35fee284699 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Lopez <1175054+carlossanlop@users.noreply.github.com> Date: Thu, 25 Apr 2019 10:03:32 -0700 Subject: [PATCH 4/4] Update Directory.xml Suggested by rpetrusha: - The note should be placed in the Remarks section, not the Examples section. - It would be useful to add "See the Note in the Remarks section." to line 3486. --- xml/System.IO/Directory.xml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/xml/System.IO/Directory.xml b/xml/System.IO/Directory.xml index 26429366288..0c518d2e7b0 100644 --- a/xml/System.IO/Directory.xml +++ b/xml/System.IO/Directory.xml @@ -3468,7 +3468,10 @@ Directory::CreateDirectory("Public\\Html"); Trailing spaces are removed from the end of the path parameters before moving the directory. For a list of common I/O tasks, see [Common I/O Tasks](~/docs/standard/io/common-i-o-tasks.md). - + + +> [!NOTE] +> Starting with .NET Core 3.0, the `Move` method throws an in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename). ## Examples @@ -3477,17 +3480,13 @@ Directory::CreateDirectory("Public\\Html"); [!code-csharp[System.IO.Directory#14](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Directory/CS/class6.cs#14)] [!code-vb[System.IO.Directory#14](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Directory/VB/class6.vb#14)] - -> [!NOTE] -> Starting with .NET Core 3.0, the `Move` method throws an in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename). - ]]> - An attempt was made to move a directory to a different volume. + An attempt was made to move a directory to a different volume. -or- - already exists. + already exists. See the Note in the Remarks section. -or-