From 8b9fa39775b8e16516111ae0d648f36ec513cc10 Mon Sep 17 00:00:00 2001 From: Ian Hays Date: Mon, 26 Sep 2016 14:29:56 -0700 Subject: [PATCH 1/4] Expose InternalBufferOverflowException in FSW Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher. --- .../Formatters/BinaryFormatterHelpers.cs | 4 +- src/System.IO.FileSystem.Watcher/dir.props | 2 +- .../pkg/System.IO.FileSystem.Watcher.pkgproj | 3 +- .../ref/System.IO.FileSystem.Watcher.cs | 8 ++++ .../ref/System.IO.FileSystem.Watcher.csproj | 2 +- .../ref/project.json | 6 +-- .../src/System.IO.FileSystem.Watcher.builds | 4 +- .../src/System.IO.FileSystem.Watcher.csproj | 26 +++++------ .../IO/InternalBufferOverflowException.cs | 8 +++- .../src/project.json | 37 +++++++-------- .../src/win/project.json | 37 +++++++-------- .../tests/FileSystemWatcher.Directory.Move.cs | 7 +-- ...ileSystemWatcher.Directory.NotifyFilter.cs | 3 +- .../tests/FileSystemWatcher.File.Move.cs | 19 ++++---- .../FileSystemWatcher.File.NotifyFilter.cs | 3 +- .../FileSystemWatcher.InternalBufferSize.cs | 3 +- .../tests/FileSystemWatcher.unit.cs | 9 ++-- .../tests/InternalBufferOverflowException.cs | 46 +++++++++++++++++++ .../System.IO.FileSystem.Watcher.Tests.builds | 15 ++++++ .../System.IO.FileSystem.Watcher.Tests.csproj | 16 +++++-- .../tests/project.json | 27 ++++++++++- 21 files changed, 198 insertions(+), 87 deletions(-) create mode 100644 src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs diff --git a/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs b/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs index 5f3cce306a00..0771244e3bd4 100644 --- a/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs +++ b/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs @@ -8,7 +8,7 @@ namespace System.Runtime.Serialization.Formatters.Tests { - internal static class BinaryFormatterHelpers + public static class BinaryFormatterHelpers { internal static T Clone(T obj) { @@ -21,7 +21,7 @@ internal static T Clone(T obj) } } - internal static void AssertRoundtrips(T expected, params Func[] additionalGetters) + public static void AssertRoundtrips(T expected, params Func[] additionalGetters) where T : Exception { for (int i = 0; i < 2; i++) diff --git a/src/System.IO.FileSystem.Watcher/dir.props b/src/System.IO.FileSystem.Watcher/dir.props index 38aaf93ed7aa..0769c12aaa28 100644 --- a/src/System.IO.FileSystem.Watcher/dir.props +++ b/src/System.IO.FileSystem.Watcher/dir.props @@ -1,7 +1,7 @@ - 4.0.1.0 + 4.1.0.0 diff --git a/src/System.IO.FileSystem.Watcher/pkg/System.IO.FileSystem.Watcher.pkgproj b/src/System.IO.FileSystem.Watcher/pkg/System.IO.FileSystem.Watcher.pkgproj index 750e7994cb8b..695046fa9ddb 100644 --- a/src/System.IO.FileSystem.Watcher/pkg/System.IO.FileSystem.Watcher.pkgproj +++ b/src/System.IO.FileSystem.Watcher/pkg/System.IO.FileSystem.Watcher.pkgproj @@ -3,10 +3,9 @@ - net46;netcoreapp1.0;$(AllXamarinFrameworks) + net463;netcoreapp1.1;$(AllXamarinFrameworks) - diff --git a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs index 557a53450c24..b4fc6c5126e0 100644 --- a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs +++ b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs @@ -46,6 +46,14 @@ protected void OnRenamed(System.IO.RenamedEventArgs e) { } public System.IO.WaitForChangedResult WaitForChanged(System.IO.WatcherChangeTypes changeType) { return default(System.IO.WaitForChangedResult); } public System.IO.WaitForChangedResult WaitForChanged(System.IO.WatcherChangeTypes changeType, int timeout) { return default(System.IO.WaitForChangedResult); } } + [Serializable] + public partial class InternalBufferOverflowException : System.Exception + { + public InternalBufferOverflowException() { } + public InternalBufferOverflowException(string message) { } + public InternalBufferOverflowException(string message, System.Exception inner) { } + protected InternalBufferOverflowException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } [System.FlagsAttribute] public enum NotifyFilters { diff --git a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj index 3c79156d9cf9..8392a54146be 100644 --- a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj +++ b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.csproj @@ -3,7 +3,7 @@ Library - .NETStandard,Version=v1.3 + .NETStandard,Version=v1.7 diff --git a/src/System.IO.FileSystem.Watcher/ref/project.json b/src/System.IO.FileSystem.Watcher/ref/project.json index e131fe0dbced..1529bddc652f 100644 --- a/src/System.IO.FileSystem.Watcher/ref/project.json +++ b/src/System.IO.FileSystem.Watcher/ref/project.json @@ -1,11 +1,11 @@ { "dependencies": { - "System.Runtime": "4.0.0" + "System.Runtime": "4.3.0-beta-devapi-24512-01" }, "frameworks": { - "netstandard1.3": { + "netstandard1.7": { "imports": [ - "dotnet5.4" + "dotnet5.8" ] } } diff --git a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.builds b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.builds index f175438b0da8..32f54f23f2da 100644 --- a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.builds +++ b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.builds @@ -10,9 +10,9 @@ Windows_NT - + - net46 + net463 diff --git a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index d8ab57648753..42a04136faba 100644 --- a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -7,10 +7,10 @@ {77E702D9-C6D8-4CE4-9941-D3056C3CCBED} true - true - .NETStandard,Version=v1.3 - - + true + .NETStandard,Version=v1.7 + + win/project.json win/project.lock.json @@ -21,9 +21,9 @@ - - - + + + @@ -44,7 +44,7 @@ Common\System\IO\PathInternal.CaseSensitivity.cs - + Common\System\IO\PathInternal.Windows.cs @@ -68,7 +68,7 @@ - + Common\Interop\Unix\Interop.Libraries.cs @@ -88,7 +88,7 @@ Common\Interop\Unix\Interop.PathConf.cs - + Common\Interop\Linux\Interop.inotify.cs @@ -100,7 +100,7 @@ Common\Interop\Unix\Interop.Stat.cs - + Common\Interop\OSX\Interop.EventStream.cs @@ -127,10 +127,10 @@ Common\Microsoft\Win32\SafeHandles\SafeEventStreamHandle.OSX.cs - + - + diff --git a/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs b/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs index d64f6a6a01c0..ac7a67dab0ff 100644 --- a/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs +++ b/src/System.IO.FileSystem.Watcher/src/System/IO/InternalBufferOverflowException.cs @@ -2,12 +2,15 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Runtime.Serialization; + namespace System.IO { /// /// The exception that is thrown when the internal buffer overflows. /// - public class InternalBufferOverflowException : Exception + [Serializable] + public class InternalBufferOverflowException : SystemException { /// /// Initializes a new default instance of the class. @@ -33,5 +36,8 @@ public InternalBufferOverflowException(string message, Exception inner) : base(m { HResult = HResults.InternalBufferOverflow; } + + protected InternalBufferOverflowException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } } diff --git a/src/System.IO.FileSystem.Watcher/src/project.json b/src/System.IO.FileSystem.Watcher/src/project.json index a2c82d95d001..5caa6e08006e 100644 --- a/src/System.IO.FileSystem.Watcher/src/project.json +++ b/src/System.IO.FileSystem.Watcher/src/project.json @@ -1,28 +1,29 @@ { "frameworks": { - "netstandard1.3": { + "netstandard1.7": { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.0", - "System.Collections": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tools": "4.0.0", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Threading": "4.0.10", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Thread": "4.0.0" - }, + "Microsoft.Win32.Primitives": "4.3.0-beta-devapi-24512-01", + "System.Collections": "4.3.0-beta-devapi-24512-01", + "System.Diagnostics.Debug": "4.3.0-beta-devapi-24512-01", + "System.Diagnostics.Tools": "4.3.0-beta-devapi-24512-01", + "System.IO": "4.3.0-beta-devapi-24512-01", + "System.IO.FileSystem": "4.3.0-beta-devapi-24512-01", + "System.IO.FileSystem.Primitives": "4.3.0-beta-devapi-24512-01", + "System.Resources.ResourceManager": "4.3.0-beta-devapi-24512-01", + "System.Runtime": "4.3.0-beta-devapi-24512-01", + "System.Runtime.Extensions": "4.3.0-beta-devapi-24512-01", + "System.Runtime.Handles": "4.3.0-beta-devapi-24512-01", + "System.Runtime.InteropServices": "4.3.0-beta-devapi-24512-01", + "System.Threading": "4.3.0-beta-devapi-24512-01", + "System.Threading.Tasks": "4.3.0-beta-devapi-24512-01", + "System.Threading.Thread": "4.3.0-beta-devapi-24512-01" + }, "imports": [ - "dotnet5.4" + "dotnet5.8" ] }, - "net46": { + "net463": { "dependencies": { "Microsoft.TargetingPack.NETFramework.v4.6": "1.0.1" } diff --git a/src/System.IO.FileSystem.Watcher/src/win/project.json b/src/System.IO.FileSystem.Watcher/src/win/project.json index 9c5a35ec9f99..e6c55b6882a4 100644 --- a/src/System.IO.FileSystem.Watcher/src/win/project.json +++ b/src/System.IO.FileSystem.Watcher/src/win/project.json @@ -1,25 +1,26 @@ { "frameworks": { - "netstandard1.3": { + "netstandard1.7": { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.0.0", - "System.Diagnostics.Debug": "4.0.10", - "System.Diagnostics.Tools": "4.0.0", - "System.IO": "4.0.10", - "System.IO.FileSystem": "4.0.0", - "System.IO.FileSystem.Primitives": "4.0.0", - "System.Resources.ResourceManager": "4.0.0", - "System.Runtime": "4.0.20", - "System.Runtime.Extensions": "4.0.10", - "System.Runtime.Handles": "4.0.0", - "System.Threading": "4.0.10", - "System.Threading.Overlapped": "4.0.0", - "System.Threading.Tasks": "4.0.10", - "System.Threading.Thread": "4.0.0" - }, - "imports": [ - "dotnet5.4" + "Microsoft.Win32.Primitives": "4.3.0-beta-devapi-24512-01", + "System.Diagnostics.Debug": "4.3.0-beta-devapi-24512-01", + "System.Diagnostics.Tools": "4.3.0-beta-devapi-24512-01", + "System.IO": "4.3.0-beta-devapi-24512-01", + "System.IO.FileSystem": "4.3.0-beta-devapi-24512-01", + "System.IO.FileSystem.Primitives": "4.3.0-beta-devapi-24512-01", + "System.Resources.ResourceManager": "4.3.0-beta-devapi-24512-01", + "System.Runtime": "4.3.0-beta-devapi-24512-01", + "System.Runtime.Extensions": "4.3.0-beta-devapi-24512-01", + "System.Runtime.Handles": "4.3.0-beta-devapi-24512-01", + "System.Runtime.InteropServices": "4.3.0-beta-devapi-24512-01", + "System.Threading": "4.3.0-beta-devapi-24512-01", + "System.Threading.Overlapped": "4.3.0-beta-devapi-24512-01", + "System.Threading.Tasks": "4.3.0-beta-devapi-24512-01", + "System.Threading.Thread": "4.3.0-beta-devapi-24512-01" + }, + "imports": [ + "dotnet5.8" ] } } diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs index dd4ac34341a8..17bcaab1ec09 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { public class Directory_Move_Tests : FileSystemWatcherTest { [Fact] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Directory_Move_To_Same_Directory() { DirectoryMove_SameDirectory(WatcherChangeTypes.Renamed); @@ -22,14 +23,14 @@ public void Directory_Move_From_Watched_To_Unwatched() } [Fact] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Windows_Directory_Move_To_Different_Watched_Directory() { DirectoryMove_DifferentWatchedDirectory(WatcherChangeTypes.Changed); } [Fact] - [PlatformSpecific(PlatformID.AnyUnix)] + [PlatformSpecific(XunitPlatformID.AnyUnix)] public void Unix_Directory_Move_To_Different_Watched_Directory() { DirectoryMove_DifferentWatchedDirectory(0); diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs index 201d69d85f3f..61a8de745cf6 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.NotifyFilter.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { @@ -142,7 +143,7 @@ public void FileSystemWatcher_Directory_NotifyFilter_LastWriteTime(NotifyFilters [Theory] [MemberData(nameof(FilterTypes))] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void FileSystemWatcher_Directory_NotifyFilter_Security(NotifyFilters filter) { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs index b0fcc81d3a82..a7d19ea6ee4c 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs @@ -3,20 +3,21 @@ // See the LICENSE file in the project root for more information. using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { public class File_Move_Tests : FileSystemWatcherTest { [Fact] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Windows_File_Move_To_Same_Directory() { FileMove_SameDirectory(WatcherChangeTypes.Renamed); } [Fact] - [PlatformSpecific(PlatformID.AnyUnix)] + [PlatformSpecific(XunitPlatformID.AnyUnix)] public void Unix_File_Move_To_Same_Directory() { FileMove_SameDirectory(WatcherChangeTypes.Created | WatcherChangeTypes.Deleted); @@ -29,21 +30,21 @@ public void File_Move_From_Watched_To_Unwatched() } [Fact] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Windows_File_Move_To_Different_Watched_Directory() { FileMove_DifferentWatchedDirectory(WatcherChangeTypes.Changed); } [Fact] - [PlatformSpecific(PlatformID.OSX)] + [PlatformSpecific(XunitPlatformID.OSX)] public void OSX_File_Move_To_Different_Watched_Directory() { FileMove_DifferentWatchedDirectory(WatcherChangeTypes.Changed); } [Fact] - [PlatformSpecific(PlatformID.Linux)] + [PlatformSpecific(XunitPlatformID.Linux)] public void Linux_File_Move_To_Different_Watched_Directory() { FileMove_DifferentWatchedDirectory(0); @@ -58,7 +59,7 @@ public void File_Move_From_Unwatched_To_Watched() [Theory] [InlineData(false)] [InlineData(true)] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Windows_File_Move_In_Nested_Directory(bool includeSubdirectories) { FileMove_NestedDirectory(includeSubdirectories ? WatcherChangeTypes.Renamed : 0, includeSubdirectories); @@ -67,21 +68,21 @@ public void Windows_File_Move_In_Nested_Directory(bool includeSubdirectories) [Theory] [InlineData(false)] [InlineData(true)] - [PlatformSpecific(PlatformID.AnyUnix)] + [PlatformSpecific(XunitPlatformID.AnyUnix)] public void Unix_File_Move_In_Nested_Directory(bool includeSubdirectories) { FileMove_NestedDirectory(includeSubdirectories ? WatcherChangeTypes.Created | WatcherChangeTypes.Deleted : 0, includeSubdirectories); } [Fact] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void Windows_File_Move_With_Set_NotifyFilter() { FileMove_WithNotifyFilter(WatcherChangeTypes.Renamed); } [Fact] - [PlatformSpecific(PlatformID.AnyUnix)] + [PlatformSpecific(XunitPlatformID.AnyUnix)] public void Unix_File_Move_With_Set_NotifyFilter() { FileMove_WithNotifyFilter(WatcherChangeTypes.Deleted); diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs index 0e6ff8c4ba76..30d14dafd7fe 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.NotifyFilter.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { @@ -169,7 +170,7 @@ public void FileSystemWatcher_File_NotifyFilter_Size(NotifyFilters filter) [Theory] [MemberData(nameof(FilterTypes))] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void FileSystemWatcher_File_NotifyFilter_Security(NotifyFilters filter) { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs index 6aefaa39bcd3..b3748a3e3155 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.InternalBufferSize.cs @@ -4,6 +4,7 @@ using System.Threading; using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { @@ -41,7 +42,7 @@ public class InternalBufferSizeTests : FileSystemWatcherTest [Theory] [InlineData(true)] [InlineData(false)] - [PlatformSpecific(PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.Windows)] public void FileSystemWatcher_InternalBufferSize(bool setToHigherCapacity) { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs index 536efa5bb343..a0779d5daf9a 100644 --- a/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +++ b/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs @@ -9,6 +9,7 @@ using System.Runtime.InteropServices; using System.Threading; using Xunit; +using XunitPlatformID = Xunit.PlatformID; namespace System.IO.Tests { @@ -361,7 +362,7 @@ public void FileSystemWatcher_OnCreated() } [Fact] - [PlatformSpecific(PlatformID.OSX | PlatformID.Windows)] + [PlatformSpecific(XunitPlatformID.OSX | XunitPlatformID.Windows)] public void FileSystemWatcher_OnCreatedWithMismatchedCasingGivesExpectedFullPath() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -454,7 +455,7 @@ public void FileSystemWatcher_OnRenamed() } [Fact] - [PlatformSpecific(PlatformID.Windows)] // Unix FSW don't trigger on a file rename. + [PlatformSpecific(XunitPlatformID.Windows)] // Unix FSW don't trigger on a file rename. public void FileSystemWatcher_Windows_OnRenameGivesExpectedFullPath() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -543,7 +544,7 @@ public void FileSystemWatcher_Renamed() } [Fact] - [PlatformSpecific(PlatformID.Linux)] + [PlatformSpecific(XunitPlatformID.Linux)] [OuterLoop("This test has high system resource demands and may cause failures in other concurrent tests")] public void FileSystemWatcher_CreateManyConcurrentInstances() { @@ -574,7 +575,7 @@ public void FileSystemWatcher_CreateManyConcurrentInstances() } [Fact] - [PlatformSpecific(PlatformID.Linux)] + [PlatformSpecific(XunitPlatformID.Linux)] [OuterLoop("This test has high system resource demands and may cause failures in other concurrent tests")] public void FileSystemWatcher_CreateManyConcurrentWatches() { diff --git a/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs b/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs new file mode 100644 index 000000000000..9f1c014c0b14 --- /dev/null +++ b/src/System.IO.FileSystem.Watcher/tests/InternalBufferOverflowException.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; +using System.Runtime.Serialization.Formatters.Tests; + +namespace System.IO.Tests +{ + public static class InternalBufferOverflowExceptionTests + { + [Fact] + public static void DefaultConstructor() + { + InternalBufferOverflowException ide = new InternalBufferOverflowException(); + + Assert.NotNull(ide.Message); + } + + [Fact] + public static void MessageConstructor() + { + string message = "MessageConstructor"; + InternalBufferOverflowException ide = new InternalBufferOverflowException(message); + + Assert.Equal(message, ide.Message); + } + + [Fact] + public static void MessageInnerExceptionConstructor() + { + string message = "MessageConstructor"; + Exception innerException = new Exception(); + InternalBufferOverflowException ide = new InternalBufferOverflowException(message, innerException); + + Assert.Equal(message, ide.Message); + Assert.Same(innerException, ide.InnerException); + } + + [Fact] + public static void ExceptionRoundtrips() + { + BinaryFormatterHelpers.AssertRoundtrips(new InternalBufferOverflowException()); + } + } +} diff --git a/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.builds b/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.builds index 9123cf22ad92..37979c3d4f5f 100644 --- a/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.builds +++ b/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.builds @@ -12,6 +12,21 @@ netcoreapp1.0;net46 Windows_NT + + netstandard1.7 + netcoreapp1.1 + Linux + + + netstandard1.7 + netcoreapp1.1 + OSX + + + netstandard1.7 + netcoreapp1.1 + Windows_NT + diff --git a/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj b/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj index 4f9f23feb2bc..a745aeb299f3 100644 --- a/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj +++ b/src/System.IO.FileSystem.Watcher/tests/System.IO.FileSystem.Watcher.Tests.csproj @@ -1,4 +1,4 @@ - + Windows_Debug @@ -10,8 +10,10 @@ {20411A66-C7A4-4941-8FA2-66308365FD22} Library System.IO.FileSystem.Watcher.Tests - .NETStandard,Version=v1.3 - + .NETStandard,Version=v1.3 + + + {77E702D9-C6D8-4CE4-9941-D3056C3CCBED} @@ -22,7 +24,7 @@ - + @@ -36,9 +38,10 @@ + - + Common\System\IO\FileCleanupTestBase.cs @@ -51,6 +54,9 @@ Common\System\PlatformDetection.cs + + Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs + diff --git a/src/System.IO.FileSystem.Watcher/tests/project.json b/src/System.IO.FileSystem.Watcher/tests/project.json index 0ae1b2ce73e0..e1f370ee8c93 100644 --- a/src/System.IO.FileSystem.Watcher/tests/project.json +++ b/src/System.IO.FileSystem.Watcher/tests/project.json @@ -24,13 +24,36 @@ "Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00807-03" }, "frameworks": { - "netstandard1.3": {} + "netstandard1.3": {}, + "netstandard1.7": { + "dependencies": { + "System.Runtime.Serialization.Formatters": "4.3.0-beta-devapi-24512-01" + } + } }, "supports": { "coreFx.Test.netcoreapp1.0": {}, "coreFx.Test.net46": {}, "coreFx.Test.net461": {}, "coreFx.Test.net462": {}, - "coreFx.Test.net463": {} + "coreFx.Test.net463": {}, + "coreFx.Test.netcoreapp1.1-ns17": { + "netstandard1.7": [ + "win7-x86", + "win7-x64", + "win10-arm64", + "osx.10.10-x64", + "centos.7-x64", + "debian.8-x64", + "rhel.7-x64", + "ubuntu.14.04-x64", + "ubuntu.16.04-x64", + "ubuntu.16.10-x64", + "fedora.23-x64", + "linux-x64", + "opensuse.13.2-x64", + "opensuse.42.1-x64" + ] + } } } From d48291563c6285168c3f0106a65319bb29e683de Mon Sep 17 00:00:00 2001 From: Ian Hays Date: Mon, 26 Sep 2016 16:12:57 -0700 Subject: [PATCH 2/4] Update project.json versions --- .../ref/project.json | 2 +- .../src/project.json | 30 +++++++++---------- .../src/win/project.json | 30 +++++++++---------- .../tests/project.json | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/System.IO.FileSystem.Watcher/ref/project.json b/src/System.IO.FileSystem.Watcher/ref/project.json index 1529bddc652f..e471440524f9 100644 --- a/src/System.IO.FileSystem.Watcher/ref/project.json +++ b/src/System.IO.FileSystem.Watcher/ref/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "System.Runtime": "4.3.0-beta-devapi-24512-01" + "System.Runtime": "4.3.0-beta-24522-03" }, "frameworks": { "netstandard1.7": { diff --git a/src/System.IO.FileSystem.Watcher/src/project.json b/src/System.IO.FileSystem.Watcher/src/project.json index 5caa6e08006e..7a7cffc28bd8 100644 --- a/src/System.IO.FileSystem.Watcher/src/project.json +++ b/src/System.IO.FileSystem.Watcher/src/project.json @@ -3,21 +3,21 @@ "netstandard1.7": { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.3.0-beta-devapi-24512-01", - "System.Collections": "4.3.0-beta-devapi-24512-01", - "System.Diagnostics.Debug": "4.3.0-beta-devapi-24512-01", - "System.Diagnostics.Tools": "4.3.0-beta-devapi-24512-01", - "System.IO": "4.3.0-beta-devapi-24512-01", - "System.IO.FileSystem": "4.3.0-beta-devapi-24512-01", - "System.IO.FileSystem.Primitives": "4.3.0-beta-devapi-24512-01", - "System.Resources.ResourceManager": "4.3.0-beta-devapi-24512-01", - "System.Runtime": "4.3.0-beta-devapi-24512-01", - "System.Runtime.Extensions": "4.3.0-beta-devapi-24512-01", - "System.Runtime.Handles": "4.3.0-beta-devapi-24512-01", - "System.Runtime.InteropServices": "4.3.0-beta-devapi-24512-01", - "System.Threading": "4.3.0-beta-devapi-24512-01", - "System.Threading.Tasks": "4.3.0-beta-devapi-24512-01", - "System.Threading.Thread": "4.3.0-beta-devapi-24512-01" + "Microsoft.Win32.Primitives": "4.3.0-beta-24522-03", + "System.Collections": "4.3.0-beta-24522-03", + "System.Diagnostics.Debug": "4.3.0-beta-24522-03", + "System.Diagnostics.Tools": "4.3.0-beta-24522-03", + "System.IO": "4.3.0-beta-24522-03", + "System.IO.FileSystem": "4.3.0-beta-24522-03", + "System.IO.FileSystem.Primitives": "4.3.0-beta-24522-03", + "System.Resources.ResourceManager": "4.3.0-beta-24522-03", + "System.Runtime": "4.3.0-beta-24522-03", + "System.Runtime.Extensions": "4.3.0-beta-24522-03", + "System.Runtime.Handles": "4.3.0-beta-24522-03", + "System.Runtime.InteropServices": "4.3.0-beta-24522-03", + "System.Threading": "4.3.0-beta-24522-03", + "System.Threading.Tasks": "4.3.0-beta-24522-03", + "System.Threading.Thread": "4.3.0-beta-24522-03" }, "imports": [ "dotnet5.8" diff --git a/src/System.IO.FileSystem.Watcher/src/win/project.json b/src/System.IO.FileSystem.Watcher/src/win/project.json index e6c55b6882a4..d8f68cebe8b8 100644 --- a/src/System.IO.FileSystem.Watcher/src/win/project.json +++ b/src/System.IO.FileSystem.Watcher/src/win/project.json @@ -3,21 +3,21 @@ "netstandard1.7": { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.3.0-beta-devapi-24512-01", - "System.Diagnostics.Debug": "4.3.0-beta-devapi-24512-01", - "System.Diagnostics.Tools": "4.3.0-beta-devapi-24512-01", - "System.IO": "4.3.0-beta-devapi-24512-01", - "System.IO.FileSystem": "4.3.0-beta-devapi-24512-01", - "System.IO.FileSystem.Primitives": "4.3.0-beta-devapi-24512-01", - "System.Resources.ResourceManager": "4.3.0-beta-devapi-24512-01", - "System.Runtime": "4.3.0-beta-devapi-24512-01", - "System.Runtime.Extensions": "4.3.0-beta-devapi-24512-01", - "System.Runtime.Handles": "4.3.0-beta-devapi-24512-01", - "System.Runtime.InteropServices": "4.3.0-beta-devapi-24512-01", - "System.Threading": "4.3.0-beta-devapi-24512-01", - "System.Threading.Overlapped": "4.3.0-beta-devapi-24512-01", - "System.Threading.Tasks": "4.3.0-beta-devapi-24512-01", - "System.Threading.Thread": "4.3.0-beta-devapi-24512-01" + "Microsoft.Win32.Primitives": "4.3.0-beta-24522-03", + "System.Diagnostics.Debug": "4.3.0-beta-24522-03", + "System.Diagnostics.Tools": "4.3.0-beta-24522-03", + "System.IO": "4.3.0-beta-24522-03", + "System.IO.FileSystem": "4.3.0-beta-24522-03", + "System.IO.FileSystem.Primitives": "4.3.0-beta-24522-03", + "System.Resources.ResourceManager": "4.3.0-beta-24522-03", + "System.Runtime": "4.3.0-beta-24522-03", + "System.Runtime.Extensions": "4.3.0-beta-24522-03", + "System.Runtime.Handles": "4.3.0-beta-24522-03", + "System.Runtime.InteropServices": "4.3.0-beta-24522-03", + "System.Threading": "4.3.0-beta-24522-03", + "System.Threading.Overlapped": "4.3.0-beta-24522-03", + "System.Threading.Tasks": "4.3.0-beta-24522-03", + "System.Threading.Thread": "4.3.0-beta-24522-03" }, "imports": [ "dotnet5.8" diff --git a/src/System.IO.FileSystem.Watcher/tests/project.json b/src/System.IO.FileSystem.Watcher/tests/project.json index e1f370ee8c93..be2bef29d42d 100644 --- a/src/System.IO.FileSystem.Watcher/tests/project.json +++ b/src/System.IO.FileSystem.Watcher/tests/project.json @@ -27,7 +27,7 @@ "netstandard1.3": {}, "netstandard1.7": { "dependencies": { - "System.Runtime.Serialization.Formatters": "4.3.0-beta-devapi-24512-01" + "System.Runtime.Serialization.Formatters": "4.3.0-beta-24522-03" } } }, From 0aeaf40c7ed7ce1bf0f1f1e0a54eb52bafc0807a Mon Sep 17 00:00:00 2001 From: Ian Hays Date: Tue, 27 Sep 2016 08:20:58 -0700 Subject: [PATCH 3/4] Update package assembly version --- pkg/Microsoft.Private.PackageBaseline/packageIndex.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/Microsoft.Private.PackageBaseline/packageIndex.json b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json index 19a54b605f79..eb56af67ce8f 100644 --- a/pkg/Microsoft.Private.PackageBaseline/packageIndex.json +++ b/pkg/Microsoft.Private.PackageBaseline/packageIndex.json @@ -1088,7 +1088,7 @@ "BaselineVersion": "4.0.0", "AssemblyVersionInPackageVersion": { "4.0.0.0": "4.0.0", - "4.0.1.0": "4.3.0" + "4.1.0.0": "4.3.0" } }, "System.IO.IsolatedStorage": { From ab7ca6388d14e54dde938ca2b4258d4cdd5a011e Mon Sep 17 00:00:00 2001 From: Ian Hays Date: Thu, 29 Sep 2016 14:24:44 -0700 Subject: [PATCH 4/4] PR feedback. --- .../ref/System.IO.FileSystem.Watcher.cs | 2 +- .../src/System.IO.FileSystem.Watcher.csproj | 4 --- .../src/project.json | 3 ++- .../src/win/project.json | 27 ------------------- .../tests/project.json | 21 ++------------- 5 files changed, 5 insertions(+), 52 deletions(-) delete mode 100644 src/System.IO.FileSystem.Watcher/src/win/project.json diff --git a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs index b4fc6c5126e0..0413384cf421 100644 --- a/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs +++ b/src/System.IO.FileSystem.Watcher/ref/System.IO.FileSystem.Watcher.cs @@ -47,7 +47,7 @@ protected void OnRenamed(System.IO.RenamedEventArgs e) { } public System.IO.WaitForChangedResult WaitForChanged(System.IO.WatcherChangeTypes changeType, int timeout) { return default(System.IO.WaitForChangedResult); } } [Serializable] - public partial class InternalBufferOverflowException : System.Exception + public partial class InternalBufferOverflowException : System.SystemException { public InternalBufferOverflowException() { } public InternalBufferOverflowException(string message) { } diff --git a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj index 42a04136faba..6b4f21d19cf4 100644 --- a/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj +++ b/src/System.IO.FileSystem.Watcher/src/System.IO.FileSystem.Watcher.csproj @@ -10,10 +10,6 @@ true .NETStandard,Version=v1.7 - - win/project.json - win/project.lock.json - diff --git a/src/System.IO.FileSystem.Watcher/src/project.json b/src/System.IO.FileSystem.Watcher/src/project.json index 7a7cffc28bd8..e9832b7565da 100644 --- a/src/System.IO.FileSystem.Watcher/src/project.json +++ b/src/System.IO.FileSystem.Watcher/src/project.json @@ -16,10 +16,11 @@ "System.Runtime.Handles": "4.3.0-beta-24522-03", "System.Runtime.InteropServices": "4.3.0-beta-24522-03", "System.Threading": "4.3.0-beta-24522-03", + "System.Threading.Overlapped": "4.3.0-beta-24522-03", "System.Threading.Tasks": "4.3.0-beta-24522-03", "System.Threading.Thread": "4.3.0-beta-24522-03" }, - "imports": [ + "imports": [ "dotnet5.8" ] }, diff --git a/src/System.IO.FileSystem.Watcher/src/win/project.json b/src/System.IO.FileSystem.Watcher/src/win/project.json deleted file mode 100644 index d8f68cebe8b8..000000000000 --- a/src/System.IO.FileSystem.Watcher/src/win/project.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "frameworks": { - "netstandard1.7": { - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.Win32.Primitives": "4.3.0-beta-24522-03", - "System.Diagnostics.Debug": "4.3.0-beta-24522-03", - "System.Diagnostics.Tools": "4.3.0-beta-24522-03", - "System.IO": "4.3.0-beta-24522-03", - "System.IO.FileSystem": "4.3.0-beta-24522-03", - "System.IO.FileSystem.Primitives": "4.3.0-beta-24522-03", - "System.Resources.ResourceManager": "4.3.0-beta-24522-03", - "System.Runtime": "4.3.0-beta-24522-03", - "System.Runtime.Extensions": "4.3.0-beta-24522-03", - "System.Runtime.Handles": "4.3.0-beta-24522-03", - "System.Runtime.InteropServices": "4.3.0-beta-24522-03", - "System.Threading": "4.3.0-beta-24522-03", - "System.Threading.Overlapped": "4.3.0-beta-24522-03", - "System.Threading.Tasks": "4.3.0-beta-24522-03", - "System.Threading.Thread": "4.3.0-beta-24522-03" - }, - "imports": [ - "dotnet5.8" - ] - } - } -} diff --git a/src/System.IO.FileSystem.Watcher/tests/project.json b/src/System.IO.FileSystem.Watcher/tests/project.json index be2bef29d42d..1c5ad838136a 100644 --- a/src/System.IO.FileSystem.Watcher/tests/project.json +++ b/src/System.IO.FileSystem.Watcher/tests/project.json @@ -33,27 +33,10 @@ }, "supports": { "coreFx.Test.netcoreapp1.0": {}, + "coreFx.Test.netcoreapp1.1": {}, "coreFx.Test.net46": {}, "coreFx.Test.net461": {}, "coreFx.Test.net462": {}, - "coreFx.Test.net463": {}, - "coreFx.Test.netcoreapp1.1-ns17": { - "netstandard1.7": [ - "win7-x86", - "win7-x64", - "win10-arm64", - "osx.10.10-x64", - "centos.7-x64", - "debian.8-x64", - "rhel.7-x64", - "ubuntu.14.04-x64", - "ubuntu.16.04-x64", - "ubuntu.16.10-x64", - "fedora.23-x64", - "linux-x64", - "opensuse.13.2-x64", - "opensuse.42.1-x64" - ] - } + "coreFx.Test.net463": {} } }