From faf2f3f065f91bf220b2e999ccfca7c2ea475e7b Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 13 Apr 2018 15:06:17 -0700 Subject: [PATCH] Attempt to workaround issues with File.Move on NFS file shares (aspnet/Home#2941) --- .../Repositories/FileSystemXmlRepository.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs index a980e7f82c..914cc3f9ba 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs @@ -230,7 +230,9 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories // Once the file has been fully written, perform the rename. // Renames are atomic operations on the file systems we support. _logger.WritingDataToFile(finalFilename); - File.Move(tempFilename, finalFilename); + + // Use File.Copy because File.Move on NFS shares has issues in .NET Core 2.0 + File.Copy(tempFilename, finalFilename); } finally {