Commit Graph
590 Commits
Author SHA1 Message Date
Stephen Toub 8fd85a520b Set ILLinkClearInitLocals across repo
Enable it for all C# src projects.


Commit migrated from https://github.com/dotnet/corefx/commit/4b5b5c163b925400b884dac2bf207d189b69bd3b
2019-01-08 09:49:57 -05:00
Stanislav Ushakov ac76a68271 Removed global suppression of CS1573 and CS1591 warnings (dotnet/corefx#34232)
* Removed global suppression of CS1573 and CS1591, moved suppression to the project level.

* Fixes for netfx build, added 2 projects


Commit migrated from https://github.com/dotnet/corefx/commit/adb4d48fe65d48b6dd1c2ff15c8a60e5f96bf266
2018-12-24 12:17:29 -05:00
Viktor Hofer 66e8f64d31 Consume Microsoft.DotNet.CoreFxTesting package (dotnet/corefx#33423)
* Consume Microsoft.DotNet.CoreFxTesting package

* Remove code coverage dedicated runtime dir config files and switch to Coverlet

* Add global tool support in corefx

* Update code coverage docs

Commit migrated from https://github.com/dotnet/corefx/commit/ae38b7cc3762d832fdcebe27a0aab7b22ab2f3fa
2018-12-06 02:56:11 +01:00
Stephen Toub e1ab1eab31 Ensure ManagedWebSocket.CloseOutputAsync closes the underlying stream (dotnet/corefx#33473)
* Ensure CloseOutputAsync closes the underlying stream

When we issue a close, we then wait for the response close message, and after receiving it, dispose of the web socket instance, which then closes the stream.  We don't currently do the same when sending a close frame having already received a close frame, but we should.

* Address PR feedback

And fix break on netfx where ArraySegment doesn't have an implicit cast from byte[].


Commit migrated from https://github.com/dotnet/corefx/commit/f798c1a103c9b7c899ea43e0d978f7e1f7458473
2018-11-14 16:36:10 -05:00
David Shulman f2119ef08c Disable WebSocket SendReceiveTest on NETFX (dotnet/corefx#33429)
Disable SendAsync_MultipleOutstandingSendOperations_Throws() test on .NET Framework.  This is likely a .NET Framework bug but possibly a test bug.

Contributes to dotnet/corefx#33401

Commit migrated from https://github.com/dotnet/corefx/commit/ea617a49ab690c4df481a6d7eaf96e48439ba41c
2018-11-12 16:06:02 -05:00
Wes Haggard 954fb511b3 Rename AssemblyKey properties to StrongNameKeyId as part of arcade work
Commit migrated from https://github.com/dotnet/corefx/commit/7edd861bf2dd59ecdb4284e0fd291d7458198a9d
2018-10-30 15:14:01 -07:00
Stephen Toub dfd51da7c5 Fix several WebSocket tests blocking xunit's SynchronizationContext (dotnet/corefx#32591)
* Fix several WebSocket tests that were blocking xunit's SynchronizationContext

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/7685f1c5212fa9637b408d97928ffba7b8d9d6c2
2018-10-03 05:51:00 -04:00
Filip Navara 2a2c2ef521 Move uap, uapaot, netfx, netcoreapp and netcoreapp20 constant definitions to top-level build file. (dotnet/corefx#31470)
* Move uap, uapaot, netfx and netcoreapp constant definitions to top-level build file.

* Trying to fix compilation of PerformanceCounterLib for netcoreapp2.0 targets.

* Change netcoreapp definition to mean the current version only.

* Fix conflict in System.Private.DataContractSerialization.csproj.

* Revert change in src/shims/manual/Directory.Build.props.

* Fix condition in test.

* Bring back TargetsNetCoreApp, it was lost during rebases.

* Move definition of netstandard to top-level build file. Remove more netcoreapp/uap definitions from individual files.

* Fix vbproj compatibility.

* Address PR review and unify the definitions to use TargetGroup directly.

* Add back one "netstandard" definition.


Commit migrated from https://github.com/dotnet/corefx/commit/ac994544e749eac3e85b60bf0012ae2f85ae0e49
2018-08-29 08:49:33 -07:00
Eric Erhardt 779486884e Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/ec546de620c5248f3662d6aaca989ed382b86b6b
2018-06-28 21:28:41 -05:00
Eric Erhardt 8b6d5baf20 Change .csproj to new Configurations property
Change .sln to use the managed C# project system GUID.


Commit migrated from https://github.com/dotnet/corefx/commit/e05508a62d28f4807f85abe9cb7adf8382f792b4
2018-06-28 17:49:22 -05:00
Stephen Toub 4c9eb2ec25 Simplify built-in types across corefx tests (dotnet/corefx#30660)
Commit migrated from https://github.com/dotnet/corefx/commit/7ae1a252d7e68c5513d2658de7a401c37e9b0504
2018-06-25 22:42:04 -07:00
Stephen Toub 2fb9f847fc Simplify built-in types across corefx (dotnet/corefx#30656)
Commit migrated from https://github.com/dotnet/corefx/commit/e0ba7aa8026280ee3571179cc06431baf1dfaaac
2018-06-25 16:54:41 -07:00
Eric Erhardt 1df03e5bbd Rename dir files to Directory.Build
dir.props => Directory.Build.props
dir.targets => Directory.Build.targets


Commit migrated from https://github.com/dotnet/corefx/commit/204a8dbbc23bfc51d419c93f2f2ddaf50db8020f
2018-06-15 17:07:48 -05:00
Eric Erhardt 70091b9c8b Merge master into SdkProj
Commit migrated from https://github.com/dotnet/corefx/commit/ad505eb98c6a887db2d2932fec256d9e4e394169
2018-06-11 17:20:10 -05:00
ares128 a3b99c346d check SwitchingProtocol before ContentLength (dotnet/corefx#29948)
* check SwitchingProtocol before ContentLength

In case some websocket retrun ContentLength =0 with SwitchingProtocol

* Update LoopbackHelper To ContentLength: 0

Test Situation when Content-Length: 0 with SwitchingProtocols


Commit migrated from https://github.com/dotnet/corefx/commit/8063d42defc2f5d8afc1053273347cf3384673ef
2018-05-30 09:29:16 -07:00
David Shulman 19d0b8b05f Fix websocket partial message receive test (dotnet/corefx#29826)
This test was originally disabled before we switched from WinHTTP to a managed
implementation on Windows. And any other failure noted on Linux was probably due
to a transient network/environment issue.

I simplified the test to use smaller buffer sizes which might help with any test
environment issues. These updated sizes still meet the requirements of what needs
to be tested. If we find that this test is still failing frequently then we will
switch to a loopback echo websocket server (which we don't have fully implemented yet).

Fixes dotnet/corefx#9296


Commit migrated from https://github.com/dotnet/corefx/commit/077280bd5b20d158136ea000bb6c4c86ec40ac0c
2018-05-21 18:09:16 -07:00
wtgodbe f38ceb30be Convert all .csproj files in src to SDK-style projects
Commit migrated from https://github.com/dotnet/corefx/commit/91d7e62bbf28094a2b419b87847bcd6a7658564d
2018-05-21 11:53:46 -07:00
David Shulman f01edad59d Fix WebSocket.Client tests on UAP (dotnet/corefx#29810)
Fixed WinRTWebSocket for the edge case of dealing with 0-byte receive calls.

Made a few adjustments to the tests for UAP test runs.

Fixes dotnet/corefx#28755.

Commit migrated from https://github.com/dotnet/corefx/commit/3a84f58a3889f1308f8908fcb1e294a5b09a9fbe
2018-05-21 09:38:29 -07:00
David Shulman 07300982d0 Optimize eligible client certificate lookup (dotnet/corefx#29766)
Optimize eligible client certificate lookup

Following up from PR dotnet/corefx#29758, this PR optimizes how we search a collection of certificates
to find an eligible client certificate. This PR moves us away from using the inefficient Find()
API which creates new managed objects for collections and certificates and complicated lifetime
issues for PFX based certificates.

Now, we just do a simple one-time pass over the existing collection and return a certificate
(or null) from that collection.

This change was validated against both System.Net.Http functional tests (which exercise client
certificates) and System.Net.Http.WinHttpHandler unit tests which test all the code paths here
including Client EKU and DigitalSignature OID combinations.

See: https://github.com/dotnet/corefx/blob/master/src/System.Net.Http.WinHttpHandler/tests/UnitTests/ClientCertificateScenarioTest.cs


Commit migrated from https://github.com/dotnet/corefx/commit/ef3418c6b6e9dd525b273f8e7cb271804b56c678
2018-05-18 17:24:44 -07:00
Stephen Toub b90fae078b Add more missing overrides to refs (dotnet/corefx#29738)
Ran /t:GenerateReferenceSource and undid irrelevant changes, though I kept a few files where the changes were trivial (e.g. whitespace) and it seemed better to just accept the change to stay in sync with GenerateReferenceSource.

In general I only added missing overrides on non-sealed classes, but when there were already overrides included on sealed classes, I added them back for consistency.

Commit migrated from https://github.com/dotnet/corefx/commit/10aa8277de2521fb1e6a5b42d053ad8cc947be81
2018-05-16 22:11:33 -04:00
David Shulman 2ae1d2c874 Update System.Net tests to use newer corefx-testdata PFX files (dotnet/corefx#29724)
Updated PFX files were checked into corefx-testdata repro via
https://github.com/dotnet/corefx-testdata/pull/24. This PR removed
the friendly name attribute from the private key. This fixes the
problem in Windows dealing with parallel PFX import.

This PR updates the System.Net.* tests to use the updated corefx-testdata package.

Closes dotnet/corefx#23341
Contributes to dotnet/corefx#9543

Commit migrated from https://github.com/dotnet/corefx/commit/84883052ef0f720a8befdc8525db50c9544227d5
2018-05-16 11:42:46 -07:00
Stephen Toub c8e7b2312b Add missing awaits to XmlTextReaderImplAsync (dotnet/corefx#29518)
* Comment on awaits that don't need ConfigureAwait(false)

- Add comments to several awaits on tasks where ConfigureAwait is unnecessary for a variety of reasons
- Rather than commenting, change one await to GetAwaiter().GetResult() where we know the task is already completed (rather than just commenting to that effect)

* Add missing awaits to XmlTextReaderImplAsync


Commit migrated from https://github.com/dotnet/corefx/commit/b758c3b1f1293ada2e46f9e221be0b392838cc41
2018-05-04 16:08:59 -04:00
Dan Friedman 33591df321 Clean dead code System.Net* (dotnet/corefx#29302)
* Clean dead code in System.Net

* More cleaning

* Clean dead code for HttpListener

* Clean dead code for Mail

* Clean dead code in Http

* Clean dead code for NetworkInformation

* Clean more dead code

* Various fixes

* Build fix

* Restore field

* var -> string


Commit migrated from https://github.com/dotnet/corefx/commit/71cc1ae8ba02b7b71878cb69a50c667c8ed0f50f
2018-05-01 16:49:12 -07:00
Caesar Chen dc7affffaf Fix ClientWebSocket error message when endpoint is not a real websocket (dotnet/corefx#29159)
* fix clientwebsocket error message

* address feedback

* fix comment


Commit migrated from https://github.com/dotnet/corefx/commit/0c15e758b797bded4a058b397e0a520961a84c6a
2018-04-18 09:03:45 -07:00
Stephen Toub 30cf8987ce Remove buffer argument from WebSocket.CreateFromStream (dotnet/corefx#28649)
Commit migrated from https://github.com/dotnet/corefx/commit/bf38b7b8c56e7fbe10796dcfa1918a36377a1cd6
2018-03-30 14:23:56 -07:00
Stephen Toub c62e1d8f06 Reduce buffering in ManagedWebSocket.ReceiveAsync (dotnet/corefx#28577)
* Change SocketsHttpHandler's 101 response stream to buffer response reads

The connection already has a buffer; use it.

* Reduce buffering in ManagedWebSocket.ReceiveAsync

Today we use a big-ish receive buffer, reading all data into the receive buffer and then copying from there into the caller-provided destination buffer.  With this change, we assume that the underlying stream is providing the desired level of buffering, and thus only use a buffer small enough to handle message headers and control payloads (the latter for simplicity, as no caller-supplied buffer is available there).

* Change ClientWebSocket to avoid creating a large buffer


Commit migrated from https://github.com/dotnet/corefx/commit/06aa6f0ce4cdf78985f029f218007a7d55f8965f
2018-03-30 09:53:26 -07:00
Stephen Toub 88da6077e1 Add WebSocket test for zero-byte receives (dotnet/corefx#28579)
Commit migrated from https://github.com/dotnet/corefx/commit/21947fbd29845d6fea9c5576991b6debc995e0f7
2018-03-28 23:11:51 -07:00
Caesar Chen bbfe5af55e enable test (dotnet/corefx#28481)
Commit migrated from https://github.com/dotnet/corefx/commit/1d107ad2e499bda7de6974f83314ebfe8b38f7b5
2018-03-28 11:25:21 -07:00
Alexander Radchenko cb47fdd588 Fixed netfx System.Net.WebSockets.Client.Tests fails on non-English Windows (dotnet/corefx#28380)
Commit migrated from https://github.com/dotnet/corefx/commit/4e3476bcee357443fbd1668269cf33276e310c97
2018-03-22 22:59:46 -04:00
Caesar Chen 162fd4fcf7 Make ClientWebSocket always use CONNECT tunneling through a proxy (dotnet/corefx#28150)
* make non-secure websocket use CONNECT tunnel through proxy

* add test

* address pr feedback


Commit migrated from https://github.com/dotnet/corefx/commit/cad146596eb4f64ae81fc7db17335a6fb12e0b3b
2018-03-22 09:31:24 -07:00
Stephen Toub cb16c44b05 Expose ClientWebSocketOptions.RemoteCertificateValidationCallback (dotnet/corefx#28141)
* Expose ClientWebSocketOptions.RemoteCertificateValidationCallback

* Address PR feedback

* Address PR feedback


Commit migrated from https://github.com/dotnet/corefx/commit/c008bb5c791c930b1a5a8cb4bb160f6dc675240e
2018-03-19 19:12:32 -04:00
Caesar Chen 5710d3bdca enable test (dotnet/corefx#28106)
Commit migrated from https://github.com/dotnet/corefx/commit/e9fb978f6a77d9758a47f2e1cfd00c73f1b5b9e9
2018-03-15 17:05:43 -07:00
David Shulman 2969354735 Add tests for ClientWebSocket connections thru a proxy (dotnet/corefx#28031)
Created new tests for verifying ClientWebSocket connections
end-to-end thru a proxy.

Opened new issues dotnet/corefx#28024 and dotnet/corefx#28027 which cause the new tests to fail.

Fixes dotnet/corefx#26957

Commit migrated from https://github.com/dotnet/corefx/commit/02c3892380a392458a4d1f41c53ce2048cb6681d
2018-03-14 09:45:39 -07:00
Caesar Chen 9df60dc56a Make SocketsHttpHandler default Handler (dotnet/corefx#27821)
* set SocketsHttpHandler to default

* address feedback

* fix if check for 28002


Commit migrated from https://github.com/dotnet/corefx/commit/2b850f6fe5fd3171c2554da965cb07070e1d648e
2018-03-14 00:34:56 -04:00
Stephen Toub fd01dc8c39 Use shared SocketsHttpHandler for some ClientWebSocket options (dotnet/corefx#27994)
* Use shared SocketsHttpHandler for some ClientWebSocket options

Currently we're creating a new SocketsHttpHandler for each ClientWebSocket.  This change makes it so that if mostly default options are used (namely no credentials, no proxy, no cookies, and no client certificates), we'll use a shared handler instance.

* Make ClientWebSocketOptions.Proxy non-null by default

netfx's ClientWebSocketOptions.Proxy defaults to a system-default proxy.  It can then be set to null to mean "no proxy" or to another proxy.  This changes netcoreapp's Proxy to match as closely as possible.

It also then fixes up a few other settings on SocketsHttpHandler:
- UseDefaultCredentials wasn't being factored in.  On netfx, UseDefaultCredentials takes precedence over Credentials, so this does the same.
- UseCookies should be true iff Cookies is non-null.

Finally, removed Outerloop from some tests that did not need to be, as they didn't actually involve making external requests, and deleted some dead test code.


Commit migrated from https://github.com/dotnet/corefx/commit/d4853e2cfd69cda68c0b17fd54b6c7d2d48b7f98
2018-03-13 14:03:19 -04:00
Stephen Toub 52648185cb Dispose of the SocketsHttpHandler used in WebSocketHandle.Managed (dotnet/corefx#27900)
Commit migrated from https://github.com/dotnet/corefx/commit/649ddbcefcc53e99219a4fc483b23c70880d801e
2018-03-09 13:07:05 -05:00
Eric St. John 98c0015605 Update SLNs and projects to be in sync with configurations
Commit migrated from https://github.com/dotnet/corefx/commit/8ce7e620e1b5001be002598f4d10d4becdd77a49
2018-03-08 08:25:31 -08:00
Stephen Toub 62ff1478db Fix NullReferenceException when using client certs with ClientWebSocket (dotnet/corefx#27777)
Commit migrated from https://github.com/dotnet/corefx/commit/e9d0a64f1d275ef0cb41b3812d6226ac1a45cb49
2018-03-06 19:14:42 -05:00
Stephen Toub 7482b6a4b0 Expose and roll out ValueTask extensibility
This commit does several things:
- Exposes the new `ValueTask` extensibility model being added in coreclr.  The ValueTask-related files will separately be mirrored over to corefx to enable the netstandard build of System.Threading.Tasks.Extensions.
- Adapts all `Stream`-derived types to return `ValueTask` instead of `Task` from `WriteAsync`.
- Changes the new `WebSocket` `SendAsync` method to return `ValueTask` instead of `Task`, and updates the `ManagedWebSocket` implementation accordingly.  Most `SendAsync`s on `ManagedWebSocket` should now return a `ValueTask` that's either completed synchronously (no allocation) or using a pooled object.  It now uses the underlying transport's new `WriteAsync` overload that returns `ValueTask`.
- Switches more uses of `ReadAsync` and `WriteAsync` over to the new overloads, including in Process, DeflateStream, BrotliStream, File, HttpClient, SslStream, WebClient, BufferedStream, CryptoStream,
- Removed some unnecessary array clearing from various routines using ArrayPool (after the clearing was added we changed our minds and decided clearing was only necessary in very specific circumstances)
- Implements a custom `IValueTaskSource` in Socket, such that async receives and sends become allocation-free (ammortized).  `NetworkStream` then inherits this functionality, such that its new `ReadAsync` and `WriteAsync` are also allocation-free (in the unbounded channel implementations; we can subsequently add it in for bounded).
- Implements a custom `IValueTaskSource` in System.Threading.Channels, such that reading and writing are ammortized allocation-free up to one concurrent reader and writer.
- A few random things I noticed as I was going through, e.g. missing ConfigureAwait, some incorrect synchronization in tests, etc.
- Adds a ton of new tests, mainly in System.Threading.Tasks.Extensions, System.Threading.Channels, and System.Net.Sockets.


Commit migrated from https://github.com/dotnet/corefx/commit/6d1671b2cfcf130b7bc6c059bb0508073426532a
2018-03-02 09:56:25 -08:00
Max Kerr ef39ea4c98 Update WebSocket status when the underlying connection is closed (dotnet/corefx#27556)
This fix addresses a behavior difference between the new managed WebSocket implementation and the old Windows only version.

When the underlying connection is closed, we need to also update the state of the WebSocket to show that it has been aborted. All of the code to do this was already written, it just needed to be called in one additional place.

Fixes dotnet/corefx#26219


Commit migrated from https://github.com/dotnet/corefx/commit/594a7f2a72dca255bb8e09613d3dcbb2499215de
2018-02-28 13:41:43 -08:00
Caesar Chen 987d73a579 Enable SendReceive_VaryingLengthBuffers_Success on Windows run (dotnet/corefx#27181)
* enable test on Windows run

* delete script

* disable test issue dotnet/corefx#27211

* disable test see dotnet/corefx#27217


Commit migrated from https://github.com/dotnet/corefx/commit/d3a69ff4448a0bd4df12e6af481898825c066c67
2018-02-16 16:03:46 -08:00
Geoff Kizer b94eefba0f reorganize and cleanup some LoopbackServer code
Commit migrated from https://github.com/dotnet/corefx/commit/ec6a7215bb28a061d2357d8c3874447bc575132d
2018-02-13 15:43:59 -08:00
Stephen Toub f8e6f41b81 Clear initlocals in a bunch of assemblies (dotnet/corefx#26993)
* Clear initlocals in a bunch of assemblies

Sets
```XML
<ILLinkClearInitLocals>true</ILLinkClearInitLocals>
```
for the assemblies:
    - System.IO.FileSystem
    - System.IO.Pipes
    - System.Memory
    - System.Net.Http
    - System.Net.Http.WinHttpHandler
    - System.Net.NameResolution
    - System.Net.NetworkInformation
    - System.Net.Primitives
    - System.Net.Requests
    - System.Net.Security
    - System.Net.Sockets
    - System.Net.WebSockets
    - System.Net.WebSockets.Client
    - System.Net.WebSockets.WebSocketsProtocol
    - System.Private.Uri
    - System.Runtime
    - System.Runtime.Extensions

Eventually we'd ideally set the flag for the whole repo; these are just the ones I audited thus far.  In a few cases I had to make code changes to adapt, where the code was expecting stackallocs to be cleared.  I also looked at a few other projects (System.Collections, System.Runtime.Numerics) where there were more significant dependencies on clearing and I decided to leave those for later.

* Disable ILLinkClearInitLocals running on Unix until it works there


Commit migrated from https://github.com/dotnet/corefx/commit/f0a032e4a1c8a848574a5db3e69e8a6fa0aae91e
2018-02-13 06:30:25 -05:00
Geoff Kizer 3a5fbcf1c2 add protocol tests for cookie handling
Commit migrated from https://github.com/dotnet/corefx/commit/750b29bbb1433ad5d4c3727217192dddbef90eef
2018-02-09 00:37:09 -08:00
Stephen Toub 89dfde815e Expose SocketsHttpHandler
- Renames ManagedHandler to SocketsHttpHandler
- Moves a bunch of files around accordingly
- Updates System.Net.WebSockets.Client to use SocketsHttpHandler directly
- Updates System.Net.Http's tests with a reflection-based rather than TLS-based method for instantiating an HttpClientHandler backed by a SocketsHttpHandler.


Commit migrated from https://github.com/dotnet/corefx/commit/852d40e723c849e8d0c486676d40332343e12ca5
2018-02-08 19:12:50 -05:00
Stephen Toub 3e942132d9 Fix ManagedHandler env var / AppContext handling (dotnet/corefx#26763)
* Fix ManagedHandler env var / AppContext handling

* Update two names

* Update README.md


Commit migrated from https://github.com/dotnet/corefx/commit/473a4cf05c28f95d8a93b826647f755dbdec8728
2018-02-01 22:04:16 -05:00
Lakshmi Priya Sekar 7b8085b573 Use ManagedWebSocket implementation everywhere except uap.
Commit migrated from https://github.com/dotnet/corefx/commit/70f41f974d2b9aaa25e10d897a647bd2d3b1c103
2018-01-18 15:26:23 -08:00
Ahson Khan 7886be085d Convert uses of the Dangerous APIs to use MemoryMarshal.GetReference (dotnet/corefx#25936)
* Convert uses of the Dangerous APIs to use MemoryMarshal.GetReference

* Fix unresolved merge conflict.

* Add using directive

* Add missing using directives.

* Add references to System.Memory


Commit migrated from https://github.com/dotnet/corefx/commit/40cbd5636851093309b841db4d53af369b7ef1c6
2017-12-21 11:05:06 -08:00
Santiago Fernandez Madero c077e72880 Ensure build of netcoreapp vertical of CoreFx can be done without past packages (dotnet/corefx#25921)
* Add System.Drawing.Common to netcoreapp vertical

* Make System.Data.Odbc be able to build for netcoreapp vertical

* Add netcoreapp to System.Diagnostics.PerformanceCounter

* Add netcoreapp to System.Diagnostics.EventLog

* Run UpdateVSConfigurations

* Change Contains('netcoreapp') to StartsWith('netcoreapp')

* Include netcoreapp.depproj only when BuildAllConfigurations == true

* Change tests to netcoreapp from netcoreapp2.0 for vertical


Commit migrated from https://github.com/dotnet/corefx/commit/edacccb1cd6ecf7d36cd2379df8dd609ae0eb9a4
2017-12-18 17:20:36 -06:00
Ahson Khan 9de80f2b5a Reference Unsafe APIs from CoreLib in System.Memory (dotnet/corefx#25929)
* Reference Unsafe APIs from CoreLib in System.Memory

* Add reference to System.Memory for System.Net.Sockets.

* Remove unused references to S.R.CS.Unsafe.

* Used fixed instead of Unsafe API


Commit migrated from https://github.com/dotnet/corefx/commit/79d708b2faf8a75089b1873fbb101b0a957c1fbd
2017-12-15 23:36:33 -08:00