Expose InternalBufferOverflowException in FSW#11785
Conversation
| <Import Project="..\dir.props" /> | ||
| <PropertyGroup> | ||
| <AssemblyVersion>4.0.1.0</AssemblyVersion> | ||
| <AssemblyVersion>4.2.0.0</AssemblyVersion> |
| public InternalBufferOverflowException() { } | ||
| public InternalBufferOverflowException(string message) { } | ||
| public InternalBufferOverflowException(string message, System.Exception inner) { } | ||
| } |
There was a problem hiding this comment.
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?
| Assert.Equal(message, ide.Message); | ||
| Assert.Same(innerException, ide.InnerException); | ||
| } | ||
| } |
There was a problem hiding this comment.
Once you add the serialization stuff, you can also do a serialization test of it with https://github.com/dotnet/corefx/blob/master/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs#L24
There was a problem hiding this comment.
What is System.Runtime.Serialization.Formatters.Binary? It's listed in that common test file but it has no package that I'm aware of.
There was a problem hiding this comment.
It's the namespace that contains BinaryFormatter. BinaryFormatter is in the System.Runtime.Serialization.Formatters assembly.
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio 14 | ||
| VisualStudioVersion = 14.0.22609.0 | ||
| VisualStudioVersion = 14.0.25123.0 |
| <OutputType>Library</OutputType> | ||
| <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker> | ||
| <NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker> | ||
| <PackageTargetFramework>netstandard1.7</PackageTargetFramework> |
There was a problem hiding this comment.
netstandard1.7 [](start = 4, length = 63)
You don't need this. This should now be inferred by buildtools.
| @@ -0,0 +1,14 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
There was a problem hiding this comment.
You don't need this depproj and project.json either. Eric made some changes such that now we harvest the latest stable package and grab old assets from there, so you can remove this.
| <PropertyGroup> | ||
| <ProjectGuid>{77E702D9-C6D8-4CE4-9941-D3056C3CCBED}</ProjectGuid> | ||
| <AssemblyVersion Condition="'$(TargetGroup)'=='netstandard1.3' Or '$(TargetGroup)'=='net46' Or '$(TargetGroup)'=='netcore50'">4.0.0.0</AssemblyVersion> | ||
| <ContractProject Condition="'$(AssemblyVersion)'=='4.0.0.0'">../ref/4.0.0/System.IO.FileSystem.Watcher.depproj</ContractProject> |
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net46'">true</IsPartialFacadeAssembly> | ||
| <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.3</NuGetTargetMoniker> | ||
| <NuGetTargetMoniker Condition="'$(TargetGroup)' == 'netstandard1.3'">.NETStandard,Version=v1.3</NuGetTargetMoniker> |
There was a problem hiding this comment.
.NETStandard,Version=v1.3 [](start = 4, length = 115)
Remove this line as well.
| <NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(TargetsWindows)' == 'true' AND '$(TargetGroup)' == ''"> | ||
| <PropertyGroup Condition="'$(TargetsWindows)' == 'true' AND ('$(TargetGroup)' == '' Or '$(TargetGroup)' == 'netstandard1.3')"> |
There was a problem hiding this comment.
Or '$(TargetGroup)' == 'netstandard1.3' [](start = 86, length = 39)
We won't compile for netstandard1.3 anymore so this can go away too
There was a problem hiding this comment.
Oh good, that saves me a ton of hassle. From looking at the project files for IO and FileSystem it appeared that we still needed to be able to build for the older netstandard1.3. There's a bunch of junk in this PR that can be removed in that case.
|
@ianhays you are missing a few things in order for this to work for netstandard1.7
<ItemGroup>
<ProjectReference Include="..\ref\System.IO.FileSystem.Watcher.csproj">
<SupportedFramework>net463;netcoreapp1.1;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.IO.FileSystem.Watcher.builds" />
</ItemGroup> |
Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher.
|
@joperezr @stephentoub Thanks for all the feedback! I responded to it all and pushed some updates, though it seems the new github interface doesn't handle rebases too well. |
| "net46": { | ||
| "net463": { | ||
| "dependencies": { | ||
| "Microsoft.TargetingPack.NETFramework.v4.6": "1.0.1" |
There was a problem hiding this comment.
v4.6 [](start = 46, length = 4)
we should probably update this to be v4.6.2
| 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] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Just curious, should this type implement ISerializable?
There was a problem hiding this comment.
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.
| @@ -1,25 +1,26 @@ | |||
| { | |||
There was a problem hiding this comment.
I'm not sure I understand why there is a separate project.json for netstandard1.7 if this is also includded on the one under src/ . Is there a reason why we can't clean this up?
| "opensuse.13.2-x64", | ||
| "opensuse.42.1-x64" | ||
| ] | ||
| } |
There was a problem hiding this comment.
I believe you shouldn't need this anymore. All you need now is to add a "coreFx.Test.netcoreapp1.1": {}, and that should be good enough since we recently updated the nuget framework mappings which understand the connection between netstandard1.7 and netcoreapp1.1
| "netstandard1.3": {}, | ||
| "netstandard1.7": { | ||
| "dependencies": { | ||
| "System.Runtime.Serialization.Formatters": "4.3.0-beta-24522-03" |
There was a problem hiding this comment.
"System.Runtime.Serialization.Formatters": "4.3.0-beta-24522-03" [](start = 8, length = 64)
Any reason why we can't just add this where the rest of the dependencies are?
There was a problem hiding this comment.
Formatters doesn't work when the TargetGroup is netstandard1.3.
joperezr
left a comment
There was a problem hiding this comment.
Added a few comments but overall this LGTM.
|
Thanks, Ian. |
* Expose InternalBufferOverflowException in FSW Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher. Commit migrated from dotnet/corefx@148e7d9
Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher.
@danmosemsft @joperezr @stephentoub