Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Expose InternalBufferOverflowException in FSW#11785

Merged
stephentoub merged 4 commits into
dotnet:masterfrom
ianhays:api_fsw_internalbufferoverflowexception
Sep 30, 2016
Merged

Expose InternalBufferOverflowException in FSW#11785
stephentoub merged 4 commits into
dotnet:masterfrom
ianhays:api_fsw_internalbufferoverflowexception

Conversation

@ianhays
Copy link
Copy Markdown
Contributor

@ianhays ianhays commented Sep 16, 2016

Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher.

@danmosemsft @joperezr @stephentoub

@ianhays ianhays added this to the 1.1.0 milestone Sep 16, 2016
@ianhays ianhays self-assigned this Sep 16, 2016
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
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.

4.2 instead of 4.1?

public InternalBufferOverflowException() { }
public InternalBufferOverflowException(string message) { }
public InternalBufferOverflowException(string message, System.Exception inner) { }
}
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?

Assert.Equal(message, ide.Message);
Assert.Same(innerException, ide.InnerException);
}
}
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.

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.

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.

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.

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
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.

Unwanted change?

<OutputType>Library</OutputType>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
<NuGetTargetMoniker>.NETStandard,Version=v1.7</NuGetTargetMoniker>
<PackageTargetFramework>netstandard1.7</PackageTargetFramework>
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.

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"?>
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.

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.

@joperezr
Copy link
Copy Markdown
Member

"netstandard1.3": {

No need for this anymore and no need for the net46 either. What you do need to add is a net463 since we have to x-compile for it


Refers to: src/System.IO.FileSystem.Watcher/src/project.json:3 in 6c17624. [](commit_id = 6c17624, deletion_comment = False)

<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>
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.

You don't need this anymore.

<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>
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.

.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')">
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.

Or '$(TargetGroup)' == 'netstandard1.3' [](start = 86, length = 39)

We won't compile for netstandard1.3 anymore so this can go away too

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.

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.

@joperezr
Copy link
Copy Markdown
Member

@ianhays you are missing a few things in order for this to work for netstandard1.7

  1. You need to change the src/System.IO.FileSystem.Watcher.builds file to add a x-compilation for net463 and remove the one for net46.
  2. You need to make sure that the src/.csproj builds correctly for net463, so basically you want to check all of the places where we have a condition like '$(TargetGroup)' == 'net46' in the project and change that to 463.
  3. You need to update the pkg/.pkgproj file to say that you now support netcoreapp1.1, like:
  <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>

Ian Hays added 3 commits September 26, 2016 16:11
Updates the default targetgroup of filesystemwatcher to netstandard1.7 and exposes InternalBufferOverflowException out of System.IO.FileSystemWatcher.
@ianhays
Copy link
Copy Markdown
Contributor Author

ianhays commented Sep 27, 2016

@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"
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

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 😄

@@ -1,25 +1,26 @@
{
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'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?

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.

Combined.

"opensuse.13.2-x64",
"opensuse.42.1-x64"
]
}
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 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

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.

Removed.

"netstandard1.3": {},
"netstandard1.7": {
"dependencies": {
"System.Runtime.Serialization.Formatters": "4.3.0-beta-24522-03"
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.

"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?

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.

Formatters doesn't work when the TargetGroup is netstandard1.3.

Copy link
Copy Markdown
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

Added a few comments but overall this LGTM.

@stephentoub
Copy link
Copy Markdown
Member

Thanks, Ian.

@stephentoub stephentoub merged commit 148e7d9 into dotnet:master Sep 30, 2016
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
@ianhays ianhays deleted the api_fsw_internalbufferoverflowexception branch April 25, 2017 18:05
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants