-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove System.Net.Connections and related features #41648
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,24 @@ public SocketsConnectionFactory(System.Net.Sockets.SocketType socketType, System | |
protected virtual System.Net.Sockets.Socket CreateSocket(System.Net.Sockets.AddressFamily addressFamily, System.Net.Sockets.SocketType socketType, System.Net.Sockets.ProtocolType protocolType, System.Net.EndPoint? endPoint, System.Net.Connections.IConnectionProperties? options) { throw null; } | ||
} | ||
} | ||
namespace System.Net | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does it work if we remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not exposed to the user. It's still part of the tree, but not dropped. |
||
{ | ||
public enum NetworkError : int | ||
{ | ||
Other = 0, | ||
EndPointInUse, | ||
HostNotFound, | ||
TimedOut, | ||
ConnectionRefused, | ||
OperationAborted, | ||
ConnectionAborted, | ||
ConnectionReset, | ||
} | ||
public class NetworkException : System.IO.IOException | ||
{ | ||
public NetworkException(NetworkError error, Exception? innerException = null) { } | ||
public NetworkException(string message, NetworkError error, Exception? innerException = null) { } | ||
protected NetworkException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { } | ||
public NetworkError NetworkError { get { throw null; } } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,36 +225,6 @@ public async Task Connection_Pipe_ReadWrite_Success(EndPoint endPoint, SocketTyp | |
Assert.True(rr.Buffer.FirstSpan.SequenceEqual(sendData)); | ||
} | ||
|
||
[Fact] | ||
public async Task Connection_Stream_FailingOperation_ThowsNetworkException() | ||
{ | ||
using var server = SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, IPAddress.Loopback); | ||
using SocketsConnectionFactory factory = new SocketsConnectionFactory(SocketType.Stream, ProtocolType.Tcp); | ||
using Connection connection = await factory.ConnectAsync(server.EndPoint); | ||
|
||
connection.ConnectionProperties.TryGet(out Socket socket); | ||
Stream stream = connection.Stream; | ||
socket.Dispose(); | ||
|
||
Assert.Throws<NetworkException>(() => stream.Read(new byte[1], 0, 1)); | ||
Assert.Throws<NetworkException>(() => stream.Write(new byte[1], 0, 1)); | ||
} | ||
|
||
[Fact] | ||
public async Task Connection_Pipe_FailingOperation_ThowsNetworkException() | ||
{ | ||
using var server = SocketTestServer.SocketTestServerFactory(SocketImplementationType.Async, IPAddress.Loopback); | ||
using SocketsConnectionFactory factory = new SocketsConnectionFactory(SocketType.Stream, ProtocolType.Tcp); | ||
using Connection connection = await factory.ConnectAsync(server.EndPoint); | ||
|
||
connection.ConnectionProperties.TryGet(out Socket socket); | ||
IDuplexPipe pipe = connection.Pipe; | ||
socket.Dispose(); | ||
|
||
await Assert.ThrowsAsync<NetworkException>(() => pipe.Input.ReadAsync().AsTask()); | ||
await Assert.ThrowsAsync<NetworkException>(() => pipe.Output.WriteAsync(new byte[1]).AsTask()); | ||
} | ||
Comment on lines
-229
to
-256
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are keeping the rest of the code anyways, can we preserve these tests by refactoring the assertions for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, the only reason these tests exist is to check for NetworkException specifically. So I'm not sure what we get by checking for IOException. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that the assertion is less valuable in it's current form, but is it more likely that we are about to re-introduce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on the direction we go, we will make a branch from master that reverts this PR and continue to iterate the API --so, I don't think we will lose anything. |
||
|
||
[Theory] | ||
[InlineData(false, false)] | ||
[InlineData(false, true)] | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is removing pipelines reference here going to require a reaction in aspnetcore? Did we make changes to not reference it ourselves? @halter73 @Tratcher @JunTaoLuo