Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/Microsoft.Private.PackageBaseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace System.Runtime.Serialization.Formatters.Tests
{
internal static class BinaryFormatterHelpers
public static class BinaryFormatterHelpers
{
internal static T Clone<T>(T obj)
{
Expand All @@ -21,7 +21,7 @@ internal static T Clone<T>(T obj)
}
}

internal static void AssertRoundtrips<T>(T expected, params Func<T, object>[] additionalGetters)
public static void AssertRoundtrips<T>(T expected, params Func<T, object>[] additionalGetters)
where T : Exception
{
for (int i = 0; i < 2; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/System.IO.FileSystem.Watcher/dir.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
</PropertyGroup>
</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.IO.FileSystem.Watcher.csproj">
<SupportedFramework>net46;netcoreapp1.0;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>net463;netcoreapp1.1;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.IO.FileSystem.Watcher.builds" />

</ItemGroup>
<ItemGroup>
<InboxOnTargetFramework Include="MonoAndroid10" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serializable [](start = 5, length = 12)

Just curious, should this type implement ISerializable? I ask because usually types that have this attribute also have that interface and it's implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, should this type implement ISerializable?

not according to the docs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception itself implements ISerializable, and it exposes a protected GetObjectData method that a derived exception can override if it has additional state that needs to be serialized... InternalBufferOverflowException doesn't, so it doesn't.

In general, the majority of [Serializable] types don't actually implement ISerializable. When a type is marked as [Serializable], BinaryFormatter does a default serialization, where it serializes all fields (unless they're marked as [NonSerialized]). If you want to customize that behavior, there are a variety of ways, one of which is implementing ISerializable (which provides the GetObjectData method for getting the state to be serialized) and providing a deserialization ctor (one that takes SerializationInfo and StreamingContext)... when you implement ISerializable, BinaryFormatter then defers to the GetObjectData+ctor to serialize and deserialize the instance.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation @stephentoub 😄

public partial class InternalBufferOverflowException : System.SystemException
{
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) { }
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're adding this, can you add it with the appropriate serialization as well? It should have a protected ctor:

protected InternalBufferOverflowException(SerializationInfo info, StreamingContext context) : base (info, context) { }

Also, the base type should be SystemException, right?

[System.FlagsAttribute]
public enum NotifyFilters
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.IO.FileSystem.Watcher.cs" />
Expand Down
6 changes: 3 additions & 3 deletions src/System.IO.FileSystem.Watcher/ref/project.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"dependencies": {
"System.Runtime": "4.0.0"
"System.Runtime": "4.3.0-beta-24522-03"
},
"frameworks": {
"netstandard1.3": {
"netstandard1.7": {
"imports": [
"dotnet5.4"
"dotnet5.8"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</Project>
<Project Include="System.IO.FileSystem.Watcher.csproj">
<OSGroup>Windows_NT</OSGroup>
</Project>
</Project>
<Project Include="System.IO.FileSystem.Watcher.csproj">
<TargetGroup>net46</TargetGroup>
<TargetGroup>net463</TargetGroup>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@
<PropertyGroup>
<ProjectGuid>{77E702D9-C6D8-4CE4-9941-D3056C3CCBED}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsWindows)' == 'true' AND '$(TargetGroup)' == ''">
<ProjectJson>win/project.json</ProjectJson>
<ProjectLockJson>win/project.lock.json</ProjectLockJson>
</PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Linux_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Linux_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'OSX_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'OSX_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net46_Release|AnyCPU'" />
<ItemGroup Condition=" '$(TargetGroup)' != 'net46' ">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net463_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net463_Release|AnyCPU'" />
<ItemGroup Condition=" '$(TargetGroup)' != 'net463' ">
<Compile Include="System\HResults.cs" />
<Compile Include="System\IO\ErrorEventArgs.cs" />
<Compile Include="System\IO\ErrorEventHandler.cs" />
Expand All @@ -44,7 +40,7 @@
<Link>Common\System\IO\PathInternal.CaseSensitivity.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'net46' ">
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' != 'net463' ">
<Compile Include="$(CommonPath)\System\IO\PathInternal.Windows.cs">
<Link>Common\System\IO\PathInternal.Windows.cs</Link>
</Compile>
Expand All @@ -68,7 +64,7 @@
</Compile>
<Compile Include="System\IO\FileSystemWatcher.Win32.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' And '$(TargetGroup)' != 'net46' ">
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' And '$(TargetGroup)' != 'net463' ">
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Libraries.cs">
<Link>Common\Interop\Unix\Interop.Libraries.cs</Link>
</Compile>
Expand All @@ -88,7 +84,7 @@
<Link>Common\Interop\Unix\Interop.PathConf.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' And '$(TargetGroup)' != 'net46' ">
<ItemGroup Condition=" '$(TargetsLinux)' == 'true' And '$(TargetGroup)' != 'net463' ">
<Compile Include="System\IO\FileSystemWatcher.Linux.cs" />
<Compile Include="$(CommonPath)\Interop\Linux\System.Native\Interop.INotify.cs">
<Link>Common\Interop\Linux\Interop.inotify.cs</Link>
Expand All @@ -100,7 +96,7 @@
<Link>Common\Interop\Unix\Interop.Stat.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' And '$(TargetGroup)' != 'net46' ">
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' And '$(TargetGroup)' != 'net463' ">
<Compile Include="System\IO\FileSystemWatcher.OSX.cs" />
<Compile Include="$(CommonPath)\Interop\OSX\Interop.EventStream.cs">
<Link>Common\Interop\OSX\Interop.EventStream.cs</Link>
Expand All @@ -127,10 +123,10 @@
<Link>Common\Microsoft\Win32\SafeHandles\SafeEventStreamHandle.OSX.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" ('$(TargetsFreeBSD)' == 'true' OR '$(TargetsUnknownUnix)' == 'true') And '$(TargetGroup)' != 'net46' ">
<ItemGroup Condition=" ('$(TargetsFreeBSD)' == 'true' OR '$(TargetsUnknownUnix)' == 'true') And '$(TargetGroup)' != 'net463' ">
<Compile Include="System\IO\FileSystemWatcher.UnknownUnix.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'net46'">
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <devdoc>
/// The exception that is thrown when the internal buffer overflows.
/// </devdoc>
public class InternalBufferOverflowException : Exception
[Serializable]
public class InternalBufferOverflowException : SystemException
{
/// <devdoc>
/// Initializes a new default instance of the <see cref='System.IO.InternalBufferOverflowException'/> class.
Expand All @@ -33,5 +36,8 @@ public InternalBufferOverflowException(string message, Exception inner) : base(m
{
HResult = HResults.InternalBufferOverflow;
}

protected InternalBufferOverflowException(SerializationInfo info, StreamingContext context)
: base(info, context) { }
}
}
40 changes: 21 additions & 19 deletions src/System.IO.FileSystem.Watcher/src/project.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{
"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"
},
"imports": [
"dotnet5.4"
"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.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"
]
},
"net46": {
"net463": {
"dependencies": {
"Microsoft.TargetingPack.NETFramework.v4.6": "1.0.1"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v4.6 [](start = 46, length = 4)

we should probably update this to be v4.6.2

}
Expand Down
26 changes: 0 additions & 26 deletions src/System.IO.FileSystem.Watcher/src/win/project.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Xunit;
using XunitPlatformID = Xunit.PlatformID;

namespace System.IO.Tests
{
Expand Down Expand Up @@ -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()))
Expand Down
Loading