summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2019-04-24 15:24:31 +0200
committerJan Kotas <jkotas@microsoft.com>2019-04-24 12:01:31 -0700
commit8eb913402071a6c6c9bd56768d0fd6f68f41d745 (patch)
tree92bed106ce94305ef8832a05040d16d9da76e53a
parent377be0e800b3a0e1ebd855de779f3af2e00d5360 (diff)
downloadcoreclr-8eb913402071a6c6c9bd56768d0fd6f68f41d745.tar.gz
coreclr-8eb913402071a6c6c9bd56768d0fd6f68f41d745.tar.bz2
coreclr-8eb913402071a6c6c9bd56768d0fd6f68f41d745.zip
Fix ProjectN build breaks (dotnet/corert#7343)
Porting changes from the non-WinRT files. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
-rw-r--r--src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs6
-rw-r--r--src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs
index fc98061322..f6fde1230e 100644
--- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs
+++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs
@@ -4,6 +4,7 @@
#nullable enable
using Microsoft.Win32.SafeHandles;
+using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
@@ -26,8 +27,9 @@ internal partial class Interop
FileMode dwCreationDisposition,
ref Kernel32.CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams)
{
- lpFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(lpFileName);
- return CreateFile2Private(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, ref pCreateExParams);
+ string? lpFileNameWithPrefix = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName);
+ Debug.Assert(lpFileNameWithPrefix != null, "null not expected when non-null passed"); // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/26761
+ return CreateFile2Private(lpFileNameWithPrefix, dwDesiredAccess, dwShareMode, dwCreationDisposition, ref pCreateExParams);
}
}
}
diff --git a/src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs b/src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs
index 752a6d9d8a..937316568b 100644
--- a/src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs
+++ b/src/System.Private.CoreLib/shared/System/IO/FileStream.WinRT.cs
@@ -4,6 +4,7 @@
#nullable enable
using Microsoft.Win32.SafeHandles;
+using System.Diagnostics;
using System.Runtime.InteropServices;
namespace System.IO
@@ -33,6 +34,7 @@ namespace System.IO
using (DisableMediaInsertionPrompt.Create())
{
+ Debug.Assert(_path != null);
return ValidateFileHandle(Interop.Kernel32.CreateFile2(
lpFileName: _path,
dwDesiredAccess: access,