diff --git a/.gitignore b/.gitignore index 11bf8ccc5..6cd7bfb72 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ packages NuGet.exe _[Ss]cripts +*.binlog *.exe *.dll *.nupkg diff --git a/Runtime.msbuild b/Runtime.msbuild index c3f2294e7..2e785ab2e 100644 --- a/Runtime.msbuild +++ b/Runtime.msbuild @@ -64,24 +64,38 @@ - - - - + + <_NuGetPackagesAndSolutions Include="src\System.Net.Http.Formatting.NetCore\packages.config; + test\System.Net.Http.Formatting.NetCore.Test\packages.config; + Runtime.sln" /> + + + <_NuGetPackagesAndSolutions Include="src\System.Net.Http.Formatting.NetCore\packages.config; + test\System.Net.Http.Formatting.NetCore.Test\packages.config" + Condition=" '$(BuildPortable)' == 'true' " /> + <_ProjectsToRestore Include="src\System.Net.Http.Formatting.NetStandard\System.Net.Http.Formatting.NetStandard.csproj; + test\System.Net.Http.Formatting.NetStandard.Test\System.Net.Http.Formatting.NetStandard.Test.csproj" + Condition=" '$(BuildPortable)' == 'true' " /> + - + + + - $(MsBuildThisFileDirectory)tools\src\Microsoft.Web.FxCop\ - $(MsBuildThisFileDirectory)packages\CustomFxCopRules + $(MSBuildThisFileDirectory)tools\src\Microsoft.Web.FxCop\ + $(MSBuildThisFileDirectory)packages\CustomFxCopRules - + @@ -89,11 +103,11 @@ + Projects="@(SolutionsToBuild)" + BuildInParallel="%(SolutionsToBuild.BuildInParallel)" + Targets="Build" + Condition=" '%(SolutionsToBuild.Portable)' != 'true' or '$(BuildPortable)' == 'true' " + Properties="Configuration=$(Configuration);CodeAnalysis=$(CodeAnalysis);StyleCopEnabled=$(StyleCopEnabled);VisualStudioVersion=$(VisualStudioVersion)" /> diff --git a/build.cmd b/build.cmd index e49e2cfb8..270103785 100644 --- a/build.cmd +++ b/build.cmd @@ -26,7 +26,9 @@ if not exist %vswhere% ( ) set InstallDir= -for /f "usebackq tokens=*" %%i in (`%vswhere% -version ^[15^,16^) -latest -prerelease -products * -requires Microsoft.Component.MSBuild -property installationPath`) do ( +for /f "usebackq tokens=*" %%i in (`%vswhere% -version ^[15^,16^) -latest -prerelease -products * ^ + -requires Microsoft.Component.MSBuild -requires Microsoft.Net.Core.Component.SDK.2.1 ^ + -property installationPath`) do ( set InstallDir=%%i ) if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" ( diff --git a/global.json b/global.json index 3e8915949..9ddc9bf9c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,6 @@ { "sdk": { - "version": "2.1.523" + "version": "2.1.500", + "rollForward": "latestPatch" } } diff --git a/src/CodeAnalysisDictionary.xml b/src/CodeAnalysisDictionary.xml index fdd4e0ea7..26ab4a8af 100644 --- a/src/CodeAnalysisDictionary.xml +++ b/src/CodeAnalysisDictionary.xml @@ -55,6 +55,13 @@ ModelName BSON Untyped + Behavior + Callback + Canceled + Color + Fallback + Markup + Preflight WebPage diff --git a/src/System.Net.Http.Formatting.NetStandard/System.Net.Http.Formatting.NetStandard.csproj b/src/System.Net.Http.Formatting.NetStandard/System.Net.Http.Formatting.NetStandard.csproj index 0211316d3..400278d86 100644 --- a/src/System.Net.Http.Formatting.NetStandard/System.Net.Http.Formatting.NetStandard.csproj +++ b/src/System.Net.Http.Formatting.NetStandard/System.Net.Http.Formatting.NetStandard.csproj @@ -41,7 +41,7 @@ Common\UriQueryUtility.cs - + %(RecursiveDir)\%(Filename).cs diff --git a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj index 6cfb16e25..dbbca8480 100644 --- a/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj +++ b/test/System.Net.Http.Formatting.NetStandard.Test/System.Net.Http.Formatting.NetStandard.Test.csproj @@ -15,7 +15,7 @@ - + %(RecursiveDir)\%(Filename).cs diff --git a/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs b/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs index 39e6cffd9..bc5d1618b 100644 --- a/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs +++ b/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs @@ -380,12 +380,24 @@ private static IList UnexpectedTraces(IList expecte // artifact specific to testing in VS. (Attempting to load all types from xunit.runner.visualstudio.testadapter.dll // fails with recent xUnit.net packages. The assembly references Microsoft.VisualStudio.TestPlatform.ObjectModel.dll // which is not available with xUnit.net 2.0.x.) + // + // Similarly, ignore records for the same exception to allow test to succeed when using the xUnit MSBuild runner. + // In that case, missing types may come from System.Web and Microsoft.Build.Utilities.v4.0 as well as xunit.runner.msbuild.net452. if (actualRecord.Operation == null && actualRecord.Exception is ReflectionTypeLoadException && actualRecord.Message != null && - actualRecord.Message.StartsWith( - "Exception thrown while getting types from 'xunit.runner.visualstudio.testadapter, ", - StringComparison.Ordinal)) + (actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'xunit.runner.visualstudio.testadapter, ", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'xunit.runner.msbuild.", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'System.Web, ", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'Microsoft.Build.Utilities.", + StringComparison.Ordinal))) { continue; } @@ -397,8 +409,8 @@ actualRecord.Exception is ReflectionTypeLoadException && if (expectedTrace == null) { - unexpected.Add(string.Format("kind={0} category={1}, operator={2}, operation={3}", - actualRecord.Kind, actualRecord.Category, actualRecord.Operator, actualRecord.Operation)); + unexpected.Add(string.Format("kind={0} category={1}, operator={2}, operation={3}, message={4}", + actualRecord.Kind, actualRecord.Category, actualRecord.Operator, actualRecord.Operation, actualRecord.Message)); } } @@ -422,14 +434,26 @@ private static bool ConfirmTracingOrder(IList expectedRecor // artifact specific to testing in VS. (Attempting to load all types from xunit.runner.visualstudio.testadapter.dll // fails with recent xUnit.net packages. The assembly references Microsoft.VisualStudio.TestPlatform.ObjectModel.dll // which is not available with xUnit.net 2.0.x.) + // + // Similarly, ignore records for the same exception to allow test to succeed when using the xUnit MSBuild runner. + // In that case, missing types may come from System.Web and Microsoft.Build.Utilities.v4.0 as well as xunit.runner.msbuild.net452. var actualRecord = actualRecords.ElementAtOrDefault(traceBeginPos); - if (actualRecord != null && + while (actualRecord != null && actualRecord.Operation == null && actualRecord.Exception is ReflectionTypeLoadException && actualRecord.Message != null && - actualRecord.Message.StartsWith( - "Exception thrown while getting types from 'xunit.runner.visualstudio.testadapter, ", - StringComparison.Ordinal)) + (actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'xunit.runner.visualstudio.testadapter, ", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'xunit.runner.msbuild.", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'System.Web, ", + StringComparison.Ordinal) || + actualRecord.Message.StartsWith( + "Exception thrown while getting types from 'Microsoft.Build.Utilities.", + StringComparison.Ordinal))) { traceBeginPos++; actualRecord = actualRecords.ElementAtOrDefault(traceBeginPos); diff --git a/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs b/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs index 8ddfce69d..b8b25e30f 100644 --- a/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs +++ b/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs @@ -429,7 +429,6 @@ public async Task Invoke_BuildsUriWithHostAndPort() [InlineData(@"-_.~+""<>^`{|}")] // random unicode characters [InlineData("激光這")] - [InlineData("%24")] [InlineData("?#")] public async Task Invoke_CreatesUri_ThatGeneratesCorrectlyDecodedStrings(string decodedId) { @@ -447,6 +446,27 @@ public async Task Invoke_CreatesUri_ThatGeneratesCorrectlyDecodedStrings(string Assert.Equal(decodedId, routeData.Values["id"]); } + [Theory] + [InlineData("%24", "$")] + [InlineData("%28%29", "()")] + [InlineData("%5B%5D", "[]")] + [InlineData("%7B%7D", "{}")] + public async Task Invoke_CreatesUri_ContainingCorrectlyDecodedStrings(string encoded, string decoded) + { + var handler = CreateOKHandlerStub(); + var bufferPolicySelector = CreateBufferPolicySelector(bufferInput: false, bufferOutput: false); + var environment = CreateOwinEnvironment("GET", "http", "localhost", "/vroot", "/api/customers/" + encoded); + var options = CreateValidOptions(handler, bufferPolicySelector); + var adapter = CreateProductUnderTest(options); + var route = new HttpRoute("api/customers/{id}"); + + await adapter.Invoke(new OwinContext(environment)); + IHttpRouteData routeData = route.GetRouteData("/vroot", handler.Request); + + Assert.NotNull(routeData); + Assert.Equal(decoded, routeData.Values["id"]); + } + [Fact] public async Task Invoke_AddsRequestHeadersToRequestMessage() {