platform/upstream/dotnet/runtime.git
5 years agoFix SslStreamStreamToStreamTest to exercise correct overloads (dotnet/corefx#36065)
Stephen Toub [Fri, 15 Mar 2019 19:59:31 +0000 (15:59 -0400)]
Fix SslStreamStreamToStreamTest to exercise correct overloads (dotnet/corefx#36065)

The SslStreamStreamToStreamTest is set up as a base class from which three test classes derive, one for each of Async, Begin/End, and Sync.  But the base class isn't actually deferring to the derived types to customize most of the functionality being executed, namely read/write methods.  This PR fixes that, so that the base class properly exercises the relevant methods, customized to the base type.

Commit migrated from https://github.com/dotnet/corefx/commit/6a9fe42b8d236f9cb0e5cdede2f06dc7537dc933

5 years agoAdd test for using SslStream for concurrent read/writes (dotnet/corefx#36064)
Stephen Toub [Fri, 15 Mar 2019 18:30:25 +0000 (14:30 -0400)]
Add test for using SslStream for concurrent read/writes (dotnet/corefx#36064)

Commit migrated from https://github.com/dotnet/corefx/commit/66ddc3e0da1af94c52bd7c78f27d18ea008bea74

5 years agoAdd TextEquals helper methods to Utf8JsonReader (dotnet/corefx#35979)
Ahson Khan [Fri, 15 Mar 2019 05:38:46 +0000 (22:38 -0700)]
Add TextEquals helper methods to Utf8JsonReader (dotnet/corefx#35979)

* Add initial impl of ValueEquals with basic tests.

* Rename to TextEquals based on API review feedback.

* Move to separate test file, increase coverage, and fill in missing impl
details.

* Add xml comments and more test cases.

* Re-enable all the tests.

* Update tests to be netstandard compliant.

* Rename some existing tests to be clearer.

* Address PR feedback.

* Return early if we know unescaping won't produce a match.

* More eagerly check the lengths to return mismatch sooner.

* Add tests to improve code coverage and re-write to avoid unreachable
code.

* Fix resource string merge issue.

* Fix test build failures on netstandard (missing implicit string->span
cast)

Commit migrated from https://github.com/dotnet/corefx/commit/b8bc4ff80c5f7baa681e8a569d367356957ba78a

5 years agoAdd test for HttpWebRequest default proxy credentials (dotnet/corefx#36061)
David Shulman [Fri, 15 Mar 2019 01:47:50 +0000 (18:47 -0700)]
Add test for HttpWebRequest default proxy credentials (dotnet/corefx#36061)

It's easier to simulate default system proxy settings on Linux since it uses environment
variables. Add a test to verify that the proxy credentials are passed from
WebRequest.DefaultWebProxy.Credentials to the system proxy.

Follow-up to PR dotnet/corefx#36059

Commit migrated from https://github.com/dotnet/corefx/commit/2e006bb1a471d2b75d1bbae282241d15da388899

5 years agoFix CryptoStream.Dispose to only transform final block when writing (dotnet/corefx...
Stephen Toub [Fri, 15 Mar 2019 01:46:39 +0000 (21:46 -0400)]
Fix CryptoStream.Dispose to only transform final block when writing (dotnet/corefx#36048)

* Fix CryptoStream.Dispose to only transform final block when writing

When reading, the final transform isn't required, and using it can result in exceptions when the stream is only partially read.

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/f99562f10e72edb5b8d8fb264eb7b2436ad2df01

5 years agoFix HttpWebRequest to use WebRequest.DefaultWebProxy credentials (dotnet/corefx#36059)
David Shulman [Thu, 14 Mar 2019 23:32:38 +0000 (16:32 -0700)]
Fix HttpWebRequest to use WebRequest.DefaultWebProxy credentials (dotnet/corefx#36059)

If the HttpWebRequest is using the default system proxy, we need to pass any proxy
credentials that the developer might have set via the WebRequest.DefaultWebProxy.Credentials
property. This matches .NET Framework behavior.

I tested this manually using Fiddler as the authenticating proxy.

Fixes dotnet/corefx#36058

Commit migrated from https://github.com/dotnet/corefx/commit/d6a30736858f91b297fdd3ed4e3d1dfde67bdbdb

5 years agoImprove test logging: add process name to log (dotnet/corefx#35996)
Marco Rossignoli [Thu, 14 Mar 2019 21:19:27 +0000 (22:19 +0100)]
Improve test logging: add process name to log (dotnet/corefx#35996)

* add process name to log

* updates

* update

Commit migrated from https://github.com/dotnet/corefx/commit/88548f58fbd9a5c421395b0f6a4a1eed4be4f155

5 years agoAvoid three expensive allocations in UriHelper (dotnet/corefx#36056)
Stephen Toub [Thu, 14 Mar 2019 20:46:48 +0000 (16:46 -0400)]
Avoid three expensive allocations in UriHelper (dotnet/corefx#36056)

In this repro:
```C#
using System;
using System.Diagnostics;
using System.Text;

class Program
{
    static void Main()
    {
        string input = $"param1={GenerateUrlEncoded(40)}&param2={GenerateUrlEncoded(220)}";
        Console.WriteLine("Input length: " + input.Length);
        var sw = Stopwatch.StartNew();
        string result = Uri.UnescapeDataString(input);
        Console.WriteLine("Result length: " + result.Length);
        Console.WriteLine(sw.Elapsed);
    }

    private  static string GenerateUrlEncoded(int rowsCount)
    {
        var sb = new StringBuilder();
        for (int i = 0x100; i < 0x999; i++)
        {
            sb.Append((char)i);
            if (i % 10 == 0) sb.Append('<');
            if (i % 20 == 0) sb.Append('>');
            if (i % 15 == 0) sb.Append('\"');
        }

        string escaped = Uri.EscapeDataString(sb.ToString());
        sb.Clear();
        for (int i = 0; i < rowsCount; i++)
        {
            sb.AppendLine(escaped);
        }

        return sb.ToString();
    }
}
```
on my machine it ends up allocating ~630GB of memory and takes ~14 seconds.

Almost all of that ~14 seconds is spent in gc_heap::allocate_large, and most of that inside memset_repmovs.  This ends up being due to some large allocations being done in a tight loop.

This PR contains three simple fixes that address the majority of the problem.  There's still more that can be done here, but this is the lowest of the low-hanging fruit and makes the biggest impact:
1. In UnescapeString, the previous code was allocating a new char[bytes.Length] for each iteration.  Stop doing that.  Instead, just reuse the same array over and over and only grow it if it's smaller than is needed.
2. In MatchUTF8Sequence, the previous code was allocating a byte[] for each character or surrogate pair.  Stop doing that.  Instead, just use a reusable four-byte segment of stack.
3. In UnescapeString, the previous code was allocating a new UTF8Encoding for each iteration of the loop.  Stop doing that.  The object is thread-safe and can be used for all requests, so we just make it a static.

These changes drop that ~630GB to ~22MB and that ~14s to ~0.05s.

Subsequently, there's more memory-related changes that could be done in this code, e.g. using pooling, addressing some of the other allocation, but I've left that for the future.

Commit migrated from https://github.com/dotnet/corefx/commit/5e84d5b782fd56c7c6772f199719d208b299b605

5 years agoOptimize recursion of System.Net.Http.HttpRuleParser.GetExpressionLength (dotnet...
Marco Rossignoli [Thu, 14 Mar 2019 17:39:24 +0000 (18:39 +0100)]
Optimize recursion of System.Net.Http.HttpRuleParser.GetExpressionLength (dotnet/corefx#35959)

Optimize recursion of System.Net.Http.HttpRuleParser.GetExpressionLength

Commit migrated from https://github.com/dotnet/corefx/commit/4636de3b8595ad10eaebf00cbeed715684e7fd1b

5 years agoFix single character typo. (dotnet/corefx#36047)
Laura Walker [Thu, 14 Mar 2019 17:14:58 +0000 (17:14 +0000)]
Fix single character typo. (dotnet/corefx#36047)

Commit migrated from https://github.com/dotnet/corefx/commit/bbf559f23a072a8355ba59bff9f8aad56dbfc67d

5 years agoMake StackTrace Symbol Caching Aware of Collectible Types (Phase 2) (dotnet/corefx...
John Salem [Thu, 14 Mar 2019 17:02:53 +0000 (10:02 -0700)]
Make StackTrace Symbol Caching Aware of Collectible Types (Phase 2) (dotnet/corefx#35827)

* Update GetSourceLineInfo to consume an assembly:
* Use Assembly as cache key for MetadataReader
* Dynamic and regular assemblies now have the same cache key
* Prevents stale cache entries in the case where a PEFile is unloaded
and replaced by a new one in the same location

dotnet/coreclrdotnet/corefx#20179

* Remove redundant overload of GetSourceLineInfo
* update comments to reflect new behavior

* Change TryGetReader to use ConditionalWeakTable's atomic Add with callback method.
* cleaning up var names based on feedback

Commit migrated from https://github.com/dotnet/corefx/commit/6f00e97f85650768f87743df769206bfc4119fbc

5 years agoRename optimzation package version
Michelle McDaniel [Tue, 12 Mar 2019 21:45:41 +0000 (14:45 -0700)]
Rename optimzation package version

Commit migrated from https://github.com/dotnet/corefx/commit/a42be17c8be34eaf2711dfb09e6196bea68368d3

5 years agoRemove the workaround to put the IBC files in the right directory
Michelle McDaniel [Tue, 12 Mar 2019 20:45:26 +0000 (13:45 -0700)]
Remove the workaround to put the IBC files in the right directory

Commit migrated from https://github.com/dotnet/corefx/commit/6a942229bd09f5c34fbf9a3b7cd03bc032a626b5

5 years agoEnable default interfaces unconditionally (dotnet/corefx#36012)
Michal Strehovský [Thu, 14 Mar 2019 16:26:11 +0000 (17:26 +0100)]
Enable default interfaces unconditionally (dotnet/corefx#36012)

Corresponds to dotnet/coreclrdotnet/corefx#23225.

Commit migrated from https://github.com/dotnet/corefx/commit/5fb12949b1487e34657ba9f4e2e12f31f8305295

5 years agoFix: System.IO.Ports runtime package signing (dotnet/corefx#36022)
Krzysztof Wicher [Thu, 14 Mar 2019 16:22:56 +0000 (09:22 -0700)]
Fix: System.IO.Ports runtime package signing (dotnet/corefx#36022)

* temporarily disable publishing

* temporarily disable another publish step

* Move signing to publish step

* re-enable publish steps

Commit migrated from https://github.com/dotnet/corefx/commit/231bcfc265570ae42a412ac6cc5b09c5d47ca042

5 years agoMerge pull request dotnet/corefx#35927 from Wraith2/sqlperf-streamwrite
Afsaneh Rafighi [Thu, 14 Mar 2019 16:14:44 +0000 (09:14 -0700)]
Merge pull request dotnet/corefx#35927 from Wraith2/sqlperf-streamwrite

SqlClient rent stream parameter buffers

Commit migrated from https://github.com/dotnet/corefx/commit/397b8cff410b94c74e8c1fc3ddf9c2d44c7e98f8

5 years agoUse ILResourceReference (dotnet/corefx#36038)
Eric StJohn [Thu, 14 Mar 2019 13:59:26 +0000 (06:59 -0700)]
Use ILResourceReference (dotnet/corefx#36038)

Commit migrated from https://github.com/dotnet/corefx/commit/85e4afd0097364b2675c94d11888906f6651b93b

5 years agoUpdate ResourceManager tests to account for dotnet/corefx#35114. (dotnet/corefx#35811)
Filip Navara [Thu, 14 Mar 2019 13:51:10 +0000 (14:51 +0100)]
Update ResourceManager tests to account for dotnet/corefx#35114. (dotnet/corefx#35811)

Commit migrated from https://github.com/dotnet/corefx/commit/8de6f2aefd7e87a45ff47c4949ff251c7c84ac71

5 years agoDisable some proxy tests (dotnet/corefx#36037)
David Shulman [Thu, 14 Mar 2019 13:48:55 +0000 (06:48 -0700)]
Disable some proxy tests (dotnet/corefx#36037)

Disable some problematic proxy related tests.

Contributes to issue dotnet/corefx#32809

Commit migrated from https://github.com/dotnet/corefx/commit/b97e1b696cb9bf6bf288b4fd28481a2026b0dd7a

5 years agoRemove remaining usage of Contract.* (dotnet/corefx#36002)
Stephen Toub [Thu, 14 Mar 2019 13:47:04 +0000 (09:47 -0400)]
Remove remaining usage of Contract.* (dotnet/corefx#36002)

Only remaining use of System.Diagnostics.Contracts in corefx is tests for the library itself, and usage of the [Pure] attribute.

Commit migrated from https://github.com/dotnet/corefx/commit/940ecee40b64ab93c92f87a7e8909771c013f1a5

5 years agoTweak SslApplicationProtocol (dotnet/corefx#36021)
Stephen Toub [Thu, 14 Mar 2019 13:01:19 +0000 (09:01 -0400)]
Tweak SslApplicationProtocol (dotnet/corefx#36021)

* Tweak SslApplicationProtocol

- It currently stores a `ReadOnlyMemory<byte>`.  That just adds unnecessary expense: we can instead just store the provided `byte[]`.
- The most common values are those exposed statically: Http2 and Http11, but ToString on those results in creating a new string each time.  Special-case them.
- Constructing an SslApplicationProtocol with a null string results in an ArgumentNullException being thrown with the wrong parameter name.  Fix it.
- Miscellaneous cleanup on the file.

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/af6e226ed530bbe7c8319507f414cbad8e81df24

5 years agoFix local zip entry header for large files
Eric St. John [Wed, 13 Mar 2019 00:01:37 +0000 (17:01 -0700)]
Fix local zip entry header for large files

When opened for Write ZipArchiveEntry needs to write the local header
information to the archive stream upon the first call to write since the
compressed content comes after that and we write directly to the backing stream
rather than buffering in memory.

By default header information only accommodates 32-bit sizes since this is much
more likely and saves space in archives with lots of files and at the first
write we don’t know how big the entry is going to be.

Once the entry is disposed we know the final length and may find it cannot be
represented in 32-bit fields.  It can’t insert the extra bytes it would need
in the header region since it’s already written the compressed data and
streams/files don’t have insertion operations, so instead it sets a bit that
says the entry's size information is in a descriptor at the end of the entry.

The entry was setting the bit that indicated the descriptor existed but didn't
set the version in the header to ZIP64 to indicate wether that descriptor had
64-bit fields.  Additionally we were writing the central-directory header for
the file with a version of ZIP64 so our local header and central header didn't
match.

May ZIP implementations were OK with this, but not all.  Specifically
WindowsBase.dll's implementation of the System.IO.Packaging APIs has a
ZipArchive that insists the local header version must be ZIP64 to have a
64-bit descriptor.  Moreover it also insists that the local-header version must
match the central header version.

To ensure zips created with .NETCore's System.IO.Packaging APIs work with
desktop we should set this version field in the local header.

Commit migrated from https://github.com/dotnet/corefx/commit/b37b4efe6b58eecb83b81e6c754bd5dbe506bedc

5 years agoClean up some tests and move to new Azure endpoint (dotnet/corefx#36018)
David Shulman [Thu, 14 Mar 2019 03:57:55 +0000 (20:57 -0700)]
Clean up some tests and move to new Azure endpoint (dotnet/corefx#36018)

This PR changes the Azure test endpoint for HTTP/1.1 and WebSocket tests to use
Azure App Service instead of the classic Azure Cloud Service endpoint. This now
matches the HTTP/2.0 endpoint architecture.

We are deprecating the use of Azure Cloud Service endpoints because they are hard
to deploy and maintain. Azure App Service, on the other hand, provides a lot of benefits
including built in production/staging slots, TLS certificate handling and easier
integration with Azure DevOps deployment models.

There are a few downsides to Azure App Service which are known feature limitations.
Since it uses ARR (reverse proxy), it causes websocket connections to be proxied.
This results in some behavior changes for some edge condition tests we have. For example,
when a websocket handshake fails (due to subprotocol mismatch for example), the client
side doesn't see a TCP disconnect. Instead, due to the reverse proxy, we end up getting
an HTTP status code (like 500). Either way, it is a websocket handshake failure. So, I've
updated a few tests to be less brittle for that. I also opened another issue dotnet/corefx#36016 to
track moving a few websocket tests to the loopback websocket server which doesn't yet
have full capability.

I also converted an HTTP statusline test to use the loopback server.

Commit migrated from https://github.com/dotnet/corefx/commit/689e58ec123d8c730d48d1c35c8f7ecbba6c22cf

5 years agoDisable tests failing on WSL (dotnet/corefx#36017)
Stephen Toub [Thu, 14 Mar 2019 01:09:42 +0000 (21:09 -0400)]
Disable tests failing on WSL (dotnet/corefx#36017)

This is on Windows 10 Version 10.0.17763 Build 17763.

Commit migrated from https://github.com/dotnet/corefx/commit/cf5c3b0282c07ab13da79f04ee83d39f20bac431

5 years agolet ArrayPool clear returned arrays
Wraith2 [Thu, 14 Mar 2019 01:03:54 +0000 (01:03 +0000)]
let ArrayPool clear returned arrays

Commit migrated from https://github.com/dotnet/corefx/commit/0972e60bb1d8fb1ba867e29f7ea7d7a81506af51

5 years agoAdd (Try)GetDateTime(Offset) to Utf8JsonReader (dotnet/corefx#35903)
Layomi Akinrinade [Thu, 14 Mar 2019 01:02:35 +0000 (21:02 -0400)]
Add (Try)GetDateTime(Offset) to Utf8JsonReader (dotnet/corefx#35903)

Add (Try)GetDateTime(Offset) to Utf8JsonReader

This change partially addresses https://github.com/dotnet/corefx/issues/34690.

These methods parse JSON strings to DateTime(Offset) objects according to format `YYYY-MM-DD[Thh:mm[:ss[.s]][TZD]]`

Commit migrated from https://github.com/dotnet/corefx/commit/66cf67037568d9818881e1a78d3e7b2aa8b04047

5 years agoMerge pull request dotnet/corefx#36015 from tarikulsabbir/datastream_bugfix
Tarikul Sabbir [Wed, 13 Mar 2019 22:32:16 +0000 (15:32 -0700)]
Merge pull request dotnet/corefx#36015 from tarikulsabbir/datastream_bugfix

Porting XEvent Delay BugFix from .Net Framework

Commit migrated from https://github.com/dotnet/corefx/commit/8801ab0b3365f551966ae9caa053434ec07f41bb

5 years agoUpdate Windows.Compatibility package with references to newer WCF versions. (dotnet...
Eric StJohn [Wed, 13 Mar 2019 21:57:58 +0000 (14:57 -0700)]
Update Windows.Compatibility package with references to newer WCF versions. (dotnet/corefx#35990)

Commit migrated from https://github.com/dotnet/corefx/commit/369b90a4604281e723ddbc8f6bf114be6074cb82

5 years agoDelete XEvent before method exits.
Tarikul Sabbir [Wed, 13 Mar 2019 18:40:59 +0000 (11:40 -0700)]
Delete XEvent before method exits.

Commit migrated from https://github.com/dotnet/corefx/commit/f878d4c086baf2225b4097c03f13f347fc5c54d8

5 years agoFormatting change
Tarikul Sabbir [Wed, 13 Mar 2019 17:23:40 +0000 (10:23 -0700)]
Formatting change

Commit migrated from https://github.com/dotnet/corefx/commit/b21616da94e320b643d9dfd9fb3ee248f5752c3c

5 years agosmall fixes for ping to properly set state in case of failure (dotnet/corefx#33621)
Tomas Weinfurt [Wed, 13 Mar 2019 16:17:01 +0000 (09:17 -0700)]
small fixes for ping to properly set state in case of failure (dotnet/corefx#33621)

* unix ping fixes

* feedback from review and fixes for failing tests

* feedback from review

* more rework on cleanup logic

* add missing check for disposed object in Async path

* remove freebsd part of this change to make it cleaner

* await for all calls of SendPingAsyncCore()

* make arg checking synchronous and stabilize SendPingAsync_InvalidArgs failing on some platforms

* feedback from review

Commit migrated from https://github.com/dotnet/corefx/commit/2696d751a7b50bdc3e03bf5089f67aa0bd081b24

5 years agoUpdating to latest WCF version.
Stephen Bonikowsky [Wed, 13 Mar 2019 16:16:22 +0000 (09:16 -0700)]
Updating to latest WCF version.

Commit migrated from https://github.com/dotnet/corefx/commit/ff42076b3b432205007a562435b08e2aac246f92

5 years agoFix JsonReader bug in multi-segment string processing (dotnet/corefx#35978)
Ahson Khan [Wed, 13 Mar 2019 02:26:08 +0000 (19:26 -0700)]
Fix JsonReader bug in multi-segment string processing (dotnet/corefx#35978)

Commit migrated from https://github.com/dotnet/corefx/commit/118ea047b67221f9c50be03515f04ad52492ee6e

5 years agoDataStream Test change
Tarikul Sabbir [Wed, 13 Mar 2019 00:50:02 +0000 (17:50 -0700)]
DataStream Test change

Commit migrated from https://github.com/dotnet/corefx/commit/d761e61fd8da88f291b39cd0db8bce74fc822e75

5 years agomake TextDataFeed.DefaultEncoding internal
Wraith2 [Wed, 13 Mar 2019 00:39:18 +0000 (00:39 +0000)]
make TextDataFeed.DefaultEncoding internal

Commit migrated from https://github.com/dotnet/corefx/commit/d32a2ee4aea2ffdf3a0ec47081b0a978466a3631

5 years agoReact to changes through ASCIIEncoding and EncoderNLS
Levi Broderick [Tue, 5 Mar 2019 02:31:41 +0000 (18:31 -0800)]
React to changes through ASCIIEncoding and EncoderNLS
Also create some additional ASCII tests

Commit migrated from https://github.com/dotnet/corefx/commit/d817d68fc6e2fc78624540aa90a060f4d5bf0eee

5 years agoaddress feedback
Wraith2 [Tue, 12 Mar 2019 23:24:19 +0000 (23:24 +0000)]
address feedback

Commit migrated from https://github.com/dotnet/corefx/commit/f2417f59441b0dc55ad73deb75ff23672041aa5e

5 years agoDataSteam Test change
Tarikul Sabbir [Tue, 12 Mar 2019 22:19:17 +0000 (15:19 -0700)]
DataSteam Test change

Commit migrated from https://github.com/dotnet/corefx/commit/01f138e1008381379861eaec6df8a5b457d1084e

5 years agoPin buffer for NtQuerySystemInformation (dotnet/corefx#35991)
Jan Kotas [Tue, 12 Mar 2019 21:03:55 +0000 (14:03 -0700)]
Pin buffer for NtQuerySystemInformation (dotnet/corefx#35991)

Fixes dotnet/corefx#35987

Commit migrated from https://github.com/dotnet/corefx/commit/704a9669e69ef5faae55ca438e9850b8aa0e9ec5

5 years agoFix SendWithPingUtilityAsync to catch InvalidOperationException (dotnet/corefx#35992)
Tomas Weinfurt [Tue, 12 Mar 2019 19:16:12 +0000 (12:16 -0700)]
Fix SendWithPingUtilityAsync to catch InvalidOperationException (dotnet/corefx#35992)

* ignore InvalidOperationException from Kill

* ignore InvalidOperationException from Kill

Commit migrated from https://github.com/dotnet/corefx/commit/0f7a0bd5fb4892c1434e263824d394ab621a1b2a

5 years agoUpdate Windows.Compatibility package with references to newer WCF versions.
Stephen Bonikowsky [Tue, 12 Mar 2019 17:15:20 +0000 (10:15 -0700)]
Update Windows.Compatibility package with references to newer WCF versions.

Commit migrated from https://github.com/dotnet/corefx/commit/4feda8061bfe03429555654c3df2fa5f7438f082

5 years agoAdd unit tests for PEHeaderBuilder factory methods
Osman Turan [Tue, 12 Mar 2019 09:57:50 +0000 (12:57 +0300)]
Add unit tests for PEHeaderBuilder factory methods

See: dotnet/corefx#35758

Commit migrated from https://github.com/dotnet/corefx/commit/07dfb7b7530528a065a2eccb09b6df560e2547c5

5 years agoFix ImageCharacteristics of PEHeaderBuilder when initialized by CreateLibraryHeader
Osman Turan [Wed, 6 Mar 2019 11:03:30 +0000 (14:03 +0300)]
Fix ImageCharacteristics of PEHeaderBuilder when initialized by CreateLibraryHeader

Fixes: dotnet/corefx#35758

Commit migrated from https://github.com/dotnet/corefx/commit/a04be5028544df36b11cabd4081896ba8037b71e

5 years agoInclude correct error code in WebSocket.ThrowOnInvalidState (dotnet/corefx#35960)
Stephen Toub [Tue, 12 Mar 2019 15:05:04 +0000 (11:05 -0400)]
Include correct error code in WebSocket.ThrowOnInvalidState (dotnet/corefx#35960)

* Include correct error code in WebSocket.ThrowOnInvalidState

* Address PR feedback

* Fix UWP leg

Commit migrated from https://github.com/dotnet/corefx/commit/ef145001b10660be940aeb9318e0ff7e306f65bc

5 years agoMade some tweaks to the BufferSegmentStack (dotnet/corefx#35980)
David Fowler [Tue, 12 Mar 2019 15:02:02 +0000 (08:02 -0700)]
Made some tweaks to the BufferSegmentStack (dotnet/corefx#35980)

- Remove array covariance checks
- Added another test for pooled segments

Commit migrated from https://github.com/dotnet/corefx/commit/19ec4f3cabcc0796c14f4663c6ee3ab8173ad90d

5 years agoRemove stale TODO
Stephen Toub [Tue, 12 Mar 2019 14:40:45 +0000 (10:40 -0400)]
Remove stale TODO

We have no plans to address this further.

Commit migrated from https://github.com/dotnet/corefx/commit/57642c99f187a4611763d1c5b3efb4347d27c1b3

5 years agoDon't allocate a stack (dotnet/corefx#35958)
David Fowler [Tue, 12 Mar 2019 02:53:04 +0000 (19:53 -0700)]
Don't allocate a stack (dotnet/corefx#35958)

- Avoid an extra object allocation by using a struct based stack

Commit migrated from https://github.com/dotnet/corefx/commit/a7098b8893a0ebf53a881d43b333dcda5b2c8716

5 years agoSwitch from asserts on POSIX_FADV_* to conversions (dotnet/corefx#35971)
Calvin Buckley [Tue, 12 Mar 2019 00:23:45 +0000 (21:23 -0300)]
Switch from asserts on POSIX_FADV_* to conversions (dotnet/corefx#35971)

Commit migrated from https://github.com/dotnet/corefx/commit/fb4afc8dec2fc5bb7885606986387c37227cd350

5 years agofix catch (dotnet/corefx#35970)
Marco Rossignoli [Mon, 11 Mar 2019 23:36:40 +0000 (00:36 +0100)]
fix catch (dotnet/corefx#35970)

Commit migrated from https://github.com/dotnet/corefx/commit/d5c6b10af17a87139c745c78148f942f947e1eb9

5 years agodatastream bugfix first commit
Tarikul Sabbir [Mon, 11 Mar 2019 22:39:11 +0000 (15:39 -0700)]
datastream bugfix first commit

Commit migrated from https://github.com/dotnet/corefx/commit/408dd114ecea7100524d678bfbfcb8abed4fb341

5 years agoInject W3C headers in HTTP diagnostics handler (dotnet/corefx#35882)
Liudmila Molkova [Mon, 11 Mar 2019 22:15:08 +0000 (15:15 -0700)]
Inject W3C headers in HTTP diagnostics handler (dotnet/corefx#35882)

* Inject W3C headers in corefx Htpp Diagnostics HAndler

* Inject W3C headers if activity format is W3C

* fix style and indentation

* review: fix issue

Commit migrated from https://github.com/dotnet/corefx/commit/7314001fd1ebfb25b500774d1551170a17c7a209

5 years agoThrow an exception if examined < consumed and reworked lastExamined (dotnet/corefx...
David Fowler [Mon, 11 Mar 2019 21:35:27 +0000 (14:35 -0700)]
Throw an exception if examined < consumed and reworked lastExamined (dotnet/corefx#35879)

- Store a single absolute position instead of the segment
- Fixed some typos and added tests for null segments
- Added more tests

Commit migrated from https://github.com/dotnet/corefx/commit/203bc37eddbae8fb14531d305554a662c0428279

5 years agoAdd GNU compiler support to build src/Native (dotnet/corefx#35737)
Adeel Mujahid [Mon, 11 Mar 2019 19:32:34 +0000 (21:32 +0200)]
Add GNU compiler support to build src/Native (dotnet/corefx#35737)

* Add GNU compiler support to build src/Native
Tested with gcc v5, v6, v7 and v8 on CentOS 7, Ubuntu 18, Debian 8 and
FreeBSD 11.
`corefx/src/Native/build-native.sh x64 checked gcc`

* Remove unnecessary cast

* Sync gen-buildsys-gcc.sh with CoreCLR

Commit migrated from https://github.com/dotnet/corefx/commit/b3b1777642c80f7a0ba57b32581c33442ceac1d7

5 years agoUse TryAddWithoutValidation in WebSocketHandle.ConnectAsyncCore (dotnet/corefx#35954)
Stephen Toub [Mon, 11 Mar 2019 17:32:41 +0000 (13:32 -0400)]
Use TryAddWithoutValidation in WebSocketHandle.ConnectAsyncCore (dotnet/corefx#35954)

Don't validate the headers the developer has explicitly added to ClientWebSocketOptions.RequestHeaders; just pass them through.

Commit migrated from https://github.com/dotnet/corefx/commit/e433981ea570928efbb1587cc6735c90c1881a58

5 years agoAdd missing deserialization ctor to ChannelClosedException (dotnet/corefx#35952)
Stephen Toub [Mon, 11 Mar 2019 17:32:14 +0000 (13:32 -0400)]
Add missing deserialization ctor to ChannelClosedException (dotnet/corefx#35952)

Commit migrated from https://github.com/dotnet/corefx/commit/9187219ad62356da3d5b820c6b63deba0549f79f

5 years agoFix timezone-related failures in System.Runtime.Tests (dotnet/corefx#35955)
Stephen Toub [Mon, 11 Mar 2019 17:31:04 +0000 (13:31 -0400)]
Fix timezone-related failures in System.Runtime.Tests (dotnet/corefx#35955)

In timezones with a positive offset, several tests were failing due to going below the minimum supported values.

Commit migrated from https://github.com/dotnet/corefx/commit/8f50086da1ac1f2edd175d0a6cac7c6b596f4f36

5 years agoCleanup and enhance misc reflection/attribute tests (dotnet/corefx#35858)
Hugh Bellamy [Mon, 11 Mar 2019 15:39:15 +0000 (15:39 +0000)]
Cleanup and enhance misc reflection/attribute tests (dotnet/corefx#35858)

* Cleanup and enhance misc reflection tests

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/2a2d34df7db5d2617d12f55fe5ad8fd208117049

5 years agoBetter defaults for the Pipe (dotnet/corefx#35939)
David Fowler [Mon, 11 Mar 2019 14:31:42 +0000 (07:31 -0700)]
Better defaults for the Pipe (dotnet/corefx#35939)

- Use a 4K buffer instead of 2K (4K is a very common buffer size and usually maps to system page size)
- Use a stack for the buffer segment pool and allow pooling more than 16 segments for large writes

Commit migrated from https://github.com/dotnet/corefx/commit/b49b512a6288edd96d4fbb68bf23a4bd2f831545

5 years agoDisable TestCheckChildProcessUserAndGroupIds test (dotnet/corefx#35949)
Stephen Toub [Mon, 11 Mar 2019 14:17:04 +0000 (10:17 -0400)]
Disable TestCheckChildProcessUserAndGroupIds test (dotnet/corefx#35949)

Sporadically failing in CI

Commit migrated from https://github.com/dotnet/corefx/commit/6eedd6fd57dc89bba05bbe18ed395e9efae4ada1

5 years agoAdd await stack guard test (dotnet/corefx#35905)
Stephen Toub [Mon, 11 Mar 2019 03:19:09 +0000 (23:19 -0400)]
Add await stack guard test (dotnet/corefx#35905)

* Add await stack guard test

* Fix typo

* Skip new test on netfx

Commit migrated from https://github.com/dotnet/corefx/commit/6d7126e0a329db795930ea17e84369eacb7bae5a

5 years agoFix CompositionContract.Equals for null (dotnet/corefx#35132)
Hugh Bellamy [Sun, 10 Mar 2019 17:41:22 +0000 (17:41 +0000)]
Fix CompositionContract.Equals for null (dotnet/corefx#35132)

* Fix CompositionContract.Equals for null

* Move tests to right folder

Commit migrated from https://github.com/dotnet/corefx/commit/f52d7e6f69a35042489a192fec08edd318a134aa

5 years agodisable SendToRecvFrom_Datagram_UDP aagin. (dotnet/corefx#35920)
Tomas Weinfurt [Sun, 10 Mar 2019 09:56:10 +0000 (01:56 -0800)]
disable SendToRecvFrom_Datagram_UDP aagin. (dotnet/corefx#35920)

Commit migrated from https://github.com/dotnet/corefx/commit/0dbce2be7aa2fe6d4c82b91e9cab677c6289ace1

5 years agodisable test on netfx (dotnet/corefx#35921)
Marco Rossignoli [Sun, 10 Mar 2019 09:53:30 +0000 (10:53 +0100)]
disable test on netfx (dotnet/corefx#35921)

Commit migrated from https://github.com/dotnet/corefx/commit/1f8a77c4a96c476741b2ed35ec4faf7c92e14a8f

5 years agoFix NetEventSource logging for Windows auth on Linux (dotnet/corefx#35918)
David Shulman [Sun, 10 Mar 2019 05:22:44 +0000 (21:22 -0800)]
Fix NetEventSource logging for Windows auth on Linux (dotnet/corefx#35918)

While debugging some Linux enterprise auth (Negotiate/NTLM) scenarios, I discovered that the
logging I added in PR dotnet/corefx#35383 wasn't working. This was due to not passing in a 'null' value
for the context object for NetEventSource.Info. It was using the string object as the
context object and not logging the string data.

As part of fixing that I optimized some code for remembering what auth package (NTLM
or SPNEGO) is used.

Commit migrated from https://github.com/dotnet/corefx/commit/21db29aeff8acafe080113856545d30246891da6

5 years agoBug fix: await SmtpClient.SendMailAsync never ends (dotnet/corefx#35915)
Marco Rossignoli [Sat, 9 Mar 2019 22:23:32 +0000 (23:23 +0100)]
Bug fix: await SmtpClient.SendMailAsync never ends (dotnet/corefx#35915)

Call InvokeCallback() in case of CompletedSynchronously.

Fixes dotnet/corefx#35738

Commit migrated from https://github.com/dotnet/corefx/commit/848811c496a7cb9d48ddee2775e982b4b732e8ac

5 years agoRemove 2 suffix step 1 (dotnet/corefx#35904)
Dan Moseley [Sat, 9 Mar 2019 21:54:04 +0000 (13:54 -0800)]
Remove 2 suffix step 1 (dotnet/corefx#35904)

Commit migrated from https://github.com/dotnet/corefx/commit/71a2e84b885f4d83697c93d25cebdb85c28a5d74

5 years agoMerge remote-tracking branch 'dotnet/master' into sqlperf-streamwrite
Wraith2 [Sat, 9 Mar 2019 19:03:31 +0000 (19:03 +0000)]
Merge remote-tracking branch 'dotnet/master' into sqlperf-streamwrite

Commit migrated from https://github.com/dotnet/corefx/commit/8f3233fc13e4bcabbf2237627994865a02b35c3c

5 years ago[master] Update dependencies from dotnet/coreclr (dotnet/corefx#35891)
dotnet-maestro[bot] [Sat, 9 Mar 2019 05:00:44 +0000 (05:00 +0000)]
[master] Update dependencies from dotnet/coreclr (dotnet/corefx#35891)

* Update dependencies from https://github.com/dotnet/coreclr build 20190307.75

This change updates the following dependencies
- Microsoft.NET.Sdk.IL - 3.0.0-preview4-27507-75
- Microsoft.NETCore.ILAsm - 3.0.0-preview4-27507-75
- Microsoft.NETCore.Runtime.CoreCLR - 3.0.0-preview4-27507-75

* Update tests for globalization cleanup

* Fix NegativeSign_SetNull_ThrowsArgumentNullException test with updated arg name

Commit migrated from https://github.com/dotnet/corefx/commit/e45615101e28fac1a89414e701fee4e4be84a4fc

5 years agoJsonDocument should allow the UTF-8 content-BOM from Stream inputs
Jeremy Barton [Sat, 9 Mar 2019 03:50:25 +0000 (19:50 -0800)]
JsonDocument should allow the UTF-8 content-BOM from Stream inputs

Commit migrated from https://github.com/dotnet/corefx/commit/232796d75d9492f273f61df9bb8afc05d33d6dc6

5 years agoFix a race and inefficiency in Microsoft-Diagnostics-DiagnosticSource (dotnet/corefx...
Vance Morrison [Fri, 8 Mar 2019 19:27:52 +0000 (11:27 -0800)]
Fix a race and inefficiency in Microsoft-Diagnostics-DiagnosticSource (dotnet/corefx#35764)

* Fix a race and inefficiency in Microsoft-Diagnostics-DiagnosticSource

There is a bridge from DiagnosticSource to EventSoruce called Microsoft-Diagnostics-DiagnosticSource.
This bridge take the data object payload and derializes it int EventSource events.
There was a cache that kept  the type and it cooresponding serialization transform of the last object, which were not atomic and thus could be confused if code was executed concurrently.

In this cache is per EXPLICITLY filtered events, and works well for that case.  If however the transform is implicit, many events can share the same cache slot, and the cache becomes very ineffective.

To fix this we keep the existing one element cache, but we only set it once (which keeps things simple but avoids races and covers the explicitly filtered case), and add a lazily created ConcurrentDictionary for the 'many envent' case.

Also fixes some unrelate test issues (avoided using the same DiagnosticListner names so that tests don't interact when run concurrently),   Fixed issue were a test fails under the debugger (because the debugger turns on Microsoft-Diagnostics-DiagnosticSource which interfers with the test).

I did walk new code to insure that we at least had code coverage for the new code over our set of tests.

* Review feedback.

Basically rather than tolerate races, change to code to remove them.
This makes the code less error prone.

* Fix more nits.

* fix whitespace

* comment and use lambda so c# caches it.

* fix typo

* add in deleted line

Commit migrated from https://github.com/dotnet/corefx/commit/a8cef502cd74aabb209cb9ad7a1e2a5bc1612459

5 years agoUpdate System.Activity API to be more readonly (dotnet/corefx#35863)
Vance Morrison [Fri, 8 Mar 2019 17:52:06 +0000 (09:52 -0800)]
Update System.Activity API to be more readonly (dotnet/corefx#35863)

* Add back in Read-only-ness for ActivitySpanId and ActivityTraceId

I was able to determine a way of casting away readonly-ness (using Unsafe.AsRef),
so I was able to make ActivitySpanId and ActivityTraceId read-only (and cast away
the read-only when updating the cache).   This works better becasuse it allows
refs to these IDs to be readonly and thus prevent update to Activity.TraceId and Activity.SpanId (which we don't want).

Note that for some reason on NetStandard1.3 ref readonly returns fail (says it can't find the 'InAttribute').
This error seems to be bogus, but the upshot is that older standards gives the C# compiler a problem so
we work around it by simply droping the read-only attribute for those (you still have all the functionality).

* Resolved conflicts

* Fix for NetStandard1.3

* Update to make the cache ref-equality friendly.

Commit migrated from https://github.com/dotnet/corefx/commit/0846c3157735b00135500e20a61be9bf879859fa

5 years agouse rented buffers in stream writes
Wraith2 [Fri, 8 Mar 2019 12:11:52 +0000 (12:11 +0000)]
use rented buffers in stream writes
use cached lazy allocated default text stream encoding

Commit migrated from https://github.com/dotnet/corefx/commit/8272f7f4f2d9776eb10df0533270a81dfb562715

5 years agoAdd target to remove binding redirect (dotnet/corefx#35828)
Jeff Schwartz [Fri, 8 Mar 2019 07:43:39 +0000 (07:43 +0000)]
Add target to remove binding redirect (dotnet/corefx#35828)

* Add target to remove binding redirect

* Update name of target to not collide with WindowsRuntime target

Commit migrated from https://github.com/dotnet/corefx/commit/ca106c24bead0b7b8606be5ff5de0778ef9bc1bb

5 years agoAdd dummy object field to TypedReference in ref assembly (dotnet/corefx#35883)
Stephen Toub [Fri, 8 Mar 2019 07:42:10 +0000 (23:42 -0800)]
Add dummy object field to TypedReference in ref assembly (dotnet/corefx#35883)

Commit migrated from https://github.com/dotnet/corefx/commit/7aef7b15a9b42fd06762ccbaff821af35b97f9d6

5 years agoCleanup StrongNameKeyPair tests and increase coverage (dotnet/corefx#35856)
Hugh Bellamy [Fri, 8 Mar 2019 05:52:45 +0000 (05:52 +0000)]
Cleanup StrongNameKeyPair tests and increase coverage (dotnet/corefx#35856)

Commit migrated from https://github.com/dotnet/corefx/commit/cae9ed27d90d33f5e5cd2f95145a39806004750a

5 years agoUpgrade Test Sdk to 16.0.1 (dotnet/corefx#35876)
Viktor Hofer [Fri, 8 Mar 2019 05:52:25 +0000 (06:52 +0100)]
Upgrade Test Sdk to 16.0.1 (dotnet/corefx#35876)

* Upgrade Test Sdk to 16.0.1

* Remove static dependency

* Remove VB exclusion

Commit migrated from https://github.com/dotnet/corefx/commit/a99a7a450d7b3b785b0a495627ec745ad4f6c3e4

5 years agoenable SendToRecvFrom_Datagram_UDP again (dotnet/corefx#35846)
Tomas Weinfurt [Fri, 8 Mar 2019 05:51:39 +0000 (21:51 -0800)]
enable SendToRecvFrom_Datagram_UDP again (dotnet/corefx#35846)

* enable SendToRecvFrom_Datagram_UDP again and add some basic instrumentation

* increase timeout + feedback from review

Commit migrated from https://github.com/dotnet/corefx/commit/2e74dc7996579bc132a748e186b2a5cc0a712840

5 years agoFix ReflectPropertyDescriptor.IsReadOnly (dotnet/corefx#35872)
Santiago Fernandez Madero [Fri, 8 Mar 2019 05:19:16 +0000 (21:19 -0800)]
Fix ReflectPropertyDescriptor.IsReadOnly (dotnet/corefx#35872)

* Fix ReflectPropertyDescriptor.IsReadOnly

* PR Feedback and fix one more place we were fetching nonPublic members when shouldn't

* Add regression test for overriden readonly virtual property

Commit migrated from https://github.com/dotnet/corefx/commit/3a879b1a861946bf04cc3278d13df63e09dbe018

5 years agoMerge pull request dotnet/corefx#35854 from dotnet/darc-master-59b93f32-aa46-40fb...
Stephen Toub [Fri, 8 Mar 2019 05:15:21 +0000 (21:15 -0800)]
Merge pull request dotnet/corefx#35854 from dotnet/darc-master-59b93f32-aa46-40fb-8bb9-c9b777d54bd0

[master] Update dependencies from dotnet/coreclr

Commit migrated from https://github.com/dotnet/corefx/commit/29778a938d7de0a0915061f9519e3086ed55e3b8

5 years agoImprove process test fail output (dotnet/corefx#35853)
Marco Rossignoli [Fri, 8 Mar 2019 05:14:42 +0000 (06:14 +0100)]
Improve process test fail output (dotnet/corefx#35853)

* improve test

* cleanup

* add current pid

* address PR feedback

* nit

* Update ProcessTests.cs

Commit migrated from https://github.com/dotnet/corefx/commit/84eba428b42d5c60d4418a0c04325b9699be5e05

5 years agoAdded UserFlags field, unblocks dotnet/corefx#34560 (dotnet/corefx#35851)
Dávid Kaya [Fri, 8 Mar 2019 05:12:31 +0000 (06:12 +0100)]
Added UserFlags field, unblocks dotnet/corefx#34560 (dotnet/corefx#35851)

* Added UserFlags field

* Added UserFlags

Commit migrated from https://github.com/dotnet/corefx/commit/8c66b0fa9634b543df4bc93430d6f20d011da9e6

5 years agoUtf8JsonReader.cs - Add support for single line comments ending on \r, \r\n (dotnet...
Steven Weerdenburg [Fri, 8 Mar 2019 03:49:06 +0000 (22:49 -0500)]
Utf8JsonReader.cs - Add support for single line comments ending on \r, \r\n (dotnet/corefx#33393)

* Add support for single line comments ending on \r, \r\n

* Single Segment done

* Move single segment tests over. Add 2/3 multisegment tests

* Multi-segment tests

* Fix formatting in tests file

* Fix formatting feedback. Fix failing test post-rebase

* Modified logic and added new test cases

* Changes related to review comments

* Fixes to tests

* Remove Verify Info, fix issues

* Fix NETFX_x86 test failure

Commit migrated from https://github.com/dotnet/corefx/commit/c25d5b76dcb2a53e032a333a5cce607ed565345d

5 years agoShrink ReadOnlySequence by 8 bytes (dotnet/corefx#35860)
Ben Adams [Fri, 8 Mar 2019 02:06:49 +0000 (02:06 +0000)]
Shrink ReadOnlySequence by 8 bytes (dotnet/corefx#35860)

* Shrink ReadOnlySequence by 8 bytes

* nit

* Unwrap Start, End when used interally

Commit migrated from https://github.com/dotnet/corefx/commit/fd88c5df4bde4ef56522a1cd81da1ff69c92edc4

5 years agoAdd unit tests for Rune.Decode and friends (dotnet/corefx#35469)
Levi Broderick [Fri, 8 Mar 2019 01:59:49 +0000 (17:59 -0800)]
Add unit tests for Rune.Decode and friends (dotnet/corefx#35469)

Also forwards OperationStatus from System.Memory to System.Runtime

Commit migrated from https://github.com/dotnet/corefx/commit/43bfb492dbde0177a669982dfc9ed93d3236e1ac

5 years agoReplace AsnReader/AsnWriter with updated versions, remove unused AsnSerializer
Filip Navara [Thu, 7 Mar 2019 22:48:30 +0000 (23:48 +0100)]
Replace AsnReader/AsnWriter with updated versions, remove unused AsnSerializer

* Copy AsnReader/AsnWriter unit tests from dotnet/corefxlabs.
Remove original AsnReader/AsnWriter/AsnSerializer.

Original commit message from dotnet/corefxlab:

* Tests
  * AssertExtensions.Throws => Assert.Throws
  * Rename private overloads of public methods to *Core to avoid xunit discovery bug
  * Add tests for WriteUtcTime(maxYear)
  * Add tests for the ObjectDisposedException priority

* Change classes in the System.Security.Cryptography.Asn1 namespace to be "internal" instead of "public".
Change comment for AsnReader.ReadNamedBitListValue to allow compilation in project with warnings-as-errors.

* Update unit test names to match API names

* Add shared project for AsnReader/AsnWriter files

* Update AsnXml template to use new API names and `WriteEncodedValue` overload with `Span`

* S.S.C.Asn1: Regenerate AsnXml files

* Use new `AsnReader` API names in common S.S.C code

* S.S.C.Pkcs: Regenerate AsnXml files

* S.S.C.X509Certificates: Regenerate AsnXml files

* Update code to use `AsnWriter.WriteEncodedValue` with `Span`

* S.S.C.Algorithms: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.Cng: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.Encoding, S.S.C.Encoding.Tests: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.OpenSSL: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.Pkcs: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.Pkcs: Update usage of `AsnWriter.WriteUtcTime` to use the maximum year instead of minimum year

* S.S.C.Pkcs: Use new `AsnReader` API names

* S.S.C.Pkcs: Use `AsnReader.WriteEncodedValue` with `Span`

* S.S.C.X509Certificates: Use shared csproj for AsnReader/AsnWriter, add Argument_EncodeDestinationTooSmall resource

* S.S.C.X509Certificates: Use new `AsnReader` API names

Commit migrated from https://github.com/dotnet/corefx/commit/1382754add40c899c141803c1cdb03c335d60095

5 years agoExpose AmbiguousImplementationException and add tests (dotnet/corefx#35632)
Maryam Ariyan [Thu, 7 Mar 2019 21:40:50 +0000 (13:40 -0800)]
Expose AmbiguousImplementationException and add tests (dotnet/corefx#35632)

* Expose AmbiguousImplementationException and add tests

Fixes: dotnet/corefx#34124

Commit migrated from https://github.com/dotnet/corefx/commit/34337c3a73675aa06f09d81b15bc926889b44922

5 years agoTemporarily disabling a RealParser test.
Tanner Gooding [Thu, 7 Mar 2019 18:59:13 +0000 (10:59 -0800)]
Temporarily disabling a RealParser test.

Commit migrated from https://github.com/dotnet/corefx/commit/ee943b6c257e8e05c96d3a91bea418cb9c095972

5 years agoRename APIs based on API review (dotnet/corefx#35848)
Vance Morrison [Thu, 7 Mar 2019 18:25:58 +0000 (10:25 -0800)]
Rename APIs based on API review (dotnet/corefx#35848)

See https://github.com/dotnet/corefx/issues/34828

Commit migrated from https://github.com/dotnet/corefx/commit/3eacad602f7505f9f199dcd1992429506dd98330

5 years agoAdd FileStream.CopyToAsync missing override to ref (dotnet/corefx#35850)
Stephen Toub [Thu, 7 Mar 2019 16:44:32 +0000 (08:44 -0800)]
Add FileStream.CopyToAsync missing override to ref (dotnet/corefx#35850)

Commit migrated from https://github.com/dotnet/corefx/commit/c710854045bf7ffdffff3c2127b8fddf533ed46f

5 years agoSeed the AsnReader/AsnWriter changes from corefxlab
Jeremy Barton [Thu, 7 Mar 2019 06:26:05 +0000 (22:26 -0800)]
Seed the AsnReader/AsnWriter changes from corefxlab

These files are identical to the files at

https://github.com/dotnet/corefxlab/tree/dotnet/corefx@42ab2422b190521dd21c5c9e816810cf23f6a828/src/System.Security.Cryptography.Asn1.Experimental/System/Security/Cryptography/Asn1

though PointerMemoryManager is not included (already present in corefx)

Commit migrated from https://github.com/dotnet/corefx/commit/b66846b62fd39973eb54204087fe311941c87235

5 years agoDisable used-but-marked-unused warnings in System.Security.Cryptography.Native
Omair Majid [Thu, 7 Mar 2019 06:13:49 +0000 (01:13 -0500)]
Disable used-but-marked-unused warnings in System.Security.Cryptography.Native

When building in non-portable mode, some OpenSSL 1.1 function defnitions
that are marked as unused can be picked up by our build. When those
functions are called, clang reports a warning and fails the build:

    src/Native/Unix/System.Security.Cryptography.Native/openssl.c:432:12:
    error: 'sk_ASN1_OBJECT_num' was marked unused but was used [-Werror,-Wused-but-marked-unused]
          return sk_ASN1_OBJECT_num(eku);
                 ^

This 'unused' attribute was recently added to sk_* methods in OpenSSL
1.1: https://github.com/openssl/openssl/pull/8246

Fixes dotnet/corefx#35807

Commit migrated from https://github.com/dotnet/corefx/commit/4819ac49f2e82158baeb464c56f4cd206da1bfec

5 years agoUpdating the Microsoft.Private.Intellisense package to 3.0.0-preview3-190305-0 (dotne...
Tanner Gooding [Thu, 7 Mar 2019 05:05:10 +0000 (21:05 -0800)]
Updating the Microsoft.Private.Intellisense package to 3.0.0-preview3-190305-0 (dotnet/corefx#35842)

Commit migrated from https://github.com/dotnet/corefx/commit/2283bf7f329ee550b94da0d30d27017d50e630b4

5 years agoImprove JsonSerializer.ReadAsync(Stream) throughput (dotnet/corefx#35823)
Stephen Toub [Thu, 7 Mar 2019 04:49:58 +0000 (20:49 -0800)]
Improve JsonSerializer.ReadAsync(Stream) throughput (dotnet/corefx#35823)

* Improve JsonSerializer.ReadAsync(Stream) throughput

Some low hanging fruit:
- The method was using the Stream.ReadAsync overload that returns a `Task<int>`.  Changed it to take a `Memory<byte>` so that it instead returns a `ValueTask<int>`.
- The method was clearing the full rented buffer upon returning it to the pool, even when only using a small portion of it.  Changed it to only clear what was used.
- The method was resizing the buffer unnecessarily due to faulty logic around how much data remained.  Fixed it to only resize when more than half the buffer is full, which was the original intention.
- The ReadCore method is a bit chunky to call, initializing a new Utf8JsonReader each time, copying large structs, etc.  Since we need to read all of the data from the stream anyway, I changed it to try to fill the buffer, which then minimizes the number of times we need to call ReadCore, in particular avoiding the extra empty call at the end.  We can tweak this further in the future as needed, e.g. only making a second attempt to fill the buffer rather than doing so aggressively.
- Also fixed the exception to contain the full amount of data read from the stream, not just from the most recent call.

* Address PR feedback

Commit migrated from https://github.com/dotnet/corefx/commit/7d1a6b0548cb1fb74e2d3e7da4237e2ca56559e8

5 years agodisable tests failing on Windows ARM (dotnet/corefx#35849)
Tomas Weinfurt [Thu, 7 Mar 2019 04:43:28 +0000 (20:43 -0800)]
disable  tests failing on Windows ARM (dotnet/corefx#35849)

Commit migrated from https://github.com/dotnet/corefx/commit/0543bc85905acedfec77cb4c561754c790bed277

5 years agoReduce fix to just S.L.P (dotnet/corefx#35728)
Dan Moseley [Thu, 7 Mar 2019 03:28:24 +0000 (19:28 -0800)]
Reduce fix to just S.L.P (dotnet/corefx#35728)

Commit migrated from https://github.com/dotnet/corefx/commit/b7cc13e495944eb3f23cfbc0d18b69b680e52efb

5 years agoskip tests failing on Windows ARM64 (dotnet/corefx#35825)
Tomas Weinfurt [Wed, 6 Mar 2019 23:11:10 +0000 (15:11 -0800)]
skip tests failing on Windows ARM64 (dotnet/corefx#35825)

* skip tests failing on Windows ARM64

* fix CanWriteToPerfCounters condition to properly exclude run on arm

Commit migrated from https://github.com/dotnet/corefx/commit/229fad3002e6f986b3ae6eab08bc023abaf99bec

5 years agoignore verification failures on 10.14 (dotnet/corefx#35829)
Tomas Weinfurt [Wed, 6 Mar 2019 23:10:51 +0000 (15:10 -0800)]
ignore verification failures on 10.14 (dotnet/corefx#35829)

Commit migrated from https://github.com/dotnet/corefx/commit/9d535849e79a83fed80c506e9edc01590063a54b

5 years agoClean up lots of string.Format / SR.Format usage (dotnet/corefx#35777)
Stephen Toub [Wed, 6 Mar 2019 20:03:00 +0000 (12:03 -0800)]
Clean up lots of string.Format / SR.Format usage (dotnet/corefx#35777)

* Clean up lots of string.Format usage

This PR does a few things:
- Adds new SR.Format overloads, in particular to support accepting an IFormatProvider as the first argument.
- Fixes a bunch of calls to string.Format that should have been using SR.Format.  This not only helps in AOT builds where we want to be able to more cleanly remove resource strings, it enables easier auditing of the remaining string.Format uses to determine whether there are more appropriate implementations.
- Replaces some string.Format uses, in particular in asserts, with easier to read and maintain string interpolation
- Replaces some string.Format uses with string concatenation where it's simple and cheaper
- Fixes a bunch of SR.Format(SR.Something) calls where the SR.Format part is extraneous and should just be removed.
- Replaces a bunch of Debug.Assert(false, ...) calls with Debug.Fail(...).  This isn't directly related to string.Format, but I started this cleanup as part of cleaning up asserts that were using string.Format, and then ended up accidentally merging the chain into the same commit, and decided it was simple enough that I should just leave it rather than trying to separate it out again.

* Address PR feedback

* Fix breaks due to lower netstandard builds

Commit migrated from https://github.com/dotnet/corefx/commit/a6f76f4f620cbe74821c6445af3f13e048361658

5 years agoReduce overhead of ReadOnlySequence<T>.CopyTo (dotnet/corefx#35819)
Stephen Toub [Wed, 6 Mar 2019 19:10:46 +0000 (11:10 -0800)]
Reduce overhead of ReadOnlySequence<T>.CopyTo (dotnet/corefx#35819)

`ReadOnlySequence<T>.Length` isn't as small or fast as `ReadOnlySpan<T>.Length`, which is just a field access.  Since we need the span anyway for the single element case, just get the span first and then compare with its length.

Commit migrated from https://github.com/dotnet/corefx/commit/7fc9d5730aabc6724edf18f5bedde6d32610f681

5 years agore-enable MulticastInterface test on RH6, disable on RH7 and OSX (dotnet/corefx#35798)
Tomas Weinfurt [Wed, 6 Mar 2019 19:08:38 +0000 (11:08 -0800)]
re-enable MulticastInterface test on RH6, disable on RH7 and OSX (dotnet/corefx#35798)

* re-enable MulticastInterface test on RH6, disable on RH7 and OSX

* add missing using

* feedback from review

Commit migrated from https://github.com/dotnet/corefx/commit/ebe74b3ad7d1b7be02217bf199f5dedc05f76297