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..30ce38000c 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -14,9 +14,11 @@
/src/Hosting/ @tratcher @anurse
/src/Http/ @tratcher @jkotalik @anurse
/src/Middleware/ @tratcher @anurse
-/src/ProjectTemplates/ @ryanbrandenburg
+/src/Middleware/HttpsPolicy @jkotalik @anurse
+/src/Middleware/Rewrite @jkotalik @anurse
+# /src/ProjectTemplates/ @ryanbrandenburg
/src/Security/ @tratcher @anurse
/src/Servers/ @tratcher @jkotalik @anurse @halter73
-/src/Middleware/Rewrite @jkotalik @anurse
-/src/Middleware/HttpsPolicy @jkotalik @anurse
+/src/Shared/Http2 @aspnet/http2
+/src/Shared/test/Shared.Tests/Http2 @aspnet/http2
/src/SignalR/ @BrennanConroy @halter73 @anurse
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index ed23a80be2..e139fbb30e 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -9,18 +9,19 @@ about: Create a report about something that is not working
A clear and concise description of what the bug is.
### To Reproduce
-Steps to reproduce the behavior:
-1. Using this version of ASP.NET Core '...'
-2. Run this code '....'
-3. With these arguments '....'
-4. See error
+
+
+### Further technical details
+- ASP.NET Core version
+- Include the output of `dotnet --info`
+- The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
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 5d28b80a6f..90058d74d5 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -2,9 +2,6 @@
-
-
-
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 2ab144764a..ad3addcb53 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
- 542a22f0b0242fc7247884b316c71e921d9711da
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- 542a22f0b0242fc7247884b316c71e921d9711da
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- 542a22f0b0242fc7247884b316c71e921d9711da
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/AspNetCore-Tooling
- 542a22f0b0242fc7247884b316c71e921d9711da
+ 61d46996bb56bead402d73db8ac09108a20e442b
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/EntityFrameworkCore
- b7ef9ec472b2d25cca70e3c9b4ab3a1032d275d5
+ 05e26d9f9ede7515f881d1a5af561c385552c8b9
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
- https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
-
-
+
https://github.com/dotnet/core-setup
- 13f35c3d86a40ff811bfde0b64cfb86431c19d15
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 13f35c3d86a40ff811bfde0b64cfb86431c19d15
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 13f35c3d86a40ff811bfde0b64cfb86431c19d15
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
-
+
https://github.com/dotnet/core-setup
- 7d57652f33493fa022125b7f63aad0d70c52d810
+ a3a9cb66e59909d03269f7c0024f10fe07f0a2d5
+
+
+ https://github.com/dotnet/corefx
+ 4ac4c0367003fe3973a3648eb0715ddb0e3bbcea
-
+
https://github.com/dotnet/corefx
- 046765913dff824f9ed0f2d2fe0fb9b111906cf5
+ 03453d9aae8e5d18e571699c5d2229b1ab5f4b9d
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ bfa46e9e624cc148bd5c6b7af63f52f6e1d48c8d
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ bfa46e9e624cc148bd5c6b7af63f52f6e1d48c8d
-
+
https://github.com/dotnet/arcade
- a42a124635ce1a218309ecb31ec59d559cacb886
+ bfa46e9e624cc148bd5c6b7af63f52f6e1d48c8d
-
+
https://github.com/aspnet/Extensions
- 02e6d683074019728bfbda8e40e526606fd12875
+ 7642beec82008e7d0e719220e1cb2c3f5277276c
-
+
https://github.com/dotnet/roslyn
- dd838b6fc2ed66913ad99a1a7d58b1b1c07530ed
+ 3c865821f2864393a0ff7fe22c92ded6d51a546c
diff --git a/eng/Versions.props b/eng/Versions.props
index 7c1a0d255e..ff7533da86 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.19552.1
- 3.5.0-beta1-19551-03
+ 3.4.0-beta1-19456-03
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 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.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 1.8.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
- 4.7.0-preview3.19551.4
+ 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.19551.4
+ 5.0.0-alpha1.19520.7
- 3.1.0-preview3.19531.1
+ 5.0.0-alpha1.19531.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.2
- 3.1.0-preview3.19553.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-alpha1.19530.2
+ 5.0.0-preview2.19530.2
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
- 3.1.0-preview3.19554.3
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
+ 5.0.0-alpha1.19552.2
- 3.1.0-preview3.19553.1
- 3.1.0-preview3.19553.1
- 3.1.0-preview3.19553.1
- 3.1.0-preview3.19553.1
+ 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.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..ca2961febe 100644
--- a/global.json
+++ b/global.json
@@ -1,11 +1,11 @@
{
"sdk": {
- "version": "3.1.100-preview1-014400"
+ "version": "5.0.100-alpha1-015536"
},
"tools": {
- "dotnet": "3.1.100-preview1-014400",
+ "dotnet": "5.0.100-alpha1-015536",
"runtimes": {
- "dotnet/x64": [
+ "dotnet": [
"$(MicrosoftNETCoreAppRuntimeVersion)"
],
"dotnet/x86": [
@@ -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.19552.1",
+ "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19552.1"
}
}
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/DataProtection/src/LoggingExtensions.cs b/src/DataProtection/DataProtection/src/LoggingExtensions.cs
index 7792d48dbe..b54cd5659c 100644
--- a/src/DataProtection/DataProtection/src/LoggingExtensions.cs
+++ b/src/DataProtection/DataProtection/src/LoggingExtensions.cs
@@ -149,268 +149,268 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions()
{
_usingFallbackKeyWithExpirationAsDefaultKey = LoggerMessage.Define(
- eventId: 1,
+ eventId: new EventId(1, "UsingFallbackKeyWithExpirationAsDefaultKey"),
logLevel: LogLevel.Warning,
formatString: "Policy resolution states that a new key should be added to the key ring, but automatic generation of keys is disabled. Using fallback key {KeyId:B} with expiration {ExpirationDate:u} as default key.");
_usingKeyAsDefaultKey = LoggerMessage.Define(
- eventId: 2,
+ eventId: new EventId(2, "UsingKeyAsDefaultKey"),
logLevel: LogLevel.Debug,
formatString: "Using key {KeyId:B} as the default key.");
_openingCNGAlgorithmFromProviderWithHMAC = LoggerMessage.Define(
- eventId: 3,
+ eventId: new EventId(3, "OpeningCNGAlgorithmFromProviderWithHMAC"),
logLevel: LogLevel.Debug,
formatString: "Opening CNG algorithm '{HashAlgorithm}' from provider '{HashAlgorithmProvider}' with HMAC.");
_openingCNGAlgorithmFromProviderWithChainingModeCBC = LoggerMessage.Define(
- eventId: 4,
+ eventId: new EventId(4, "OpeningCNGAlgorithmFromProviderWithChainingModeCBC"),
logLevel: LogLevel.Debug,
formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode CBC.");
_performingUnprotectOperationToKeyWithPurposes = LoggerMessage.Define(
- eventId: 5,
+ eventId: new EventId(5, "PerformingUnprotectOperationToKeyWithPurposes"),
logLevel: LogLevel.Trace,
formatString: "Performing unprotect operation to key {KeyId:B} with purposes {Purposes}.");
_keyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed = LoggerMessage.Define(
- eventId: 6,
+ eventId: new EventId(6, "KeyWasNotFoundInTheKeyRingUnprotectOperationCannotProceed"),
logLevel: LogLevel.Trace,
formatString: "Key {KeyId:B} was not found in the key ring. Unprotect operation cannot proceed.");
_keyWasRevokedCallerRequestedUnprotectOperationProceedRegardless = LoggerMessage.Define(
- eventId: 7,
+ eventId: new EventId(7, "KeyWasRevokedCallerRequestedUnprotectOperationProceedRegardless"),
logLevel: LogLevel.Debug,
formatString: "Key {KeyId:B} was revoked. Caller requested unprotect operation proceed regardless.");
_keyWasRevokedUnprotectOperationCannotProceed = LoggerMessage.Define(
- eventId: 8,
+ eventId: new EventId(8, "KeyWasRevokedUnprotectOperationCannotProceed"),
logLevel: LogLevel.Debug,
formatString: "Key {KeyId:B} was revoked. Unprotect operation cannot proceed.");
_openingCNGAlgorithmFromProviderWithChainingModeGCM = LoggerMessage.Define(
- eventId: 9,
+ eventId: new EventId(9, "OpeningCNGAlgorithmFromProviderWithChainingModeGCM"),
logLevel: LogLevel.Debug,
formatString: "Opening CNG algorithm '{EncryptionAlgorithm}' from provider '{EncryptionAlgorithmProvider}' with chaining mode GCM.");
_usingManagedKeyedHashAlgorithm = LoggerMessage.Define(
- eventId: 10,
+ eventId: new EventId(10, "UsingManagedKeyedHashAlgorithm"),
logLevel: LogLevel.Debug,
formatString: "Using managed keyed hash algorithm '{FullName}'.");
_usingManagedSymmetricAlgorithm = LoggerMessage.Define(
- eventId: 11,
+ eventId: new EventId(11, "UsingManagedSymmetricAlgorithm"),
logLevel: LogLevel.Debug,
formatString: "Using managed symmetric algorithm '{FullName}'.");
_keyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed = LoggerMessage.Define(
- eventId: 12,
+ eventId: new EventId(12, "KeyIsIneligibleToBeTheDefaultKeyBecauseItsMethodFailed"),
logLevel: LogLevel.Warning,
formatString: "Key {KeyId:B} is ineligible to be the default key because its {MethodName} method failed.");
_consideringKeyWithExpirationDateAsDefaultKey = LoggerMessage.Define(
- eventId: 13,
+ eventId: new EventId(13, "ConsideringKeyWithExpirationDateAsDefaultKey"),
logLevel: LogLevel.Debug,
formatString: "Considering key {KeyId:B} with expiration date {ExpirationDate:u} as default key.");
_keyIsNoLongerUnderConsiderationAsDefault = LoggerMessage.Define(
- eventId: 14,
+ eventId: new EventId(14, "KeyIsNoLongerUnderConsiderationAsDefault"),
logLevel: LogLevel.Debug,
formatString: "Key {KeyId:B} is no longer under consideration as default key because it is expired, revoked, or cannot be deciphered.");
_unknownElementWithNameFoundInKeyringSkipping = LoggerMessage.Define(
- eventId: 15,
+ eventId: new EventId(15, "UnknownElementWithNameFoundInKeyringSkipping"),
logLevel: LogLevel.Warning,
formatString: "Unknown element with name '{Name}' found in keyring, skipping.");
_markedKeyAsRevokedInTheKeyring = LoggerMessage.Define(
- eventId: 16,
+ eventId: new EventId(16, "MarkedKeyAsRevokedInTheKeyring"),
logLevel: LogLevel.Debug,
formatString: "Marked key {KeyId:B} as revoked in the keyring.");
_triedToProcessRevocationOfKeyButNoSuchKeyWasFound = LoggerMessage.Define(
- eventId: 17,
+ eventId: new EventId(17, "TriedToProcessRevocationOfKeyButNoSuchKeyWasFound"),
logLevel: LogLevel.Warning,
formatString: "Tried to process revocation of key {KeyId:B}, but no such key was found in keyring. Skipping.");
_foundKey = LoggerMessage.Define(
- eventId: 18,
+ eventId: new EventId(18, "FoundKey"),
logLevel: LogLevel.Debug,
formatString: "Found key {KeyId:B}.");
_foundRevocationOfAllKeysCreatedPriorTo = LoggerMessage.Define(
- eventId: 19,
+ eventId: new EventId(19, "FoundRevocationOfAllKeysCreatedPriorTo"),
logLevel: LogLevel.Debug,
formatString: "Found revocation of all keys created prior to {RevocationDate:u}.");
_foundRevocationOfKey = LoggerMessage.Define(
- eventId: 20,
+ eventId: new EventId(20, "FoundRevocationOfKey"),
logLevel: LogLevel.Debug,
formatString: "Found revocation of key {KeyId:B}.");
_exceptionWhileProcessingRevocationElement = LoggerMessage.Define(
- eventId: 21,
+ eventId: new EventId(21, "ExceptionWhileProcessingRevocationElement"),
logLevel: LogLevel.Error,
formatString: "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.");
_revokingAllKeysAsOfForReason = LoggerMessage.Define(
- eventId: 22,
+ eventId: new EventId(22, "RevokingAllKeysAsOfForReason"),
logLevel: LogLevel.Information,
formatString: "Revoking all keys as of {RevocationDate:u} for reason '{Reason}'.");
_keyCacheExpirationTokenTriggeredByOperation = LoggerMessage.Define(
- eventId: 23,
+ eventId: new EventId(23, "KeyCacheExpirationTokenTriggeredByOperation"),
logLevel: LogLevel.Debug,
formatString: "Key cache expiration token triggered by '{OperationName}' operation.");
_anExceptionOccurredWhileProcessingTheKeyElement = LoggerMessage.Define(
- eventId: 24,
+ eventId: new EventId(24, "ExceptionOccurredWhileProcessingTheKeyElement"),
logLevel: LogLevel.Error,
formatString: "An exception occurred while processing the key element '{Element}'.");
_anExceptionOccurredWhileProcessingTheKeyElementDebug = LoggerMessage.Define(
- eventId: 25,
+ eventId: new EventId(25, "ExceptionOccurredWhileProcessingTheKeyElementDebug"),
logLevel: LogLevel.Trace,
formatString: "An exception occurred while processing the key element '{Element}'.");
_encryptingToWindowsDPAPIForCurrentUserAccount = LoggerMessage.Define(
- eventId: 26,
+ eventId: new EventId(26, "EncryptingToWindowsDPAPIForCurrentUserAccount"),
logLevel: LogLevel.Debug,
formatString: "Encrypting to Windows DPAPI for current user account ({Name}).");
_encryptingToWindowsDPAPINGUsingProtectionDescriptorRule = LoggerMessage.Define(
- eventId: 27,
+ eventId: new EventId(27, "EncryptingToWindowsDPAPINGUsingProtectionDescriptorRule"),
logLevel: LogLevel.Debug,
formatString: "Encrypting to Windows DPAPI-NG using protection descriptor rule '{DescriptorRule}'.");
_anErrorOccurredWhileEncryptingToX509CertificateWithThumbprint = LoggerMessage.Define(
- eventId: 28,
+ eventId: new EventId(28, "ErrorOccurredWhileEncryptingToX509CertificateWithThumbprint"),
logLevel: LogLevel.Error,
formatString: "An error occurred while encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
_encryptingToX509CertificateWithThumbprint = LoggerMessage.Define(
- eventId: 29,
+ eventId: new EventId(29, "EncryptingToX509CertificateWithThumbprint"),
logLevel: LogLevel.Debug,
formatString: "Encrypting to X.509 certificate with thumbprint '{Thumbprint}'.");
_exceptionOccurredWhileTryingToResolveCertificateWithThumbprint = LoggerMessage.Define(
- eventId: 30,
+ eventId: new EventId(30, "ExceptionOccurredWhileTryingToResolveCertificateWithThumbprint"),
logLevel: LogLevel.Error,
formatString: "An exception occurred while trying to resolve certificate with thumbprint '{Thumbprint}'.");
_performingProtectOperationToKeyWithPurposes = LoggerMessage.Define(
- eventId: 31,
+ eventId: new EventId(31, "PerformingProtectOperationToKeyWithPurposes"),
logLevel: LogLevel.Trace,
formatString: "Performing protect operation to key {KeyId:B} with purposes {Purposes}.");
_descriptorDeserializerTypeForKeyIs = LoggerMessage.Define(
- eventId: 32,
+ eventId: new EventId(32, "DescriptorDeserializerTypeForKeyIs"),
logLevel: LogLevel.Debug,
formatString: "Descriptor deserializer type for key {KeyId:B} is '{AssemblyQualifiedName}'.");
_keyEscrowSinkFoundWritingKeyToEscrow = LoggerMessage.Define(
- eventId: 33,
+ eventId: new EventId(33, "KeyEscrowSinkFoundWritingKeyToEscrow"),
logLevel: LogLevel.Debug,
formatString: "Key escrow sink found. Writing key {KeyId:B} to escrow.");
_noKeyEscrowSinkFoundNotWritingKeyToEscrow = LoggerMessage.Define(
- eventId: 34,
+ eventId: new EventId(34, "NoKeyEscrowSinkFoundNotWritingKeyToEscrow"),
logLevel: LogLevel.Debug,
formatString: "No key escrow sink found. Not writing key {KeyId:B} to escrow.");
_noXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm = LoggerMessage.Define(
- eventId: 35,
+ eventId: new EventId(35, "NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm"),
logLevel: LogLevel.Warning,
formatString: "No XML encryptor configured. Key {KeyId:B} may be persisted to storage in unencrypted form.");
_revokingKeyForReason = LoggerMessage.Define(
- eventId: 36,
+ eventId: new EventId(36, "RevokingKeyForReason"),
logLevel: LogLevel.Information,
formatString: "Revoking key {KeyId:B} at {RevocationDate:u} for reason '{Reason}'.");
_readingDataFromFile = LoggerMessage.Define(
- eventId: 37,
+ eventId: new EventId(37, "ReadingDataFromFile"),
logLevel: LogLevel.Debug,
formatString: "Reading data from file '{FullPath}'.");
_nameIsNotSafeFileName = LoggerMessage.Define(
- eventId: 38,
+ eventId: new EventId(38, "NameIsNotSafeFileName"),
logLevel: LogLevel.Debug,
formatString: "The name '{FriendlyName}' is not a safe file name, using '{NewFriendlyName}' instead.");
_writingDataToFile = LoggerMessage.Define(
- eventId: 39,
+ eventId: new EventId(39, "WritingDataToFile"),
logLevel: LogLevel.Information,
formatString: "Writing data to file '{FileName}'.");
_readingDataFromRegistryKeyValue = LoggerMessage.Define(
- eventId: 40,
+ eventId: new EventId(40, "ReadingDataFromRegistryKeyValue"),
logLevel: LogLevel.Debug,
formatString: "Reading data from registry key '{RegistryKeyName}', value '{Value}'.");
_nameIsNotSafeRegistryValueName = LoggerMessage.Define(
- eventId: 41,
+ eventId: new EventId(41, "NameIsNotSafeRegistryValueName"),
logLevel: LogLevel.Debug,
formatString: "The name '{FriendlyName}' is not a safe registry value name, using '{NewFriendlyName}' instead.");
_decryptingSecretElementUsingWindowsDPAPING = LoggerMessage.Define(
- eventId: 42,
+ eventId: new EventId(42, "DecryptingSecretElementUsingWindowsDPAPING"),
logLevel: LogLevel.Debug,
formatString: "Decrypting secret element using Windows DPAPI-NG with protection descriptor rule '{DescriptorRule}'.");
_exceptionOccurredTryingToDecryptElement = LoggerMessage.Define(
- eventId: 43,
+ eventId: new EventId(43, "ExceptionOccurredTryingToDecryptElement"),
logLevel: LogLevel.Error,
formatString: "An exception occurred while trying to decrypt the element.");
_encryptingUsingNullEncryptor = LoggerMessage.Define(
- eventId: 44,
+ eventId: new EventId(44, "EncryptingUsingNullEncryptor"),
logLevel: LogLevel.Warning,
formatString: "Encrypting using a null encryptor; secret information isn't being protected.");
_usingEphemeralDataProtectionProvider = LoggerMessage.Define(
- eventId: 45,
+ eventId: new EventId(45, "UsingEphemeralDataProtectionProvider"),
logLevel: LogLevel.Warning,
formatString: "Using ephemeral data protection provider. Payloads will be undecipherable upon application shutdown.");
_existingCachedKeyRingIsExpiredRefreshing = LoggerMessage.Define(
- eventId: 46,
+ eventId: new EventId(46, "ExistingCachedKeyRingIsExpiredRefreshing"),
logLevel: LogLevel.Debug,
formatString: "Existing cached key ring is expired. Refreshing.");
_errorOccurredWhileRefreshingKeyRing = LoggerMessage.Define(
- eventId: 47,
+ eventId: new EventId(47, "ErrorOccurredWhileRefreshingKeyRing"),
logLevel: LogLevel.Error,
formatString: "An error occurred while refreshing the key ring. Will try again in 2 minutes.");
_errorOccurredWhileReadingKeyRing = LoggerMessage.Define(
- eventId: 48,
+ eventId: new EventId(48, "ErrorOccurredWhileReadingKeyRing"),
logLevel: LogLevel.Error,
formatString: "An error occurred while reading the key ring.");
_keyRingDoesNotContainValidDefaultKey = LoggerMessage.Define(
- eventId: 49,
+ eventId: new EventId(49, "KeyRingDoesNotContainValidDefaultKey"),
logLevel: LogLevel.Error,
formatString: "The key ring does not contain a valid default key, and the key manager is configured with auto-generation of keys disabled.");
_usingInmemoryRepository = LoggerMessage.Define(
- eventId: 50,
+ eventId: new EventId(50, "UsingInMemoryRepository"),
logLevel: LogLevel.Warning,
formatString: "Using an in-memory repository. Keys will not be persisted to storage.");
_decryptingSecretElementUsingWindowsDPAPI = LoggerMessage.Define(
- eventId: 51,
+ eventId: new EventId(51, "DecryptingSecretElementUsingWindowsDPAPI"),
logLevel: LogLevel.Debug,
formatString: "Decrypting secret element using Windows DPAPI.");
_defaultKeyExpirationImminentAndRepository = LoggerMessage.Define(
- eventId: 52,
+ eventId: new EventId(52, "DefaultKeyExpirationImminentAndRepository"),
logLevel: LogLevel.Debug,
formatString: "Default key expiration imminent and repository contains no viable successor. Caller should generate a successor.");
_repositoryContainsNoViableDefaultKey = LoggerMessage.Define(
- eventId: 53,
+ eventId: new EventId(53, "RepositoryContainsNoViableDefaultKey"),
logLevel: LogLevel.Debug,
formatString: "Repository contains no viable default key. Caller should generate a key with immediate activation.");
_errorOccurredWhileEncryptingToWindowsDPAPI = LoggerMessage.Define(
- eventId: 54,
+ eventId: new EventId(54, "ErrorOccurredWhileEncryptingToWindowsDPAPI"),
logLevel: LogLevel.Error,
formatString: "An error occurred while encrypting to Windows DPAPI.");
_encryptingToWindowsDPAPIForLocalMachineAccount = LoggerMessage.Define(
- eventId: 55,
+ eventId: new EventId(55, "EncryptingToWindowsDPAPIForLocalMachineAccount"),
logLevel: LogLevel.Debug,
formatString: "Encrypting to Windows DPAPI for local machine account.");
_errorOccurredWhileEncryptingToWindowsDPAPING = LoggerMessage.Define(
- eventId: 56,
+ eventId: new EventId(56, "ErrorOccurredWhileEncryptingToWindowsDPAPING"),
logLevel: LogLevel.Error,
formatString: "An error occurred while encrypting to Windows DPAPI-NG.");
_policyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing = LoggerMessage.Define(
- eventId: 57,
+ eventId: new EventId(57, "PolicyResolutionStatesThatANewKeyShouldBeAddedToTheKeyRing"),
logLevel: LogLevel.Debug,
formatString: "Policy resolution states that a new key should be added to the key ring.");
_creatingKey = LoggerMessage.Define(
- eventId: 58,
+ eventId: new EventId(58, "CreatingKey"),
logLevel: LogLevel.Information,
formatString: "Creating key {KeyId:B} with creation date {CreationDate:u}, activation date {ActivationDate:u}, and expiration date {ExpirationDate:u}.");
_usingEphemeralKeyRepository = LoggerMessage.Define(
- eventId: 59,
+ eventId: new EventId(59, "UsingEphemeralKeyRepository"),
logLevel: LogLevel.Warning,
formatString: "Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.");
_usingEphemeralFileSystemLocationInContainer = LoggerMessage.Define(
- eventId: 60,
+ eventId: new EventId(60, "UsingEphemeralFileSystemLocationInContainer"),
logLevel: LogLevel.Warning,
formatString: Resources.FileSystem_EphemeralKeysLocationInContainer);
_usingRegistryAsKeyRepositoryWithDPAPI = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(61, "UsingRegistryAsKeyRepositoryWithDPAPI"),
logLevel: LogLevel.Information,
formatString: "User profile not available. Using '{Name}' as key repository and Windows DPAPI to encrypt keys at rest.");
_usingProfileAsKeyRepository = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(62, "UsingProfileAsKeyRepository"),
logLevel: LogLevel.Information,
formatString: "User profile is available. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
_usingProfileAsKeyRepositoryWithDPAPI = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(63, "UsingProfileAsKeyRepositoryWithDPAPI"),
logLevel: LogLevel.Information,
formatString: "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.");
_usingAzureAsKeyRepository = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(64, "UsingAzureAsKeyRepository"),
logLevel: LogLevel.Information,
formatString: "Azure Web Sites environment detected. Using '{FullName}' as key repository; keys will not be encrypted at rest.");
_keyRingWasLoadedOnStartup = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(65, "KeyRingWasLoadedOnStartup"),
logLevel: LogLevel.Debug,
formatString: "Key ring with default key {KeyId:B} was loaded during application startup.");
_keyRingFailedToLoadOnStartup = LoggerMessage.Define(
- eventId: 0,
+ eventId: new EventId(66, "KeyRingFailedToLoadOnStartup"),
logLevel: LogLevel.Information,
formatString: "Key ring failed to load during application startup.");
}
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/EntityFrameworkCore/src/LoggingExtensions.cs b/src/DataProtection/EntityFrameworkCore/src/LoggingExtensions.cs
index d0aeb09271..193c0100ac 100644
--- a/src/DataProtection/EntityFrameworkCore/src/LoggingExtensions.cs
+++ b/src/DataProtection/EntityFrameworkCore/src/LoggingExtensions.cs
@@ -13,11 +13,11 @@ namespace Microsoft.Extensions.Logging
static LoggingExtensions()
{
_anExceptionOccurredWhileParsingKeyXml = LoggerMessage.Define(
- eventId: 1,
+ eventId: new EventId(1, "ExceptionOccurredWhileParsingKeyXml"),
logLevel: LogLevel.Warning,
formatString: "An exception occurred while parsing the key xml '{Xml}'.");
_savingKeyToDbContext = LoggerMessage.Define(
- eventId: 2,
+ eventId: new EventId(2, "SavingKeyToDbContext"),
logLevel: LogLevel.Debug,
formatString: "Saving key '{FriendlyName}' to '{DbContext}'.");
}
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/LoggerEventIds.cs b/src/Hosting/Hosting/src/Internal/LoggerEventIds.cs
index a7c75fafdc..8c391bfa2d 100644
--- a/src/Hosting/Hosting/src/Internal/LoggerEventIds.cs
+++ b/src/Hosting/Hosting/src/Internal/LoggerEventIds.cs
@@ -1,21 +1,22 @@
// 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 Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Hosting
{
internal static class LoggerEventIds
{
- public const int RequestStarting = 1;
- public const int RequestFinished = 2;
- public const int Starting = 3;
- public const int Started = 4;
- public const int Shutdown = 5;
- public const int ApplicationStartupException = 6;
- public const int ApplicationStoppingException = 7;
- public const int ApplicationStoppedException = 8;
- public const int HostedServiceStartException = 9;
- public const int HostedServiceStopException = 10;
- public const int HostingStartupAssemblyException = 11;
- public const int ServerShutdownException = 12;
+ public static readonly EventId RequestStarting = new EventId(1, "RequestStarting");
+ public static readonly EventId RequestFinished = new EventId(2, "RequestFinished");
+ public static readonly EventId Starting = new EventId(3, "Starting");
+ public static readonly EventId Started = new EventId(4, "Started");
+ public static readonly EventId Shutdown = new EventId(5, "Shutdown");
+ public static readonly EventId ApplicationStartupException = new EventId(6, "ApplicationStartupException");
+ public static readonly EventId ApplicationStoppingException = new EventId(7, "ApplicationStoppingException");
+ public static readonly EventId ApplicationStoppedException = new EventId(8, "ApplicationStoppedException");
+ public static readonly EventId HostedServiceStartException = new EventId(9, "HostedServiceStartException");
+ public static readonly EventId HostedServiceStopException = new EventId(10, "HostedServiceStopException");
+ public static readonly EventId HostingStartupAssemblyException = new EventId(11, "HostingStartupAssemblyException");
+ public static readonly EventId ServerShutdownException = new EventId(12, "ServerShutdownException");
}
}
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