Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirill Osenkov <github@osenkov.com>2018-11-06 19:26:56 +0300
committerKirill Osenkov <github@osenkov.com>2018-11-06 19:26:56 +0300
commit9b4947b378c3ffc21c59b0197b5ee3cab3fd08d1 (patch)
treec7d6f94d78c996b93d0aa7f7c7205e46cbe1b581 /src
parentd06adf1581eb8e16242c8b6eabc7ba13ceaf0d54 (diff)
Catch an exception on Mac when trying to use Windows native API.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Impl/TextModel/FileUtilities.cs23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Text/Impl/TextModel/FileUtilities.cs b/src/Text/Impl/TextModel/FileUtilities.cs
index b6fbd82..a770837 100644
--- a/src/Text/Impl/TextModel/FileUtilities.cs
+++ b/src/Text/Impl/TextModel/FileUtilities.cs
@@ -184,17 +184,26 @@ namespace Microsoft.VisualStudio.Text.Implementation
var safeHandle = originalFileStream.SafeFileHandle;
if (!(safeHandle.IsClosed || safeHandle.IsInvalid))
{
- BY_HANDLE_FILE_INFORMATION fi;
- if (NativeMethods.GetFileInformationByHandle(safeHandle, out fi))
+ try
{
- if (fi.NumberOfLinks <= 1)
+ BY_HANDLE_FILE_INFORMATION fi;
+ if (NativeMethods.GetFileInformationByHandle(safeHandle, out fi))
{
- // The file we're trying to write to doesn't have any hard links ... clear out the originalFileStream
- // as a clue.
- originalFileStream.Dispose();
- originalFileStream = null;
+ if (fi.NumberOfLinks <= 1)
+ {
+ // The file we're trying to write to doesn't have any hard links ... clear out the originalFileStream
+ // as a clue.
+ originalFileStream.Dispose();
+ originalFileStream = null;
+ }
}
}
+ catch (EntryPointNotFoundException)
+ {
+ // The code is being executed on a non-Windows platform, assume all is good
+ originalFileStream.Dispose();
+ originalFileStream = null;
+ }
}
}
catch