You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Breaking change]: Changed AnonymousPipeServerStream.Dispose behaviour for HandleInheritability.Inheritable #32713
🏁 Release: .NET 8Work items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.
The DisposeLocalCopyOfClientHandle method should be called after the client handle has been passed to the child process. Not doing so can cause resource leaks similar to this one.
To lower the chances for introducing similar bugs for users who don't call DisposeLocalCopyOfClientHandle, the behaviour of AnonymousPipeServerStream.Dispose has been improved.
Version
.NET 8 Preview 1
Previous behavior
The client handle owned by the AnonymousPipeServerStream instance was not being disposed by AnonymousPipeServerStream.Dispose unless the handle was not exposed at all.
New behavior
The client handle owned by the server created for out-of-proc communication (HandleInheritability.Inheritable passed to AnonymousPipeServerStream ctor) is going to get disposed by AnonymousPipeServerStream.Dispose as long as it's not exposed by using the ClientSafePipeHandle property.
Type of breaking change
Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.
Reason for change
Avoiding a common resource leak.
Recommended action
Do not reuse client handle exposed as a string via GetClientHandleAsString method by the server created for out-of-proc communication (HandleInheritability.Inheritable passed to AnonymousPipeServerStream ctor) after the server instance has been Disposed.
// THIS IS VERY BAD IDEA, DON'T DO IT!AnonymousPipeServerStreamserver=new(PipeDirection.Out,HandleInheritability.Inheritable);SafePipeHandleclientPipeHandle=new(nint.Parse(server.GetClientHandleAsString()),ownsHandle:true);server.Dispose();// clientPipeHandle is now CLOSED
🏁 Release: .NET 8Work items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.
Activity