diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0496625f2aec1d..7553884106c90f 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "8.0.0-prerelease.25103.2", + "version": "8.0.0-prerelease.25207.2", "commands": [ "xharness" ] diff --git a/.github/workflows/check-no-merge-label.yml b/.github/workflows/check-no-merge-label.yml index 1b52b8f3657ab0..d42d72a623db40 100644 --- a/.github/workflows/check-no-merge-label.yml +++ b/.github/workflows/check-no-merge-label.yml @@ -5,7 +5,7 @@ permissions: on: pull_request_target: - types: [opened, reopened, labeled, unlabeled] + types: [opened, edited, reopened, labeled, unlabeled, synchronize] branches: - 'main' - 'release/**' diff --git a/.github/workflows/check-service-labels.yml b/.github/workflows/check-service-labels.yml index c158ff6f1520d6..f2e800feea5bcf 100644 --- a/.github/workflows/check-service-labels.yml +++ b/.github/workflows/check-service-labels.yml @@ -5,7 +5,7 @@ permissions: on: pull_request_target: - types: [opened, reopened, labeled, unlabeled] + types: [opened, edited, reopened, labeled, unlabeled, synchronize] branches: - 'release/**' diff --git a/NuGet.config b/NuGet.config index 3795f6e59e8c2b..83c90d18962074 100644 --- a/NuGet.config +++ b/NuGet.config @@ -9,7 +9,7 @@ - + diff --git a/eng/PackageDownloadAndReference.targets b/eng/PackageDownloadAndReference.targets new file mode 100644 index 00000000000000..0e56882d160e7b --- /dev/null +++ b/eng/PackageDownloadAndReference.targets @@ -0,0 +1,33 @@ + + + + + + + lib/$(TargetFramework) + %(Identity) + false + + + + + + + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 23e581ade23d81..c0d77ea95ce919 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -90,13 +90,13 @@ 45dd3a73dd5b64b010c4251303b3664bb30df029 - + https://github.com/dotnet/emsdk - 6afd7b9f34943078f2e3b747f33350e5fe114269 + adc0d6e7d3abb9c4ecee2420c51ae99c57dc9755 - + https://github.com/dotnet/emsdk - 6afd7b9f34943078f2e3b747f33350e5fe114269 + adc0d6e7d3abb9c4ecee2420c51ae99c57dc9755 @@ -111,9 +111,9 @@ - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 @@ -121,121 +121,121 @@ 73f0850939d96131c28cf6ea6ee5aacb4da0083a - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 https://github.com/dotnet/llvm-project @@ -322,21 +322,21 @@ https://github.com/dotnet/runtime edbd5c769a19798b6955050baccf99e6797d3208 - + https://github.com/dotnet/xharness - d33548342ade8e537d891c8f0f593aa206418625 + 6dbf15dc48cde2bde6f62811ba73241b067b3683 - + https://github.com/dotnet/xharness - d33548342ade8e537d891c8f0f593aa206418625 + 6dbf15dc48cde2bde6f62811ba73241b067b3683 - + https://github.com/dotnet/xharness - d33548342ade8e537d891c8f0f593aa206418625 + 6dbf15dc48cde2bde6f62811ba73241b067b3683 - + https://github.com/dotnet/arcade - 802042c6e779b73b4edb012ee1d5bae02ec8d41c + c487e860d456cda2580600ad81fd425d3bba21f7 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -354,13 +354,13 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization 67613417f5e1af250e6ddfba79f8f2885d8e90fb - + https://github.com/dotnet/hotreload-utils - 232793be175603f21989ca3be5dbe53dc41fc96d + 2dd1cedb9d30de03b034d3856c33a2cdf5f42b6c - + https://github.com/dotnet/runtime-assets - 88293463a34f5451d8a01b77b292b059bcacc3e4 + 611d6c8595694c9755c9f0cc36ae6018c4c15143 https://github.com/dotnet/roslyn diff --git a/eng/Versions.props b/eng/Versions.props index 0b891b622d4037..08c67394ba7148 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,11 +1,11 @@ - 8.0.15 + 8.0.16 8 0 - 15 + 16 8.0.100 7.0.20 6.0.36 @@ -87,21 +87,21 @@ 8.0.100 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 2.5.1-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 - 8.0.0-beta.25164.5 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 2.5.1-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 + 8.0.0-beta.25214.7 6.0.0-preview.1.102 @@ -136,8 +136,16 @@ 5.0.0 5.0.0 7.0.0 - + + 7.0.0 + 4.5.1 + 7.0.0 + 4.5.5 + 7.0.0 + 7.0.0 + 7.0.0 7.0.3 + 4.5.4 8.0.0-rc.1.23406.6 6.0.0 7.0.0 @@ -145,20 +153,20 @@ 4.5.0 8.0.0-rc.1.23406.6 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 - 8.0.0-beta.25113.1 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 + 8.0.0-beta.25211.2 1.0.0-prerelease.23566.3 1.0.0-prerelease.23566.3 @@ -178,17 +186,19 @@ $(MicrosoftBuildVersion) $(MicrosoftBuildVersion) $(MicrosoftBuildVersion) + 6.2.4 6.2.4 6.2.4 + 6.2.4 7.0.412701 6.0 1.1.0 17.4.0-preview-20220707-01 - 8.0.0-prerelease.25103.2 - 8.0.0-prerelease.25103.2 - 8.0.0-prerelease.25103.2 - 8.0.0-alpha.0.25124.2 + 8.0.0-prerelease.25207.2 + 8.0.0-prerelease.25207.2 + 8.0.0-prerelease.25207.2 + 8.0.0-alpha.0.25214.2 2.4.2 1.0.0 2.4.5 @@ -242,7 +252,7 @@ Note: when the name is updated, make sure to update dependency name in eng/pipelines/common/xplat-setup.yml like - DarcDependenciesChanged.Microsoft_NET_Workload_Emscripten_Current_Manifest-8_0_100_Transport --> - 8.0.15 + 8.0.16 $(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version) 1.1.87-gba258badda @@ -259,7 +269,7 @@ 3.1.7 1.0.406601 - 8.0.114 + 8.0.115 $(MicrosoftDotnetSdkInternalVersion) diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index 4585cfd6bba1ed..e5f543ea68c270 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 0cc2d37a836798..b4014fcf7be804 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -45,7 +45,7 @@ jobs: - name: _BuildConfig value: $(buildConfigUpper) - + - name: archType value: ${{ parameters.archType }} @@ -163,7 +163,7 @@ jobs: # Public Linux Build Pool ${{ if and(or(in(parameters.osGroup, 'linux', 'freebsd', 'android', 'tizen'), eq(parameters.jobParameters.hostedOs, 'linux')), eq(variables['System.TeamProject'], 'public')) }}: name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open # Official Build Linux Pool ${{ if and(or(in(parameters.osGroup, 'linux', 'freebsd', 'android', 'tizen'), eq(parameters.jobParameters.hostedOs, 'linux')), ne(variables['System.TeamProject'], 'public')) }}: diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml index 1a433d6170f7d7..b26b219518846f 100644 --- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml +++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml @@ -52,7 +52,7 @@ jobs: # Browser wasm - ${{ if eq(parameters.platform, 'browser_wasm') }}: - - (Ubuntu.1804.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-webassembly + - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # iOS devices - ${{ if in(parameters.platform, 'ios_arm64') }}: @@ -65,9 +65,9 @@ jobs: # Linux arm - ${{ if eq(parameters.platform, 'linux_arm') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Ubuntu.1804.Arm32.Open)Ubuntu.2204.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7 + - (Ubuntu.2204.Arm32.Open)Ubuntu.2204.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm32v7 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Ubuntu.1804.Arm32)Ubuntu.2204.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7 + - (Ubuntu.2204.Arm32)Ubuntu.2204.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm32v7 # Linux arm64 - ${{ if eq(parameters.platform, 'linux_arm64') }}: diff --git a/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml b/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml index 4223c10e8e53b1..75eee98aeb5db6 100644 --- a/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml +++ b/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml @@ -15,12 +15,12 @@ steps: - task: EsrpCodeSigning@5 displayName: Sign Diagnostic Binaries inputs: - ConnectedServiceName: 'diagnostics-esrp-kvcertuser' - AppRegistrationClientId: '2234cdec-a13f-4bb2-aa63-04c57fd7a1f9' - AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' - AuthAKVName: 'clrdiag-esrp-id' - AuthCertName: 'dotnetesrp-diagnostics-aad-ssl-cert' - AuthSignCertName: 'dotnet-diagnostics-esrp-pki-onecert' + ConnectedServiceName: 'diagnostics-esrp-kvcertuser-pme' + AppRegistrationClientId: '22346933-af99-4e94-97d5-7fa1dcf4bba6' + AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346' + AuthAKVName: 'clrdiag-esrp-pme' + AuthCertName: 'dac-dnceng-ssl-cert' + AuthSignCertName: 'dac-dnceng-esrpclient-cert' FolderPath: ${{ parameters.basePath }} Pattern: | **/mscordaccore*.dll diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index e2cf30888cf7b9..598837e4a07ff9 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -40,7 +40,7 @@ jobs: - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - (Ubuntu.2204.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Ubuntu.1804.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8 + - (Ubuntu.2204.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - (Debian.12.Arm64.Open)Ubuntu.2204.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm64v8 diff --git a/global.json b/global.json index 00765629ae001a..b6edc662fa2322 100644 --- a/global.json +++ b/global.json @@ -1,16 +1,16 @@ { "sdk": { - "version": "8.0.114", + "version": "8.0.115", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "8.0.114" + "dotnet": "8.0.115" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25164.5", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25164.5", - "Microsoft.DotNet.SharedFramework.Sdk": "8.0.0-beta.25164.5", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.25214.7", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.25214.7", + "Microsoft.DotNet.SharedFramework.Sdk": "8.0.0-beta.25214.7", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", "Microsoft.NET.Sdk.IL": "8.0.0-rc.1.23406.6" diff --git a/src/coreclr/jit/optimizer.cpp b/src/coreclr/jit/optimizer.cpp index 537605a522de42..40d59554f3d6cf 100644 --- a/src/coreclr/jit/optimizer.cpp +++ b/src/coreclr/jit/optimizer.cpp @@ -1801,7 +1801,7 @@ class LoopSearch // BasicBlock* FindEntry(BasicBlock* head, BasicBlock* top, BasicBlock* bottom) { - if (head->bbJumpKind == BBJ_ALWAYS) + if ((head->bbJumpKind == BBJ_ALWAYS) && !head->isBBCallAlwaysPairTail()) { if (head->bbJumpDest->bbNum <= bottom->bbNum && head->bbJumpDest->bbNum >= top->bbNum) { diff --git a/src/libraries/Common/tests/System/Net/Configuration.Http.cs b/src/libraries/Common/tests/System/Net/Configuration.Http.cs index 846aa340a9dd58..04be1ec6e44402 100644 --- a/src/libraries/Common/tests/System/Net/Configuration.Http.cs +++ b/src/libraries/Common/tests/System/Net/Configuration.Http.cs @@ -21,7 +21,7 @@ public static partial class Http // This server doesn't use HTTP/2 server push (push promise) feature. Some HttpClient implementations // don't support servers that use push right now. - public static string Http2NoPushHost => GetValue("DOTNET_TEST_HTTP2NOPUSHHOST", "www.microsoft.com"); + public static string Http2NoPushHost => GetValue("DOTNET_TEST_HTTP2NOPUSHHOST", "httpbin.org"); // Domain server environment. public static string DomainJoinedHttpHost => GetValue("DOTNET_TEST_DOMAINJOINED_HTTPHOST"); @@ -58,12 +58,7 @@ public static partial class Http public static readonly Uri RemoteEchoServer = new Uri("http://" + Host + "/" + EchoHandler); public static readonly Uri SecureRemoteEchoServer = new Uri("https://" + SecureHost + "/" + EchoHandler); public static readonly Uri Http2RemoteEchoServer = new Uri("https://" + Http2Host + "/" + EchoHandler); - public static Uri[] EchoServerList => [ - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // RemoteEchoServer, - SecureRemoteEchoServer, - Http2RemoteEchoServer - ]; + public static readonly Uri[] EchoServerList = new Uri[] { RemoteEchoServer, SecureRemoteEchoServer, Http2RemoteEchoServer }; public static readonly Uri RemoteVerifyUploadServer = new Uri("http://" + Host + "/" + VerifyUploadHandler); public static readonly Uri SecureRemoteVerifyUploadServer = new Uri("https://" + SecureHost + "/" + VerifyUploadHandler); @@ -78,36 +73,18 @@ public static partial class Http public static Uri RemoteLoopServer => new Uri("ws://" + RemoteLoopHost + "/" + RemoteLoopHandler); public static readonly object[][] EchoServers = EchoServerList.Select(x => new object[] { x }).ToArray(); - public static readonly object[][] VerifyUploadServers = { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // new object[] { RemoteVerifyUploadServer }, - new object[] { SecureRemoteVerifyUploadServer }, - new object[] { Http2RemoteVerifyUploadServer } - }; - - public static readonly object[][] CompressedServers = { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // new object[] { RemoteDeflateServer }, - new object[] { RemoteGZipServer }, - new object[] { Http2RemoteDeflateServer }, - new object[] { Http2RemoteGZipServer } - }; + public static readonly object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer }, new object[] { Http2RemoteVerifyUploadServer } }; + public static readonly object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer }, new object[] { Http2RemoteDeflateServer }, new object[] { Http2RemoteGZipServer } }; public static readonly object[][] Http2Servers = { new object[] { new Uri("https://" + Http2Host) } }; public static readonly object[][] Http2NoPushServers = { new object[] { new Uri("https://" + Http2NoPushHost) } }; + public static readonly object[][] Http2NoPushGetUris = { new object[] { new Uri("https://" + Http2NoPushHost + "/get") } }; public static readonly RemoteServer RemoteHttp11Server = new RemoteServer(new Uri("http://" + Host + "/"), HttpVersion.Version11); public static readonly RemoteServer RemoteSecureHttp11Server = new RemoteServer(new Uri("https://" + SecureHost + "/"), HttpVersion.Version11); public static readonly RemoteServer RemoteHttp2Server = new RemoteServer(new Uri("https://" + Http2Host + "/"), new Version(2, 0)); - public static IEnumerable RemoteServers => - new RemoteServer[] - { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // RemoteHttp11Server, - RemoteSecureHttp11Server, - RemoteHttp2Server - }; + public static readonly IEnumerable RemoteServers = new RemoteServer[] { RemoteHttp11Server, RemoteSecureHttp11Server, RemoteHttp2Server }; public static readonly IEnumerable RemoteServersMemberData = RemoteServers.Select(s => new object[] { s }); diff --git a/src/libraries/Common/tests/System/Net/Configuration.WebSockets.cs b/src/libraries/Common/tests/System/Net/Configuration.WebSockets.cs index 699b002f6a0037..a24512ce3b4a58 100644 --- a/src/libraries/Common/tests/System/Net/Configuration.WebSockets.cs +++ b/src/libraries/Common/tests/System/Net/Configuration.WebSockets.cs @@ -22,17 +22,8 @@ public static partial class WebSockets public static readonly Uri RemoteEchoHeadersServer = new Uri("ws://" + Host + "/" + EchoHeadersHandler); public static readonly Uri SecureRemoteEchoHeadersServer = new Uri("wss://" + SecureHost + "/" + EchoHeadersHandler); - public static object[][] EchoServers => new object[][] { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // new object[] { RemoteEchoServer }, - new object[] { SecureRemoteEchoServer }, - }; - - public static object[][] EchoHeadersServers => new object[][] { - // [ActiveIssue("https://github.com/dotnet/runtime/issues/110578)] - // new object[] { RemoteEchoHeadersServer }, - new object[] { SecureRemoteEchoHeadersServer }, - }; + public static readonly object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } }; + public static readonly object[][] EchoHeadersServers = { new object[] { RemoteEchoHeadersServer }, new object[] { SecureRemoteEchoHeadersServer } }; } } } diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs index 6596a330ddfa68..8549a5838566aa 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs @@ -31,6 +31,7 @@ public sealed class HttpClientHandler_RemoteServerTest : HttpClientHandlerTestBa public static readonly object[][] Http2Servers = Configuration.Http.Http2Servers; public static readonly object[][] Http2NoPushServers = Configuration.Http.Http2NoPushServers; + public static readonly object[][] Http2NoPushGetUris = Configuration.Http.Http2NoPushGetUris; // Standard HTTP methods defined in RFC7231: http://tools.ietf.org/html/rfc7231#section-4.3 // "GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE" @@ -70,7 +71,7 @@ public async Task UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeU handler.UseDefaultCredentials = false; using (HttpClient client = CreateHttpClient(handler)) { - Uri uri = Configuration.Http.RemoteSecureHttp11Server.NegotiateAuthUriForDefaultCreds; + Uri uri = Configuration.Http.RemoteHttp11Server.NegotiateAuthUriForDefaultCreds; _output.WriteLine("Uri: {0}", uri); using (HttpResponseMessage response = await client.GetAsync(uri)) { @@ -600,9 +601,9 @@ public async Task PostAsync_CallMethod_EmptyContent(Configuration.Http.RemoteSer public static IEnumerable ExpectContinueVersion() { return - from expect in new bool?[] { true, false, null } - from version in new Version[] { new Version(1, 0), new Version(1, 1), new Version(2, 0) } - select new object[] { expect, version }; + from expect in new bool?[] {true, false, null} + from version in new Version[] {new Version(1, 0), new Version(1, 1), new Version(2, 0)} + select new object[] {expect, version}; } [OuterLoop("Uses external servers", typeof(PlatformDetection), nameof(PlatformDetection.LocalEchoServerIsNotAvailable))] @@ -780,8 +781,7 @@ public async Task SendAsync_SendRequestUsingMethodToEchoServerWithNoContent_Meth { var request = new HttpRequestMessage( new HttpMethod(method), - serverUri) - { Version = UseVersion }; + serverUri) { Version = UseVersion }; using (HttpResponseMessage response = await client.SendAsync(TestAsync, request)) { @@ -807,8 +807,7 @@ public async Task SendAsync_SendRequestUsingMethodToEchoServerWithContent_Succes { var request = new HttpRequestMessage( new HttpMethod(method), - serverUri) - { Version = UseVersion }; + serverUri) { Version = UseVersion }; request.Content = new StringContent(ExpectedContent); using (HttpResponseMessage response = await client.SendAsync(TestAsync, request)) { @@ -987,7 +986,6 @@ public async Task GetAsync_AllowAutoRedirectTrue_RedirectFromHttpToHttp_StatusCo [OuterLoop("Uses external servers")] [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/55083", TestPlatforms.Browser)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/110578")] public async Task GetAsync_AllowAutoRedirectTrue_RedirectFromHttpToHttps_StatusCodeOK() { HttpClientHandler handler = CreateHttpClientHandler(); @@ -1072,9 +1070,9 @@ public async Task GetAsync_MaxAutomaticRedirectionsNServerHops_ThrowsIfTooMany(i handler.MaxAutomaticRedirections = maxHops; using (HttpClient client = CreateHttpClient(handler)) { - Task t = client.GetAsync(Configuration.Http.RemoteSecureHttp11Server.RedirectUriForDestinationUri( + Task t = client.GetAsync(Configuration.Http.RemoteHttp11Server.RedirectUriForDestinationUri( statusCode: 302, - destinationUri: Configuration.Http.RemoteSecureHttp11Server.EchoUri, + destinationUri: Configuration.Http.RemoteHttp11Server.EchoUri, hops: hops)); if (hops <= maxHops) @@ -1082,7 +1080,7 @@ public async Task GetAsync_MaxAutomaticRedirectionsNServerHops_ThrowsIfTooMany(i using (HttpResponseMessage response = await t) { Assert.Equal(HttpStatusCode.OK, response.StatusCode); - Assert.Equal(Configuration.Http.SecureRemoteEchoServer, response.RequestMessage.RequestUri); + Assert.Equal(Configuration.Http.RemoteEchoServer, response.RequestMessage.RequestUri); } } else @@ -1368,7 +1366,7 @@ public async Task SendAsync_RequestVersion20_ResponseVersion20IfHttp2Supported(U } [OuterLoop("Uses external servers")] - [ConditionalTheory(nameof(IsWindows10Version1607OrGreater)), MemberData(nameof(Http2NoPushServers))] + [ConditionalTheory(nameof(IsWindows10Version1607OrGreater)), MemberData(nameof(Http2NoPushGetUris))] public async Task SendAsync_RequestVersion20_ResponseVersion20(Uri server) { // Sync API supported only up to HTTP/1.1 diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs index bc623b48aa2fe3..eca2101b78edbb 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.ServerCertificates.cs @@ -97,7 +97,6 @@ public async Task NoCallback_ValidCertificate_SuccessAndExpectedPropertyBehavior [OuterLoop("Uses external servers")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/110578")] public async Task UseCallback_NotSecureConnection_CallbackNotCalled() { HttpClientHandler handler = CreateHttpClientHandler(); diff --git a/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs index 992851b166befa..77940f5fa32af0 100644 --- a/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs @@ -229,6 +229,99 @@ await client.GetAsync(remoteServer.EchoUri, HttpCompletionOption.ResponseHeaders } #if NETCOREAPP + public static IEnumerable HttpMethods => new object[][] + { + new [] { HttpMethod.Get }, + new [] { HttpMethod.Head }, + new [] { HttpMethod.Post }, + new [] { HttpMethod.Put }, + new [] { HttpMethod.Delete }, + new [] { HttpMethod.Options }, + new [] { HttpMethod.Patch }, + }; + + public static IEnumerable HttpMethodsAndAbort => new object[][] + { + new object[] { HttpMethod.Get, "abortBeforeHeaders" }, + new object[] { HttpMethod.Head , "abortBeforeHeaders"}, + new object[] { HttpMethod.Post , "abortBeforeHeaders"}, + new object[] { HttpMethod.Put , "abortBeforeHeaders"}, + new object[] { HttpMethod.Delete , "abortBeforeHeaders"}, + new object[] { HttpMethod.Options , "abortBeforeHeaders"}, + new object[] { HttpMethod.Patch , "abortBeforeHeaders"}, + + new object[] { HttpMethod.Get, "abortAfterHeaders" }, + new object[] { HttpMethod.Post , "abortAfterHeaders"}, + new object[] { HttpMethod.Put , "abortAfterHeaders"}, + new object[] { HttpMethod.Delete , "abortAfterHeaders"}, + new object[] { HttpMethod.Options , "abortAfterHeaders"}, + new object[] { HttpMethod.Patch , "abortAfterHeaders"}, + + new object[] { HttpMethod.Get, "abortDuringBody" }, + new object[] { HttpMethod.Post , "abortDuringBody"}, + new object[] { HttpMethod.Put , "abortDuringBody"}, + new object[] { HttpMethod.Delete , "abortDuringBody"}, + new object[] { HttpMethod.Options , "abortDuringBody"}, + new object[] { HttpMethod.Patch , "abortDuringBody"}, + + }; + + [MemberData(nameof(HttpMethods))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] + public async Task BrowserHttpHandler_StreamingResponse(HttpMethod method) + { + var WebAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey("WebAssemblyEnableStreamingResponse"); + + var req = new HttpRequestMessage(method, Configuration.Http.RemoteHttp11Server.BaseUri + "echo.ashx"); + req.Options.Set(WebAssemblyEnableStreamingResponseKey, true); + + if(method == HttpMethod.Post) + { + req.Content = new StringContent("hello world"); + } + + using (HttpClient client = CreateHttpClientForRemoteServer(Configuration.Http.RemoteHttp11Server)) + // we need to switch off Response buffering of default ResponseContentRead option + using (HttpResponseMessage response = await client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead)) + { + using var content = response.Content; + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + Assert.Equal(typeof(StreamContent), content.GetType()); + Assert.NotEqual(0, content.Headers.ContentLength); + if (method != HttpMethod.Head) + { + var data = await content.ReadAsByteArrayAsync(); + Assert.NotEqual(0, data.Length); + } + } + } + + [MemberData(nameof(HttpMethodsAndAbort))] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] + public async Task BrowserHttpHandler_StreamingResponseAbort(HttpMethod method, string abort) + { + var WebAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey("WebAssemblyEnableStreamingResponse"); + + var req = new HttpRequestMessage(method, Configuration.Http.RemoteHttp11Server.BaseUri + "echo.ashx?" + abort + "=true"); + req.Options.Set(WebAssemblyEnableStreamingResponseKey, true); + + if (method == HttpMethod.Post || method == HttpMethod.Put || method == HttpMethod.Patch) + { + req.Content = new StringContent("hello world"); + } + + HttpClient client = CreateHttpClientForRemoteServer(Configuration.Http.RemoteHttp11Server); + if (abort == "abortDuringBody") + { + using var res = await client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead); + await Assert.ThrowsAsync(() => res.Content.ReadAsByteArrayAsync()); + } + else + { + await Assert.ThrowsAsync(() => client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead)); + } + } + [OuterLoop] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser))] public async Task BrowserHttpHandler_Streaming() diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Handlers/EchoHandler.cs b/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Handlers/EchoHandler.cs index fd05cff102d2e6..690e759a90e8b5 100644 --- a/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Handlers/EchoHandler.cs +++ b/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Handlers/EchoHandler.cs @@ -4,8 +4,10 @@ using System; using System.Security.Cryptography; using System.Text; +using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; namespace NetCoreServer { @@ -20,23 +22,80 @@ public static async Task InvokeAsync(HttpContext context) return; } - // Add original request method verb as a custom response header. - context.Response.Headers["X-HttpRequest-Method"] = context.Request.Method; + + var qs = context.Request.QueryString.HasValue ? context.Request.QueryString.Value : ""; + var delay = 0; + if (qs.Contains("delay1sec")) + { + delay = 1000; + } + else if (qs.Contains("delay10sec")) + { + delay = 10000; + } + + if (qs.Contains("abortBeforeHeaders")) + { + context.Abort(); + return; + } + + if (delay > 0) + { + context.Features.Get().DisableBuffering(); + } // Echo back JSON encoded payload. RequestInformation info = await RequestInformation.CreateAsync(context.Request); string echoJson = info.SerializeToJson(); + byte[] bytes = Encoding.UTF8.GetBytes(echoJson); + + // Add original request method verb as a custom response header. + context.Response.Headers["X-HttpRequest-Method"] = context.Request.Method; // Compute MD5 hash so that clients can verify the received data. using (MD5 md5 = MD5.Create()) { - byte[] bytes = Encoding.UTF8.GetBytes(echoJson); byte[] hash = md5.ComputeHash(bytes); string encodedHash = Convert.ToBase64String(hash); context.Response.Headers["Content-MD5"] = encodedHash; context.Response.ContentType = "application/json"; context.Response.ContentLength = bytes.Length; + } + + await context.Response.StartAsync(CancellationToken.None); + + if (qs.Contains("abortAfterHeaders")) + { + await Task.Delay(10); + context.Abort(); + return; + } + + if(context.Request.Method == "HEAD") + { + return; + } + + if (delay > 0 || qs.Contains("abortDuringBody")) + { + await context.Response.Body.WriteAsync(bytes, 0, 10); + await context.Response.Body.FlushAsync(); + if (qs.Contains("abortDuringBody")) + { + await context.Response.Body.FlushAsync(); + await Task.Delay(10); + context.Abort(); + return; + } + + await Task.Delay(delay); + await context.Response.Body.WriteAsync(bytes, 10, bytes.Length-10); + await context.Response.Body.FlushAsync(); + } + else + { await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); } } diff --git a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj index ba7840768570b5..583cf9c1b3b21f 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj @@ -5,7 +5,7 @@ true true true - true + false 3 Logging abstractions for Microsoft.Extensions.Logging. diff --git a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj index b7307449560cd4..62e0ad2b082451 100644 --- a/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj +++ b/src/libraries/System.Diagnostics.EventLog/src/System.Diagnostics.EventLog.csproj @@ -3,7 +3,7 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppPrevious)-windows;$(NetCoreAppPrevious);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) true true - true + false 2 Provides the System.Diagnostics.EventLog class, which allows the applications to use the Windows event log service. diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj index dff002915f8770..14030b952474f2 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj +++ b/src/libraries/System.DirectoryServices.Protocols/src/System.DirectoryServices.Protocols.csproj @@ -4,7 +4,7 @@ true true true - true + false 1 true true diff --git a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj index b53abe9bf1efba..574d8c7f1ce87d 100644 --- a/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj +++ b/src/libraries/System.Formats.Asn1/src/System.Formats.Asn1.csproj @@ -4,7 +4,7 @@ true $(DefineConstants);CP_NO_ZEROMEMORY true - true + false 2 Provides classes that can read and write the ASN.1 BER, CER, and DER data formats. diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/FileSystemSecurity.cs b/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/FileSystemSecurity.cs index c438a4e9eb36fd..cece82a21343a3 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/FileSystemSecurity.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/FileSystemSecurity.cs @@ -121,7 +121,7 @@ internal void Persist(string fullPath) try { AccessControlSections persistRules = GetAccessControlSectionsFromChanges(); - base.Persist(fullPath, persistRules); + base.Persist(PathInternal.EnsureExtendedPrefixIfNeeded(fullPath), persistRules); OwnerModified = GroupModified = AuditRulesModified = AccessRulesModified = false; } finally diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs index 271f28fb2bd0af..cc119fc6ad8d82 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs @@ -143,6 +143,25 @@ public void SetAccessControl_FileInfo_FileSecurity_Success() fileInfo.SetAccessControl(fileSecurity); } + [Fact] + public void SetAccessControl_FileInfo_FileSecurity_Success_NameLongerThanMaxShortPath() + { + using var directory = new TempAclDirectory(); + + const int MaxShortPath = 260; + int fileNameLength = Math.Max(MaxShortPath - directory.Path.Length, 1); + + string path = Path.Combine(directory.Path, new string('1', fileNameLength) + ".txt"); + using var file = new TempFile(path, 1); + var fileInfo = new FileInfo(file.Path); + FileSecurity fileSecurity = fileInfo.GetAccessControl(AccessControlSections.Access); + + var newAccessRule = new FileSystemAccessRule(Helpers.s_NetworkServiceNTAccount, FileSystemRights.Write, AccessControlType.Allow); + fileSecurity.SetAccessRule(newAccessRule); + + fileInfo.SetAccessControl(fileSecurity); + } + [Fact] public void SetAccessControl_FileStream_FileSecurity_InvalidArguments() { diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj index 8959c43540ca16..65ec45bc444f7c 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj @@ -4,8 +4,8 @@ true true true - false - 2 + true + 3 Provides a message handler for HttpClient based on the WinHTTP interface of Windows. While similar to HttpClientHandler, it provides developers more granular control over the application's HTTP communication than the HttpClientHandler. Commonly Used Types: diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs index 13c154516ce82c..7542c42fab9b49 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs @@ -231,13 +231,12 @@ private static void OnRequestRedirect(WinHttpRequestState state, Uri redirectUri private static void OnRequestSendingRequest(WinHttpRequestState state) { Debug.Assert(state != null, "OnRequestSendingRequest: state is null"); - Debug.Assert(state.RequestHandle != null, "OnRequestSendingRequest: state.RequestHandle is null"); Debug.Assert(state.RequestMessage != null, "OnRequestSendingRequest: state.RequestMessage is null"); Debug.Assert(state.RequestMessage.RequestUri != null, "OnRequestSendingRequest: state.RequestMessage.RequestUri is null"); - if (state.RequestMessage.RequestUri.Scheme != UriScheme.Https) + if (state.RequestMessage.RequestUri.Scheme != UriScheme.Https || state.RequestHandle == null) { - // Not SSL/TLS. + // Not SSL/TLS or request already gone return; } diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs index 4f7d573df68b09..df73619bf8dad8 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/ServerCertificateTest.cs @@ -32,7 +32,6 @@ public async Task NoCallback_ValidCertificate_CallbackNotCalled() [OuterLoop] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/110578")] public async Task UseCallback_NotSecureConnection_CallbackNotCalled() { var handler = new WinHttpHandler(); diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs index c4f49a33a4e0fb..5ac9a78702cbab 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs @@ -55,7 +55,7 @@ public async Task GetAsync_RedirectResponseHasCookie_CookieSentToFinalUri( string cookieName, string cookieValue) { - Uri uri = System.Net.Test.Common.Configuration.Http.RemoteSecureHttp11Server.RedirectUriForDestinationUri(302, System.Net.Test.Common.Configuration.Http.SecureRemoteEchoServer, 1); + Uri uri = System.Net.Test.Common.Configuration.Http.RemoteHttp11Server.RedirectUriForDestinationUri(302, System.Net.Test.Common.Configuration.Http.RemoteEchoServer, 1); var handler = new WinHttpHandler(); handler.WindowsProxyUsePolicy = WindowsProxyUsePolicy.UseWinInetProxy; handler.CookieUsePolicy = cookieUsePolicy; diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs index d1e28514977ff4..f896ebdf1d5e93 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs @@ -644,7 +644,7 @@ private async ValueTask ProcessHeadersFrame(FrameHeader frameHeader) if (http2Stream != null) { http2Stream.OnHeadersStart(); - _rttEstimator.OnDataOrHeadersReceived(this); + _rttEstimator.OnDataOrHeadersReceived(this, sendWindowUpdateBeforePing: true); headersHandler = http2Stream; } else @@ -773,24 +773,21 @@ private void ProcessDataFrame(FrameHeader frameHeader) // Just ignore the frame in this case. ReadOnlySpan frameData = GetFrameData(_incomingBuffer.ActiveSpan.Slice(0, frameHeader.PayloadLength), hasPad: frameHeader.PaddedFlag, hasPriority: false); - if (http2Stream != null) - { - bool endStream = frameHeader.EndStreamFlag; - if (frameData.Length > 0 || endStream) - { - http2Stream.OnResponseData(frameData, endStream); - } + bool endStream = frameHeader.EndStreamFlag; - if (!endStream && frameData.Length > 0) - { - _rttEstimator.OnDataOrHeadersReceived(this); - } + if (frameData.Length > 0 || endStream) + { + http2Stream?.OnResponseData(frameData, endStream); } if (frameData.Length > 0) { - ExtendWindow(frameData.Length); + bool windowUpdateSent = ExtendWindow(frameData.Length); + if (http2Stream is not null && !endStream) + { + _rttEstimator.OnDataOrHeadersReceived(this, sendWindowUpdateBeforePing: !windowUpdateSent); + } } _incomingBuffer.Discard(frameHeader.PayloadLength); @@ -1792,7 +1789,7 @@ private Task SendWindowUpdateAsync(int streamId, int amount) }); } - private void ExtendWindow(int amount) + private bool ExtendWindow(int amount) { if (NetEventSource.Log.IsEnabled()) Trace($"{nameof(amount)}={amount}"); Debug.Assert(amount > 0); @@ -1806,7 +1803,7 @@ private void ExtendWindow(int amount) if (_pendingWindowUpdate < ConnectionWindowThreshold) { if (NetEventSource.Log.IsEnabled()) Trace($"{nameof(_pendingWindowUpdate)} {_pendingWindowUpdate} < {ConnectionWindowThreshold}."); - return; + return false; } windowUpdateSize = _pendingWindowUpdate; @@ -1814,6 +1811,17 @@ private void ExtendWindow(int amount) } LogExceptions(SendWindowUpdateAsync(0, windowUpdateSize)); + return true; + } + + private bool ForceSendConnectionWindowUpdate() + { + if (NetEventSource.Log.IsEnabled()) Trace($"{nameof(_pendingWindowUpdate)}={_pendingWindowUpdate}"); + if (_pendingWindowUpdate == 0) return false; + + LogExceptions(SendWindowUpdateAsync(0, _pendingWindowUpdate)); + _pendingWindowUpdate = 0; + return true; } public override long GetIdleTicks(long nowTicks) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs index e5dd33aa9fd361..470cacbe2de34c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.cs @@ -138,13 +138,18 @@ private void AdjustWindowDynamic(int bytesConsumed, Http2Stream stream) // Assuming that the network characteristics of the connection wouldn't change much within its lifetime, we are maintaining a running minimum value. // The more PINGs we send, the more accurate is the estimation of MinRtt, however we should be careful not to send too many of them, // to avoid triggering the server's PING flood protection which may result in an unexpected GOAWAY. - // With most servers we are fine to send PINGs, as long as we are reading their data, this rule is well formalized for gRPC: + // + // Several strategies have been implemented to conform with real life servers. + // 1. With most servers we are fine to send PINGs as long as we are reading their data, a rule formalized by a gRPC spec: // https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md - // As a rule of thumb, we can send send a PING whenever we receive DATA or HEADERS, however, there are some servers which allow receiving only - // a limited amount of PINGs within a given timeframe. - // To deal with the conflicting requirements: - // - We send an initial burst of 'InitialBurstCount' PINGs, to get a relatively good estimation fast - // - Afterwards, we send PINGs with the maximum frequency of 'PingIntervalInSeconds' PINGs per second + // According to this rule, we are OK to send a PING whenever we receive DATA or HEADERS, since the servers conforming to this doc + // will reset their unsolicited ping counter whenever they *send* DATA or HEADERS. + // 2. Some servers allow receiving only a limited amount of PINGs within a given timeframe. + // To deal with this, we send an initial burst of 'InitialBurstCount' (=4) PINGs, to get a relatively good estimation fast. Afterwards, + // we send PINGs each 'PingIntervalInSeconds' second, to maintain our estimation without triggering these servers. + // 3. Some servers in Google's backends reset their unsolicited ping counter when they *receive* DATA, HEADERS, or WINDOW_UPDATE. + // To deal with this, we need to make sure to send a connection WINDOW_UPDATE before sending a PING. The initial burst is an exception + // to this rule, since the mentioned server can tolerate 4 PINGs without receiving a WINDOW_UPDATE. // // Threading: // OnInitialSettingsSent() is called during initialization, all other methods are triggered by HttpConnection.ProcessIncomingFramesAsync(), @@ -194,7 +199,7 @@ internal void OnInitialSettingsAckReceived(Http2Connection connection) _state = State.Waiting; } - internal void OnDataOrHeadersReceived(Http2Connection connection) + internal void OnDataOrHeadersReceived(Http2Connection connection, bool sendWindowUpdateBeforePing) { if (_state != State.Waiting) return; @@ -204,6 +209,14 @@ internal void OnDataOrHeadersReceived(Http2Connection connection) { if (initial) _initialBurst--; + // When sendWindowUpdateBeforePing is true, try to send a WINDOW_UPDATE to make Google backends happy. + // Unless we are doing the initial burst, do not send PING if we were not able to send the WINDOW_UPDATE. + // See point 3. in the comments above the class definition for more info. + if (sendWindowUpdateBeforePing && !connection.ForceSendConnectionWindowUpdate() && !initial) + { + return; + } + // Send a PING _pingCounter--; if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Sending RTT PING with payload {_pingCounter}"); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index 07f19ef3029c97..a9b1be6e7766a2 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -2494,6 +2494,7 @@ public async Task PostAsyncDuplex_ClientSendsEndStream_Success() HttpResponseMessage response = await responseTask; Stream responseStream = await response.Content.ReadAsStreamAsync(); + connection.IgnoreWindowUpdates(); // Send some data back and forth await SendAndReceiveResponseDataAsync(contentBytes, responseStream, connection, streamId); await SendAndReceiveResponseDataAsync(contentBytes, responseStream, connection, streamId); @@ -2554,6 +2555,7 @@ public async Task PostAsyncDuplex_ServerSendsEndStream_Success() HttpResponseMessage response = await responseTask; Stream responseStream = await response.Content.ReadAsStreamAsync(); + connection.IgnoreWindowUpdates(); // Send some data back and forth await SendAndReceiveResponseDataAsync(contentBytes, responseStream, connection, streamId); await SendAndReceiveResponseDataAsync(contentBytes, responseStream, connection, streamId); @@ -2874,6 +2876,7 @@ public async Task PostAsyncDuplex_DisposeResponseBodyBeforeEnd_ResetsStreamAndTh // This allows the request processing to complete. duplexContent.Fail(e); + connection.IgnoreWindowUpdates(); // The RTT algorithm may send a WINDOW_UPDATE before RST_STREAM. // Client should set RST_STREAM. await connection.ReadRstStreamAsync(streamId); } @@ -2947,6 +2950,7 @@ public async Task PostAsyncDuplex_DisposeResponseBodyAfterEndReceivedButBeforeCo // This allows the request processing to complete. duplexContent.Fail(e); + connection.IgnoreWindowUpdates(); // The RTT algorithm may send a WINDOW_UPDATE before RST_STREAM. // Client should set RST_STREAM. await connection.ReadRstStreamAsync(streamId); } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs index 9fda1a3cd4735c..f25ce79fb7e7d8 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs @@ -1112,7 +1112,7 @@ public Task RequestDuration_Redirect_RecordedForEachHttpSpan() }); }, options: new GenericLoopbackOptions() { UseSsl = true }); - }, options: new GenericLoopbackOptions() { UseSsl = false }); + }, options: new GenericLoopbackOptions() { UseSsl = false}); } [Fact] diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2ExtendedConnect.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2ExtendedConnect.cs index cb1a15df14e774..ba88641a9bbc42 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2ExtendedConnect.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2ExtendedConnect.cs @@ -85,6 +85,7 @@ await Http2LoopbackServerFactory.Singleton.CreateClientAndServerAsync(async uri async server => { await using Http2LoopbackConnection connection = await ((Http2LoopbackServer)server).EstablishConnectionAsync(new SettingsEntry { SettingId = SettingId.EnableConnect, Value = 1 }); + connection.IgnoreWindowUpdates(); (int streamId, HttpRequestData request) = await connection.ReadAndParseRequestHeaderAsync(readBody: false); diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs index 4862c0a4ae52c5..f1dc09a9f7358f 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs @@ -128,7 +128,7 @@ static async Task RunTest() TimeSpan.FromMilliseconds(30), TimeSpan.Zero, 2 * 1024 * 1024, - null); + maxWindowForPingStopValidation: MaxWindow); Assert.True(maxCredit <= MaxWindow); } @@ -181,19 +181,34 @@ static async Task RunTest() RemoteExecutor.Invoke(RunTest, options).Dispose(); } + [OuterLoop("Runs long")] + [Fact] + public async Task LongRunningSlowServerStream_NoInvalidPingsAreSent() + { + // A scenario similar to https://github.com/grpc/grpc-dotnet/issues/2361. + // We need to send a small amount of data so the connection window is not consumed and no "standard" WINDOW_UPDATEs are sent and + // we also need to do it very slowly to cover some RTT PINGs after the initial burst. + // This scenario should trigger the "forced WINDOW_UPDATE" logic in the implementation, ensuring that no more than 4 PINGs are sent without a WINDOW_UPDATE. + await TestClientWindowScalingAsync( + TimeSpan.FromMilliseconds(500), + TimeSpan.FromMilliseconds(500), + 1024, + _output, + dataPerFrame: 32); + } + private static async Task TestClientWindowScalingAsync( TimeSpan networkDelay, TimeSpan slowBandwidthSimDelay, int bytesToDownload, ITestOutputHelper output = null, - int maxWindowForPingStopValidation = int.MaxValue, // set to actual maximum to test if we stop sending PING when window reached maximum - Action configureHandler = null) + int dataPerFrame = 16384, + int maxWindowForPingStopValidation = 16 * 1024 * 1024) // set to actual maximum to test if we stop sending PING when window reached maximum { TimeSpan timeout = TimeSpan.FromSeconds(30); CancellationTokenSource timeoutCts = new CancellationTokenSource(timeout); HttpClientHandler handler = CreateHttpClientHandler(HttpVersion20.Value); - configureHandler?.Invoke(GetUnderlyingSocketsHttpHandler(handler)); using Http2LoopbackServer server = Http2LoopbackServer.CreateServer(NoAutoPingResponseHttp2Options); using HttpClient client = new HttpClient(handler, true); @@ -225,13 +240,13 @@ private static async Task TestClientWindowScalingAsync( using SemaphoreSlim writeSemaphore = new SemaphoreSlim(1); int remainingBytes = bytesToDownload; - bool pingReceivedAfterReachingMaxWindow = false; + string unexpectedPingReason = null; bool unexpectedFrameReceived = false; CancellationTokenSource stopFrameProcessingCts = new CancellationTokenSource(); CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(stopFrameProcessingCts.Token, timeoutCts.Token); Task processFramesTask = ProcessIncomingFramesAsync(linkedCts.Token); - byte[] buffer = new byte[16384]; + byte[] buffer = new byte[dataPerFrame]; while (remainingBytes > 0) { @@ -259,7 +274,7 @@ private static async Task TestClientWindowScalingAsync( int dataReceived = (await response.Content.ReadAsByteArrayAsync()).Length; Assert.Equal(bytesToDownload, dataReceived); - Assert.False(pingReceivedAfterReachingMaxWindow, "Server received a PING after reaching max window"); + Assert.Null(unexpectedPingReason); Assert.False(unexpectedFrameReceived, "Server received an unexpected frame, see test output for more details."); return maxCredit; @@ -270,6 +285,7 @@ async Task ProcessIncomingFramesAsync(CancellationToken cancellationToken) // We should not receive any more RTT PING's after this point int maxWindowCreditThreshold = (int) (0.9 * maxWindowForPingStopValidation); output?.WriteLine($"maxWindowCreditThreshold: {maxWindowCreditThreshold} maxWindowForPingStopValidation: {maxWindowForPingStopValidation}"); + int pingsWithoutWindowUpdate = 0; try { @@ -284,10 +300,18 @@ async Task ProcessIncomingFramesAsync(CancellationToken cancellationToken) output?.WriteLine($"Received PING ({pingFrame.Data})"); + pingsWithoutWindowUpdate++; if (maxCredit > maxWindowCreditThreshold) { - output?.WriteLine("PING was unexpected"); - Volatile.Write(ref pingReceivedAfterReachingMaxWindow, true); + Volatile.Write(ref unexpectedPingReason, "The server received a PING after reaching max window"); + output?.WriteLine($"PING was unexpected: {unexpectedPingReason}"); + } + + // Exceeding this limit may trigger a GOAWAY on some servers. See implementation comments for more details. + if (pingsWithoutWindowUpdate > 4) + { + Volatile.Write(ref unexpectedPingReason, $"The server received {pingsWithoutWindowUpdate} PINGs without receiving a WINDOW_UPDATE"); + output?.WriteLine($"PING was unexpected: {unexpectedPingReason}"); } await writeSemaphore.WaitAsync(cancellationToken); @@ -296,6 +320,7 @@ async Task ProcessIncomingFramesAsync(CancellationToken cancellationToken) } else if (frame is WindowUpdateFrame windowUpdateFrame) { + pingsWithoutWindowUpdate = 0; // Ignore connection window: if (windowUpdateFrame.StreamId != streamId) continue; diff --git a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj index 93eb53d3e23fa2..b05a319099867c 100644 --- a/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj +++ b/src/libraries/System.Private.Xml/src/System.Private.Xml.csproj @@ -4,9 +4,6 @@ System.Xml true false - true - true - 1 diff --git a/src/mono/wasm/runtime/http.ts b/src/mono/wasm/runtime/http.ts index 1ad6a4fc457bbd..c1949ce0d589eb 100644 --- a/src/mono/wasm/runtime/http.ts +++ b/src/mono/wasm/runtime/http.ts @@ -2,7 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. import { wrap_as_cancelable_promise } from "./cancelable-promise"; -import { ENVIRONMENT_IS_NODE, Module, loaderHelpers, mono_assert } from "./globals"; +import { ENVIRONMENT_IS_NODE, loaderHelpers, mono_assert } from "./globals"; +import { mono_log_debug } from "./logging"; import { MemoryViewType, Span } from "./marshal"; import type { VoidPtr } from "./types/emscripten"; @@ -16,6 +17,14 @@ function verifyEnvironment() { } } +function mute_unhandledrejection (promise:Promise) { + promise.catch((err) => { + if (err && err !== "AbortError" && err.name !== "AbortError" ) { + mono_log_debug("http muted: " + err); + } + }); +} + export function http_wasm_supports_streaming_response(): boolean { return typeof Response !== "undefined" && "body" in Response.prototype && typeof ReadableStream === "function"; } @@ -32,12 +41,7 @@ export function http_wasm_abort_request(abort_controller: AbortController): void export function http_wasm_abort_response(res: ResponseExtension): void { res.__abort_controller.abort(); if (res.__reader) { - res.__reader.cancel().catch((err) => { - if (err && err.name !== "AbortError") { - Module.err("Error in http_wasm_abort_response: " + err); - } - // otherwise, it's expected - }); + mute_unhandledrejection(res.__reader.cancel()); } } @@ -123,8 +127,12 @@ export function http_wasm_get_streamed_response_bytes(res: ResponseExtension, bu // the bufferPtr is pinned by the caller const view = new Span(bufferPtr, bufferLength, MemoryViewType.Byte); return wrap_as_cancelable_promise(async () => { + if (!res.body) { + return 0; + } if (!res.__reader) { - res.__reader = res.body!.getReader(); + res.__reader = res.body.getReader(); + mute_unhandledrejection(res.__reader.closed); } if (!res.__chunk) { res.__chunk = await res.__reader.read(); diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt index b847f5c3cd68b9..46b52d84ca67f0 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -49,9 +49,14 @@ if (NOT SWIFT_COMPILER_TARGET AND CLR_CMAKE_TARGET_OSX) set(SWIFT_COMPILER_TARGET "${CMAKE_OSX_ARCHITECTURES}-apple-${SWIFT_PLATFORM}${SWIFT_DEPLOYMENT_TARGET}${SWIFT_PLATFORM_SUFFIX}") endif() +set(SWIFT_SDK_FLAG "") +if (CMAKE_OSX_SYSROOT) + set(SWIFT_SDK_FLAG -sdk ${CMAKE_OSX_SYSROOT}) +endif() + add_custom_command( OUTPUT pal_swiftbindings.o - COMMAND xcrun swiftc -emit-object -static -parse-as-library -runtime-compatibility-version none -sdk ${CMAKE_OSX_SYSROOT} -target ${SWIFT_COMPILER_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift -o pal_swiftbindings.o + COMMAND xcrun swiftc -emit-object -static -parse-as-library -runtime-compatibility-version none ${SWIFT_SDK_FLAG} -target ${SWIFT_COMPILER_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift -o pal_swiftbindings.o MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/pal_swiftbindings.swift COMMENT "Compiling Swift file pal_swiftbindings.swift" ) diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index f0b394604a7a28..691b1603df17ae 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -64,7 +64,7 @@ - + - + - - - diff --git a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj index e76730b5aeca07..860b54a2bb84c3 100644 --- a/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj +++ b/src/tasks/AotCompilerTask/MonoAOTCompiler.csproj @@ -11,11 +11,6 @@ $(NoWarn),CS8604,CS8602 true - - - - - diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj b/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj index 233333c8dcd15a..9962f0a110267c 100644 --- a/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj +++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.csproj @@ -10,9 +10,6 @@ - - - diff --git a/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj b/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj index 93aab7abedef8b..6e81ac04c70457 100644 --- a/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj +++ b/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj @@ -9,8 +9,13 @@ $(NoWarn),CS8604,CS8602 - - + + + + + + diff --git a/src/tasks/Directory.Build.targets b/src/tasks/Directory.Build.targets new file mode 100644 index 00000000000000..c0b1ec84a2a158 --- /dev/null +++ b/src/tasks/Directory.Build.targets @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tasks/LibraryBuilder/LibraryBuilder.csproj b/src/tasks/LibraryBuilder/LibraryBuilder.csproj index e0445fcddc2499..9a04948d7d39e3 100644 --- a/src/tasks/LibraryBuilder/LibraryBuilder.csproj +++ b/src/tasks/LibraryBuilder/LibraryBuilder.csproj @@ -10,9 +10,6 @@ - - - diff --git a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj index 4d329dff0242f8..1d85bdf0addbc6 100644 --- a/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj +++ b/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks.csproj @@ -19,11 +19,7 @@ - - - - - + diff --git a/src/tasks/Microsoft.NET.WebAssembly.Webcil/Microsoft.NET.WebAssembly.Webcil.csproj b/src/tasks/Microsoft.NET.WebAssembly.Webcil/Microsoft.NET.WebAssembly.Webcil.csproj index d09ae4a569a598..92d9522e1bd333 100644 --- a/src/tasks/Microsoft.NET.WebAssembly.Webcil/Microsoft.NET.WebAssembly.Webcil.csproj +++ b/src/tasks/Microsoft.NET.WebAssembly.Webcil/Microsoft.NET.WebAssembly.Webcil.csproj @@ -14,13 +14,6 @@ false - - - - - - - diff --git a/src/tasks/MobileBuildTasks/MobileBuildTasks.csproj b/src/tasks/MobileBuildTasks/MobileBuildTasks.csproj index f0f24cad0843c6..cb9f094bf1ab66 100644 --- a/src/tasks/MobileBuildTasks/MobileBuildTasks.csproj +++ b/src/tasks/MobileBuildTasks/MobileBuildTasks.csproj @@ -13,11 +13,6 @@ - - - - - diff --git a/src/tasks/MonoTargetsTasks/MonoTargetsTasks.csproj b/src/tasks/MonoTargetsTasks/MonoTargetsTasks.csproj index 21861ede492813..d192664dfd84be 100644 --- a/src/tasks/MonoTargetsTasks/MonoTargetsTasks.csproj +++ b/src/tasks/MonoTargetsTasks/MonoTargetsTasks.csproj @@ -5,21 +5,6 @@ enable $(NoWarn),CA1050,CA1850 - - - - - - - - - - - - - - - diff --git a/src/tasks/TestExclusionListTasks/TestExclusionListTasks.csproj b/src/tasks/TestExclusionListTasks/TestExclusionListTasks.csproj index 592a8652953b83..5f0f172020ecb1 100644 --- a/src/tasks/TestExclusionListTasks/TestExclusionListTasks.csproj +++ b/src/tasks/TestExclusionListTasks/TestExclusionListTasks.csproj @@ -13,9 +13,6 @@ - - - diff --git a/src/tasks/WasmAppBuilder/PInvokeCollector.cs b/src/tasks/WasmAppBuilder/PInvokeCollector.cs index 6c26c3a7be9790..e40fcd460c660d 100644 --- a/src/tasks/WasmAppBuilder/PInvokeCollector.cs +++ b/src/tasks/WasmAppBuilder/PInvokeCollector.cs @@ -167,13 +167,7 @@ static bool MethodHasCallbackAttributes(MethodInfo method) } } - public static bool IsBlittable(Type type) - { - if (type.IsPrimitive || type.IsByRef || type.IsPointer || type.IsEnum) - return true; - else - return false; - } + public static bool IsBlittable(Type type) => type.IsPrimitive || type.IsByRef || type.IsPointer || type.IsEnum; private static void Error(string msg) => throw new LogAsErrorException(msg); @@ -200,11 +194,24 @@ private static bool HasAttribute(MemberInfo element, params string[] attributeNa return false; } - private static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotNullWhen(true)] out string? reason) + public static bool IsFunctionPointer(Type type) + { + object? bIsFunctionPointer = type.GetType().GetProperty("IsFunctionPointer")?.GetValue(type); + return (bIsFunctionPointer is bool b) && b; + } + + internal static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotNullWhen(true)] out string? reason) { try { method.GetParameters(); + foreach (var p in method.GetParameters()) + { + if (IsFunctionPointer(p.ParameterType)) + { + throw new NotSupportedException("Parsing function pointer types in signatures is not supported."); + } + } } catch (NotSupportedException nse) { diff --git a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs index a1dee5649efb4d..cad52c4199ed62 100644 --- a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs @@ -13,8 +13,6 @@ internal sealed class PInvokeTableGenerator { - private readonly Dictionary _assemblyDisableRuntimeMarshallingAttributeCache = new(); - private TaskLoggingHelper Log { get; set; } private readonly Func _fixupSymbolName; private readonly HashSet signatures = new(); @@ -168,13 +166,13 @@ static bool ShouldTreatAsVariadic(PInvoke[] candidates) return false; PInvoke first = candidates[0]; - if (TryIsMethodGetParametersUnsupported(first.Method, out _)) + if (PInvokeCollector.TryIsMethodGetParametersUnsupported(first.Method, out _)) return false; int firstNumArgs = first.Method.GetParameters().Length; return candidates .Skip(1) - .Any(c => !TryIsMethodGetParametersUnsupported(c.Method, out _) && + .Any(c => !PInvokeCollector.TryIsMethodGetParametersUnsupported(c.Method, out _) && c.Method.GetParameters().Length != firstNumArgs); } } @@ -200,28 +198,6 @@ private string SymbolNameForMethod(MethodInfo method) _ => "int" }; - // FIXME: System.Reflection.MetadataLoadContext can't decode function pointer types - // https://github.com/dotnet/runtime/issues/43791 - private static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotNullWhen(true)] out string? reason) - { - try - { - method.GetParameters(); - } - catch (NotSupportedException nse) - { - reason = nse.Message; - return true; - } - catch - { - // not concerned with other exceptions - } - - reason = null; - return false; - } - private string? GenPInvokeDecl(PInvoke pinvoke) { var sb = new StringBuilder(); @@ -234,7 +210,7 @@ private static bool TryIsMethodGetParametersUnsupported(MethodInfo method, [NotN return sb.ToString(); } - if (TryIsMethodGetParametersUnsupported(pinvoke.Method, out string? reason)) + if (PInvokeCollector.TryIsMethodGetParametersUnsupported(pinvoke.Method, out string? reason)) { // Don't use method.ToString() or any of it's parameters, or return type // because at least one of those are unsupported, and will throw @@ -381,25 +357,5 @@ private void EmitNativeToInterp(StreamWriter w, List callbacks) w.WriteLine("};"); } - private bool HasAssemblyDisableRuntimeMarshallingAttribute(Assembly assembly) - { - if (!_assemblyDisableRuntimeMarshallingAttributeCache.TryGetValue(assembly, out var value)) - { - _assemblyDisableRuntimeMarshallingAttributeCache[assembly] = value = assembly - .GetCustomAttributesData() - .Any(d => d.AttributeType.Name == "DisableRuntimeMarshallingAttribute"); - } - - return value; - } - - private static bool IsBlittable(Type type) - { - if (type.IsPrimitive || type.IsByRef || type.IsPointer || type.IsEnum) - return true; - else - return false; - } - private static void Error(string msg) => throw new LogAsErrorException(msg); } diff --git a/src/tasks/WasmAppBuilder/SignatureMapper.cs b/src/tasks/WasmAppBuilder/SignatureMapper.cs index 75b51ddeb47e84..085af5703250dd 100644 --- a/src/tasks/WasmAppBuilder/SignatureMapper.cs +++ b/src/tasks/WasmAppBuilder/SignatureMapper.cs @@ -59,6 +59,10 @@ internal static class SignatureMapper foreach (var parameter in method.GetParameters()) { + if (PInvokeCollector.IsFunctionPointer(parameter.ParameterType)) + { + throw new NotSupportedException("Parsing function pointer types in signatures is not supported."); + } char? parameterChar = TypeToChar(parameter.ParameterType); if (parameterChar == null) { diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj index 34a51095986136..a664c4de72acd0 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj @@ -21,16 +21,15 @@ - - - - - - + + + + @@ -38,8 +37,6 @@ - diff --git a/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj b/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj index 32f7be8a7fa50f..b925f4f2e7aa89 100644 --- a/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj +++ b/src/tasks/WasmBuildTasks/WasmBuildTasks.csproj @@ -6,8 +6,6 @@ $(NoWarn),CA1050 - - diff --git a/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj b/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj index fbb13d8d9c4ecf..768fb6439f563d 100644 --- a/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj +++ b/src/tasks/WorkloadBuildTasks/WorkloadBuildTasks.csproj @@ -7,7 +7,5 @@ - - diff --git a/src/tasks/installer.tasks/installer.tasks.csproj b/src/tasks/installer.tasks/installer.tasks.csproj index 98c370fdfedb13..031a237ecc1860 100644 --- a/src/tasks/installer.tasks/installer.tasks.csproj +++ b/src/tasks/installer.tasks/installer.tasks.csproj @@ -6,19 +6,12 @@ - - - - - - - + + + - - - - + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.cs b/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.cs new file mode 100644 index 00000000000000..57abb965a205a6 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.cs @@ -0,0 +1,74 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; +using System.Security.Cryptography; +using System.IO; +using System.Text; +using System.Threading; +using Xunit; + +public class Runtime_108811 +{ + [MethodImpl(MethodImplOptions.AggressiveOptimization)] + [Fact] + public static int Test() + { + var hex = "3AE46205A50ED00E7612A91692552B7A"; + var key = "abcdef1234567890"; + var iv = "abcdef1234567890"; + var bytes = Convert.FromHexString(hex); + int retval = 100; + for (int i = 0; i < 200; i++) + { + var result = new Runtime_108811().Decrypt(bytes, key, iv, out _); + Console.Write($"{result} "); + if (result != 9) + { + retval = -1; + break; + } + Thread.Sleep(10); + } + Console.WriteLine(); + return retval; + } + + public int Decrypt(byte[] buffer, string key, string iv, out byte[] decryptedData) + { + int decryptedByteCount = 0; + decryptedData = new byte[buffer.Length]; + + using var aes = Aes.Create(); + aes.Mode = CipherMode.CBC; + aes.KeySize = 128; + aes.Padding = PaddingMode.Zeros; + + var instPwdArray = Encoding.ASCII.GetBytes(key); + var instSaltArray = Encoding.ASCII.GetBytes(iv); + + using (var decryptor = aes.CreateDecryptor(instPwdArray, instSaltArray)) + { + using (var memoryStream = new MemoryStream(buffer)) + { + using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read)) + { + int read; + do + { + read = cryptoStream.Read( + decryptedData, + decryptedByteCount, + decryptedData.Length - decryptedByteCount); + decryptedByteCount += read; + } while (read != 0); + } + } + } + // Found the accurate length of decrypted data + while (decryptedData[decryptedByteCount - 1] == 0 && decryptedByteCount > 0) + decryptedByteCount--; + return decryptedByteCount; + } +} \ No newline at end of file diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.csproj new file mode 100644 index 00000000000000..15edd99711a1a4 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_108811/Runtime_108811.csproj @@ -0,0 +1,8 @@ + + + True + + + + + \ No newline at end of file diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 537655fa553ce1..a5c8a27f2e41c9 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -3241,6 +3241,9 @@ Loads an assembly from file + + Requires AES + diff --git a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj index c14ed13a50d532..d018d7bcf786f9 100644 --- a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -56,14 +56,16 @@ - - - - - + + + + + + + +

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy