diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml
index 835b8bf0ef..5114966c0c 100644
--- a/.azure/pipelines/ci.yml
+++ b/.azure/pipelines/ci.yml
@@ -139,6 +139,7 @@ stages:
-pack
-noBuildDeps
$(_BuildArgs)
+ condition: ne(variables['Build.Reason'], 'PullRequest')
displayName: Build SiteExtension
# This runs code-signing on all packages, zips, and jar files as defined in build/CodeSign.targets. If https://github.com/dotnet/arcade/issues/1957 is resolved,
@@ -456,7 +457,7 @@ stages:
- name: Windows_Test_Dumps
path: artifacts/dumps/
publishOnError: true
- includeForks: false
+ includeForks: true
- name: Windows_Test_Logs
path: artifacts/log/
publishOnError: true
@@ -484,7 +485,7 @@ stages:
- name: Windows_Test_Templates_Dumps
path: artifacts/dumps/
publishOnError: true
- includeForks: false
+ includeForks: true
- name: Windows_Test_Templates_Logs
path: artifacts/log/
publishOnError: true
@@ -566,6 +567,25 @@ stages:
publishOnError: true
includeForks: true
+# Helix x64
+ - template: jobs/default-build.yml
+ parameters:
+ jobName: Helix_x64
+ jobDisplayName: 'Tests: Helix x64'
+ agentOs: Windows
+ timeoutInMinutes: 180
+ steps:
+ - script: .\restore.cmd -ci
+ displayName: Restore
+ - script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=false -bl
+ displayName: Run build.cmd helix target
+ env:
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
+ artifacts:
+ - name: Helix_logs
+ path: artifacts/log/
+ publishOnError: true
+
# Source build
- job: Source_Build
displayName: 'Test: Linux Source Build'
diff --git a/.azure/pipelines/helix-daily.yml b/.azure/pipelines/helix-daily.yml
new file mode 100644
index 0000000000..129d4f6a09
--- /dev/null
+++ b/.azure/pipelines/helix-daily.yml
@@ -0,0 +1,45 @@
+# Uses Scheduled Triggers, which aren't supported in YAML yet.
+# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=vsts&tabs=yaml#scheduled
+
+# Daily Helix Tests for ASP.NET Core
+
+jobs:
+- template: jobs/default-build.yml
+ parameters:
+ jobName: Helix_x64_daily
+ jobDisplayName: 'Tests: Helix x64 Daily'
+ agentOs: Windows
+ timeoutInMinutes: 240
+ steps:
+ - script: .\restore.cmd -ci
+ displayName: Restore
+ - script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true -bl
+ displayName: Run build.cmd helix target
+ env:
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
+ artifacts:
+ - name: Helix_logs
+ path: artifacts/log/
+ publishOnError: true
+
+# Helix ARM64
+- template: jobs/default-build.yml
+ parameters:
+ jobName: Helix_arm64_daily
+ jobDisplayName: "Tests: Helix ARM64 Daily"
+ agentOs: Linux
+ timeoutInMinutes: 180
+ steps:
+ - script: ./restore.sh -ci
+ displayName: Restore
+ - script: ./build.sh -ci --arch arm64 -test --no-build-nodejs -projects $(Build.SourcesDirectory)/eng/helix/helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true -bl
+ displayName: Run build.sh helix arm64 target
+ env:
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
+ installNodeJs: false
+ artifacts:
+ - name: Helix_arm64_logs
+ path: artifacts/log/
+ publishOnError: true
+ includeForks: true
+
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 103c64248f..cb9cb3cdff 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -14,7 +14,7 @@
/src/Hosting/ @tratcher @anurse
/src/Http/ @tratcher @jkotalik @anurse
/src/Middleware/ @tratcher @anurse
-/src/ProjectTemplates/ @ryanbrandenburg
+# /src/ProjectTemplates/ @ryanbrandenburg
/src/Security/ @tratcher @anurse
/src/Servers/ @tratcher @jkotalik @anurse @halter73
/src/Middleware/Rewrite @jkotalik @anurse
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000000..c83511906d
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,66 @@
+# "AzureAD" is an area-security area.
+area-azure:
+ - src/Azure/AzureAppServices.HostingStartup/**/*
+ - src/Azure/AzureAppServicesIntegration/**/*
+
+area-blazor:
+ - src/Components/**/*
+
+area-commandlinetools:
+ - src/Tools/**/*
+
+area-dataprotection:
+ - src/DataProtection/**/*
+
+#area-grpc:
+
+#area-healthchecks:
+
+area-hosting:
+ - src/Hosting/**/*
+ - src/SiteExtensions/**/*
+ - src/DefaultBuilder/**/*
+
+#area-httpclientfactory:
+
+area-identity:
+ - src/Identity/**/*
+
+area-infrastructure:
+ - global.json
+ - .azure/**/*
+ - .config/**/*
+ - eng/**/*
+
+area-installers:
+ - src/Installers/**/*
+
+area-middleware:
+ - src/Middleware/**/*
+
+area-mvc:
+ - src/ProjectTemplates/**/*
+ - src/Razor/**/*
+ - src/Mvc/**/*
+ - src/MusicStore/**/*
+
+area-platform:
+ - src/Framework/**/*
+
+area-security:
+ - src/Security/**/*
+ - src/Azure/AzureAD/**/*
+
+# For now, "Http" is under servers. We might adjust that later.
+area-servers:
+ - src/Servers/**/*
+ - src/Http/**/*
+
+area-signalr:
+ - src/SignalR/**/*
+
+area-websockets:
+ - src/Middleware/WebSockets/**/*
+
+api-suggestion:
+ - src/**/ref/**/*
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 0000000000..4652757b25
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,12 @@
+name: "Pull Request Labeler"
+on:
+- pull_request
+
+jobs:
+ triage:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v2
+ if: github.repository == 'aspnet/AspNetCore'
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
diff --git a/.gitignore b/.gitignore
index 8a2385174b..fddfe14e16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,4 @@ launchSettings.json
msbuild.ProjectImports.zip
StyleCop.Cache
UpgradeLog.htm
+.idea
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index 2fe19bde83..b3dc903387 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -51,7 +51,7 @@
true
- netcoreapp3.1
+ netcoreapp5.0
@@ -61,6 +61,10 @@
$(WarningsNotAsErrors);CS1591
$(WarningsNotAsErrors);xUnit1004
+
+ $(NoWarn);NU5131
+
+ $(NoWarn);NU5048
diff --git a/NuGet.config b/NuGet.config
index 90058d74d5..2aa0b156cb 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -2,6 +2,9 @@
+
+
+
diff --git a/README.md b/README.md
index 4b954c6076..f115a7f28b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
ASP.NET Core
============
-ASP.NET Core is an open-source and cross-platform framework for building modern cloud based internet connected applications, such as web apps, IoT apps and mobile backends. ASP.NET Core apps can run on .NET Core or on the full .NET Framework. It was architected to provide an optimized development framework for apps that are deployed to the cloud or run on-premises. It consists of modular components with minimal overhead, so you retain flexibility while constructing your solutions. You can develop and run your ASP.NET Core apps cross-platform on Windows, Mac and Linux. [Learn more about ASP.NET Core](https://docs.microsoft.com/aspnet/core/).
+ASP.NET Core is an open-source and cross-platform framework for building modern cloud based internet connected applications, such as web apps, IoT apps and mobile backends. ASP.NET Core apps run on [.NET Core](https://dot.net), a free, cross-platform and open-source application runtime. It was architected to provide an optimized development framework for apps that are deployed to the cloud or run on-premises. It consists of modular components with minimal overhead, so you retain flexibility while constructing your solutions. You can develop and run your ASP.NET Core apps cross-platform on Windows, Mac and Linux. [Learn more about ASP.NET Core](https://docs.microsoft.com/aspnet/core/).
## Get Started
diff --git a/THIRD-PARTY-NOTICES.txt b/THIRD-PARTY-NOTICES.txt
index 81fadeae22..99d1e37721 100644
--- a/THIRD-PARTY-NOTICES.txt
+++ b/THIRD-PARTY-NOTICES.txt
@@ -189,3 +189,31 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+
+License notice for corefx
+
+------------------------------------------------
+
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md
index 5cc74a5f9d..b9d0d993c1 100644
--- a/docs/BuildFromSource.md
+++ b/docs/BuildFromSource.md
@@ -1,11 +1,11 @@
Build ASP.NET Core from Source
==============================
-Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and to contribute your improvements back to the project.
+Building ASP.NET Core from source allows you to tweak and customize ASP.NET Core, and to contribute your improvements back to the project.
See https://github.com/aspnet/AspNetCore/labels/area-infrastructure for known issues and to track ongoing work.
-## Install pre-requistes
+## Install pre-requisites
### Windows
@@ -44,7 +44,7 @@ Building ASP.NET Core on macOS or Linux requires:
## Clone the source code
-ASP.NET Core uses git submodules to include source from a few other projects.
+ASP.NET Core uses git submodules to include the source from a few other projects.
For a new copy of the project, run:
```
@@ -64,19 +64,19 @@ Before opening our .sln files in Visual Studio or VS Code, you need to perform t
```
.\restore.cmd
```
- This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about.
+ This will download the required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about.
> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. On the master branch, we regularly update the versions of .NET Core SDK required to build the repo.
> You will need to restart Visual Studio every time we update the .NET Core SDK.
-2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables.
+2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets the required environment variables.
### Solution files
We don't have a single .sln file for all of ASP.NET Core because Visual Studio doesn't currently handle projects of this scale.
Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .slns:
-1. Solution files are not used by CI or command line build scripts. They are for meant for use by developers only.
+1. Solution files are not used by CI or command line build scripts. They are meant for use by developers only.
2. Solution files group together projects which are frequently edited at the same time.
3. Can't find a solution that has the projects you care about? Feel free to make a PR to add a new .sln file.
@@ -91,7 +91,7 @@ Opening solution files and building may produce an error code CS0006 with a mess
The cause of this problem is that the solution you are using does not include the project that produces this .dll. This most often occurs after we have added new projects to the repo, but failed to update our .sln files to include the new project. In some cases, it is sometimes the intended behavior of the .sln which has been crafted to only include a subset of projects.
**You can fix this in one of two ways**
-1. Build the project on command line. In most cases, running `build.cmd` on command line solve this problem.
+1. Build the project on command line. In most cases, running `build.cmd` on command line solves this problem.
2. Update the solution to include the missing project. You can either do this one by one using `dotnet sln`
```
dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj
@@ -139,7 +139,7 @@ On macOS/Linux:
./build.sh
```
-By default, all of the C# projects are built. Some C# projects requires NodeJS to be installed to compile JavaScript assets which are then checked in as source. If NodeJS is detected on the path, the NodeJS projects will be compiled as part of building C# projects. If NodeJS is not detected on the path, the JavaScript assets checked in previously will be used instead. To disable building NodeJS projects, specify /p:BuildNodeJs=false on the command line.
+By default, all of the C# projects are built. Some C# projects require NodeJS to be installed to compile JavaScript assets which are then checked in as source. If NodeJS is detected on the path, the NodeJS projects will be compiled as part of building C# projects. If NodeJS is not detected on the path, the JavaScript assets checked in previously will be used instead. To disable building NodeJS projects, specify /p:BuildNodeJs=false on the command line.
### Using `dotnet` on command line in this repo
diff --git a/docs/ReferenceAssemblies.md b/docs/ReferenceAssemblies.md
index 1ef20699e6..593682a29e 100644
--- a/docs/ReferenceAssemblies.md
+++ b/docs/ReferenceAssemblies.md
@@ -22,4 +22,4 @@ Set `false` in the implementation (
### Regenerate reference assemblies for all projects
-Run `.\eng\scripts\GenerateReferenceAssemblies.ps1` from repository root.
+Run `.\eng\scripts\GenerateReferenceAssemblies.ps1` from repository root. Make sure you've run `.\restore.cmd` first.
diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props
index 3ac3e8dbf6..778f9b7620 100644
--- a/eng/ProjectReferences.props
+++ b/eng/ProjectReferences.props
@@ -60,6 +60,7 @@
+
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index e15ff170a5..fe8bbc2c53 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -9,428 +9,428 @@
-->
-
+
https://github.com/aspnet/Blazor
- df77420cad90b1834fe43c952861dad11097d38f
+ 67c011629f56585c6a561dc4bdca70efc43579dd
-
+
https://github.com/aspnet/AspNetCore-Tooling
- b840e69971378b1a4de061c8ed2a4b7a9e28e396
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- b840e69971378b1a4de061c8ed2a4b7a9e28e396
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- b840e69971378b1a4de061c8ed2a4b7a9e28e396
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- b840e69971378b1a4de061c8ed2a4b7a9e28e396
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/EntityFrameworkCore
- 0a7c02e7484dcfec055e3acbb2dc8352043675f9
+ ff6b374c976f69d5c426d2110328ed3498c0ad22
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
- https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
-
-
+
https://github.com/dotnet/core-setup
- 4950751278293d59898be799c0115e0ad895747e
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 4950751278293d59898be799c0115e0ad895747e
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 4950751278293d59898be799c0115e0ad895747e
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 7d57652f33493fa022125b7f63aad0d70c52d810
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
+
+
+ https://github.com/dotnet/corefx
+ 4ac4c0367003fe3973a3648eb0715ddb0e3bbcea
-
+
https://github.com/dotnet/corefx
- d29d1bf34dea385124d076405ccb66ccfd173a86
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ cd7480090dc1c2f2ec7b6090faac7b634ef0b11b
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ cd7480090dc1c2f2ec7b6090faac7b634ef0b11b
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ cd7480090dc1c2f2ec7b6090faac7b634ef0b11b
-
+
https://github.com/aspnet/Extensions
- c8e7e853e886635da89699e1faa2e5df403c267c
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/roslyn
- d54455f982927b219209b63ba09c21b3f059be1d
+ 3c865821f2864393a0ff7fe22c92ded6d51a546c
diff --git a/eng/Versions.props b/eng/Versions.props
index f92ab0fb36..bbb65c2a39 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -6,19 +6,17 @@
-->
- 3
- 1
+ 5
+ 0
0
- 3
+ 1
false
release
- true
- false
- preview$(PreReleasePreviewNumber)
- Preview $(PreReleasePreviewNumber)
+ alpha$(PreReleasePreviewNumber)
+ Alpha $(PreReleasePreviewNumber)
$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)
false
@@ -62,116 +60,116 @@
-->
- 1.0.0-beta.19517.3
+ 5.0.0-beta.19531.8
- 3.5.0-beta1-19531-01
+ 3.4.0-beta1-19456-03
- 3.1.0-preview3.19530.5
- 3.1.0-preview3.19530.5
- 3.1.0-preview3.19530.5
- 2.1.0
+ 5.0.0-alpha1.19521.2
+ 5.0.0-alpha1.19521.2
+ 5.0.0-alpha1.19521.2
+ 2.1.0-alpha1.19521.2
- 1.1.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 1.8.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
- 4.7.0-preview3.19530.2
+ 1.0.0
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
+ 5.0.0-alpha1.19520.7
- 3.1.0-preview3.19530.2
+ 5.0.0-alpha1.19520.7
- 3.1.0-preview3.19531.1
+ 5.0.0-alpha1.19531.2
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
- 3.1.0-preview3.19531.6
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-alpha1.19530.2
+ 5.0.0-preview2.19530.2
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
- 3.1.0-preview3.19531.11
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
+ 5.0.0-alpha1.19531.1
- 3.1.0-preview3.19531.9
- 3.1.0-preview3.19531.9
- 3.1.0-preview3.19531.9
- 3.1.0-preview3.19531.9
+ 5.0.0-alpha1.19531.8
+ 5.0.0-alpha1.19531.8
+ 5.0.0-alpha1.19531.8
+ 5.0.0-alpha1.19531.8
-
+
- 3.1
+ 5.0
@@ -25,11 +25,6 @@
-
-
- $(MicrosoftNETCorePlatformsPackageVersion)
-
-
+
+
+
+
+
+
diff --git a/eng/common/PublishToSymbolServers.proj b/eng/common/PublishToSymbolServers.proj
index 5d55e312b0..311e2bbe0f 100644
--- a/eng/common/PublishToSymbolServers.proj
+++ b/eng/common/PublishToSymbolServers.proj
@@ -37,6 +37,8 @@
3650
true
+ true
+ true
false
@@ -56,7 +58,7 @@
DryRun="false"
ConvertPortablePdbsToWindowsPdbs="false"
PdbConversionTreatAsWarning=""
- Condition="$(PublishToSymbolServer)"/>
+ Condition="$(PublishToSymbolServer) and $(PublishToMSDL)"/>
@@ -12,15 +6,15 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -28,20 +22,27 @@
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
@@ -53,4 +54,5 @@
+
diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets
index d3a45dfa45..16f5e9f5a2 100644
--- a/eng/targets/Helix.targets
+++ b/eng/targets/Helix.targets
@@ -42,7 +42,7 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
- <_HelixProjectTargetQueue Include="%(HelixAvailableTargetQueue.Identity)" Condition="'%(HelixAvailableTargetQueue.Identity)' != '' AND '$(_SelectedPlatforms.Contains(%(Platform)))' == 'true' AND '%(EnableByDefault)' == 'true'" />
+ <_HelixProjectTargetQueue Include="%(HelixAvailableTargetQueue.Identity)" Condition="'%(HelixAvailableTargetQueue.Identity)' != '' AND '$(_SelectedPlatforms.Contains(%(Platform)))' == 'true'" />
<_HelixApplicableTargetQueue Include="%(_HelixProjectTargetQueue.Identity)" Condition="'%(Identity)' == '$(HelixTargetQueue)'" />
diff --git a/eng/targets/Npm.Common.targets b/eng/targets/Npm.Common.targets
index 062a9d3a8f..7695ed7039 100644
--- a/eng/targets/Npm.Common.targets
+++ b/eng/targets/Npm.Common.targets
@@ -20,16 +20,20 @@
-
-
-
+
+
+
+
+
+
+
-
-
+
+
@@ -53,12 +57,25 @@
+
+
+
+
+
+
+
+
+ DependsOnTargets="GetBuildInputCacheFile"
+ Inputs="@(TSFiles);$(BaseIntermediateOutputPath)tsfiles.cache"
+ Outputs="@(BuildOutputFiles)">
-
+
@@ -73,7 +90,10 @@
-
+
+
<_PackageTargetPath>$(MSBuildProjectDirectory)\$(PackageFileName)
diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj
index 68d4cd23fb..a8e176b773 100644
--- a/eng/tools/RepoTasks/RepoTasks.csproj
+++ b/eng/tools/RepoTasks/RepoTasks.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/eng/tools/RepoTasks/RepoTasks.tasks b/eng/tools/RepoTasks/RepoTasks.tasks
index 5fcc97d156..0fa015d81f 100644
--- a/eng/tools/RepoTasks/RepoTasks.tasks
+++ b/eng/tools/RepoTasks/RepoTasks.tasks
@@ -1,6 +1,6 @@
- <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">netcoreapp3.1
+ <_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' == 'core'">netcoreapp5.0
<_RepoTaskAssemblyFolder Condition="'$(MSBuildRuntimeType)' != 'core'">net472
<_RepoTaskAssembly>$(ArtifactsBinDir)RepoTasks\Release\$(_RepoTaskAssemblyFolder)\RepoTasks.dll
diff --git a/global.json b/global.json
index 17454ad1bf..d7f7af330f 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,9 @@
{
"sdk": {
- "version": "3.1.100-preview1-014400"
+ "version": "5.0.100-alpha1-014696"
},
"tools": {
- "dotnet": "3.1.100-preview1-014400",
+ "dotnet": "5.0.100-alpha1-014696",
"runtimes": {
"dotnet/x64": [
"$(MicrosoftNETCoreAppRuntimeVersion)"
@@ -25,7 +25,7 @@
},
"msbuild-sdks": {
"Yarn.MSBuild": "1.15.2",
- "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19517.3",
- "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19517.3"
+ "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19531.8",
+ "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19531.8"
}
}
diff --git a/src/Antiforgery/ref/Microsoft.AspNetCore.Antiforgery.netcoreapp.cs b/src/Antiforgery/ref/Microsoft.AspNetCore.Antiforgery.netcoreapp.cs
index 5eb2c8be65..4ca6748cce 100644
--- a/src/Antiforgery/ref/Microsoft.AspNetCore.Antiforgery.netcoreapp.cs
+++ b/src/Antiforgery/ref/Microsoft.AspNetCore.Antiforgery.netcoreapp.cs
@@ -9,16 +9,16 @@ namespace Microsoft.AspNetCore.Antiforgery
public AntiforgeryOptions() { }
public Microsoft.AspNetCore.Http.CookieBuilder Cookie { get { throw null; } set { } }
public string FormFieldName { get { throw null; } set { } }
- public string HeaderName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool SuppressXFrameOptionsHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string HeaderName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool SuppressXFrameOptionsHeader { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class AntiforgeryTokenSet
{
public AntiforgeryTokenSet(string requestToken, string cookieToken, string formFieldName, string headerName) { }
- public string CookieToken { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string FormFieldName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string HeaderName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string RequestToken { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string CookieToken { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string FormFieldName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string HeaderName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string RequestToken { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public partial class AntiforgeryValidationException : System.Exception
{
diff --git a/src/Antiforgery/src/IAntiforgeryAdditionalDataProvider.cs b/src/Antiforgery/src/IAntiforgeryAdditionalDataProvider.cs
index d66b6245db..485fc8c9e8 100644
--- a/src/Antiforgery/src/IAntiforgeryAdditionalDataProvider.cs
+++ b/src/Antiforgery/src/IAntiforgeryAdditionalDataProvider.cs
@@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Antiforgery
///
/// Allows providing or validating additional custom data for antiforgery tokens.
/// For example, the developer could use this to supply a nonce when the token is
- /// generated, then he could validate the nonce when the token is validated.
+ /// generated, then validate it when the token is validated.
///
///
/// The antiforgery system already embeds the client's username within the
diff --git a/src/Antiforgery/src/Internal/DefaultAntiforgery.cs b/src/Antiforgery/src/Internal/DefaultAntiforgery.cs
index 030f79c07e..3fab8af560 100644
--- a/src/Antiforgery/src/Internal/DefaultAntiforgery.cs
+++ b/src/Antiforgery/src/Internal/DefaultAntiforgery.cs
@@ -379,7 +379,7 @@ namespace Microsoft.AspNetCore.Antiforgery
/// The .
protected virtual void SetDoNotCacheHeaders(HttpContext httpContext)
{
- // Since antifogery token generation is not very obvious to the end users (ex: MVC's form tag generates them
+ // Since antiforgery token generation is not very obvious to the end users (ex: MVC's form tag generates them
// by default), log a warning to let users know of the change in behavior to any cache headers they might
// have set explicitly.
LogCacheHeaderOverrideWarning(httpContext.Response);
diff --git a/src/Antiforgery/test/DefaultClaimUidExtractorTest.cs b/src/Antiforgery/test/DefaultClaimUidExtractorTest.cs
index 1852b910da..67d690a83a 100644
--- a/src/Antiforgery/test/DefaultClaimUidExtractorTest.cs
+++ b/src/Antiforgery/test/DefaultClaimUidExtractorTest.cs
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Antiforgery.Internal
public void DefaultUniqueClaimTypes_NotPresent_SerializesAllClaimTypes()
{
var identity = new ClaimsIdentity("someAuthentication");
- identity.AddClaim(new Claim(ClaimTypes.Email, "someone@antifrogery.com"));
+ identity.AddClaim(new Claim(ClaimTypes.Email, "someone@antiforgery.com"));
identity.AddClaim(new Claim(ClaimTypes.GivenName, "some"));
identity.AddClaim(new Claim(ClaimTypes.Surname, "one"));
identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, string.Empty));
diff --git a/src/Azure/AzureAD/Authentication.AzureAD.UI/ref/Microsoft.AspNetCore.Authentication.AzureAD.UI.netcoreapp.cs b/src/Azure/AzureAD/Authentication.AzureAD.UI/ref/Microsoft.AspNetCore.Authentication.AzureAD.UI.netcoreapp.cs
index 2e7a9b87f9..37f4cd5573 100644
--- a/src/Azure/AzureAD/Authentication.AzureAD.UI/ref/Microsoft.AspNetCore.Authentication.AzureAD.UI.netcoreapp.cs
+++ b/src/Azure/AzureAD/Authentication.AzureAD.UI/ref/Microsoft.AspNetCore.Authentication.AzureAD.UI.netcoreapp.cs
@@ -26,16 +26,16 @@ namespace Microsoft.AspNetCore.Authentication.AzureAD.UI
{
public AzureADOptions() { }
public string[] AllSchemes { get { throw null; } }
- public string CallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ClientId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ClientSecret { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string CookieSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string JwtBearerSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string OpenIdConnectSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string SignedOutCallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string TenantId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string CallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ClientId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ClientSecret { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string CookieSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string JwtBearerSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string OpenIdConnectSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string SignedOutCallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string TenantId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Authentication.AzureAD.UI.Internal
@@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureAD.UI.Internal
public partial class ErrorModel : Microsoft.AspNetCore.Mvc.RazorPages.PageModel
{
public ErrorModel() { }
- public string RequestId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string RequestId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public bool ShowRequestId { get { throw null; } }
public void OnGet() { }
}
diff --git a/src/Azure/AzureAD/Authentication.AzureADB2C.UI/ref/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.netcoreapp.cs b/src/Azure/AzureAD/Authentication.AzureADB2C.UI/ref/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.netcoreapp.cs
index 5cd9f38724..65981fe5fa 100644
--- a/src/Azure/AzureAD/Authentication.AzureADB2C.UI/ref/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.netcoreapp.cs
+++ b/src/Azure/AzureAD/Authentication.AzureADB2C.UI/ref/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.netcoreapp.cs
@@ -27,19 +27,19 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI
{
public AzureADB2COptions() { }
public string[] AllSchemes { get { throw null; } }
- public string CallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ClientId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ClientSecret { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string CookieSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string CallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ClientId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ClientSecret { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string CookieSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string DefaultPolicy { get { throw null; } }
- public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string EditProfilePolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string JwtBearerSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string OpenIdConnectSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ResetPasswordPolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string SignedOutCallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string SignUpSignInPolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string EditProfilePolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Instance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string JwtBearerSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string OpenIdConnectSchemeName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ResetPasswordPolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string SignedOutCallbackPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string SignUpSignInPolicyId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Internal
@@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Internal
public partial class ErrorModel : Microsoft.AspNetCore.Mvc.RazorPages.PageModel
{
public ErrorModel() { }
- public string RequestId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string RequestId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public bool ShowRequestId { get { throw null; } }
public void OnGet() { }
}
diff --git a/src/Components/Analyzers/test/ComponentInternalUsageDiagnoticsAnalyzerTest.cs b/src/Components/Analyzers/test/ComponentInternalUsageDiagnosticsAnalyzerTest.cs
similarity index 93%
rename from src/Components/Analyzers/test/ComponentInternalUsageDiagnoticsAnalyzerTest.cs
rename to src/Components/Analyzers/test/ComponentInternalUsageDiagnosticsAnalyzerTest.cs
index 92e2252304..e478f1ef45 100644
--- a/src/Components/Analyzers/test/ComponentInternalUsageDiagnoticsAnalyzerTest.cs
+++ b/src/Components/Analyzers/test/ComponentInternalUsageDiagnosticsAnalyzerTest.cs
@@ -8,9 +8,9 @@ using Xunit;
namespace Microsoft.AspNetCore.Components.Analyzers
{
- public class ComponentInternalUsageDiagnoticsAnalyzerTest : AnalyzerTestBase
+ public class ComponentInternalUsageDiagnosticsAnalyzerTest : AnalyzerTestBase
{
- public ComponentInternalUsageDiagnoticsAnalyzerTest()
+ public ComponentInternalUsageDiagnosticsAnalyzerTest()
{
Analyzer = new ComponentInternalUsageDiagnosticAnalyzer();
Runner = new ComponentAnalyzerDiagnosticAnalyzerRunner(Analyzer);
diff --git a/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs b/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs
similarity index 83%
rename from src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs
rename to src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs
index 415030a011..453cd69d74 100644
--- a/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs
+++ b/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameAsParameter.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components.RenderTree;
-namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnoticsAnalyzerTest
+namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnosticsAnalyzerTest
{
class UsesRenderTreeFrameAsParameter
{
diff --git a/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs b/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs
similarity index 86%
rename from src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs
rename to src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs
index bdd40c2df1..daf857f996 100644
--- a/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnoticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs
+++ b/src/Components/Analyzers/test/TestFiles/ComponentInternalUsageDiagnosticsAnalyzerTest/UsesRenderTreeFrameTypeAsLocal.cs
@@ -1,7 +1,7 @@
using System;
using Microsoft.AspNetCore.Components.RenderTree;
-namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnoticsAnalyzerTest
+namespace Microsoft.AspNetCore.Components.Analyzers.Tests.TestFiles.ComponentInternalUsageDiagnosticsAnalyzerTest
{
class UsesRenderTreeFrameTypeAsLocal
{
diff --git a/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netcoreapp.cs b/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netcoreapp.cs
index ca0535937a..1ed5ecbf0e 100644
--- a/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netcoreapp.cs
+++ b/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netcoreapp.cs
@@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Components.Authorization
public partial class AuthenticationState
{
public AuthenticationState(System.Security.Claims.ClaimsPrincipal user) { }
- public System.Security.Claims.ClaimsPrincipal User { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Security.Claims.ClaimsPrincipal User { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public delegate void AuthenticationStateChangedHandler(System.Threading.Tasks.Task task);
public abstract partial class AuthenticationStateProvider
@@ -20,33 +20,33 @@ namespace Microsoft.AspNetCore.Components.Authorization
{
public AuthorizeRouteView() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void Render(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) { }
}
public partial class AuthorizeView : Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore
{
public AuthorizeView() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public string Policy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Policy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public string Roles { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Roles { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override Microsoft.AspNetCore.Authorization.IAuthorizeData[] GetAuthorizeData() { throw null; }
}
public abstract partial class AuthorizeViewCore : Microsoft.AspNetCore.Components.ComponentBase
{
protected AuthorizeViewCore() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public object Resource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public object Resource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) { }
protected abstract Microsoft.AspNetCore.Authorization.IAuthorizeData[] GetAuthorizeData();
[System.Diagnostics.DebuggerStepThroughAttribute]
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Components.Authorization
{
public CascadingAuthenticationState() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { }
protected override void OnInitialized() { }
void System.IDisposable.Dispose() { }
diff --git a/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netstandard2.0.cs b/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netstandard2.0.cs
index ca0535937a..1ed5ecbf0e 100644
--- a/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netstandard2.0.cs
+++ b/src/Components/Authorization/ref/Microsoft.AspNetCore.Components.Authorization.netstandard2.0.cs
@@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Components.Authorization
public partial class AuthenticationState
{
public AuthenticationState(System.Security.Claims.ClaimsPrincipal user) { }
- public System.Security.Claims.ClaimsPrincipal User { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Security.Claims.ClaimsPrincipal User { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public delegate void AuthenticationStateChangedHandler(System.Threading.Tasks.Task task);
public abstract partial class AuthenticationStateProvider
@@ -20,33 +20,33 @@ namespace Microsoft.AspNetCore.Components.Authorization
{
public AuthorizeRouteView() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void Render(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) { }
}
public partial class AuthorizeView : Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore
{
public AuthorizeView() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public string Policy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Policy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public string Roles { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Roles { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override Microsoft.AspNetCore.Authorization.IAuthorizeData[] GetAuthorizeData() { throw null; }
}
public abstract partial class AuthorizeViewCore : Microsoft.AspNetCore.Components.ComponentBase
{
protected AuthorizeViewCore() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment Authorizing { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment NotAuthorized { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public object Resource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public object Resource { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) { }
protected abstract Microsoft.AspNetCore.Authorization.IAuthorizeData[] GetAuthorizeData();
[System.Diagnostics.DebuggerStepThroughAttribute]
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Components.Authorization
{
public CascadingAuthenticationState() { }
[Microsoft.AspNetCore.Components.ParameterAttribute]
- public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { }
protected override void OnInitialized() { }
void System.IDisposable.Dispose() { }
diff --git a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs
index b8062d72c0..583e9efc50 100644
--- a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs
+++ b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs
@@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Blazor.Hosting
public sealed partial class WebAssemblyHostBuilderContext
{
public WebAssemblyHostBuilderContext(System.Collections.Generic.IDictionary
byte[] Encrypt(ArraySegment plaintext, ArraySegment additionalAuthenticatedData, uint preBufferSize, uint postBufferSize);
diff --git a/src/DataProtection/DataProtection/src/IDataProtectionBuilder.cs b/src/DataProtection/DataProtection/src/IDataProtectionBuilder.cs
index 95c7c61f50..68db854e74 100644
--- a/src/DataProtection/DataProtection/src/IDataProtectionBuilder.cs
+++ b/src/DataProtection/DataProtection/src/IDataProtectionBuilder.cs
@@ -15,14 +15,14 @@ namespace Microsoft.AspNetCore.DataProtection
///
///
/// If the developer changes the at-rest key protection mechanism, it is intended that
- /// he also change the key storage location, and vice versa. For instance, a call to
+ /// they also change the key storage location, and vice versa. For instance, a call to
/// should generally be accompanied by
/// a call to , or exceptions may
/// occur at runtime due to the data protection system not knowing where to persist keys.
///
///
/// Similarly, when a developer modifies the default protected payload cryptographic
- /// algorithms, it is intended that he also select an explitiy key storage location.
+ /// algorithms, they should also set an explicit key storage location.
/// A call to
/// should therefore generally be paired with a call to ,
/// for example.
@@ -40,4 +40,4 @@ namespace Microsoft.AspNetCore.DataProtection
///
IServiceCollection Services { get; }
}
-}
\ No newline at end of file
+}
diff --git a/src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs b/src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs
index d1857d76d2..9fd73d6125 100644
--- a/src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs
+++ b/src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs
@@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.DataProtection.KeyManagement
}
}
- // Do we need to notify the caller that he should reprotect the data?
+ // Do we need to notify the caller that they should reprotect the data?
status = UnprotectStatus.Ok;
if (keyIdFromPayload != currentKeyRing.DefaultKeyId)
{
diff --git a/src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs b/src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs
index 8f3fa1904d..badea8559c 100644
--- a/src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs
+++ b/src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs
@@ -226,9 +226,9 @@ namespace Microsoft.AspNetCore.DataProtection.KeyManagement
Volatile.Write(ref _cacheableKeyRing, existingCacheableKeyRing.WithTemporaryExtendedLifetime(utcNow));
}
- // The immediate caller should fail so that he can report the error up his chain. This makes it more likely
+ // The immediate caller should fail so that they can report the error up the chain. This makes it more likely
// that an administrator can see the error and react to it as appropriate. The caller can retry the operation
- // and will probably have success as long as he falls within the temporary extension mentioned above.
+ // and will probably have success as long as they fall within the temporary extension mentioned above.
throw;
}
diff --git a/src/DataProtection/EntityFrameworkCore/ref/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.netstandard2.1.cs b/src/DataProtection/EntityFrameworkCore/ref/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.netstandard2.1.cs
index 6c4ae69807..67ab1ae859 100644
--- a/src/DataProtection/EntityFrameworkCore/ref/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.netstandard2.1.cs
+++ b/src/DataProtection/EntityFrameworkCore/ref/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.netstandard2.1.cs
@@ -13,9 +13,9 @@ namespace Microsoft.AspNetCore.DataProtection.EntityFrameworkCore
public partial class DataProtectionKey
{
public DataProtectionKey() { }
- public string FriendlyName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int Id { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Xml { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string FriendlyName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int Id { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Xml { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class EntityFrameworkCoreXmlRepository : Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository where TContext : Microsoft.EntityFrameworkCore.DbContext, Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.IDataProtectionKeyContext
{
diff --git a/src/DataProtection/README.md b/src/DataProtection/README.md
index cd58074d9e..4c558753b0 100644
--- a/src/DataProtection/README.md
+++ b/src/DataProtection/README.md
@@ -1,7 +1,7 @@
DataProtection
==============
-Data Protection APIs for protecting and unprotecting data. You can find documentation for Data Protection in the [ASP.NET Core Documentation](https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/).
+Data Protection APIs for protecting and unprotecting data. You can find documentation for Data Protection in the [ASP.NET Core Documentation](https://docs.microsoft.com/aspnet/core/security/data-protection/).
## Community Maintained Data Protection Providers & Projects
diff --git a/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs b/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs
index 79ef5dfc33..da51bb4a3c 100644
--- a/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs
+++ b/src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs
@@ -158,7 +158,7 @@ namespace Microsoft.AspNetCore.Tests
var applicationName = "CreateDefaultBuilderApp";
var deploymentParameters = new DeploymentParameters(Path.Combine(GetTestSitesPath(), applicationName), ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
{
- TargetFramework = "netcoreapp3.1",
+ TargetFramework = "netcoreapp5.0",
HostingModel = HostingModel.InProcess
};
@@ -213,7 +213,7 @@ namespace Microsoft.AspNetCore.Tests
{
var deploymentParameters = new DeploymentParameters(Path.Combine(GetTestSitesPath(), applicationName), ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
{
- TargetFramework = "netcoreapp3.1",
+ TargetFramework = "netcoreapp5.0",
};
if (setTestEnvVars)
diff --git a/src/Features/JsonPatch/JsonPatch.sln b/src/Features/JsonPatch/JsonPatch.sln
new file mode 100644
index 0000000000..efa5fbdf86
--- /dev/null
+++ b/src/Features/JsonPatch/JsonPatch.sln
@@ -0,0 +1,48 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.JsonPatch", "src\Microsoft.AspNetCore.JsonPatch.csproj", "{B2094419-9ED4-4733-B15D-60314118B61C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.JsonPatch.Tests", "test\Microsoft.AspNetCore.JsonPatch.Tests.csproj", "{4F34177F-6E1E-4880-A2CA-0511EFEDB395}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|x64.Build.0 = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Debug|x86.Build.0 = Debug|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|x64.ActiveCfg = Release|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|x64.Build.0 = Release|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|x86.ActiveCfg = Release|Any CPU
+ {B2094419-9ED4-4733-B15D-60314118B61C}.Release|x86.Build.0 = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|x64.Build.0 = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Debug|x86.Build.0 = Debug|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|x64.ActiveCfg = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|x64.Build.0 = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|x86.ActiveCfg = Release|Any CPU
+ {4F34177F-6E1E-4880-A2CA-0511EFEDB395}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/src/Features/JsonPatch/ref/Microsoft.AspNetCore.JsonPatch.netstandard2.0.cs b/src/Features/JsonPatch/ref/Microsoft.AspNetCore.JsonPatch.netstandard2.0.cs
index f8ba24f51f..61ba9315d9 100644
--- a/src/Features/JsonPatch/ref/Microsoft.AspNetCore.JsonPatch.netstandard2.0.cs
+++ b/src/Features/JsonPatch/ref/Microsoft.AspNetCore.JsonPatch.netstandard2.0.cs
@@ -14,8 +14,8 @@ namespace Microsoft.AspNetCore.JsonPatch
public JsonPatchDocument() { }
public JsonPatchDocument(System.Collections.Generic.List operations, Newtonsoft.Json.Serialization.IContractResolver contractResolver) { }
[Newtonsoft.Json.JsonIgnoreAttribute]
- public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Collections.Generic.List Operations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Collections.Generic.List Operations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.JsonPatch.JsonPatchDocument Add(string path, object value) { throw null; }
public void ApplyTo(object objectToApplyTo) { }
public void ApplyTo(object objectToApplyTo, Microsoft.AspNetCore.JsonPatch.Adapters.IObjectAdapter adapter) { }
@@ -34,8 +34,8 @@ namespace Microsoft.AspNetCore.JsonPatch
public JsonPatchDocument() { }
public JsonPatchDocument(System.Collections.Generic.List> operations, Newtonsoft.Json.Serialization.IContractResolver contractResolver) { }
[Newtonsoft.Json.JsonIgnoreAttribute]
- public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Collections.Generic.List> Operations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Collections.Generic.List> Operations { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.JsonPatch.JsonPatchDocument Add(System.Linq.Expressions.Expression>> path, TProp value) { throw null; }
public Microsoft.AspNetCore.JsonPatch.JsonPatchDocument Add(System.Linq.Expressions.Expression>> path, TProp value, int position) { throw null; }
public Microsoft.AspNetCore.JsonPatch.JsonPatchDocument Add(System.Linq.Expressions.Expression> path, TProp value) { throw null; }
@@ -69,15 +69,15 @@ namespace Microsoft.AspNetCore.JsonPatch
public partial class JsonPatchError
{
public JsonPatchError(object affectedObject, Microsoft.AspNetCore.JsonPatch.Operations.Operation operation, string errorMessage) { }
- public object AffectedObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.JsonPatch.Operations.Operation Operation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public object AffectedObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string ErrorMessage { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.JsonPatch.Operations.Operation Operation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public partial class JsonPatchProperty
{
public JsonPatchProperty(Newtonsoft.Json.Serialization.JsonProperty property, object parent) { }
- public object Parent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Newtonsoft.Json.Serialization.JsonProperty Property { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public object Parent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Newtonsoft.Json.Serialization.JsonProperty Property { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.JsonPatch.Adapters
@@ -107,9 +107,9 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
{
public ObjectAdapter(Newtonsoft.Json.Serialization.IContractResolver contractResolver, System.Action logErrorAction) { }
public ObjectAdapter(Newtonsoft.Json.Serialization.IContractResolver contractResolver, System.Action logErrorAction, Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory adapterFactory) { }
- public Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory AdapterFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Action LogErrorAction { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.JsonPatch.Adapters.IAdapterFactory AdapterFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Newtonsoft.Json.Serialization.IContractResolver ContractResolver { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Action LogErrorAction { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public void Add(Microsoft.AspNetCore.JsonPatch.Operations.Operation operation, object objectToApplyTo) { }
public void Copy(Microsoft.AspNetCore.JsonPatch.Operations.Operation operation, object objectToApplyTo) { }
public void Move(Microsoft.AspNetCore.JsonPatch.Operations.Operation operation, object objectToApplyTo) { }
@@ -141,8 +141,8 @@ namespace Microsoft.AspNetCore.JsonPatch.Exceptions
public JsonPatchException(Microsoft.AspNetCore.JsonPatch.JsonPatchError jsonPatchError) { }
public JsonPatchException(Microsoft.AspNetCore.JsonPatch.JsonPatchError jsonPatchError, System.Exception innerException) { }
public JsonPatchException(string message, System.Exception innerException) { }
- public object AffectedObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.JsonPatch.Operations.Operation FailedOperation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public object AffectedObject { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.JsonPatch.Operations.Operation FailedOperation { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
}
namespace Microsoft.AspNetCore.JsonPatch.Helpers
@@ -150,8 +150,8 @@ namespace Microsoft.AspNetCore.JsonPatch.Helpers
public partial class GetValueResult
{
public GetValueResult(object propertyValue, bool hasError) { }
- public bool HasError { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public object PropertyValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public bool HasError { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public object PropertyValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
}
namespace Microsoft.AspNetCore.JsonPatch.Internal
@@ -159,8 +159,8 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
public partial class ConversionResult
{
public ConversionResult(bool canBeConverted, object convertedInstance) { }
- public bool CanBeConverted { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public object ConvertedInstance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public bool CanBeConverted { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public object ConvertedInstance { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public static partial class ConversionResultProvider
{
@@ -201,6 +201,16 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
bool TryTest(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, object value, out string errorMessage);
bool TryTraverse(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out object nextTarget, out string errorMessage);
}
+ public partial class JObjectAdapter : Microsoft.AspNetCore.JsonPatch.Internal.IAdapter
+ {
+ public JObjectAdapter() { }
+ public virtual bool TryAdd(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, object value, out string errorMessage) { throw null; }
+ public virtual bool TryGet(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out object value, out string errorMessage) { throw null; }
+ public virtual bool TryRemove(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out string errorMessage) { throw null; }
+ public virtual bool TryReplace(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, object value, out string errorMessage) { throw null; }
+ public virtual bool TryTest(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, object value, out string errorMessage) { throw null; }
+ public virtual bool TryTraverse(object target, string segment, Newtonsoft.Json.Serialization.IContractResolver contractResolver, out object nextTarget, out string errorMessage) { throw null; }
+ }
public partial class ListAdapter : Microsoft.AspNetCore.JsonPatch.Internal.IAdapter
{
public ListAdapter() { }
@@ -225,8 +235,8 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
{
private readonly int _dummyPrimitive;
public PositionInfo(Microsoft.AspNetCore.JsonPatch.Internal.ListAdapter.PositionType type, int index) { throw null; }
- public int Index { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.JsonPatch.Internal.ListAdapter.PositionType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public int Index { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.JsonPatch.Internal.ListAdapter.PositionType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
protected enum PositionType
{
@@ -246,6 +256,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
public readonly partial struct ParsedPath
{
private readonly object _dummy;
+ private readonly int _dummyPrimitive;
public ParsedPath(string path) { throw null; }
public string LastSegment { get { throw null; } }
public System.Collections.Generic.IReadOnlyList Segments { get { throw null; } }
@@ -271,7 +282,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Operations
public Operation(string op, string path, string from) { }
public Operation(string op, string path, string from, object value) { }
[Newtonsoft.Json.JsonPropertyAttribute("value")]
- public object value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public object value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public void Apply(object objectToApplyTo, Microsoft.AspNetCore.JsonPatch.Adapters.IObjectAdapter adapter) { }
public bool ShouldSerializevalue() { throw null; }
}
@@ -280,13 +291,13 @@ namespace Microsoft.AspNetCore.JsonPatch.Operations
public OperationBase() { }
public OperationBase(string op, string path, string from) { }
[Newtonsoft.Json.JsonPropertyAttribute("from")]
- public string from { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string from { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[Newtonsoft.Json.JsonPropertyAttribute("op")]
public string op { get { throw null; } set { } }
[Newtonsoft.Json.JsonIgnoreAttribute]
public Microsoft.AspNetCore.JsonPatch.Operations.OperationType OperationType { get { throw null; } }
[Newtonsoft.Json.JsonPropertyAttribute("path")]
- public string path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public bool ShouldSerializefrom() { throw null; }
}
public enum OperationType
diff --git a/src/Features/JsonPatch/src/Adapters/AdapterFactory.cs b/src/Features/JsonPatch/src/Adapters/AdapterFactory.cs
index 078f83e175..ff91018a88 100644
--- a/src/Features/JsonPatch/src/Adapters/AdapterFactory.cs
+++ b/src/Features/JsonPatch/src/Adapters/AdapterFactory.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.JsonPatch.Internal;
+using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections;
@@ -29,6 +30,10 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
var jsonContract = contractResolver.ResolveContract(target.GetType());
+ if (target is JObject)
+ {
+ return new JObjectAdapter();
+ }
if (target is IList)
{
return new ListAdapter();
diff --git a/src/Features/JsonPatch/src/Adapters/IObjectAdapter.cs b/src/Features/JsonPatch/src/Adapters/IObjectAdapter.cs
index e5206bfa0d..0c15ce0ae6 100644
--- a/src/Features/JsonPatch/src/Adapters/IObjectAdapter.cs
+++ b/src/Features/JsonPatch/src/Adapters/IObjectAdapter.cs
@@ -7,18 +7,18 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
{
///
/// Defines the operations that can be performed on a JSON patch document.
- ///
+ ///
public interface IObjectAdapter
{
///
/// Using the "add" operation a new value is inserted into the root of the target
/// document, into the target array at the specified valid index, or to a target object at
/// the specified location.
- ///
- /// When adding to arrays, the specified index MUST NOT be greater than the number of elements in the array.
+ ///
+ /// When adding to arrays, the specified index MUST NOT be greater than the number of elements in the array.
/// To append the value to the array, the index of "-" character is used (see [RFC6901]).
- ///
- /// When adding to an object, if an object member does not already exist, a new member is added to the object at the
+ ///
+ /// When adding to an object, if an object member does not already exist, a new member is added to the object at the
/// specified location or if an object member does exist, that member's value is replaced.
///
/// The operation object MUST contain a "value" member whose content
@@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
/// For example:
///
/// { "op": "copy", "from": "/a/b/c", "path": "/a/b/e" }
- ///
+ ///
/// See RFC 6902 https://tools.ietf.org/html/rfc6902#page-7
///
/// The copy operation.
@@ -67,7 +67,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
/// { "op": "move", "from": "/a/b/c", "path": "/a/b/d" }
///
/// A location cannot be moved into one of its children.
- ///
+ ///
/// See RFC 6902 https://tools.ietf.org/html/rfc6902#page-6
///
/// The move operation.
@@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
///
/// If removing an element from an array, any elements above the
/// specified index are shifted one position to the left.
- ///
+ ///
/// See RFC 6902 https://tools.ietf.org/html/rfc6902#page-6
///
/// The remove operation.
@@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
void Remove(Operation operation, object objectToApplyTo);
///
- /// Using the "replace" operation he value at the target location is replaced
+ /// Using the "replace" operation the value at the target location is replaced
/// with a new value. The operation object MUST contain a "value" member
/// which specifies the replacement value.
///
@@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Adapters
/// For example:
///
/// { "op": "replace", "path": "/a/b/c", "value": 42 }
- ///
+ ///
/// See RFC 6902 https://tools.ietf.org/html/rfc6902#page-6
///
/// The replace operation.
diff --git a/src/Features/JsonPatch/src/Internal/JObjectAdapter.cs b/src/Features/JsonPatch/src/Internal/JObjectAdapter.cs
new file mode 100644
index 0000000000..8354d2043b
--- /dev/null
+++ b/src/Features/JsonPatch/src/Internal/JObjectAdapter.cs
@@ -0,0 +1,140 @@
+using Microsoft.AspNetCore.JsonPatch.Internal;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Newtonsoft.Json.Serialization;
+
+namespace Microsoft.AspNetCore.JsonPatch.Internal
+{
+ public class JObjectAdapter : IAdapter
+ {
+ public virtual bool TryAdd(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ object value,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ obj[segment] = JToken.FromObject(value);
+
+ errorMessage = null;
+ return true;
+ }
+
+ public virtual bool TryGet(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ out object value,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ if (!obj.ContainsKey(segment))
+ {
+ value = null;
+ errorMessage = Resources.FormatTargetLocationAtPathSegmentNotFound(segment);
+ return false;
+ }
+
+ value = obj[segment];
+ errorMessage = null;
+ return true;
+ }
+
+ public virtual bool TryRemove(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ if (!obj.ContainsKey(segment))
+ {
+ errorMessage = Resources.FormatTargetLocationAtPathSegmentNotFound(segment);
+ return false;
+ }
+
+ obj.Remove(segment);
+ errorMessage = null;
+ return true;
+ }
+
+ public virtual bool TryReplace(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ object value,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ if (!obj.ContainsKey(segment))
+ {
+ errorMessage = Resources.FormatTargetLocationAtPathSegmentNotFound(segment);
+ return false;
+ }
+
+ obj[segment] = JToken.FromObject(value);
+
+ errorMessage = null;
+ return true;
+ }
+
+ public virtual bool TryTest(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ object value,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ if (!obj.ContainsKey(segment))
+ {
+ errorMessage = Resources.FormatTargetLocationAtPathSegmentNotFound(segment);
+ return false;
+ }
+
+ var currentValue = obj[segment];
+
+ if (currentValue == null || string.IsNullOrEmpty(currentValue.ToString()))
+ {
+ errorMessage = Resources.FormatValueForTargetSegmentCannotBeNullOrEmpty(segment);
+ return false;
+ }
+
+ if (!JToken.DeepEquals(JsonConvert.SerializeObject(currentValue), JsonConvert.SerializeObject(value)))
+ {
+ errorMessage = Resources.FormatValueNotEqualToTestValue(currentValue, value, segment);
+ return false;
+ }
+
+ errorMessage = null;
+ return true;
+ }
+
+ public virtual bool TryTraverse(
+ object target,
+ string segment,
+ IContractResolver contractResolver,
+ out object nextTarget,
+ out string errorMessage)
+ {
+ var obj = (JObject) target;
+
+ if (!obj.ContainsKey(segment))
+ {
+ nextTarget = null;
+ errorMessage = null;
+ return false;
+ }
+
+ nextTarget = obj[segment];
+ errorMessage = null;
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Features/JsonPatch/test/JsonPatchDocumentJObjectTest.cs b/src/Features/JsonPatch/test/JsonPatchDocumentJObjectTest.cs
new file mode 100644
index 0000000000..271f100871
--- /dev/null
+++ b/src/Features/JsonPatch/test/JsonPatchDocumentJObjectTest.cs
@@ -0,0 +1,144 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Collections.Generic;
+using System.Dynamic;
+using Microsoft.AspNetCore.JsonPatch.Exceptions;
+using Microsoft.AspNetCore.JsonPatch.Operations;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.JsonPatch
+{
+ public class JsonPatchDocumentJObjectTest
+ {
+ [Fact]
+ public void ApplyTo_Array_Add()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { Emails = new[] { "foo@bar.com" } })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("add", "/CustomData/Emails/-", null, "foo@baz.com"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.Equal("foo@baz.com", model.CustomData["Emails"][1].Value());
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Test1()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { Email = "foo@bar.com", Name = "Bar" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("test", "/CustomData/Email", null, "foo@baz.com"));
+ patch.Operations.Add(new Operation("add", "/CustomData/Name", null, "Bar Baz"));
+
+ // Act & Assert
+ Assert.Throws(() => patch.ApplyTo(model));
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Test2()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { Email = "foo@bar.com", Name = "Bar" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("test", "/CustomData/Email", null, "foo@bar.com"));
+ patch.Operations.Add(new Operation("add", "/CustomData/Name", null, "Bar Baz"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.Equal("Bar Baz", model.CustomData["Name"].Value());
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Copy()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { Email = "foo@bar.com" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("copy", "/CustomData/UserName", "/CustomData/Email"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.Equal("foo@bar.com", model.CustomData["UserName"].Value());
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Remove()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { FirstName = "Foo", LastName = "Bar" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("remove", "/CustomData/LastName", null));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.False(model.CustomData.ContainsKey("LastName"));
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Move()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { FirstName = "Bar" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("move", "/CustomData/LastName", "/CustomData/FirstName"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.False(model.CustomData.ContainsKey("FirstName"));
+ Assert.Equal("Bar", model.CustomData["LastName"].Value());
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Add()
+ {
+ // Arrange
+ var model = new ObjectWithJObject();
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("add", "/CustomData/Name", null, "Foo"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.Equal("Foo", model.CustomData["Name"].Value());
+ }
+
+ [Fact]
+ public void ApplyTo_Model_Replace()
+ {
+ // Arrange
+ var model = new ObjectWithJObject{ CustomData = JObject.FromObject(new { Email = "foo@bar.com", Name = "Bar" })};
+ var patch = new JsonPatchDocument();
+
+ patch.Operations.Add(new Operation("replace", "/CustomData/Email", null, "foo@baz.com"));
+
+ // Act
+ patch.ApplyTo(model);
+
+ // Assert
+ Assert.Equal("foo@baz.com", model.CustomData["Email"].Value());
+ }
+ }
+}
diff --git a/src/Features/JsonPatch/test/TestObjectModels/ObjectWithJObject.cs b/src/Features/JsonPatch/test/TestObjectModels/ObjectWithJObject.cs
new file mode 100644
index 0000000000..188ca034d2
--- /dev/null
+++ b/src/Features/JsonPatch/test/TestObjectModels/ObjectWithJObject.cs
@@ -0,0 +1,9 @@
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.AspNetCore.JsonPatch
+{
+ public class ObjectWithJObject
+ {
+ public JObject CustomData { get; set; } = new JObject();
+ }
+}
diff --git a/src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs b/src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs
index 4a3b8668f1..6b12e045e8 100644
--- a/src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs
+++ b/src/Hosting/Abstractions/ref/Microsoft.AspNetCore.Hosting.Abstractions.netcoreapp.cs
@@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Hosting
public sealed partial class HostingStartupAttribute : System.Attribute
{
public HostingStartupAttribute(System.Type hostingStartupType) { }
- public System.Type HostingStartupType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Type HostingStartupType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
[System.ObsoleteAttribute("This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostApplicationLifetime.", false)]
public partial interface IApplicationLifetime
@@ -104,8 +104,8 @@ namespace Microsoft.AspNetCore.Hosting
public partial class WebHostBuilderContext
{
public WebHostBuilderContext() { }
- public Microsoft.Extensions.Configuration.IConfiguration Configuration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.Extensions.Configuration.IConfiguration Configuration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public static partial class WebHostDefaults
{
diff --git a/src/Hosting/Hosting/ref/Microsoft.AspNetCore.Hosting.netcoreapp.cs b/src/Hosting/Hosting/ref/Microsoft.AspNetCore.Hosting.netcoreapp.cs
index 5a17de6ee4..b87c115dea 100644
--- a/src/Hosting/Hosting/ref/Microsoft.AspNetCore.Hosting.netcoreapp.cs
+++ b/src/Hosting/Hosting/ref/Microsoft.AspNetCore.Hosting.netcoreapp.cs
@@ -73,8 +73,8 @@ namespace Microsoft.AspNetCore.Hosting.Server.Features
public partial class ServerAddressesFeature : Microsoft.AspNetCore.Hosting.Server.Features.IServerAddressesFeature
{
public ServerAddressesFeature() { }
- public System.Collections.Generic.ICollection Addresses { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public bool PreferHostingUrls { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public System.Collections.Generic.ICollection Addresses { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public bool PreferHostingUrls { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Hosting.StaticWebAssets
diff --git a/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs b/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs
index 89c6b4e941..701855e913 100644
--- a/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs
+++ b/src/Hosting/Hosting/src/GenericHost/GenericWebHostedService.cs
@@ -173,6 +173,7 @@ namespace Microsoft.AspNetCore.Hosting
{
var exceptionDetailProvider = new ExceptionDetailsProvider(
HostingEnvironment.ContentRootFileProvider,
+ Logger,
sourceCodeLineCount: 6);
model.ErrorDetails = exceptionDetailProvider.GetDetails(exception);
diff --git a/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs b/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs
index 08ecd9b057..2637a8b3a6 100644
--- a/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs
+++ b/src/Hosting/Hosting/src/Http/DefaultHttpContextFactory.cs
@@ -26,6 +26,8 @@ namespace Microsoft.AspNetCore.Http
_serviceScopeFactory = serviceProvider.GetRequiredService();
}
+ internal IHttpContextAccessor HttpContextAccessor => _httpContextAccessor;
+
public HttpContext Create(IFeatureCollection featureCollection)
{
if (featureCollection is null)
diff --git a/src/Hosting/Hosting/src/Internal/HostingApplication.cs b/src/Hosting/Hosting/src/Internal/HostingApplication.cs
index c64426c0db..8432661215 100644
--- a/src/Hosting/Hosting/src/Internal/HostingApplication.cs
+++ b/src/Hosting/Hosting/src/Internal/HostingApplication.cs
@@ -96,6 +96,14 @@ namespace Microsoft.AspNetCore.Hosting
if (_defaultHttpContextFactory != null)
{
_defaultHttpContextFactory.Dispose((DefaultHttpContext)httpContext);
+
+ if (_defaultHttpContextFactory.HttpContextAccessor != null)
+ {
+ // Clear the HttpContext if the accessor was used. It's likely that the lifetime extends
+ // past the end of the http request and we want to avoid changing the reference from under
+ // consumers.
+ context.HttpContext = null;
+ }
}
else
{
@@ -114,6 +122,7 @@ namespace Microsoft.AspNetCore.Hosting
public HttpContext HttpContext { get; set; }
public IDisposable Scope { get; set; }
public Activity Activity { get; set; }
+ internal HostingRequestStartingLog StartLog { get; set; }
public long StartTimestamp { get; set; }
internal bool HasDiagnosticListener { get; set; }
@@ -125,6 +134,7 @@ namespace Microsoft.AspNetCore.Hosting
Scope = null;
Activity = null;
+ StartLog = null;
StartTimestamp = 0;
HasDiagnosticListener = false;
diff --git a/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs b/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
index 65730d67ff..385bcbf46d 100644
--- a/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
+++ b/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
@@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Hosting
}
// Non-inline
- LogRequestStarting(httpContext);
+ LogRequestStarting(context);
}
}
context.StartTimestamp = startTimestamp;
@@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Hosting
{
currentTimestamp = Stopwatch.GetTimestamp();
// Non-inline
- LogRequestFinished(httpContext, startTimestamp, currentTimestamp);
+ LogRequestFinished(context, startTimestamp, currentTimestamp);
}
if (_diagnosticListener.IsEnabled())
@@ -167,30 +167,34 @@ namespace Microsoft.AspNetCore.Hosting
}
[MethodImpl(MethodImplOptions.NoInlining)]
- private void LogRequestStarting(HttpContext httpContext)
+ private void LogRequestStarting(HostingApplication.Context context)
{
// IsEnabled is checked in the caller, so if we are here just log
+ var startLog = new HostingRequestStartingLog(context.HttpContext);
+ context.StartLog = startLog;
+
_logger.Log(
logLevel: LogLevel.Information,
eventId: LoggerEventIds.RequestStarting,
- state: new HostingRequestStartingLog(httpContext),
+ state: startLog,
exception: null,
formatter: HostingRequestStartingLog.Callback);
}
[MethodImpl(MethodImplOptions.NoInlining)]
- private void LogRequestFinished(HttpContext httpContext, long startTimestamp, long currentTimestamp)
+ private void LogRequestFinished(HostingApplication.Context context, long startTimestamp, long currentTimestamp)
{
// IsEnabled isn't checked in the caller, startTimestamp > 0 is used as a fast proxy check
- // but that may be because diagnostics are enabled, which also uses startTimestamp, so check here
- if (_logger.IsEnabled(LogLevel.Information))
+ // but that may be because diagnostics are enabled, which also uses startTimestamp,
+ // so check if we logged the start event
+ if (context.StartLog != null)
{
var elapsed = new TimeSpan((long)(TimestampToTicks * (currentTimestamp - startTimestamp)));
_logger.Log(
logLevel: LogLevel.Information,
eventId: LoggerEventIds.RequestFinished,
- state: new HostingRequestFinishedLog(httpContext, elapsed),
+ state: new HostingRequestFinishedLog(context, elapsed),
exception: null,
formatter: HostingRequestFinishedLog.Callback);
}
diff --git a/src/Hosting/Hosting/src/Internal/HostingRequestFinishedLog.cs b/src/Hosting/Hosting/src/Internal/HostingRequestFinishedLog.cs
index 63fd5f0921..09a132851d 100644
--- a/src/Hosting/Hosting/src/Internal/HostingRequestFinishedLog.cs
+++ b/src/Hosting/Hosting/src/Internal/HostingRequestFinishedLog.cs
@@ -9,51 +9,56 @@ using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Hosting
{
+ using static HostingRequestStartingLog;
+
internal class HostingRequestFinishedLog : IReadOnlyList>
{
internal static readonly Func Callback = (state, exception) => ((HostingRequestFinishedLog)state).ToString();
- private readonly HttpContext _httpContext;
- private readonly TimeSpan _elapsed;
+ private readonly HostingApplication.Context _context;
private string _cachedToString;
+ public TimeSpan Elapsed { get; }
- public int Count => 3;
+ public int Count => 11;
public KeyValuePair this[int index]
{
get
{
- switch (index)
+ var request = _context.HttpContext.Request;
+ var response = _context.HttpContext.Response;
+
+ return index switch
{
- case 0:
- return new KeyValuePair("ElapsedMilliseconds", _elapsed.TotalMilliseconds);
- case 1:
- return new KeyValuePair("StatusCode", _httpContext.Response.StatusCode);
- case 2:
- return new KeyValuePair("ContentType", _httpContext.Response.ContentType);
- default:
- throw new IndexOutOfRangeException(nameof(index));
- }
+ 0 => new KeyValuePair("ElapsedMilliseconds", Elapsed.TotalMilliseconds),
+ 1 => new KeyValuePair(nameof(response.StatusCode), response.StatusCode),
+ 2 => new KeyValuePair(nameof(response.ContentType), response.ContentType),
+ 3 => new KeyValuePair(nameof(response.ContentLength), response.ContentLength),
+ 4 => new KeyValuePair(nameof(request.Protocol), request.Protocol),
+ 5 => new KeyValuePair(nameof(request.Method), request.Method),
+ 6 => new KeyValuePair(nameof(request.Scheme), request.Scheme),
+ 7 => new KeyValuePair(nameof(request.Host), request.Host.Value),
+ 8 => new KeyValuePair(nameof(request.PathBase), request.PathBase.Value),
+ 9 => new KeyValuePair(nameof(request.Path), request.Path.Value),
+ 10 => new KeyValuePair(nameof(request.QueryString), request.QueryString.Value),
+ _ => throw new IndexOutOfRangeException(nameof(index)),
+ };
}
}
- public HostingRequestFinishedLog(HttpContext httpContext, TimeSpan elapsed)
+ public HostingRequestFinishedLog(HostingApplication.Context context, TimeSpan elapsed)
{
- _httpContext = httpContext;
- _elapsed = elapsed;
+ _context = context;
+ Elapsed = elapsed;
}
public override string ToString()
{
if (_cachedToString == null)
{
- _cachedToString = string.Format(
- CultureInfo.InvariantCulture,
- "Request finished in {0}ms {1} {2}",
- _elapsed.TotalMilliseconds,
- _httpContext.Response.StatusCode,
- _httpContext.Response.ContentType);
+ var response = _context.HttpContext.Response;
+ _cachedToString = $"Request finished {_context.StartLog.ToStringWithoutPreamble()} - {response.StatusCode.ToString(CultureInfo.InvariantCulture)} {ValueOrEmptyMarker(response.ContentLength)} {EscapedValueOrEmptyMarker(response.ContentType)} {Elapsed.TotalMilliseconds.ToString("0.0000", CultureInfo.InvariantCulture)}ms";
}
return _cachedToString;
diff --git a/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs b/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs
index 279fa06aed..3a7586b1c9 100644
--- a/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs
+++ b/src/Hosting/Hosting/src/Internal/HostingRequestStartingLog.cs
@@ -5,12 +5,16 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
+using System.Net;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Hosting
{
internal class HostingRequestStartingLog : IReadOnlyList>
{
+ private const string LogPreamble = "Request starting ";
+ private const string EmptyEntry = "-";
+
internal static readonly Func Callback = (state, exception) => ((HostingRequestStartingLog)state).ToString();
private readonly HttpRequest _request;
@@ -19,35 +23,19 @@ namespace Microsoft.AspNetCore.Hosting
public int Count => 9;
- public KeyValuePair this[int index]
+ public KeyValuePair this[int index] => index switch
{
- get
- {
- switch (index)
- {
- case 0:
- return new KeyValuePair("Protocol", _request.Protocol);
- case 1:
- return new KeyValuePair("Method", _request.Method);
- case 2:
- return new KeyValuePair("ContentType", _request.ContentType);
- case 3:
- return new KeyValuePair("ContentLength", _request.ContentLength);
- case 4:
- return new KeyValuePair("Scheme", _request.Scheme);
- case 5:
- return new KeyValuePair("Host", _request.Host.ToString());
- case 6:
- return new KeyValuePair("PathBase", _request.PathBase.ToString());
- case 7:
- return new KeyValuePair("Path", _request.Path.ToString());
- case 8:
- return new KeyValuePair("QueryString", _request.QueryString.ToString());
- default:
- throw new IndexOutOfRangeException(nameof(index));
- }
- }
- }
+ 0 => new KeyValuePair(nameof(_request.Protocol), _request.Protocol),
+ 1 => new KeyValuePair(nameof(_request.Method), _request.Method),
+ 2 => new KeyValuePair(nameof(_request.ContentType), _request.ContentType),
+ 3 => new KeyValuePair(nameof(_request.ContentLength), _request.ContentLength),
+ 4 => new KeyValuePair(nameof(_request.Scheme), _request.Scheme),
+ 5 => new KeyValuePair(nameof(_request.Host), _request.Host.Value),
+ 6 => new KeyValuePair(nameof(_request.PathBase), _request.PathBase.Value),
+ 7 => new KeyValuePair(nameof(_request.Path), _request.Path.Value),
+ 8 => new KeyValuePair(nameof(_request.QueryString), _request.QueryString.Value),
+ _ => throw new IndexOutOfRangeException(nameof(index)),
+ };
public HostingRequestStartingLog(HttpContext httpContext)
{
@@ -58,18 +46,8 @@ namespace Microsoft.AspNetCore.Hosting
{
if (_cachedToString == null)
{
- _cachedToString = string.Format(
- CultureInfo.InvariantCulture,
- "Request starting {0} {1} {2}://{3}{4}{5}{6} {7} {8}",
- _request.Protocol,
- _request.Method,
- _request.Scheme,
- _request.Host.Value,
- _request.PathBase.Value,
- _request.Path.Value,
- _request.QueryString.Value,
- _request.ContentType,
- _request.ContentLength);
+ var request = _request;
+ _cachedToString = $"{LogPreamble}{request.Protocol} {request.Method} {request.Scheme}://{request.Host.Value}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value} {EscapedValueOrEmptyMarker(request.ContentType)} {ValueOrEmptyMarker(request.ContentLength)}"; ;
}
return _cachedToString;
@@ -87,5 +65,15 @@ namespace Microsoft.AspNetCore.Hosting
{
return GetEnumerator();
}
+
+ internal string ToStringWithoutPreamble()
+ => ToString().Substring(LogPreamble.Length);
+
+ internal static string EscapedValueOrEmptyMarker(string potentialValue)
+ // Encode space as +
+ => potentialValue?.Length > 0 ? potentialValue.Replace(' ', '+') : EmptyEntry;
+
+ internal static string ValueOrEmptyMarker(T? potentialValue) where T : struct, IFormattable
+ => potentialValue?.ToString(null, CultureInfo.InvariantCulture) ?? EmptyEntry;
}
}
diff --git a/src/Hosting/Hosting/src/Internal/WebHost.cs b/src/Hosting/Hosting/src/Internal/WebHost.cs
index 6e976959e7..b016f751a8 100644
--- a/src/Hosting/Hosting/src/Internal/WebHost.cs
+++ b/src/Hosting/Hosting/src/Internal/WebHost.cs
@@ -270,6 +270,7 @@ namespace Microsoft.AspNetCore.Hosting
{
var exceptionDetailProvider = new ExceptionDetailsProvider(
hostingEnv.ContentRootFileProvider,
+ logger,
sourceCodeLineCount: 6);
model.ErrorDetails = exceptionDetailProvider.GetDetails(ex);
@@ -355,7 +356,7 @@ namespace Microsoft.AspNetCore.Hosting
public void Dispose()
{
- DisposeAsync().ConfigureAwait(false).GetAwaiter().GetResult();
+ DisposeAsync().GetAwaiter().GetResult();
}
public async ValueTask DisposeAsync()
diff --git a/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs
new file mode 100644
index 0000000000..385424fa67
--- /dev/null
+++ b/src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs
@@ -0,0 +1,532 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Features;
+using Microsoft.Extensions.Logging;
+using Moq;
+using Xunit;
+
+namespace Microsoft.AspNetCore.Hosting.Tests
+{
+ public class HostingApplicationDiagnosticsTests
+ {
+ [Fact]
+ public void DisposeContextDoesNotThrowWhenContextScopeIsNull()
+ {
+ // Arrange
+ var hostingApplication = CreateApplication(out var features);
+ var context = hostingApplication.CreateContext(features);
+
+ // Act/Assert
+ hostingApplication.DisposeContext(context, null);
+ }
+
+ [Fact]
+ public void CreateContextWithDisabledLoggerDoesNotCreateActivity()
+ {
+ // Arrange
+ var hostingApplication = CreateApplication(out var features);
+
+ // Act
+ hostingApplication.CreateContext(features);
+
+ Assert.Null(Activity.Current);
+ }
+
+ [Fact]
+ public void CreateContextWithEnabledLoggerCreatesActivityAndSetsActivityInScope()
+ {
+ // Arrange
+ var logger = new LoggerWithScopes(isEnabled: true);
+ var hostingApplication = CreateApplication(out var features, logger: logger);
+
+ // Act
+ var context = hostingApplication.CreateContext(features);
+
+ Assert.Single(logger.Scopes);
+ var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
+ Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
+ Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
+ Assert.Equal(string.Empty, pairs["ParentId"]?.ToString());
+ }
+
+ [Fact]
+ public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActivityInScope()
+ {
+ // Arrange
+
+ // Generate an id we can use for the request id header (in the correct format)
+ var activity = new Activity("IncomingRequest");
+ activity.Start();
+ var id = activity.Id;
+ activity.Stop();
+
+ var logger = new LoggerWithScopes(isEnabled: true);
+ var hostingApplication = CreateApplication(out var features, logger: logger, configure: context =>
+ {
+ context.Request.Headers["Request-Id"] = id;
+ });
+
+ // Act
+ var context = hostingApplication.CreateContext(features);
+
+ Assert.Single(logger.Scopes);
+ var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
+ Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
+ Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
+ Assert.Equal(id, pairs["ParentId"].ToString());
+ }
+
+ [Fact]
+ public void ActivityStopDoesNotFireIfNoListenerAttachedForStart()
+ {
+ // Arrange
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var logger = new LoggerWithScopes(isEnabled: true);
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener, logger: logger);
+ var startFired = false;
+ var stopFired = false;
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ // This should not fire
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
+ {
+ startFired = true;
+ }
+
+ // This should not fire
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
+ {
+ stopFired = true;
+ }
+ }),
+ (s, o, arg3) =>
+ {
+ // The events are off
+ return false;
+ });
+
+
+ // Act
+ var context = hostingApplication.CreateContext(features);
+
+ hostingApplication.DisposeContext(context, exception: null);
+
+ Assert.False(startFired);
+ Assert.False(stopFired);
+ Assert.Null(Activity.Current);
+ }
+
+ [Fact]
+ public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool eventsFired = false;
+ bool isEnabledActivityFired = false;
+ bool isEnabledStartFired = false;
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
+ }), (s, o, arg3) =>
+ {
+ if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn")
+ {
+ Assert.IsAssignableFrom(o);
+ isEnabledActivityFired = true;
+ }
+ if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
+ {
+ isEnabledStartFired = true;
+ }
+ return false;
+ });
+
+ hostingApplication.CreateContext(features);
+ Assert.Null(Activity.Current);
+ Assert.True(isEnabledActivityFired);
+ Assert.False(isEnabledStartFired);
+ Assert.False(eventsFired);
+ }
+
+ [Fact]
+ public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool eventsFired = false;
+ bool isEnabledStartFired = false;
+ bool isEnabledActivityFired = false;
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
+ }), (s, o, arg3) =>
+ {
+ if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn")
+ {
+ Assert.IsAssignableFrom(o);
+ isEnabledActivityFired = true;
+ return true;
+ }
+
+ if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
+ {
+ isEnabledStartFired = true;
+ return false;
+ }
+ return true;
+ });
+
+ hostingApplication.CreateContext(features);
+ Assert.NotNull(Activity.Current);
+ Assert.True(isEnabledActivityFired);
+ Assert.True(isEnabledStartFired);
+ Assert.False(eventsFired);
+ }
+
+ [Fact]
+ public void ActivityIsCreatedAndLogged()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool startCalled = false;
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
+ {
+ startCalled = true;
+ Assert.NotNull(pair.Value);
+ Assert.NotNull(Activity.Current);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ AssertProperty(pair.Value, "HttpContext");
+ }
+ }));
+
+ hostingApplication.CreateContext(features);
+ Assert.NotNull(Activity.Current);
+ Assert.True(startCalled);
+ }
+
+ [Fact]
+ public void ActivityIsStoppedDuringStopCall()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool endCalled = false;
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
+ {
+ endCalled = true;
+
+ Assert.NotNull(Activity.Current);
+ Assert.True(Activity.Current.Duration > TimeSpan.Zero);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ AssertProperty(pair.Value, "HttpContext");
+ }
+ }));
+
+ var context = hostingApplication.CreateContext(features);
+ hostingApplication.DisposeContext(context, null);
+ Assert.True(endCalled);
+ }
+
+ [Fact]
+ public void ActivityIsStoppedDuringUnhandledExceptionCall()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool endCalled = false;
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
+ {
+ endCalled = true;
+ Assert.NotNull(Activity.Current);
+ Assert.True(Activity.Current.Duration > TimeSpan.Zero);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ AssertProperty(pair.Value, "HttpContext");
+ }
+ }));
+
+ var context = hostingApplication.CreateContext(features);
+ hostingApplication.DisposeContext(context, new Exception());
+ Assert.True(endCalled);
+ }
+
+ [Fact]
+ public void ActivityIsAvailableDuringUnhandledExceptionCall()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool endCalled = false;
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
+ {
+ if (pair.Key == "Microsoft.AspNetCore.Hosting.UnhandledException")
+ {
+ endCalled = true;
+ Assert.NotNull(Activity.Current);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ }
+ }));
+
+ var context = hostingApplication.CreateContext(features);
+ hostingApplication.DisposeContext(context, new Exception());
+ Assert.True(endCalled);
+ }
+
+ [Fact]
+ public void ActivityIsAvailibleDuringRequest()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
+ s =>
+ {
+ if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
+ {
+ return true;
+ }
+ return false;
+ });
+
+ hostingApplication.CreateContext(features);
+
+ Assert.NotNull(Activity.Current);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ }
+
+ [Fact]
+ public void ActivityParentIdAndBaggeReadFromHeaders()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
+ s =>
+ {
+ if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
+ {
+ return true;
+ }
+ return false;
+ });
+
+ features.Set(new HttpRequestFeature()
+ {
+ Headers = new HeaderDictionary()
+ {
+ {"Request-Id", "ParentId1"},
+ {"Correlation-Context", "Key1=value1, Key2=value2"}
+ }
+ });
+ hostingApplication.CreateContext(features);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ Assert.Equal("ParentId1", Activity.Current.ParentId);
+ Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1");
+ Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2");
+ }
+
+
+ [Fact]
+ public void ActivityTraceParentAndTraceStateFromHeaders()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
+ s =>
+ {
+ if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
+ {
+ return true;
+ }
+ return false;
+ });
+
+ features.Set(new HttpRequestFeature()
+ {
+ Headers = new HeaderDictionary()
+ {
+ {"traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"},
+ {"tracestate", "TraceState1"},
+ {"Correlation-Context", "Key1=value1, Key2=value2"}
+ }
+ });
+ hostingApplication.CreateContext(features);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
+ Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat);
+ Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString());
+ Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString());
+ Assert.Equal("TraceState1", Activity.Current.TraceStateString);
+
+ Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1");
+ Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2");
+ }
+
+ [Fact]
+ public void ActivityOnExportHookIsCalled()
+ {
+ var diagnosticListener = new DiagnosticListener("DummySource");
+ var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
+
+ bool onActivityImportCalled = false;
+ diagnosticListener.Subscribe(
+ observer: new CallbackDiagnosticListener(pair => { }),
+ isEnabled: (s, o, _) => true,
+ onActivityImport: (activity, context) =>
+ {
+ onActivityImportCalled = true;
+ Assert.Null(Activity.Current);
+ Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", activity.OperationName);
+ Assert.NotNull(context);
+ Assert.IsAssignableFrom(context);
+
+ activity.ActivityTraceFlags = ActivityTraceFlags.Recorded;
+ });
+
+ hostingApplication.CreateContext(features);
+
+ Assert.True(onActivityImportCalled);
+ Assert.NotNull(Activity.Current);
+ Assert.True(Activity.Current.Recorded);
+ }
+
+
+ private static void AssertProperty(object o, string name)
+ {
+ Assert.NotNull(o);
+ var property = o.GetType().GetTypeInfo().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
+ Assert.NotNull(property);
+ var value = property.GetValue(o);
+ Assert.NotNull(value);
+ Assert.IsAssignableFrom(value);
+ }
+
+ private static HostingApplication CreateApplication(out FeatureCollection features,
+ DiagnosticListener diagnosticListener = null, ILogger logger = null, Action configure = null)
+ {
+ var httpContextFactory = new Mock();
+
+ features = new FeatureCollection();
+ features.Set(new HttpRequestFeature());
+ var context = new DefaultHttpContext(features);
+ configure?.Invoke(context);
+ httpContextFactory.Setup(s => s.Create(It.IsAny())).Returns(context);
+ httpContextFactory.Setup(s => s.Dispose(It.IsAny()));
+
+ var hostingApplication = new HostingApplication(
+ ctx => Task.CompletedTask,
+ logger ?? new NullScopeLogger(),
+ diagnosticListener ?? new NoopDiagnosticListener(),
+ httpContextFactory.Object);
+
+ return hostingApplication;
+ }
+
+ private class NullScopeLogger : ILogger
+ {
+ private readonly bool _isEnabled;
+ public NullScopeLogger(bool isEnabled = false)
+ {
+ _isEnabled = isEnabled;
+ }
+
+ public IDisposable BeginScope(TState state) => null;
+
+ public bool IsEnabled(LogLevel logLevel) => _isEnabled;
+
+ public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
+ {
+ }
+ }
+
+ private class LoggerWithScopes : ILogger
+ {
+ private readonly bool _isEnabled;
+ public LoggerWithScopes(bool isEnabled = false)
+ {
+ _isEnabled = isEnabled;
+ }
+
+ public IDisposable BeginScope(TState state)
+ {
+ Scopes.Add(state);
+ return new Scope();
+ }
+
+ public List Scopes { get; set; } = new List();
+
+ public bool IsEnabled(LogLevel logLevel) => _isEnabled;
+
+ public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
+ {
+
+ }
+
+ private class Scope : IDisposable
+ {
+ public void Dispose()
+ {
+ }
+ }
+ }
+
+ private class NoopDiagnosticListener : DiagnosticListener
+ {
+ private readonly bool _isEnabled;
+
+ public NoopDiagnosticListener(bool isEnabled = false) : base("DummyListener")
+ {
+ _isEnabled = isEnabled;
+ }
+
+ public override bool IsEnabled(string name) => _isEnabled;
+
+ public override void Write(string name, object value)
+ {
+ }
+ }
+
+ private class CallbackDiagnosticListener : IObserver>
+ {
+ private readonly Action> _callback;
+
+ public CallbackDiagnosticListener(Action> callback)
+ {
+ _callback = callback;
+ }
+
+ public void OnNext(KeyValuePair value)
+ {
+ _callback(value);
+ }
+
+ public void OnError(Exception error)
+ {
+ }
+
+ public void OnCompleted()
+ {
+ }
+ }
+ }
+}
diff --git a/src/Hosting/Hosting/test/HostingApplicationTests.cs b/src/Hosting/Hosting/test/HostingApplicationTests.cs
index 64d832eb0c..4dd9863718 100644
--- a/src/Hosting/Hosting/test/HostingApplicationTests.cs
+++ b/src/Hosting/Hosting/test/HostingApplicationTests.cs
@@ -1,532 +1,136 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting.Server.Abstractions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging.Abstractions;
using Moq;
using Xunit;
+using static Microsoft.AspNetCore.Hosting.HostingApplication;
namespace Microsoft.AspNetCore.Hosting.Tests
{
public class HostingApplicationTests
{
[Fact]
- public void DisposeContextDoesNotThrowWhenContextScopeIsNull()
+ public void DisposeContextDoesNotClearHttpContextIfDefaultHttpContextFactoryUsed()
{
// Arrange
- var hostingApplication = CreateApplication(out var features);
+ var hostingApplication = CreateApplication();
+ var httpContext = new DefaultHttpContext();
+
+ var context = hostingApplication.CreateContext(httpContext.Features);
+ Assert.NotNull(context.HttpContext);
+
+ // Act/Assert
+ hostingApplication.DisposeContext(context, null);
+ Assert.NotNull(context.HttpContext);
+ }
+
+ [Fact]
+ public void DisposeContextClearsHttpContextIfIHttpContextAccessorIsActive()
+ {
+ // Arrange
+ var hostingApplication = CreateApplication(useHttpContextAccessor: true);
+ var httpContext = new DefaultHttpContext();
+
+ var context = hostingApplication.CreateContext(httpContext.Features);
+ Assert.NotNull(context.HttpContext);
+
+ // Act/Assert
+ hostingApplication.DisposeContext(context, null);
+ Assert.Null(context.HttpContext);
+ }
+
+ [Fact]
+ public void CreateContextReinitializesPreviouslyStoredDefaultHttpContext()
+ {
+ // Arrange
+ var hostingApplication = CreateApplication();
+ var features = new FeaturesWithContext(new DefaultHttpContext().Features);
+ var previousContext = new DefaultHttpContext();
+ // Pretend like we had previous HttpContext
+ features.HostContext = new Context();
+ features.HostContext.HttpContext = previousContext;
+
var context = hostingApplication.CreateContext(features);
+ Assert.Same(previousContext, context.HttpContext);
+
+ // Act/Assert
+ hostingApplication.DisposeContext(context, null);
+ Assert.Same(previousContext, context.HttpContext);
+ }
+
+ [Fact]
+ public void CreateContextCreatesNewContextIfNotUsingDefaultHttpContextFactory()
+ {
+ // Arrange
+ var factory = new Mock();
+ factory.Setup(m => m.Create(It.IsAny())).Returns(f => new DefaultHttpContext(f));
+ factory.Setup(m => m.Dispose(It.IsAny())).Callback(() => { });
+
+ var hostingApplication = CreateApplication(factory.Object);
+ var features = new FeaturesWithContext(new DefaultHttpContext().Features);
+ var previousContext = new DefaultHttpContext();
+ // Pretend like we had previous HttpContext
+ features.HostContext = new Context();
+ features.HostContext.HttpContext = previousContext;
+
+ var context = hostingApplication.CreateContext(features);
+ Assert.NotSame(previousContext, context.HttpContext);
// Act/Assert
hostingApplication.DisposeContext(context, null);
}
- [Fact]
- public void CreateContextWithDisabledLoggerDoesNotCreateActivity()
+ private static HostingApplication CreateApplication(IHttpContextFactory httpContextFactory = null, bool useHttpContextAccessor = false)
{
- // Arrange
- var hostingApplication = CreateApplication(out var features);
-
- // Act
- hostingApplication.CreateContext(features);
-
- Assert.Null(Activity.Current);
- }
-
- [Fact]
- public void CreateContextWithEnabledLoggerCreatesActivityAndSetsActivityInScope()
- {
- // Arrange
- var logger = new LoggerWithScopes(isEnabled: true);
- var hostingApplication = CreateApplication(out var features, logger: logger);
-
- // Act
- var context = hostingApplication.CreateContext(features);
-
- Assert.Single(logger.Scopes);
- var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
- Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
- Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
- Assert.Equal(string.Empty, pairs["ParentId"]?.ToString());
- }
-
- [Fact]
- public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActivityInScope()
- {
- // Arrange
-
- // Generate an id we can use for the request id header (in the correct format)
- var activity = new Activity("IncomingRequest");
- activity.Start();
- var id = activity.Id;
- activity.Stop();
-
- var logger = new LoggerWithScopes(isEnabled: true);
- var hostingApplication = CreateApplication(out var features, logger: logger, configure: context =>
+ var services = new ServiceCollection();
+ services.AddOptions();
+ if (useHttpContextAccessor)
{
- context.Request.Headers["Request-Id"] = id;
- });
+ services.AddHttpContextAccessor();
+ }
- // Act
- var context = hostingApplication.CreateContext(features);
-
- Assert.Single(logger.Scopes);
- var pairs = ((IReadOnlyList>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
- Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
- Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
- Assert.Equal(id, pairs["ParentId"].ToString());
- }
-
- [Fact]
- public void ActivityStopDoesNotFireIfNoListenerAttachedForStart()
- {
- // Arrange
- var diagnosticListener = new DiagnosticListener("DummySource");
- var logger = new LoggerWithScopes(isEnabled: true);
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener, logger: logger);
- var startFired = false;
- var stopFired = false;
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- // This should not fire
- if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
- {
- startFired = true;
- }
-
- // This should not fire
- if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
- {
- stopFired = true;
- }
- }),
- (s, o, arg3) =>
- {
- // The events are off
- return false;
- });
-
-
- // Act
- var context = hostingApplication.CreateContext(features);
-
- hostingApplication.DisposeContext(context, exception: null);
-
- Assert.False(startFired);
- Assert.False(stopFired);
- Assert.Null(Activity.Current);
- }
-
- [Fact]
- public void ActivityIsNotCreatedWhenIsEnabledForActivityIsFalse()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool eventsFired = false;
- bool isEnabledActivityFired = false;
- bool isEnabledStartFired = false;
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
- }), (s, o, arg3) =>
- {
- if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn")
- {
- Assert.IsAssignableFrom(o);
- isEnabledActivityFired = true;
- }
- if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
- {
- isEnabledStartFired = true;
- }
- return false;
- });
-
- hostingApplication.CreateContext(features);
- Assert.Null(Activity.Current);
- Assert.True(isEnabledActivityFired);
- Assert.False(isEnabledStartFired);
- Assert.False(eventsFired);
- }
-
- [Fact]
- public void ActivityIsCreatedButNotLoggedWhenIsEnabledForActivityStartIsFalse()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool eventsFired = false;
- bool isEnabledStartFired = false;
- bool isEnabledActivityFired = false;
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- eventsFired |= pair.Key.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn");
- }), (s, o, arg3) =>
- {
- if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn")
- {
- Assert.IsAssignableFrom(o);
- isEnabledActivityFired = true;
- return true;
- }
-
- if (s == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
- {
- isEnabledStartFired = true;
- return false;
- }
- return true;
- });
-
- hostingApplication.CreateContext(features);
- Assert.NotNull(Activity.Current);
- Assert.True(isEnabledActivityFired);
- Assert.True(isEnabledStartFired);
- Assert.False(eventsFired);
- }
-
- [Fact]
- public void ActivityIsCreatedAndLogged()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool startCalled = false;
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Start")
- {
- startCalled = true;
- Assert.NotNull(pair.Value);
- Assert.NotNull(Activity.Current);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- AssertProperty(pair.Value, "HttpContext");
- }
- }));
-
- hostingApplication.CreateContext(features);
- Assert.NotNull(Activity.Current);
- Assert.True(startCalled);
- }
-
- [Fact]
- public void ActivityIsStoppedDuringStopCall()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool endCalled = false;
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
- {
- endCalled = true;
-
- Assert.NotNull(Activity.Current);
- Assert.True(Activity.Current.Duration > TimeSpan.Zero);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- AssertProperty(pair.Value, "HttpContext");
- }
- }));
-
- var context = hostingApplication.CreateContext(features);
- hostingApplication.DisposeContext(context, null);
- Assert.True(endCalled);
- }
-
- [Fact]
- public void ActivityIsStoppedDuringUnhandledExceptionCall()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool endCalled = false;
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- if (pair.Key == "Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop")
- {
- endCalled = true;
- Assert.NotNull(Activity.Current);
- Assert.True(Activity.Current.Duration > TimeSpan.Zero);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- AssertProperty(pair.Value, "HttpContext");
- }
- }));
-
- var context = hostingApplication.CreateContext(features);
- hostingApplication.DisposeContext(context, new Exception());
- Assert.True(endCalled);
- }
-
- [Fact]
- public void ActivityIsAvailableDuringUnhandledExceptionCall()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool endCalled = false;
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair =>
- {
- if (pair.Key == "Microsoft.AspNetCore.Hosting.UnhandledException")
- {
- endCalled = true;
- Assert.NotNull(Activity.Current);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- }
- }));
-
- var context = hostingApplication.CreateContext(features);
- hostingApplication.DisposeContext(context, new Exception());
- Assert.True(endCalled);
- }
-
- [Fact]
- public void ActivityIsAvailibleDuringRequest()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
- s =>
- {
- if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
- {
- return true;
- }
- return false;
- });
-
- hostingApplication.CreateContext(features);
-
- Assert.NotNull(Activity.Current);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- }
-
- [Fact]
- public void ActivityParentIdAndBaggeReadFromHeaders()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
- s =>
- {
- if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
- {
- return true;
- }
- return false;
- });
-
- features.Set(new HttpRequestFeature()
- {
- Headers = new HeaderDictionary()
- {
- {"Request-Id", "ParentId1"},
- {"Correlation-Context", "Key1=value1, Key2=value2"}
- }
- });
- hostingApplication.CreateContext(features);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- Assert.Equal("ParentId1", Activity.Current.ParentId);
- Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1");
- Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2");
- }
-
-
- [Fact]
- public void ActivityTraceParentAndTraceStateFromHeaders()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- diagnosticListener.Subscribe(new CallbackDiagnosticListener(pair => { }),
- s =>
- {
- if (s.StartsWith("Microsoft.AspNetCore.Hosting.HttpRequestIn"))
- {
- return true;
- }
- return false;
- });
-
- features.Set(new HttpRequestFeature()
- {
- Headers = new HeaderDictionary()
- {
- {"traceparent", "00-0123456789abcdef0123456789abcdef-0123456789abcdef-01"},
- {"tracestate", "TraceState1"},
- {"Correlation-Context", "Key1=value1, Key2=value2"}
- }
- });
- hostingApplication.CreateContext(features);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", Activity.Current.OperationName);
- Assert.Equal(ActivityIdFormat.W3C, Activity.Current.IdFormat);
- Assert.Equal("0123456789abcdef0123456789abcdef", Activity.Current.TraceId.ToHexString());
- Assert.Equal("0123456789abcdef", Activity.Current.ParentSpanId.ToHexString());
- Assert.Equal("TraceState1", Activity.Current.TraceStateString);
-
- Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key1" && pair.Value == "value1");
- Assert.Contains(Activity.Current.Baggage, pair => pair.Key == "Key2" && pair.Value == "value2");
- }
-
- [Fact]
- public void ActivityOnExportHookIsCalled()
- {
- var diagnosticListener = new DiagnosticListener("DummySource");
- var hostingApplication = CreateApplication(out var features, diagnosticListener: diagnosticListener);
-
- bool onActivityImportCalled = false;
- diagnosticListener.Subscribe(
- observer: new CallbackDiagnosticListener(pair => { }),
- isEnabled: (s, o, _) => true,
- onActivityImport: (activity, context) =>
- {
- onActivityImportCalled = true;
- Assert.Null(Activity.Current);
- Assert.Equal("Microsoft.AspNetCore.Hosting.HttpRequestIn", activity.OperationName);
- Assert.NotNull(context);
- Assert.IsAssignableFrom(context);
-
- activity.ActivityTraceFlags = ActivityTraceFlags.Recorded;
- });
-
- hostingApplication.CreateContext(features);
-
- Assert.True(onActivityImportCalled);
- Assert.NotNull(Activity.Current);
- Assert.True(Activity.Current.Recorded);
- }
-
-
- private static void AssertProperty(object o, string name)
- {
- Assert.NotNull(o);
- var property = o.GetType().GetTypeInfo().GetProperty(name, BindingFlags.Instance | BindingFlags.Public);
- Assert.NotNull(property);
- var value = property.GetValue(o);
- Assert.NotNull(value);
- Assert.IsAssignableFrom(value);
- }
-
- private static HostingApplication CreateApplication(out FeatureCollection features,
- DiagnosticListener diagnosticListener = null, ILogger logger = null, Action configure = null)
- {
- var httpContextFactory = new Mock();
-
- features = new FeatureCollection();
- features.Set(new HttpRequestFeature());
- var context = new DefaultHttpContext(features);
- configure?.Invoke(context);
- httpContextFactory.Setup(s => s.Create(It.IsAny())).Returns(context);
- httpContextFactory.Setup(s => s.Dispose(It.IsAny()));
+ httpContextFactory ??= new DefaultHttpContextFactory(services.BuildServiceProvider());
var hostingApplication = new HostingApplication(
ctx => Task.CompletedTask,
- logger ?? new NullScopeLogger(),
- diagnosticListener ?? new NoopDiagnosticListener(),
- httpContextFactory.Object);
+ NullLogger.Instance,
+ new DiagnosticListener("Microsoft.AspNetCore"),
+ httpContextFactory);
return hostingApplication;
}
- private class NullScopeLogger : ILogger
+ private class FeaturesWithContext : IHostContextContainer, IFeatureCollection
{
- private readonly bool _isEnabled;
- public NullScopeLogger(bool isEnabled = false)
+ public FeaturesWithContext(IFeatureCollection features)
{
- _isEnabled = isEnabled;
+ Features = features;
}
- public IDisposable BeginScope(TState state) => null;
+ public IFeatureCollection Features { get; }
- public bool IsEnabled(LogLevel logLevel) => _isEnabled;
+ public object this[Type key] { get => Features[key]; set => Features[key] = value; }
- public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
- {
- }
- }
+ public T HostContext { get; set; }
- private class LoggerWithScopes : ILogger
- {
- private readonly bool _isEnabled;
- public LoggerWithScopes(bool isEnabled = false)
- {
- _isEnabled = isEnabled;
- }
+ public bool IsReadOnly => Features.IsReadOnly;
- public IDisposable BeginScope(TState state)
- {
- Scopes.Add(state);
- return new Scope();
- }
+ public int Revision => Features.Revision;
- public List Scopes { get; set; } = new List();
+ public TFeature Get() => Features.Get();
- public bool IsEnabled(LogLevel logLevel) => _isEnabled;
+ public IEnumerator> GetEnumerator() => Features.GetEnumerator();
- public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter)
- {
+ public void Set(TFeature instance) => Features.Set(instance);
- }
-
- private class Scope : IDisposable
- {
- public void Dispose()
- {
- }
- }
- }
-
- private class NoopDiagnosticListener : DiagnosticListener
- {
- private readonly bool _isEnabled;
-
- public NoopDiagnosticListener(bool isEnabled = false) : base("DummyListener")
- {
- _isEnabled = isEnabled;
- }
-
- public override bool IsEnabled(string name) => _isEnabled;
-
- public override void Write(string name, object value)
- {
- }
- }
-
- private class CallbackDiagnosticListener : IObserver>
- {
- private readonly Action> _callback;
-
- public CallbackDiagnosticListener(Action> callback)
- {
- _callback = callback;
- }
-
- public void OnNext(KeyValuePair value)
- {
- _callback(value);
- }
-
- public void OnError(Exception error)
- {
- }
-
- public void OnCompleted()
- {
- }
+ IEnumerator IEnumerable.GetEnumerator() => Features.GetEnumerator();
}
}
}
diff --git a/src/Hosting/Server.Abstractions/ref/Microsoft.AspNetCore.Hosting.Server.Abstractions.netcoreapp.cs b/src/Hosting/Server.Abstractions/ref/Microsoft.AspNetCore.Hosting.Server.Abstractions.netcoreapp.cs
index 184bb7353c..cf0de7f4fe 100644
--- a/src/Hosting/Server.Abstractions/ref/Microsoft.AspNetCore.Hosting.Server.Abstractions.netcoreapp.cs
+++ b/src/Hosting/Server.Abstractions/ref/Microsoft.AspNetCore.Hosting.Server.Abstractions.netcoreapp.cs
@@ -23,8 +23,8 @@ namespace Microsoft.AspNetCore.Hosting.Server
public partial class ServerIntegratedAuth : Microsoft.AspNetCore.Hosting.Server.IServerIntegratedAuth
{
public ServerIntegratedAuth() { }
- public string AuthenticationScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool IsEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string AuthenticationScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool IsEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Hosting.Server.Abstractions
diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs b/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs
index 5eea2b8ce3..e1608bba80 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Server.IntegrationTesting
diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs b/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs
deleted file mode 100644
index 732a598ab8..0000000000
--- a/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Microsoft.AspNetCore.Hosting.Server.Features;
-using System.Linq;
-
-namespace Microsoft.AspNetCore.Hosting
-{
- public static class IWebHostExtensions
- {
- public static string GetAddress(this IWebHost host)
- {
- return host.ServerFeatures.Get().Addresses.First();
- }
- }
-}
diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/TestPortHelper.cs b/src/Hosting/Server.IntegrationTesting/src/Common/TestPortHelper.cs
index 7129ff73d3..b8688dec04 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Common/TestPortHelper.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Common/TestPortHelper.cs
@@ -56,34 +56,5 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.Common
}
}
}
-
- private const int BasePort = 5001;
- private const int MaxPort = 8000;
- private static int NextPort = BasePort;
-
- // GetNextPort doesn't check for HttpSys urlacls.
- public static int GetNextHttpSysPort(string scheme)
- {
- while (NextPort < MaxPort)
- {
- var port = NextPort++;
-
- using (var server = new HttpListener())
- {
- server.Prefixes.Add($"{scheme}://localhost:{port}/");
- try
- {
- server.Start();
- server.Stop();
- return port;
- }
- catch (HttpListenerException)
- {
- }
- }
- }
- NextPort = BasePort;
- throw new Exception("Failed to locate a free port.");
- }
}
}
diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/TestUriHelper.cs b/src/Hosting/Server.IntegrationTesting/src/Common/TestUriHelper.cs
index aaac5b88a7..4899fbea4f 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Common/TestUriHelper.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Common/TestUriHelper.cs
@@ -1,7 +1,9 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Diagnostics;
+
namespace Microsoft.AspNetCore.Server.IntegrationTesting.Common
{
public static class TestUriHelper
@@ -34,7 +36,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.Common
}
else if (serverType == ServerType.HttpSys)
{
- return new UriBuilder(scheme, "localhost", TestPortHelper.GetNextHttpSysPort(scheme)).Uri;
+ Debug.Assert(scheme == "http", "Https not supported");
+ return new UriBuilder(scheme, "localhost", 0).Uri;
}
else
{
diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/Tfm.cs b/src/Hosting/Server.IntegrationTesting/src/Common/Tfm.cs
index b828a5868e..92cea4fb37 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Common/Tfm.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Common/Tfm.cs
@@ -13,6 +13,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
public const string NetCoreApp22 = "netcoreapp2.2";
public const string NetCoreApp30 = "netcoreapp3.0";
public const string NetCoreApp31 = "netcoreapp3.1";
+ public const string NetCoreApp50 = "netcoreapp5.0";
public static bool Matches(string tfm1, string tfm2)
{
diff --git a/src/Hosting/Server.IntegrationTesting/src/Deployers/NginxDeployer.cs b/src/Hosting/Server.IntegrationTesting/src/Deployers/NginxDeployer.cs
index d5c0dc02ca..262ff80ce8 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Deployers/NginxDeployer.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Deployers/NginxDeployer.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
diff --git a/src/Hosting/Server.IntegrationTesting/src/Deployers/SelfHostDeployer.cs b/src/Hosting/Server.IntegrationTesting/src/Deployers/SelfHostDeployer.cs
index 06923f7c46..e6e724c98c 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Deployers/SelfHostDeployer.cs
+++ b/src/Hosting/Server.IntegrationTesting/src/Deployers/SelfHostDeployer.cs
@@ -22,7 +22,6 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: (?.*)$");
private const string ApplicationStartedMessage = "Application started. Press Ctrl+C to shut down.";
- private const int RetryCount = 5;
public Process HostProcess { get; private set; }
public SelfHostDeployer(DeploymentParameters deploymentParameters, ILoggerFactory loggerFactory)
@@ -56,33 +55,23 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
DotnetPublish();
}
+ var hintUrl = TestUriHelper.BuildTestUri(
+ DeploymentParameters.ServerType,
+ DeploymentParameters.Scheme,
+ DeploymentParameters.ApplicationBaseUriHint,
+ DeploymentParameters.StatusMessagesEnabled);
+
// Launch the host process.
- for (var i = 0; i < RetryCount; i++)
- {
- var hintUrl = TestUriHelper.BuildTestUri(
- DeploymentParameters.ServerType,
- DeploymentParameters.Scheme,
- DeploymentParameters.ApplicationBaseUriHint,
- DeploymentParameters.StatusMessagesEnabled);
- var (actualUrl, hostExitToken) = await StartSelfHostAsync(hintUrl);
+ var (actualUrl, hostExitToken) = await StartSelfHostAsync(hintUrl);
- if (DeploymentParameters.ServerType == ServerType.HttpSys && hostExitToken.IsCancellationRequested)
- {
- // Retry HttpSys deployments due to port conflicts.
- continue;
- }
+ Logger.LogInformation("Application ready at URL: {appUrl}", actualUrl);
- Logger.LogInformation("Application ready at URL: {appUrl}", actualUrl);
-
- return new DeploymentResult(
- LoggerFactory,
- DeploymentParameters,
- applicationBaseUri: actualUrl.ToString(),
- contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath,
- hostShutdownToken: hostExitToken);
- }
-
- throw new Exception($"Failed to start Self hosted application after {RetryCount} retries.");
+ return new DeploymentResult(
+ LoggerFactory,
+ DeploymentParameters,
+ applicationBaseUri: actualUrl.ToString(),
+ contentRoot: DeploymentParameters.PublishApplicationBeforeDeployment ? DeploymentParameters.PublishedApplicationRootPath : DeploymentParameters.ApplicationPath,
+ hostShutdownToken: hostExitToken);
}
}
@@ -176,6 +165,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
Logger.LogInformation("host process ID {pid} shut down", HostProcess.Id);
// If TrySetResult was called above, this will just silently fail to set the new state, which is what we want
+ started.TrySetException(new Exception($"Command exited unexpectedly with exit code: {HostProcess.ExitCode}"));
+
TriggerHostShutdown(hostExitTokenSource);
};
@@ -187,6 +178,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
Logger.LogError("Error occurred while starting the process. Exception: {exception}", ex.ToString());
}
+
if (HostProcess.HasExited)
{
Logger.LogError("Host process {processName} {pid} exited with code {exitCode} or failed to start.", startInfo.FileName, HostProcess.Id, HostProcess.ExitCode);
diff --git a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj
index 8edf4ff3f0..ba625f4332 100644
--- a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj
+++ b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj
@@ -1,4 +1,4 @@
-
+
ASP.NET Core helpers to deploy applications to IIS Express, IIS, WebListener and Kestrel for testing.
@@ -19,7 +19,6 @@
-
diff --git a/src/Hosting/TestHost/ref/Microsoft.AspNetCore.TestHost.netcoreapp.cs b/src/Hosting/TestHost/ref/Microsoft.AspNetCore.TestHost.netcoreapp.cs
index ed7536b490..6f94aa576c 100644
--- a/src/Hosting/TestHost/ref/Microsoft.AspNetCore.TestHost.netcoreapp.cs
+++ b/src/Hosting/TestHost/ref/Microsoft.AspNetCore.TestHost.netcoreapp.cs
@@ -17,12 +17,12 @@ namespace Microsoft.AspNetCore.TestHost
public partial class HttpResetTestException : System.Exception
{
public HttpResetTestException(int errorCode) { }
- public int ErrorCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public int ErrorCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public partial class RequestBuilder
{
public RequestBuilder(Microsoft.AspNetCore.TestHost.TestServer server, string path) { }
- public Microsoft.AspNetCore.TestHost.TestServer TestServer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.TestHost.TestServer TestServer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.TestHost.RequestBuilder AddHeader(string name, string value) { throw null; }
public Microsoft.AspNetCore.TestHost.RequestBuilder And(System.Action configure) { throw null; }
public System.Threading.Tasks.Task GetAsync() { throw null; }
@@ -35,12 +35,12 @@ namespace Microsoft.AspNetCore.TestHost
public TestServer(Microsoft.AspNetCore.Hosting.IWebHostBuilder builder, Microsoft.AspNetCore.Http.Features.IFeatureCollection featureCollection) { }
public TestServer(System.IServiceProvider services) { }
public TestServer(System.IServiceProvider services, Microsoft.AspNetCore.Http.Features.IFeatureCollection featureCollection) { }
- public bool AllowSynchronousIO { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Uri BaseAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.Features.IFeatureCollection Features { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public bool AllowSynchronousIO { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Uri BaseAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.Features.IFeatureCollection Features { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.Hosting.IWebHost Host { get { throw null; } }
- public bool PreserveExecutionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.IServiceProvider Services { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public bool PreserveExecutionContext { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.IServiceProvider Services { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Net.Http.HttpClient CreateClient() { throw null; }
public System.Net.Http.HttpMessageHandler CreateHandler() { throw null; }
public Microsoft.AspNetCore.TestHost.RequestBuilder CreateRequest(string path) { throw null; }
@@ -69,8 +69,8 @@ namespace Microsoft.AspNetCore.TestHost
public partial class WebSocketClient
{
internal WebSocketClient() { }
- public System.Action ConfigureRequest { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Collections.Generic.IList SubProtocols { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Action ConfigureRequest { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Collections.Generic.IList SubProtocols { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
[System.Diagnostics.DebuggerStepThroughAttribute]
public System.Threading.Tasks.Task ConnectAsync(System.Uri uri, System.Threading.CancellationToken cancellationToken) { throw null; }
}
diff --git a/src/Hosting/TestHost/src/WebSocketClient.cs b/src/Hosting/TestHost/src/WebSocketClient.cs
index 7cf116cd7a..88fb19a9aa 100644
--- a/src/Hosting/TestHost/src/WebSocketClient.cs
+++ b/src/Hosting/TestHost/src/WebSocketClient.cs
@@ -4,12 +4,14 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Net.WebSockets;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
+using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.TestHost
{
@@ -72,10 +74,15 @@ namespace Microsoft.AspNetCore.TestHost
request.PathBase = _pathBase;
}
request.QueryString = QueryString.FromUriComponent(uri);
- request.Headers.Add("Connection", new string[] { "Upgrade" });
- request.Headers.Add("Upgrade", new string[] { "websocket" });
- request.Headers.Add("Sec-WebSocket-Version", new string[] { "13" });
- request.Headers.Add("Sec-WebSocket-Key", new string[] { CreateRequestKey() });
+ request.Headers.Add(HeaderNames.Connection, new string[] { "Upgrade" });
+ request.Headers.Add(HeaderNames.Upgrade, new string[] { "websocket" });
+ request.Headers.Add(HeaderNames.SecWebSocketVersion, new string[] { "13" });
+ request.Headers.Add(HeaderNames.SecWebSocketKey, new string[] { CreateRequestKey() });
+ if (SubProtocols.Any())
+ {
+ request.Headers.Add(HeaderNames.SecWebSocketProtocol, SubProtocols.ToArray());
+ }
+
request.Body = Stream.Null;
// WebSocket
diff --git a/src/Hosting/TestHost/test/TestClientTests.cs b/src/Hosting/TestHost/test/TestClientTests.cs
index 9ae6caebfe..701d191f0b 100644
--- a/src/Hosting/TestHost/test/TestClientTests.cs
+++ b/src/Hosting/TestHost/test/TestClientTests.cs
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
+using Microsoft.Net.Http.Headers;
using Xunit;
namespace Microsoft.AspNetCore.TestHost
@@ -467,6 +468,7 @@ namespace Microsoft.AspNetCore.TestHost
{
if (ctx.WebSockets.IsWebSocketRequest)
{
+ Assert.False(ctx.Request.Headers.ContainsKey(HeaderNames.SecWebSocketProtocol));
var websocket = await ctx.WebSockets.AcceptWebSocketAsync();
var receiveArray = new byte[1024];
while (true)
@@ -527,6 +529,58 @@ namespace Microsoft.AspNetCore.TestHost
clientSocket.Dispose();
}
+ [Fact]
+ public async Task WebSocketSubProtocolsWorks()
+ {
+ // Arrange
+ RequestDelegate appDelegate = async ctx =>
+ {
+ if (ctx.WebSockets.IsWebSocketRequest)
+ {
+ if (ctx.WebSockets.WebSocketRequestedProtocols.Contains("alpha") &&
+ ctx.WebSockets.WebSocketRequestedProtocols.Contains("bravo"))
+ {
+ // according to rfc6455, the "server needs to include the same field and one of the selected subprotocol values"
+ // however, this isn't enforced by either our server or client so it's possible to accept an arbitrary protocol.
+ // Done here to demonstrate not "correct" behaviour, simply to show it's possible. Other clients may not allow this.
+ var websocket = await ctx.WebSockets.AcceptWebSocketAsync("charlie");
+ await websocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Normal Closure", CancellationToken.None);
+ }
+ else
+ {
+ var subprotocols = ctx.WebSockets.WebSocketRequestedProtocols.Any()
+ ? string.Join(", ", ctx.WebSockets.WebSocketRequestedProtocols)
+ : "";
+ var closeReason = "Unexpected subprotocols: " + subprotocols;
+ var websocket = await ctx.WebSockets.AcceptWebSocketAsync();
+ await websocket.CloseAsync(WebSocketCloseStatus.InternalServerError, closeReason, CancellationToken.None);
+ }
+ }
+ };
+ var builder = new WebHostBuilder()
+ .Configure(app =>
+ {
+ app.Run(appDelegate);
+ });
+ var server = new TestServer(builder);
+
+ // Act
+ var client = server.CreateWebSocketClient();
+ client.SubProtocols.Add("alpha");
+ client.SubProtocols.Add("bravo");
+ var clientSocket = await client.ConnectAsync(new Uri("wss://localhost"), CancellationToken.None);
+ var buffer = new byte[1024];
+ var result = await clientSocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None);
+
+ // Assert
+ Assert.Equal(WebSocketMessageType.Close, result.MessageType);
+ Assert.Equal("Normal Closure", result.CloseStatusDescription);
+ Assert.Equal(WebSocketState.CloseReceived, clientSocket.State);
+ Assert.Equal("charlie", clientSocket.SubProtocol);
+
+ clientSocket.Dispose();
+ }
+
[ConditionalFact]
public async Task WebSocketAcceptThrowsWhenCancelled()
{
diff --git a/src/Hosting/build.cmd b/src/Hosting/build.cmd
deleted file mode 100644
index 2406296662..0000000000
--- a/src/Hosting/build.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
-@ECHO OFF
-SET RepoRoot=%~dp0..\..
-%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %*
diff --git a/src/Hosting/test/FunctionalTests/ShutdownTests.cs b/src/Hosting/test/FunctionalTests/ShutdownTests.cs
index 246a9abbea..54f7adb4e8 100644
--- a/src/Hosting/test/FunctionalTests/ShutdownTests.cs
+++ b/src/Hosting/test/FunctionalTests/ShutdownTests.cs
@@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Hosting.FunctionalTests
RuntimeArchitecture.x64)
{
EnvironmentName = "Shutdown",
- TargetFramework = Tfm.NetCoreApp31,
+ TargetFramework = Tfm.NetCoreApp50,
ApplicationType = ApplicationType.Portable,
PublishApplicationBeforeDeployment = true,
StatusMessagesEnabled = false
diff --git a/src/Hosting/test/FunctionalTests/WebHostBuilderTests.cs b/src/Hosting/test/FunctionalTests/WebHostBuilderTests.cs
index 5d5044eacc..8747a75f26 100644
--- a/src/Hosting/test/FunctionalTests/WebHostBuilderTests.cs
+++ b/src/Hosting/test/FunctionalTests/WebHostBuilderTests.cs
@@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Hosting.FunctionalTests
public WebHostBuilderTests(ITestOutputHelper output) : base(output) { }
public static TestMatrix TestVariants => TestMatrix.ForServers(ServerType.Kestrel)
- .WithTfms(Tfm.NetCoreApp31);
+ .WithTfms(Tfm.NetCoreApp50);
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
diff --git a/src/Html/Abstractions/ref/Microsoft.AspNetCore.Html.Abstractions.netcoreapp.cs b/src/Html/Abstractions/ref/Microsoft.AspNetCore.Html.Abstractions.netcoreapp.cs
index 2c4b056743..206b2611d1 100644
--- a/src/Html/Abstractions/ref/Microsoft.AspNetCore.Html.Abstractions.netcoreapp.cs
+++ b/src/Html/Abstractions/ref/Microsoft.AspNetCore.Html.Abstractions.netcoreapp.cs
@@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Html
public static readonly Microsoft.AspNetCore.Html.HtmlString Empty;
public static readonly Microsoft.AspNetCore.Html.HtmlString NewLine;
public HtmlString(string value) { }
- public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public override string ToString() { throw null; }
public void WriteTo(System.IO.TextWriter writer, System.Text.Encodings.Web.HtmlEncoder encoder) { }
}
diff --git a/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs b/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs
index dd9628c89a..4027259f90 100644
--- a/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs
+++ b/src/Http/Authentication.Abstractions/ref/Microsoft.AspNetCore.Authentication.Abstractions.netcoreapp.cs
@@ -6,12 +6,12 @@ namespace Microsoft.AspNetCore.Authentication
public partial class AuthenticateResult
{
protected AuthenticateResult() { }
- public System.Exception Failure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } }
- public bool None { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } }
+ public System.Exception Failure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] protected set { } }
+ public bool None { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] protected set { } }
public System.Security.Claims.ClaimsPrincipal Principal { get { throw null; } }
- public Microsoft.AspNetCore.Authentication.AuthenticationProperties Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } }
+ public Microsoft.AspNetCore.Authentication.AuthenticationProperties Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] protected set { } }
public bool Succeeded { get { throw null; } }
- public Microsoft.AspNetCore.Authentication.AuthenticationTicket Ticket { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]protected set { } }
+ public Microsoft.AspNetCore.Authentication.AuthenticationTicket Ticket { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] protected set { } }
public static Microsoft.AspNetCore.Authentication.AuthenticateResult Fail(System.Exception failure) { throw null; }
public static Microsoft.AspNetCore.Authentication.AuthenticateResult Fail(System.Exception failure, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties) { throw null; }
public static Microsoft.AspNetCore.Authentication.AuthenticateResult Fail(string failureMessage) { throw null; }
@@ -45,14 +45,14 @@ namespace Microsoft.AspNetCore.Authentication
public partial class AuthenticationOptions
{
public AuthenticationOptions() { }
- public string DefaultAuthenticateScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string DefaultChallengeScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string DefaultForbidScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string DefaultScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string DefaultSignInScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string DefaultSignOutScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool RequireAuthenticatedSignIn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Collections.Generic.IDictionary SchemeMap { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string DefaultAuthenticateScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string DefaultChallengeScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string DefaultForbidScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string DefaultScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string DefaultSignInScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string DefaultSignOutScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool RequireAuthenticatedSignIn { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Collections.Generic.IDictionary SchemeMap { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Collections.Generic.IEnumerable Schemes { get { throw null; } }
public void AddScheme(string name, System.Action configureBuilder) { }
public void AddScheme(string name, string displayName) where THandler : Microsoft.AspNetCore.Authentication.IAuthenticationHandler { }
@@ -66,8 +66,8 @@ namespace Microsoft.AspNetCore.Authentication
public System.DateTimeOffset? ExpiresUtc { get { throw null; } set { } }
public bool IsPersistent { get { throw null; } set { } }
public System.DateTimeOffset? IssuedUtc { get { throw null; } set { } }
- public System.Collections.Generic.IDictionary Items { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Collections.Generic.IDictionary Parameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Collections.Generic.IDictionary Items { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Collections.Generic.IDictionary Parameters { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string RedirectUri { get { throw null; } set { } }
protected bool? GetBool(string key) { throw null; }
protected System.DateTimeOffset? GetDateTimeOffset(string key) { throw null; }
@@ -81,31 +81,31 @@ namespace Microsoft.AspNetCore.Authentication
public partial class AuthenticationScheme
{
public AuthenticationScheme(string name, string displayName, System.Type handlerType) { }
- public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Type HandlerType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Type HandlerType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public partial class AuthenticationSchemeBuilder
{
public AuthenticationSchemeBuilder(string name) { }
- public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Type HandlerType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Type HandlerType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.Authentication.AuthenticationScheme Build() { throw null; }
}
public partial class AuthenticationTicket
{
public AuthenticationTicket(System.Security.Claims.ClaimsPrincipal principal, Microsoft.AspNetCore.Authentication.AuthenticationProperties properties, string authenticationScheme) { }
public AuthenticationTicket(System.Security.Claims.ClaimsPrincipal principal, string authenticationScheme) { }
- public string AuthenticationScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Security.Claims.ClaimsPrincipal Principal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Authentication.AuthenticationProperties Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string AuthenticationScheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Security.Claims.ClaimsPrincipal Principal { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.AuthenticationProperties Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public partial class AuthenticationToken
{
public AuthenticationToken() { }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public static partial class AuthenticationTokenExtensions
{
@@ -149,6 +149,7 @@ namespace Microsoft.AspNetCore.Authentication
System.Threading.Tasks.Task> GetRequestHandlerSchemesAsync();
System.Threading.Tasks.Task GetSchemeAsync(string name);
void RemoveScheme(string name);
+ bool TryAddScheme(Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme) { throw null; }
}
public partial interface IAuthenticationService
{
diff --git a/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs b/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs
index 3d2584fca8..d0f54d74d0 100644
--- a/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs
+++ b/src/Http/Authentication.Abstractions/src/IAuthenticationSchemeProvider.cs
@@ -71,6 +71,23 @@ namespace Microsoft.AspNetCore.Authentication
/// The scheme.
void AddScheme(AuthenticationScheme scheme);
+ ///
+ /// Registers a scheme for use by .
+ ///
+ /// The scheme.
+ /// true if the scheme was added successfully.
+ bool TryAddScheme(AuthenticationScheme scheme)
+ {
+ try
+ {
+ AddScheme(scheme);
+ return true;
+ }
+ catch {
+ return false;
+ }
+ }
+
///
/// Removes a scheme, preventing it from being used by .
///
diff --git a/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs b/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs
index f12e27bcf2..590d651d41 100644
--- a/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs
+++ b/src/Http/Authentication.Core/ref/Microsoft.AspNetCore.Authentication.Core.netcoreapp.cs
@@ -6,13 +6,13 @@ namespace Microsoft.AspNetCore.Authentication
public partial class AuthenticationFeature : Microsoft.AspNetCore.Authentication.IAuthenticationFeature
{
public AuthenticationFeature() { }
- public Microsoft.AspNetCore.Http.PathString OriginalPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.PathString OriginalPathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.PathString OriginalPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.PathString OriginalPathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class AuthenticationHandlerProvider : Microsoft.AspNetCore.Authentication.IAuthenticationHandlerProvider
{
public AuthenticationHandlerProvider(Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemes) { }
- public Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider Schemes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider Schemes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
[System.Diagnostics.DebuggerStepThroughAttribute]
public System.Threading.Tasks.Task GetHandlerAsync(Microsoft.AspNetCore.Http.HttpContext context, string authenticationScheme) { throw null; }
}
@@ -30,14 +30,15 @@ namespace Microsoft.AspNetCore.Authentication
public virtual System.Threading.Tasks.Task> GetRequestHandlerSchemesAsync() { throw null; }
public virtual System.Threading.Tasks.Task GetSchemeAsync(string name) { throw null; }
public virtual void RemoveScheme(string name) { }
+ public virtual bool TryAddScheme(Microsoft.AspNetCore.Authentication.AuthenticationScheme scheme) { throw null; }
}
public partial class AuthenticationService : Microsoft.AspNetCore.Authentication.IAuthenticationService
{
public AuthenticationService(Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider schemes, Microsoft.AspNetCore.Authentication.IAuthenticationHandlerProvider handlers, Microsoft.AspNetCore.Authentication.IClaimsTransformation transform, Microsoft.Extensions.Options.IOptions options) { }
- public Microsoft.AspNetCore.Authentication.IAuthenticationHandlerProvider Handlers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Authentication.AuthenticationOptions Options { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider Schemes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Authentication.IClaimsTransformation Transform { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.IAuthenticationHandlerProvider Handlers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.AuthenticationOptions Options { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider Schemes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Authentication.IClaimsTransformation Transform { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
[System.Diagnostics.DebuggerStepThroughAttribute]
public virtual System.Threading.Tasks.Task AuthenticateAsync(Microsoft.AspNetCore.Http.HttpContext context, string scheme) { throw null; }
[System.Diagnostics.DebuggerStepThroughAttribute]
diff --git a/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs b/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs
index a7b913b1b2..4f181081f2 100644
--- a/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs
+++ b/src/Http/Authentication.Core/src/AuthenticationSchemeProvider.cs
@@ -133,17 +133,18 @@ namespace Microsoft.AspNetCore.Authentication
/// Registers a scheme for use by .
///
/// The scheme.
- public virtual void AddScheme(AuthenticationScheme scheme)
+ /// true if the scheme was added successfully.
+ public virtual bool TryAddScheme(AuthenticationScheme scheme)
{
if (_schemes.ContainsKey(scheme.Name))
{
- throw new InvalidOperationException("Scheme already exists: " + scheme.Name);
+ return false;
}
lock (_lock)
{
if (_schemes.ContainsKey(scheme.Name))
{
- throw new InvalidOperationException("Scheme already exists: " + scheme.Name);
+ return false;
}
if (typeof(IAuthenticationRequestHandler).IsAssignableFrom(scheme.HandlerType))
{
@@ -152,6 +153,26 @@ namespace Microsoft.AspNetCore.Authentication
}
_schemes[scheme.Name] = scheme;
_schemesCopy = _schemes.Values.ToArray();
+ return true;
+ }
+ }
+
+ ///
+ /// Registers a scheme for use by .
+ ///
+ /// The scheme.
+ public virtual void AddScheme(AuthenticationScheme scheme)
+ {
+ if (_schemes.ContainsKey(scheme.Name))
+ {
+ throw new InvalidOperationException("Scheme already exists: " + scheme.Name);
+ }
+ lock (_lock)
+ {
+ if (!TryAddScheme(scheme))
+ {
+ throw new InvalidOperationException("Scheme already exists: " + scheme.Name);
+ }
}
}
diff --git a/src/Http/Authentication.Core/src/AuthenticationService.cs b/src/Http/Authentication.Core/src/AuthenticationService.cs
index 7efce69ce8..de63980c4a 100644
--- a/src/Http/Authentication.Core/src/AuthenticationService.cs
+++ b/src/Http/Authentication.Core/src/AuthenticationService.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
@@ -15,6 +16,8 @@ namespace Microsoft.AspNetCore.Authentication
///
public class AuthenticationService : IAuthenticationService
{
+ private HashSet _transformCache;
+
///
/// Constructor.
///
@@ -77,8 +80,20 @@ namespace Microsoft.AspNetCore.Authentication
var result = await handler.AuthenticateAsync();
if (result != null && result.Succeeded)
{
- var transformed = await Transform.TransformAsync(result.Principal);
- return AuthenticateResult.Success(new AuthenticationTicket(transformed, result.Properties, result.Ticket.AuthenticationScheme));
+ var principal = result.Principal;
+ var doTransform = true;
+ _transformCache ??= new HashSet();
+ if (_transformCache.Contains(principal))
+ {
+ doTransform = false;
+ }
+
+ if (doTransform)
+ {
+ principal = await Transform.TransformAsync(principal);
+ _transformCache.Add(principal);
+ }
+ return AuthenticateResult.Success(new AuthenticationTicket(principal, result.Properties, result.Ticket.AuthenticationScheme));
}
return result;
}
@@ -253,7 +268,7 @@ namespace Microsoft.AspNetCore.Authentication
var schemes = await GetAllSignInSchemeNames();
// CookieAuth is the only implementation of sign-in.
- var footer = $" Did you forget to call AddAuthentication().AddCookies(\"{scheme}\",...)?";
+ var footer = $" Did you forget to call AddAuthentication().AddCookie(\"{scheme}\",...)?";
if (string.IsNullOrEmpty(schemes))
{
@@ -275,7 +290,7 @@ namespace Microsoft.AspNetCore.Authentication
{
// CookieAuth is the only implementation of sign-in.
return new InvalidOperationException(mismatchError
- + $"Did you forget to call AddAuthentication().AddCookies(\"Cookies\") and SignInAsync(\"Cookies\",...)?");
+ + $"Did you forget to call AddAuthentication().AddCookie(\"Cookies\") and SignInAsync(\"Cookies\",...)?");
}
return new InvalidOperationException(mismatchError + $"The registered sign-in schemes are: {schemes}.");
@@ -292,7 +307,7 @@ namespace Microsoft.AspNetCore.Authentication
{
var schemes = await GetAllSignOutSchemeNames();
- var footer = $" Did you forget to call AddAuthentication().AddCookies(\"{scheme}\",...)?";
+ var footer = $" Did you forget to call AddAuthentication().AddCookie(\"{scheme}\",...)?";
if (string.IsNullOrEmpty(schemes))
{
@@ -314,7 +329,7 @@ namespace Microsoft.AspNetCore.Authentication
{
// CookieAuth is the most common implementation of sign-out, but OpenIdConnect and WsFederation also support it.
return new InvalidOperationException(mismatchError
- + $"Did you forget to call AddAuthentication().AddCookies(\"Cookies\") and {nameof(SignOutAsync)}(\"Cookies\",...)?");
+ + $"Did you forget to call AddAuthentication().AddCookie(\"Cookies\") and {nameof(SignOutAsync)}(\"Cookies\",...)?");
}
return new InvalidOperationException(mismatchError + $"The registered sign-out schemes are: {schemes}.");
diff --git a/src/Http/Authentication.Core/test/AuthenticationPropertiesTests.cs b/src/Http/Authentication.Core/test/AuthenticationPropertiesTests.cs
index 84db381ce4..c8a8056077 100644
--- a/src/Http/Authentication.Core/test/AuthenticationPropertiesTests.cs
+++ b/src/Http/Authentication.Core/test/AuthenticationPropertiesTests.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -298,4 +298,4 @@ namespace Microsoft.AspNetCore.Authentication.Core.Test
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs b/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs
index 82602000aa..f422ee885d 100644
--- a/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs
+++ b/src/Http/Authentication.Core/test/AuthenticationSchemeProviderTests.cs
@@ -11,7 +11,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Xunit;
-namespace Microsoft.AspNetCore.Authentication
+namespace Microsoft.AspNetCore.Authentication.Core.Test
{
public class AuthenticationSchemeProviderTests
{
@@ -133,6 +133,23 @@ namespace Microsoft.AspNetCore.Authentication
Assert.Contains("Scheme already exists: signin", error.Message);
}
+ [Fact]
+ public void CanSafelyTryAddSchemes()
+ {
+ var services = new ServiceCollection().AddOptions().AddAuthenticationCore(o =>
+ {
+ }).BuildServiceProvider();
+
+ var o = services.GetRequiredService();
+ Assert.True(o.TryAddScheme(new AuthenticationScheme("signin", "whatever", typeof(Handler))));
+ Assert.True(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler))));
+ Assert.False(o.TryAddScheme(new AuthenticationScheme("signin", "whatever", typeof(Handler))));
+ Assert.True(o.TryAddScheme(new AuthenticationScheme("signin3", "whatever", typeof(Handler))));
+ Assert.False(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler))));
+ o.RemoveScheme("signin2");
+ Assert.True(o.TryAddScheme(new AuthenticationScheme("signin2", "whatever", typeof(Handler))));
+ }
+
[Fact]
public async Task LookupUsesProvidedStringComparer()
{
diff --git a/src/Http/Authentication.Core/test/AuthenticationServiceTests.cs b/src/Http/Authentication.Core/test/AuthenticationServiceTests.cs
index b62db22077..6134ca9172 100644
--- a/src/Http/Authentication.Core/test/AuthenticationServiceTests.cs
+++ b/src/Http/Authentication.Core/test/AuthenticationServiceTests.cs
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace Microsoft.AspNetCore.Authentication
+namespace Microsoft.AspNetCore.Authentication.Core.Test
{
public class AuthenticationServiceTests
{
@@ -27,6 +27,30 @@ namespace Microsoft.AspNetCore.Authentication
Assert.Contains("base", ex.Message);
}
+ [Fact]
+ public async Task CustomHandlersAuthenticateRunsClaimsTransformationEveryTime()
+ {
+ var transform = new RunOnce();
+ var services = new ServiceCollection().AddOptions().AddAuthenticationCore(o =>
+ {
+ o.AddScheme("base", "whatever");
+ })
+ .AddSingleton(transform)
+ .BuildServiceProvider();
+ var context = new DefaultHttpContext();
+ context.RequestServices = services;
+
+ // Because base handler returns a different principal per call, its run multiple times
+ await context.AuthenticateAsync("base");
+ Assert.Equal(1, transform.Ran);
+
+ await context.AuthenticateAsync("base");
+ Assert.Equal(2, transform.Ran);
+
+ await context.AuthenticateAsync("base");
+ Assert.Equal(3, transform.Ran);
+ }
+
[Fact]
public async Task ChallengeThrowsForSchemeMismatch()
{
@@ -219,12 +243,25 @@ namespace Microsoft.AspNetCore.Authentication
await context.ForbidAsync();
}
+ private class RunOnce : IClaimsTransformation
+ {
+ public int Ran = 0;
+ public Task TransformAsync(ClaimsPrincipal principal)
+ {
+ Ran++;
+ return Task.FromResult(new ClaimsPrincipal());
+ }
+ }
private class BaseHandler : IAuthenticationHandler
{
public Task AuthenticateAsync()
{
- return Task.FromResult(AuthenticateResult.NoResult());
+ return Task.FromResult(AuthenticateResult.Success(
+ new AuthenticationTicket(
+ new ClaimsPrincipal(new ClaimsIdentity("whatever")),
+ new AuthenticationProperties(),
+ "whatever")));
}
public Task ChallengeAsync(AuthenticationProperties properties)
diff --git a/src/Http/Authentication.Core/test/TokenExtensionTests.cs b/src/Http/Authentication.Core/test/TokenExtensionTests.cs
index 7215d526e9..49f47cf45f 100644
--- a/src/Http/Authentication.Core/test/TokenExtensionTests.cs
+++ b/src/Http/Authentication.Core/test/TokenExtensionTests.cs
@@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
-namespace Microsoft.AspNetCore.Authentication
+namespace Microsoft.AspNetCore.Authentication.Core.Test
{
public class TokenExtensionTests
{
diff --git a/src/Http/Headers/ref/Microsoft.Net.Http.Headers.netcoreapp.cs b/src/Http/Headers/ref/Microsoft.Net.Http.Headers.netcoreapp.cs
index a730eadf21..2e059efe1a 100644
--- a/src/Http/Headers/ref/Microsoft.Net.Http.Headers.netcoreapp.cs
+++ b/src/Http/Headers/ref/Microsoft.Net.Http.Headers.netcoreapp.cs
@@ -325,14 +325,14 @@ namespace Microsoft.Net.Http.Headers
{
public SetCookieHeaderValue(Microsoft.Extensions.Primitives.StringSegment name) { }
public SetCookieHeaderValue(Microsoft.Extensions.Primitives.StringSegment name, Microsoft.Extensions.Primitives.StringSegment value) { }
- public Microsoft.Extensions.Primitives.StringSegment Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.Extensions.Primitives.StringSegment Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.Extensions.Primitives.StringSegment Name { get { throw null; } set { } }
- public Microsoft.Extensions.Primitives.StringSegment Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.Net.Http.Headers.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.Extensions.Primitives.StringSegment Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.Net.Http.Headers.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.Extensions.Primitives.StringSegment Value { get { throw null; } set { } }
public void AppendToStringBuilder(System.Text.StringBuilder builder) { }
public override bool Equals(object obj) { throw null; }
diff --git a/src/Http/Headers/src/EntityTagHeaderValue.cs b/src/Http/Headers/src/EntityTagHeaderValue.cs
index e46cee3a34..9b3a37136b 100644
--- a/src/Http/Headers/src/EntityTagHeaderValue.cs
+++ b/src/Http/Headers/src/EntityTagHeaderValue.cs
@@ -53,7 +53,7 @@ namespace Microsoft.Net.Http.Headers
(length != tag.Length))
{
// Note that we don't allow 'W/' prefixes for weak ETags in the 'tag' parameter. If the user wants to
- // add a weak ETag, he can set 'isWeak' to true.
+ // add a weak ETag, they can set 'isWeak' to true.
throw new FormatException("Invalid ETag name");
}
diff --git a/src/Http/Headers/src/HeaderUtilities.cs b/src/Http/Headers/src/HeaderUtilities.cs
index 0d193b4e61..54034359fb 100644
--- a/src/Http/Headers/src/HeaderUtilities.cs
+++ b/src/Http/Headers/src/HeaderUtilities.cs
@@ -26,7 +26,7 @@ namespace Microsoft.Net.Http.Headers
{
// Note that even if we check the value here, we can't prevent a user from adding an invalid quality
// value using Parameters.Add(). Even if we would prevent the user from adding an invalid value
- // using Parameters.Add() he could always add invalid values using HttpHeaders.AddWithoutValidation().
+ // using Parameters.Add() they could always add invalid values using HttpHeaders.AddWithoutValidation().
// So this check is really for convenience to show users that they're trying to add an invalid
// value.
if ((value < 0) || (value > 1))
diff --git a/src/Http/Headers/src/SetCookieHeaderValue.cs b/src/Http/Headers/src/SetCookieHeaderValue.cs
index 3a5b217d6c..cdf12381aa 100644
--- a/src/Http/Headers/src/SetCookieHeaderValue.cs
+++ b/src/Http/Headers/src/SetCookieHeaderValue.cs
@@ -24,10 +24,6 @@ namespace Microsoft.Net.Http.Headers
private static readonly string SameSiteLaxToken = SameSiteMode.Lax.ToString().ToLower();
private static readonly string SameSiteStrictToken = SameSiteMode.Strict.ToString().ToLower();
- // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1
- // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1
- internal static bool SuppressSameSiteNone;
-
private const string HttpOnlyToken = "httponly";
private const string SeparatorToken = "; ";
private const string EqualsToken = "=";
@@ -42,14 +38,6 @@ namespace Microsoft.Net.Http.Headers
private StringSegment _name;
private StringSegment _value;
- static SetCookieHeaderValue()
- {
- if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled))
- {
- SuppressSameSiteNone = enabled;
- }
- }
-
private SetCookieHeaderValue()
{
// Used by the parser to create a new instance of this type.
@@ -106,7 +94,7 @@ namespace Microsoft.Net.Http.Headers
public bool Secure { get; set; }
- public SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified;
+ public SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified;
public bool HttpOnly { get; set; }
@@ -145,7 +133,7 @@ namespace Microsoft.Net.Http.Headers
}
// Allow for Unspecified (-1) to skip SameSite
- if (SameSite == SameSiteMode.None && !SuppressSameSiteNone)
+ if (SameSite == SameSiteMode.None)
{
sameSite = SameSiteNoneToken;
length += SeparatorToken.Length + SameSiteToken.Length + EqualsToken.Length + sameSite.Length;
@@ -275,7 +263,7 @@ namespace Microsoft.Net.Http.Headers
}
// Allow for Unspecified (-1) to skip SameSite
- if (SameSite == SameSiteMode.None && !SuppressSameSiteNone)
+ if (SameSite == SameSiteMode.None)
{
AppendSegment(builder, SameSiteToken, SameSiteNoneToken);
}
@@ -478,7 +466,7 @@ namespace Microsoft.Net.Http.Headers
{
if (!ReadEqualsSign(input, ref offset))
{
- result.SameSite = SuppressSameSiteNone ? SameSiteMode.Strict : SameSiteMode.Unspecified;
+ result.SameSite = SameSiteMode.Unspecified;
}
else
{
@@ -492,14 +480,13 @@ namespace Microsoft.Net.Http.Headers
{
result.SameSite = SameSiteMode.Lax;
}
- else if (!SuppressSameSiteNone
- && StringSegment.Equals(enforcementMode, SameSiteNoneToken, StringComparison.OrdinalIgnoreCase))
+ else if (StringSegment.Equals(enforcementMode, SameSiteNoneToken, StringComparison.OrdinalIgnoreCase))
{
result.SameSite = SameSiteMode.None;
}
else
{
- result.SameSite = SuppressSameSiteNone ? SameSiteMode.Strict : SameSiteMode.Unspecified;
+ result.SameSite = SameSiteMode.Unspecified;
}
}
}
diff --git a/src/Http/Headers/test/SetCookieHeaderValueTest.cs b/src/Http/Headers/test/SetCookieHeaderValueTest.cs
index 11593b4f93..4f33c54599 100644
--- a/src/Http/Headers/test/SetCookieHeaderValueTest.cs
+++ b/src/Http/Headers/test/SetCookieHeaderValueTest.cs
@@ -313,28 +313,6 @@ namespace Microsoft.Net.Http.Headers
Assert.Equal(expectedValue, input.ToString());
}
- [Fact]
- public void SetCookieHeaderValue_ToString_SameSiteNoneCompat()
- {
- SetCookieHeaderValue.SuppressSameSiteNone = true;
-
- var input = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
-
- Assert.Equal("name=value", input.ToString());
-
- SetCookieHeaderValue.SuppressSameSiteNone = false;
-
- var input2 = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
-
- Assert.Equal("name=value; samesite=none", input2.ToString());
- }
-
[Theory]
[MemberData(nameof(SetCookieHeaderDataSet))]
public void SetCookieHeaderValue_AppendToStringBuilder(SetCookieHeaderValue input, string expectedValue)
@@ -346,32 +324,6 @@ namespace Microsoft.Net.Http.Headers
Assert.Equal(expectedValue, builder.ToString());
}
- [Fact]
- public void SetCookieHeaderValue_AppendToStringBuilder_SameSiteNoneCompat()
- {
- SetCookieHeaderValue.SuppressSameSiteNone = true;
-
- var builder = new StringBuilder();
- var input = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
-
- input.AppendToStringBuilder(builder);
- Assert.Equal("name=value", builder.ToString());
-
- SetCookieHeaderValue.SuppressSameSiteNone = false;
-
- var builder2 = new StringBuilder();
- var input2 = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
-
- input2.AppendToStringBuilder(builder2);
- Assert.Equal("name=value; samesite=none", builder2.ToString());
- }
-
[Theory]
[MemberData(nameof(SetCookieHeaderDataSet))]
public void SetCookieHeaderValue_Parse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue)
@@ -382,31 +334,6 @@ namespace Microsoft.Net.Http.Headers
Assert.Equal(expectedValue, header.ToString());
}
- [Fact]
- public void SetCookieHeaderValue_Parse_AcceptsValidValues_SameSiteNoneCompat()
- {
- SetCookieHeaderValue.SuppressSameSiteNone = true;
- var header = SetCookieHeaderValue.Parse("name=value; samesite=none");
-
- var cookie = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.Strict,
- };
-
- Assert.Equal(cookie, header);
- Assert.Equal("name=value; samesite=strict", header.ToString());
- SetCookieHeaderValue.SuppressSameSiteNone = false;
-
- var header2 = SetCookieHeaderValue.Parse("name=value; samesite=none");
-
- var cookie2 = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
- Assert.Equal(cookie2, header2);
- Assert.Equal("name=value; samesite=none", header2.ToString());
- }
-
[Theory]
[MemberData(nameof(SetCookieHeaderDataSet))]
public void SetCookieHeaderValue_TryParse_AcceptsValidValues(SetCookieHeaderValue cookie, string expectedValue)
@@ -417,31 +344,6 @@ namespace Microsoft.Net.Http.Headers
Assert.Equal(expectedValue, header.ToString());
}
- [Fact]
- public void SetCookieHeaderValue_TryParse_AcceptsValidValues_SameSiteNoneCompat()
- {
- SetCookieHeaderValue.SuppressSameSiteNone = true;
- Assert.True(SetCookieHeaderValue.TryParse("name=value; samesite=none", out var header));
- var cookie = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.Strict,
- };
-
- Assert.Equal(cookie, header);
- Assert.Equal("name=value; samesite=strict", header.ToString());
-
- SetCookieHeaderValue.SuppressSameSiteNone = false;
-
- Assert.True(SetCookieHeaderValue.TryParse("name=value; samesite=none", out var header2));
- var cookie2 = new SetCookieHeaderValue("name", "value")
- {
- SameSite = SameSiteMode.None,
- };
-
- Assert.Equal(cookie2, header2);
- Assert.Equal("name=value; samesite=none", header2.ToString());
- }
-
[Theory]
[MemberData(nameof(InvalidSetCookieHeaderDataSet))]
public void SetCookieHeaderValue_Parse_RejectsInvalidValues(string value)
diff --git a/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp.cs b/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp.cs
index cf19578fe0..30eefbe417 100644
--- a/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp.cs
+++ b/src/Http/Http.Abstractions/ref/Microsoft.AspNetCore.Http.Abstractions.netcoreapp.cs
@@ -6,9 +6,9 @@ namespace Microsoft.AspNetCore.Builder
public abstract partial class EndpointBuilder
{
protected EndpointBuilder() { }
- public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Collections.Generic.IList Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Http.RequestDelegate RequestDelegate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Collections.Generic.IList Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Http.RequestDelegate RequestDelegate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public abstract Microsoft.AspNetCore.Http.Endpoint Build();
}
public partial interface IApplicationBuilder
@@ -27,6 +27,7 @@ namespace Microsoft.AspNetCore.Builder
public static partial class MapExtensions
{
public static Microsoft.AspNetCore.Builder.IApplicationBuilder Map(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.AspNetCore.Http.PathString pathMatch, System.Action configuration) { throw null; }
+ public static Microsoft.AspNetCore.Builder.IApplicationBuilder Map(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.AspNetCore.Http.PathString pathMatch, bool preserveMatchedPathSegment, System.Action configuration) { throw null; }
}
public static partial class MapWhenExtensions
{
@@ -65,8 +66,9 @@ namespace Microsoft.AspNetCore.Builder.Extensions
public partial class MapOptions
{
public MapOptions() { }
- public Microsoft.AspNetCore.Http.RequestDelegate Branch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.PathString PathMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.RequestDelegate Branch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.PathString PathMatch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool PreserveMatchedPathSegment { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class MapWhenMiddleware
{
@@ -77,7 +79,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
public partial class MapWhenOptions
{
public MapWhenOptions() { }
- public Microsoft.AspNetCore.Http.RequestDelegate Branch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.RequestDelegate Branch { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public System.Func Predicate { get { throw null; } set { } }
}
public partial class UsePathBaseMiddleware
@@ -109,15 +111,15 @@ namespace Microsoft.AspNetCore.Http
public partial class CookieBuilder
{
public CookieBuilder() { }
- public virtual string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual System.TimeSpan? Expiration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public virtual string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual System.TimeSpan? Expiration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public virtual string Name { get { throw null; } set { } }
- public virtual string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public virtual Microsoft.AspNetCore.Http.CookieSecurePolicy SecurePolicy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public virtual string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public virtual Microsoft.AspNetCore.Http.CookieSecurePolicy SecurePolicy { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.AspNetCore.Http.CookieOptions Build(Microsoft.AspNetCore.Http.HttpContext context) { throw null; }
public virtual Microsoft.AspNetCore.Http.CookieOptions Build(Microsoft.AspNetCore.Http.HttpContext context, System.DateTimeOffset expiresFrom) { throw null; }
}
@@ -130,9 +132,9 @@ namespace Microsoft.AspNetCore.Http
public partial class Endpoint
{
public Endpoint(Microsoft.AspNetCore.Http.RequestDelegate requestDelegate, Microsoft.AspNetCore.Http.EndpointMetadataCollection metadata, string displayName) { }
- public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Http.EndpointMetadataCollection Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Http.RequestDelegate RequestDelegate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string DisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Http.EndpointMetadataCollection Metadata { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Http.RequestDelegate RequestDelegate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public override string ToString() { throw null; }
}
public static partial class EndpointHttpContextExtensions
@@ -157,7 +159,7 @@ namespace Microsoft.AspNetCore.Http
{
private object _dummy;
private int _dummyPrimitive;
- public object Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public object Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
public void Reset() { }
@@ -167,6 +169,7 @@ namespace Microsoft.AspNetCore.Http
public readonly partial struct FragmentString : System.IEquatable
{
private readonly object _dummy;
+ private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Http.FragmentString Empty;
public FragmentString(string value) { throw null; }
public bool HasValue { get { throw null; } }
@@ -192,6 +195,7 @@ namespace Microsoft.AspNetCore.Http
public readonly partial struct HostString : System.IEquatable
{
private readonly object _dummy;
+ private readonly int _dummyPrimitive;
public HostString(string value) { throw null; }
public HostString(string host, int port) { throw null; }
public bool HasValue { get { throw null; } }
@@ -266,7 +270,7 @@ namespace Microsoft.AspNetCore.Http
public abstract string Protocol { get; set; }
public abstract Microsoft.AspNetCore.Http.IQueryCollection Query { get; set; }
public abstract Microsoft.AspNetCore.Http.QueryString QueryString { get; set; }
- public virtual Microsoft.AspNetCore.Routing.RouteValueDictionary RouteValues { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public virtual Microsoft.AspNetCore.Routing.RouteValueDictionary RouteValues { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public abstract string Scheme { get; set; }
public abstract System.Threading.Tasks.Task ReadFormAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
@@ -320,6 +324,7 @@ namespace Microsoft.AspNetCore.Http
public readonly partial struct PathString : System.IEquatable
{
private readonly object _dummy;
+ private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Http.PathString Empty;
public PathString(string value) { throw null; }
public bool HasValue { get { throw null; } }
@@ -353,6 +358,7 @@ namespace Microsoft.AspNetCore.Http
public readonly partial struct QueryString : System.IEquatable
{
private readonly object _dummy;
+ private readonly int _dummyPrimitive;
public static readonly Microsoft.AspNetCore.Http.QueryString Empty;
public QueryString(string value) { throw null; }
public bool HasValue { get { throw null; } }
@@ -510,7 +516,7 @@ namespace Microsoft.AspNetCore.Routing
private object _dummy;
private int _dummyPrimitive;
public Enumerator(Microsoft.AspNetCore.Routing.RouteValueDictionary dictionary) { throw null; }
- public System.Collections.Generic.KeyValuePair Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Collections.Generic.KeyValuePair Current { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool MoveNext() { throw null; }
diff --git a/src/Http/Http.Abstractions/src/CookieBuilder.cs b/src/Http/Http.Abstractions/src/CookieBuilder.cs
index 46ed33e7f8..429de53cf3 100644
--- a/src/Http/Http.Abstractions/src/CookieBuilder.cs
+++ b/src/Http/Http.Abstractions/src/CookieBuilder.cs
@@ -11,20 +11,8 @@ namespace Microsoft.AspNetCore.Http
///
public class CookieBuilder
{
- // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1
- // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1
- internal static bool SuppressSameSiteNone;
-
private string _name;
- static CookieBuilder()
- {
- if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled))
- {
- SuppressSameSiteNone = enabled;
- }
- }
-
///
/// The name of the cookie.
///
@@ -40,7 +28,7 @@ namespace Microsoft.AspNetCore.Http
/// The cookie path.
///
///
- /// Determines the value that will set on .
+ /// Determines the value that will set on .
///
public virtual string Path { get; set; }
@@ -48,7 +36,7 @@ namespace Microsoft.AspNetCore.Http
/// The domain to associate the cookie with.
///
///
- /// Determines the value that will set on .
+ /// Determines the value that will set on .
///
public virtual string Domain { get; set; }
@@ -56,7 +44,7 @@ namespace Microsoft.AspNetCore.Http
/// Indicates whether a cookie is accessible by client-side script.
///
///
- /// Determines the value that will set on .
+ /// Determines the value that will set on .
///
public virtual bool HttpOnly { get; set; }
@@ -64,12 +52,12 @@ namespace Microsoft.AspNetCore.Http
/// The SameSite attribute of the cookie. The default value is
///
///
- /// Determines the value that will set on .
+ /// Determines the value that will set on .
///
- public virtual SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified;
+ public virtual SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified;
///
- /// The policy that will be used to determine .
+ /// The policy that will be used to determine .
/// This is determined from the passed to .
///
public virtual CookieSecurePolicy SecurePolicy { get; set; }
@@ -101,7 +89,7 @@ namespace Microsoft.AspNetCore.Http
/// Creates the cookie options from the given with an expiration based on and .
///
/// The .
- /// The time to use as the base for computing .
+ /// The time to use as the base for computing .
/// The cookie options.
public virtual CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
{
diff --git a/src/Http/Http.Abstractions/src/Extensions/MapExtensions.cs b/src/Http/Http.Abstractions/src/Extensions/MapExtensions.cs
index 448e2c6f6d..fc33e8fe8a 100644
--- a/src/Http/Http.Abstractions/src/Extensions/MapExtensions.cs
+++ b/src/Http/Http.Abstractions/src/Extensions/MapExtensions.cs
@@ -21,6 +21,20 @@ namespace Microsoft.AspNetCore.Builder
/// The branch to take for positive path matches.
/// The instance.
public static IApplicationBuilder Map(this IApplicationBuilder app, PathString pathMatch, Action configuration)
+ {
+ return Map(app, pathMatch, preserveMatchedPathSegment: false, configuration);
+ }
+
+ ///
+ /// Branches the request pipeline based on matches of the given request path. If the request path starts with
+ /// the given path, the branch is executed.
+ ///
+ /// The instance.
+ /// The request path to match.
+ /// if false, matched path would be removed from Request.Path and added to Request.PathBase.
+ /// The branch to take for positive path matches.
+ /// The instance.
+ public static IApplicationBuilder Map(this IApplicationBuilder app, PathString pathMatch, bool preserveMatchedPathSegment, Action configuration)
{
if (app == null)
{
@@ -46,8 +60,9 @@ namespace Microsoft.AspNetCore.Builder
{
Branch = branch,
PathMatch = pathMatch,
+ PreserveMatchedPathSegment = preserveMatchedPathSegment
};
return app.Use(next => new MapMiddleware(next, options).Invoke);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Http/Http.Abstractions/src/Extensions/MapMiddleware.cs b/src/Http/Http.Abstractions/src/Extensions/MapMiddleware.cs
index 4215b82697..0ba76507c8 100644
--- a/src/Http/Http.Abstractions/src/Extensions/MapMiddleware.cs
+++ b/src/Http/Http.Abstractions/src/Extensions/MapMiddleware.cs
@@ -48,16 +48,17 @@ namespace Microsoft.AspNetCore.Builder.Extensions
throw new ArgumentNullException(nameof(context));
}
- PathString matchedPath;
- PathString remainingPath;
-
- if (context.Request.Path.StartsWithSegments(_options.PathMatch, out matchedPath, out remainingPath))
+ if (context.Request.Path.StartsWithSegments(_options.PathMatch, out var matchedPath, out var remainingPath))
{
- // Update the path
var path = context.Request.Path;
var pathBase = context.Request.PathBase;
- context.Request.PathBase = pathBase.Add(matchedPath);
- context.Request.Path = remainingPath;
+
+ if (!_options.PreserveMatchedPathSegment)
+ {
+ // Update the path
+ context.Request.PathBase = pathBase.Add(matchedPath);
+ context.Request.Path = remainingPath;
+ }
try
{
@@ -65,8 +66,11 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
finally
{
- context.Request.PathBase = pathBase;
- context.Request.Path = path;
+ if (!_options.PreserveMatchedPathSegment)
+ {
+ context.Request.PathBase = pathBase;
+ context.Request.Path = path;
+ }
}
}
else
@@ -75,4 +79,4 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Http/Http.Abstractions/src/Extensions/MapOptions.cs b/src/Http/Http.Abstractions/src/Extensions/MapOptions.cs
index 60adc74379..d914aa4210 100644
--- a/src/Http/Http.Abstractions/src/Extensions/MapOptions.cs
+++ b/src/Http/Http.Abstractions/src/Extensions/MapOptions.cs
@@ -19,5 +19,11 @@ namespace Microsoft.AspNetCore.Builder.Extensions
/// The branch taken for a positive match.
///
public RequestDelegate Branch { get; set; }
+
+ ///
+ /// If false, matched path would be removed from Request.Path and added to Request.PathBase
+ /// Defaults to false.
+ ///
+ public bool PreserveMatchedPathSegment { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Http/Http.Abstractions/src/IHttpContextAccessor.cs b/src/Http/Http.Abstractions/src/IHttpContextAccessor.cs
index dc8ec34a7c..b02c78d144 100644
--- a/src/Http/Http.Abstractions/src/IHttpContextAccessor.cs
+++ b/src/Http/Http.Abstractions/src/IHttpContextAccessor.cs
@@ -3,8 +3,18 @@
namespace Microsoft.AspNetCore.Http
{
+ ///
+ /// Provides access to the current , if one is available.
+ ///
+ ///
+ /// This interface should be used with caution. It relies on which can have a negative performance impact on async calls.
+ /// It also creates a dependency on "ambient state" which can make testing more difficult.
+ ///
public interface IHttpContextAccessor
{
+ ///
+ /// Gets or sets the current . Returns if there is no active .
+ ///
HttpContext HttpContext { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Http/Http.Abstractions/src/IHttpContextFactory.cs b/src/Http/Http.Abstractions/src/IHttpContextFactory.cs
index 7d049626c3..4a73724219 100644
--- a/src/Http/Http.Abstractions/src/IHttpContextFactory.cs
+++ b/src/Http/Http.Abstractions/src/IHttpContextFactory.cs
@@ -5,9 +5,22 @@ using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Http
{
+ ///
+ /// Provides methods to create and dispose of instances.
+ ///
public interface IHttpContextFactory
{
+ ///
+ /// Creates an instance for the specified set of HTTP features.
+ ///
+ /// The collection of HTTP features to set on the created instance.
+ /// The instance.
HttpContext Create(IFeatureCollection featureCollection);
+
+ ///
+ /// Releases resources held by the .
+ ///
+ /// The to dispose.
void Dispose(HttpContext httpContext);
}
}
diff --git a/src/Http/Http.Abstractions/test/MapPathMiddlewareTests.cs b/src/Http/Http.Abstractions/test/MapPathMiddlewareTests.cs
index a30e99603c..f9d935b086 100644
--- a/src/Http/Http.Abstractions/test/MapPathMiddlewareTests.cs
+++ b/src/Http/Http.Abstractions/test/MapPathMiddlewareTests.cs
@@ -54,13 +54,13 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/foo", "/Bar", "/foo/cho/")]
[InlineData("/foo/cho", "/Bar", "/foo/cho")]
[InlineData("/foo/cho", "/Bar", "/foo/cho/do")]
- public void PathMatchFunc_BranchTaken(string matchPath, string basePath, string requestPath)
+ public async Task PathMatchFunc_BranchTaken(string matchPath, string basePath, string requestPath)
{
HttpContext context = CreateRequest(basePath, requestPath);
var builder = new ApplicationBuilder(serviceProvider: null);
builder.Map(matchPath, UseSuccess);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(basePath, context.Request.PathBase.Value);
@@ -82,19 +82,47 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/foo", "/Bar", "/Foo/Cho/")]
[InlineData("/foo/cho", "/Bar", "/Foo/Cho")]
[InlineData("/foo/cho", "/Bar", "/Foo/Cho/do")]
- public void PathMatchAction_BranchTaken(string matchPath, string basePath, string requestPath)
+ public async Task PathMatchAction_BranchTaken(string matchPath, string basePath, string requestPath)
{
HttpContext context = CreateRequest(basePath, requestPath);
var builder = new ApplicationBuilder(serviceProvider: null);
builder.Map(matchPath, subBuilder => subBuilder.Run(Success));
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(basePath + requestPath.Substring(0, matchPath.Length), (string)context.Items["test.PathBase"]);
Assert.Equal(requestPath.Substring(matchPath.Length), context.Items["test.Path"]);
}
+ [Theory]
+ [InlineData("/foo", "", "/foo")]
+ [InlineData("/foo", "", "/foo/")]
+ [InlineData("/foo", "/Bar", "/foo")]
+ [InlineData("/foo", "/Bar", "/foo/cho")]
+ [InlineData("/foo", "/Bar", "/foo/cho/")]
+ [InlineData("/foo/cho", "/Bar", "/foo/cho")]
+ [InlineData("/foo/cho", "/Bar", "/foo/cho/do")]
+ [InlineData("/foo", "", "/Foo")]
+ [InlineData("/foo", "", "/Foo/")]
+ [InlineData("/foo", "/Bar", "/Foo")]
+ [InlineData("/foo", "/Bar", "/Foo/Cho")]
+ [InlineData("/foo", "/Bar", "/Foo/Cho/")]
+ [InlineData("/foo/cho", "/Bar", "/Foo/Cho")]
+ [InlineData("/foo/cho", "/Bar", "/Foo/Cho/do")]
+ public async Task PathMatchAction_BranchTaken_WithPreserveMatchedPathSegment(string matchPath, string basePath, string requestPath)
+ {
+ HttpContext context = CreateRequest(basePath, requestPath);
+ var builder = new ApplicationBuilder(serviceProvider: null);
+ builder.Map(matchPath, true, subBuilder => subBuilder.Run(Success));
+ var app = builder.Build();
+ await app.Invoke(context);
+
+ Assert.Equal(200, context.Response.StatusCode);
+ Assert.Equal(basePath, (string)context.Items["test.PathBase"]);
+ Assert.Equal(requestPath, context.Items["test.Path"]);
+ }
+
[Theory]
[InlineData("/")]
[InlineData("/foo/")]
@@ -112,14 +140,14 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/foo", "/foo", "/bar")]
[InlineData("/foo", "", "/bar/foo")]
[InlineData("/foo/bar", "/foo", "/bar")]
- public void PathMismatchFunc_PassedThrough(string matchPath, string basePath, string requestPath)
+ public async Task PathMismatchFunc_PassedThrough(string matchPath, string basePath, string requestPath)
{
HttpContext context = CreateRequest(basePath, requestPath);
var builder = new ApplicationBuilder(serviceProvider: null);
builder.Map(matchPath, UseNotImplemented);
builder.Run(Success);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(basePath, context.Request.PathBase.Value);
@@ -134,14 +162,14 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/foo", "/foo", "/bar")]
[InlineData("/foo", "", "/bar/foo")]
[InlineData("/foo/bar", "/foo", "/bar")]
- public void PathMismatchAction_PassedThrough(string matchPath, string basePath, string requestPath)
+ public async Task PathMismatchAction_PassedThrough(string matchPath, string basePath, string requestPath)
{
HttpContext context = CreateRequest(basePath, requestPath);
var builder = new ApplicationBuilder(serviceProvider: null);
builder.Map(matchPath, UseNotImplemented);
builder.Run(Success);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(basePath, context.Request.PathBase.Value);
@@ -149,7 +177,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
[Fact]
- public void ChainedRoutes_Success()
+ public async Task ChainedRoutes_Success()
{
var builder = new ApplicationBuilder(serviceProvider: null);
builder.Map("/route1", map =>
@@ -161,28 +189,28 @@ namespace Microsoft.AspNetCore.Builder.Extensions
var app = builder.Build();
HttpContext context = CreateRequest(string.Empty, "/route1");
- Assert.Throws(() => app.Invoke(context).Wait());
+ await Assert.ThrowsAsync(() => app.Invoke(context));
context = CreateRequest(string.Empty, "/route1/subroute1");
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(string.Empty, context.Request.PathBase.Value);
Assert.Equal("/route1/subroute1", context.Request.Path.Value);
context = CreateRequest(string.Empty, "/route2");
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(404, context.Response.StatusCode);
Assert.Equal(string.Empty, context.Request.PathBase.Value);
Assert.Equal("/route2", context.Request.Path.Value);
context = CreateRequest(string.Empty, "/route2/subroute2");
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(string.Empty, context.Request.PathBase.Value);
Assert.Equal("/route2/subroute2", context.Request.Path.Value);
context = CreateRequest(string.Empty, "/route2/subroute2/subsub2");
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
Assert.Equal(string.Empty, context.Request.PathBase.Value);
Assert.Equal("/route2/subroute2/subsub2", context.Request.Path.Value);
diff --git a/src/Http/Http.Abstractions/test/MapPredicateMiddlewareTests.cs b/src/Http/Http.Abstractions/test/MapPredicateMiddlewareTests.cs
index 9274ab4207..048d522579 100644
--- a/src/Http/Http.Abstractions/test/MapPredicateMiddlewareTests.cs
+++ b/src/Http/Http.Abstractions/test/MapPredicateMiddlewareTests.cs
@@ -61,44 +61,44 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
[Fact]
- public void PredicateTrue_BranchTaken()
+ public async Task PredicateTrue_BranchTaken()
{
HttpContext context = CreateRequest();
var builder = new ApplicationBuilder(serviceProvider: null);
builder.MapWhen(TruePredicate, UseSuccess);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
}
[Fact]
- public void PredicateTrueAction_BranchTaken()
+ public async Task PredicateTrueAction_BranchTaken()
{
HttpContext context = CreateRequest();
var builder = new ApplicationBuilder(serviceProvider: null);
builder.MapWhen(TruePredicate, UseSuccess);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
}
[Fact]
- public void PredicateFalseAction_PassThrough()
+ public async Task PredicateFalseAction_PassThrough()
{
HttpContext context = CreateRequest();
var builder = new ApplicationBuilder(serviceProvider: null);
builder.MapWhen(FalsePredicate, UseNotImplemented);
builder.Run(Success);
var app = builder.Build();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
}
[Fact]
- public void ChainedPredicates_Success()
+ public async Task ChainedPredicates_Success()
{
var builder = new ApplicationBuilder(serviceProvider: null);
builder.MapWhen(TruePredicate, map1 =>
@@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
var app = builder.Build();
HttpContext context = CreateRequest();
- app.Invoke(context).Wait();
+ await app.Invoke(context);
Assert.Equal(200, context.Response.StatusCode);
}
diff --git a/src/Http/Http.Abstractions/test/UsePathBaseExtensionsTests.cs b/src/Http/Http.Abstractions/test/UsePathBaseExtensionsTests.cs
index 4b8e9d71cb..e5f7903bc5 100644
--- a/src/Http/Http.Abstractions/test/UsePathBaseExtensionsTests.cs
+++ b/src/Http/Http.Abstractions/test/UsePathBaseExtensionsTests.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@@ -76,9 +76,9 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/base/more", "/oldbase", "/base/more", "/oldbase/base/more", "")]
[InlineData("/base/more", "/oldbase", "/base/more/something", "/oldbase/base/more", "/something")]
[InlineData("/base/more", "/oldbase", "/base/more/something/", "/oldbase/base/more", "/something/")]
- public void RequestPathBaseContainingPathBase_IsSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ public Task RequestPathBaseContainingPathBase_IsSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
- TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
+ return TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
}
[Theory]
@@ -90,9 +90,9 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/base", "/oldbase", "/baseandsomething", "/oldbase", "/baseandsomething")]
[InlineData("/base", "/oldbase", "/ba", "/oldbase", "/ba")]
[InlineData("/base", "/oldbase", "/ba/se", "/oldbase", "/ba/se")]
- public void RequestPathBaseNotContainingPathBase_IsNotSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ public Task RequestPathBaseNotContainingPathBase_IsNotSplit(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
- TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
+ return TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
}
[Theory]
@@ -106,17 +106,17 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/base", "/oldbase", "/base/", "/oldbase/base", "/")]
[InlineData("/base/", "/oldbase", "/base", "/oldbase/base", "")]
[InlineData("/base/", "/oldbase", "/base/", "/oldbase/base", "/")]
- public void PathBaseNeverEndsWithSlash(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ public Task PathBaseNeverEndsWithSlash(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
- TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
+ return TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
}
[Theory]
[InlineData("/base", "", "/Base/Something", "/Base", "/Something")]
[InlineData("/base", "/OldBase", "/Base/Something", "/OldBase/Base", "/Something")]
- public void PathBaseAndPathPreserveRequestCasing(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ public Task PathBaseAndPathPreserveRequestCasing(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
- TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
+ return TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
}
[Theory]
@@ -126,12 +126,12 @@ namespace Microsoft.AspNetCore.Builder.Extensions
[InlineData("/b♫se", "/oldb♫se", "/b♫se/something", "/oldb♫se/b♫se", "/something")]
[InlineData("/b♫se", "/oldb♫se", "/b♫se/Something", "/oldb♫se/b♫se", "/Something")]
[InlineData("/b♫se", "/oldb♫se", "/B♫se/something", "/oldb♫se/B♫se", "/something")]
- public void PathBaseCanHaveUnicodeCharacters(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ public Task PathBaseCanHaveUnicodeCharacters(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
- TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
+ return TestPathBase(registeredPathBase, pathBase, requestPath, expectedPathBase, expectedPath);
}
- private static void TestPathBase(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
+ private static async Task TestPathBase(string registeredPathBase, string pathBase, string requestPath, string expectedPathBase, string expectedPath)
{
HttpContext requestContext = CreateRequest(pathBase, requestPath);
var builder = CreateBuilder()
@@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
context.Items["test.PathBase"] = context.Request.PathBase;
return Task.FromResult(0);
});
- builder.Build().Invoke(requestContext).Wait();
+ await builder.Build().Invoke(requestContext);
// Assert path and pathBase are split after middleware
Assert.Equal(expectedPath, ((PathString)requestContext.Items["test.Path"]).Value);
diff --git a/src/Http/Http.Abstractions/test/UseWhenExtensionsTests.cs b/src/Http/Http.Abstractions/test/UseWhenExtensionsTests.cs
index 902a003b26..901454b62e 100644
--- a/src/Http/Http.Abstractions/test/UseWhenExtensionsTests.cs
+++ b/src/Http/Http.Abstractions/test/UseWhenExtensionsTests.cs
@@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
[Fact]
- public void PredicateTrue_BranchTaken_WillRejoin()
+ public async Task PredicateTrue_BranchTaken_WillRejoin()
{
// Arrange
var context = CreateContext();
@@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
parent.Use(Increment("parent"));
// Act
- parent.Build().Invoke(context).Wait();
+ await parent.Build().Invoke(context);
// Assert
Assert.Equal(1, Count(context, "parent"));
@@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
[Fact]
- public void PredicateTrue_BranchTaken_CanTerminate()
+ public async Task PredicateTrue_BranchTaken_CanTerminate()
{
// Arrange
var context = CreateContext();
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
parent.Use(Increment("parent"));
// Act
- parent.Build().Invoke(context).Wait();
+ await parent.Build().Invoke(context);
// Assert
Assert.Equal(0, Count(context, "parent"));
@@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
}
[Fact]
- public void PredicateFalse_PassThrough()
+ public async Task PredicateFalse_PassThrough()
{
// Arrange
var context = CreateContext();
@@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.Builder.Extensions
parent.Use(Increment("parent"));
// Act
- parent.Build().Invoke(context).Wait();
+ await parent.Build().Invoke(context);
// Assert
Assert.Equal(1, Count(context, "parent"));
diff --git a/src/Http/Http.Extensions/ref/Microsoft.AspNetCore.Http.Extensions.netcoreapp.cs b/src/Http/Http.Extensions/ref/Microsoft.AspNetCore.Http.Extensions.netcoreapp.cs
index 4023268f5b..14f3400e95 100644
--- a/src/Http/Http.Extensions/ref/Microsoft.AspNetCore.Http.Extensions.netcoreapp.cs
+++ b/src/Http/Http.Extensions/ref/Microsoft.AspNetCore.Http.Extensions.netcoreapp.cs
@@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.Http.Headers
public System.Collections.Generic.IList Cookie { get { throw null; } set { } }
public System.DateTimeOffset? Date { get { throw null; } set { } }
public System.DateTimeOffset? Expires { get { throw null; } set { } }
- public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.Http.HostString Host { get { throw null; } set { } }
public System.Collections.Generic.IList IfMatch { get { throw null; } set { } }
public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
@@ -114,7 +114,7 @@ namespace Microsoft.AspNetCore.Http.Headers
public System.DateTimeOffset? Date { get { throw null; } set { } }
public Microsoft.Net.Http.Headers.EntityTagHeaderValue ETag { get { throw null; } set { } }
public System.DateTimeOffset? Expires { get { throw null; } set { } }
- public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.DateTimeOffset? LastModified { get { throw null; } set { } }
public System.Uri Location { get { throw null; } set { } }
public System.Collections.Generic.IList SetCookie { get { throw null; } set { } }
diff --git a/src/Http/Http.Extensions/src/RequestHeaders.cs b/src/Http/Http.Extensions/src/RequestHeaders.cs
index 12246922d4..94fa8149b9 100644
--- a/src/Http/Http.Extensions/src/RequestHeaders.cs
+++ b/src/Http/Http.Extensions/src/RequestHeaders.cs
@@ -279,11 +279,27 @@ namespace Microsoft.AspNetCore.Http.Headers
}
}
+ ///
+ /// Gets the value of header with .
+ ///
+ /// must contain a TryParse method with the signature public static bool TryParse(string, out T).
+ /// The type of the header.
+ /// The given type must have a static TryParse method.
+ /// The name of the header to retrieve.
+ /// The value of the header.
public T Get(string name)
{
return Headers.Get(name);
}
+ ///
+ /// Gets the values of header with .
+ ///
+ /// must contain a TryParseList method with the signature public static bool TryParseList(IList<string>, out IList<T>).
+ /// The type of the header.
+ /// The given type must have a static TryParseList method.
+ /// The name of the header to retrieve.
+ /// List of values of the header.
public IList GetList(string name)
{
return Headers.GetList(name);
diff --git a/src/Http/Http.Extensions/src/ResponseHeaders.cs b/src/Http/Http.Extensions/src/ResponseHeaders.cs
index 87e3c0318c..2feff2fe3c 100644
--- a/src/Http/Http.Extensions/src/ResponseHeaders.cs
+++ b/src/Http/Http.Extensions/src/ResponseHeaders.cs
@@ -158,11 +158,27 @@ namespace Microsoft.AspNetCore.Http.Headers
}
}
+ ///
+ /// Gets the value of header with .
+ ///
+ /// must contain a TryParse method with the signature public static bool TryParse(string, out T).
+ /// The type of the header.
+ /// The given type must have a static TryParse method.
+ /// The name of the header to retrieve.
+ /// The value of the header.
public T Get(string name)
{
return Headers.Get(name);
}
+ ///
+ /// Gets the values of header with .
+ ///
+ /// must contain a TryParseList method with the signature public static bool TryParseList(IList<string>, out IList<T>).
+ /// The type of the header.
+ /// The given type must have a static TryParseList method.
+ /// The name of the header to retrieve.
+ /// List of values of the header.
public IList GetList(string name)
{
return Headers.GetList(name);
@@ -208,4 +224,4 @@ namespace Microsoft.AspNetCore.Http.Headers
Headers.AppendList(name, values);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netcoreapp.cs b/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netcoreapp.cs
index 0ba8551260..45f7f9d135 100644
--- a/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netcoreapp.cs
+++ b/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netcoreapp.cs
@@ -6,14 +6,14 @@ namespace Microsoft.AspNetCore.Http
public partial class CookieOptions
{
public CookieOptions() { }
- public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial interface IFormCollection : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable
{
@@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Http
public partial class WebSocketAcceptContext
{
public WebSocketAcceptContext() { }
- public virtual string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public virtual string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Http.Features
@@ -116,8 +116,8 @@ namespace Microsoft.AspNetCore.Http.Features
private int _dummyPrimitive;
public TCache Cache;
public FeatureReferences(Microsoft.AspNetCore.Http.Features.IFeatureCollection collection) { throw null; }
- public Microsoft.AspNetCore.Http.Features.IFeatureCollection Collection { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public int Revision { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Http.Features.IFeatureCollection Collection { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public int Revision { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public TFeature Fetch(ref TFeature cached, System.Func factory) where TFeature : class { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public TFeature Fetch(ref TFeature cached, TState state, System.Func factory) where TFeature : class { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection collection) { }
diff --git a/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netstandard2.0.cs b/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netstandard2.0.cs
index 0ba8551260..45f7f9d135 100644
--- a/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netstandard2.0.cs
+++ b/src/Http/Http.Features/ref/Microsoft.AspNetCore.Http.Features.netstandard2.0.cs
@@ -6,14 +6,14 @@ namespace Microsoft.AspNetCore.Http
public partial class CookieOptions
{
public CookieOptions() { }
- public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string Domain { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.DateTimeOffset? Expires { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool HttpOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool IsEssential { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.TimeSpan? MaxAge { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.SameSiteMode SameSite { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public bool Secure { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial interface IFormCollection : System.Collections.Generic.IEnumerable>, System.Collections.IEnumerable
{
@@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Http
public partial class WebSocketAcceptContext
{
public WebSocketAcceptContext() { }
- public virtual string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public virtual string SubProtocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
}
namespace Microsoft.AspNetCore.Http.Features
@@ -116,8 +116,8 @@ namespace Microsoft.AspNetCore.Http.Features
private int _dummyPrimitive;
public TCache Cache;
public FeatureReferences(Microsoft.AspNetCore.Http.Features.IFeatureCollection collection) { throw null; }
- public Microsoft.AspNetCore.Http.Features.IFeatureCollection Collection { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public int Revision { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Http.Features.IFeatureCollection Collection { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public int Revision { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public TFeature Fetch(ref TFeature cached, System.Func factory) where TFeature : class { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public TFeature Fetch(ref TFeature cached, TState state, System.Func factory) where TFeature : class { throw null; }
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public void Initalize(Microsoft.AspNetCore.Http.Features.IFeatureCollection collection) { }
diff --git a/src/Http/Http.Features/src/CookieOptions.cs b/src/Http/Http.Features/src/CookieOptions.cs
index 6720ad6f05..833eeedea2 100644
--- a/src/Http/Http.Features/src/CookieOptions.cs
+++ b/src/Http/Http.Features/src/CookieOptions.cs
@@ -10,18 +10,6 @@ namespace Microsoft.AspNetCore.Http
///
public class CookieOptions
{
- // True (old): https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1
- // False (new): https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.1
- internal static bool SuppressSameSiteNone;
-
- static CookieOptions()
- {
- if (AppContext.TryGetSwitch("Microsoft.AspNetCore.SuppressSameSiteNone", out var enabled))
- {
- SuppressSameSiteNone = enabled;
- }
- }
-
///
/// Creates a default cookie with a path of '/'.
///
@@ -58,7 +46,7 @@ namespace Microsoft.AspNetCore.Http
/// Gets or sets the value for the SameSite attribute of the cookie. The default value is
///
/// The representing the enforcement mode of the cookie.
- public SameSiteMode SameSite { get; set; } = SuppressSameSiteNone ? SameSiteMode.None : SameSiteMode.Unspecified;
+ public SameSiteMode SameSite { get; set; } = SameSiteMode.Unspecified;
///
/// Gets or sets a value that indicates whether a cookie is accessible by client-side script.
diff --git a/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp.cs b/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp.cs
index 56489b8752..ed6962230f 100644
--- a/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp.cs
+++ b/src/Http/Http/ref/Microsoft.AspNetCore.Http.netcoreapp.cs
@@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Builder
public ApplicationBuilder(System.IServiceProvider serviceProvider) { }
public ApplicationBuilder(System.IServiceProvider serviceProvider, object server) { }
public System.IServiceProvider ApplicationServices { get { throw null; } set { } }
- public System.Collections.Generic.IDictionary Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public System.Collections.Generic.IDictionary Properties { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.Http.Features.IFeatureCollection ServerFeatures { get { throw null; } }
public Microsoft.AspNetCore.Http.RequestDelegate Build() { throw null; }
public Microsoft.AspNetCore.Builder.IApplicationBuilder New() { throw null; }
@@ -20,11 +20,11 @@ namespace Microsoft.AspNetCore.Http
public partial class BindingAddress
{
public BindingAddress() { }
- public string Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string Host { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public bool IsUnixPipe { get { throw null; } }
- public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public int Port { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public int Port { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string UnixPipePath { get { throw null; } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
@@ -37,7 +37,7 @@ namespace Microsoft.AspNetCore.Http
public DefaultHttpContext(Microsoft.AspNetCore.Http.Features.IFeatureCollection features) { }
public override Microsoft.AspNetCore.Http.ConnectionInfo Connection { get { throw null; } }
public override Microsoft.AspNetCore.Http.Features.IFeatureCollection Features { get { throw null; } }
- public Microsoft.AspNetCore.Http.Features.FormOptions FormOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.Features.FormOptions FormOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public Microsoft.AspNetCore.Http.HttpContext HttpContext { get { throw null; } }
public override System.Collections.Generic.IDictionary Items { get { throw null; } set { } }
@@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Http
public override System.Threading.CancellationToken RequestAborted { get { throw null; } set { } }
public override System.IServiceProvider RequestServices { get { throw null; } set { } }
public override Microsoft.AspNetCore.Http.HttpResponse Response { get { throw null; } }
- public Microsoft.Extensions.DependencyInjection.IServiceScopeFactory ServiceScopeFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.Extensions.DependencyInjection.IServiceScopeFactory ServiceScopeFactory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public override Microsoft.AspNetCore.Http.ISession Session { get { throw null; } set { } }
public override string TraceIdentifier { get { throw null; } set { } }
public override System.Security.Claims.ClaimsPrincipal User { get { throw null; } set { } }
@@ -84,10 +84,10 @@ namespace Microsoft.AspNetCore.Http
public FormFile(System.IO.Stream baseStream, long baseStreamOffset, long length, string name, string fileName) { }
public string ContentDisposition { get { throw null; } set { } }
public string ContentType { get { throw null; } set { } }
- public string FileName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public long Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public string FileName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public long Length { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public void CopyTo(System.IO.Stream target) { }
[System.Diagnostics.DebuggerStepThroughAttribute]
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream target, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
@@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Http
public HeaderDictionary(int capacity) { }
public long? ContentLength { get { throw null; } set { } }
public int Count { get { throw null; } }
- public bool IsReadOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public bool IsReadOnly { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public Microsoft.Extensions.Primitives.StringValues this[string key] { get { throw null; } set { } }
public System.Collections.Generic.ICollection Keys { get { throw null; } }
Microsoft.Extensions.Primitives.StringValues System.Collections.Generic.IDictionary.this[string key] { get { throw null; } set { } }
@@ -204,8 +204,8 @@ namespace Microsoft.AspNetCore.Http
{
public StreamResponseBodyFeature(System.IO.Stream stream) { }
public StreamResponseBodyFeature(System.IO.Stream stream, Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature priorFeature) { }
- public Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature PriorFeature { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.IO.Stream Stream { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
+ public Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature PriorFeature { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.IO.Stream Stream { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.IO.Pipelines.PipeWriter Writer { get { throw null; } }
[System.Diagnostics.DebuggerStepThroughAttribute]
public virtual System.Threading.Tasks.Task CompleteAsync() { throw null; }
@@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Http.Features
public partial class DefaultSessionFeature : Microsoft.AspNetCore.Http.Features.ISessionFeature
{
public DefaultSessionFeature() { }
- public Microsoft.AspNetCore.Http.ISession Session { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.ISession Session { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class FormFeature : Microsoft.AspNetCore.Http.Features.IFormFeature
{
@@ -241,38 +241,38 @@ namespace Microsoft.AspNetCore.Http.Features
public const long DefaultMultipartBodyLengthLimit = (long)134217728;
public const int DefaultMultipartBoundaryLengthLimit = 128;
public FormOptions() { }
- public bool BufferBody { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public long BufferBodyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int KeyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int MemoryBufferThreshold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public long MultipartBodyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int MultipartBoundaryLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int MultipartHeadersCountLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int MultipartHeadersLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int ValueCountLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int ValueLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public bool BufferBody { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public long BufferBodyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int KeyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int MemoryBufferThreshold { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public long MultipartBodyLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int MultipartBoundaryLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int MultipartHeadersCountLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int MultipartHeadersLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int ValueCountLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int ValueLengthLimit { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class HttpConnectionFeature : Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature
{
public HttpConnectionFeature() { }
- public string ConnectionId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Net.IPAddress LocalIpAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int LocalPort { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Net.IPAddress RemoteIpAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int RemotePort { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public string ConnectionId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Net.IPAddress LocalIpAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int LocalPort { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Net.IPAddress RemoteIpAddress { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int RemotePort { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class HttpRequestFeature : Microsoft.AspNetCore.Http.Features.IHttpRequestFeature
{
public HttpRequestFeature() { }
- public System.IO.Stream Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Method { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Protocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string QueryString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string RawTarget { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public System.IO.Stream Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Method { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Path { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string PathBase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Protocol { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string QueryString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string RawTarget { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string Scheme { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public partial class HttpRequestIdentifierFeature : Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature
{
@@ -282,24 +282,24 @@ namespace Microsoft.AspNetCore.Http.Features
public partial class HttpRequestLifetimeFeature : Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature
{
public HttpRequestLifetimeFeature() { }
- public System.Threading.CancellationToken RequestAborted { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public System.Threading.CancellationToken RequestAborted { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public void Abort() { }
}
public partial class HttpResponseFeature : Microsoft.AspNetCore.Http.Features.IHttpResponseFeature
{
public HttpResponseFeature() { }
- public System.IO.Stream Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public System.IO.Stream Body { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public virtual bool HasStarted { get { throw null; } }
- public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string ReasonPhrase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
+ public Microsoft.AspNetCore.Http.IHeaderDictionary Headers { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public string ReasonPhrase { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public int StatusCode { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public virtual void OnCompleted(System.Func callback, object state) { }
public virtual void OnStarting(System.Func