diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2f4ce2358e0207..3bff7a26fb1843 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "9.0.0-prerelease.24405.1", + "version": "9.0.0-prerelease.25375.3", "commands": [ "xharness" ] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2d544524862e2d..6d8489e86c472d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -113,3 +113,4 @@ /docs/area-owners.* @jeffhandley /docs/issue*.md @jeffhandley /.github/policies/ @jeffhandley @mkArtakMSFT +/.github/workflows/ @jeffhandley @dotnet/runtime-infrastructure diff --git a/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md index 9a748a085a20f1..cfd64682e8313e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md @@ -22,6 +22,7 @@ main PR -# Package authoring signed off? +# Package authoring no longer needed in .NET 9 -IMPORTANT: If this change touches code that ships in a NuGet package, please make certain that you have added any necessary [package authoring](../../docs/project/library-servicing.md) and gotten it explicitly reviewed. +IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. +Keep in mind that we still need package authoring in .NET 8 and older versions. \ No newline at end of file diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000000000..f5e7799b30e2a2 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,22 @@ +# Workflows + +General guidance: + +Please make sure to include the @dotnet/runtime-infrastructure group as a reviewer of your PRs. + +For workflows that are triggered by pull requests, refer to GitHub's documentation for the `pull_request` and `pull_request_target` events. The `pull_request_target` event is the more common use case in this repository as it runs the workflow in the context of the target branch instead of in the context of the pull request's fork or branch. However, workflows that need to consume the contents of the pull request need to use the `pull_request` event. There are security considerations with each of the events though. + +Most workflows are intended to run only in the `dotnet/runtime` repository and not in forks. To force workflow jobs to be skipped in forks, each job should apply an `if` statement that checks the repository name or owner. Either approach works, but checking only the repository owner allows the workflow to run in copies or forks withing the dotnet org. + +```yaml +jobs: + job-1: + # Do not run this job in forks + if: github.repository == 'dotnet/runtime' + + job-2: + # Do not run this job in forks outside the dotnet org + if: github.repository_owner == 'dotnet' +``` + +Refer to GitHub's [Workflows in forked repositories](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflows-in-forked-repositories) and [pull_request_target](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target) documentation for more information. diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index f8165363070ea5..67ddf782dc0d14 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -48,4 +48,7 @@ jobs: - The PR target branch is `release/X.0-staging`, not `release/X.0`. - - If the change touches code that ships in a NuGet package, you have added the necessary [package authoring](https://github.com/dotnet/runtime/blob/main/docs/project/library-servicing.md) and gotten it explicitly reviewed. + ## Package authoring no longer needed in .NET 9 + + **IMPORTANT**: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version. + Keep in mind that we still need package authoring in .NET 8 and older versions. \ No newline at end of file diff --git a/.github/workflows/check-no-merge-label.yml b/.github/workflows/check-no-merge-label.yml new file mode 100644 index 00000000000000..a0bb075db84312 --- /dev/null +++ b/.github/workflows/check-no-merge-label.yml @@ -0,0 +1,25 @@ +name: check-no-merge-label + +permissions: + pull-requests: read + +on: + pull_request_target: + types: [opened, edited, reopened, labeled, unlabeled, synchronize] + branches: + - 'release/**' + +jobs: + check-labels: + if: github.repository == 'dotnet/runtime' + runs-on: ubuntu-latest + steps: + - name: Check 'NO-MERGE' label + run: | + echo "Merging permission is disabled when the 'NO-MERGE' label is applied." + if [ "${{ contains(github.event.pull_request.labels.*.name, 'NO-MERGE') }}" = "false" ]; then + exit 0 + else + echo "::error:: The 'NO-MERGE' label was applied to the PR. Merging is disabled." + exit 1 + fi diff --git a/.github/workflows/check-service-labels.yml b/.github/workflows/check-service-labels.yml index 5261cc165ee128..f2e800feea5bcf 100644 --- a/.github/workflows/check-service-labels.yml +++ b/.github/workflows/check-service-labels.yml @@ -4,18 +4,19 @@ permissions: pull-requests: read on: - pull_request: + pull_request_target: types: [opened, edited, reopened, labeled, unlabeled, synchronize] branches: - 'release/**' jobs: check-labels: + if: github.repository == 'dotnet/runtime' runs-on: ubuntu-latest steps: - name: Check 'Servicing-approved' label run: | - echo "Merging permission is enabled for servicing PRs when the `Servicing-approved` label is applied." + echo "Merging permission is enabled for servicing PRs when the 'Servicing-approved' label is applied." if [ "${{ contains(github.event.pull_request.labels.*.name, 'Servicing-approved') }}" = "true" ]; then exit 0 else diff --git a/.github/workflows/jit-format.yml b/.github/workflows/jit-format.yml index be0a5d854a9caa..18fb209c628afc 100644 --- a/.github/workflows/jit-format.yml +++ b/.github/workflows/jit-format.yml @@ -15,7 +15,7 @@ jobs: os: - name: linux image: ubuntu-latest - container: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-net9.0 + container: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64 extension: '.sh' cross: '--cross' rootfs: '/crossrootfs/x64' diff --git a/Directory.Build.props b/Directory.Build.props index 688fcaec63b4f6..530286a2719d7e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -121,9 +121,8 @@ - - 8.0.0 - net8.0 + 9.0.0 + net9.0 diff --git a/NuGet.config b/NuGet.config index c35709acd8020a..52627ab5e8c7a3 100644 --- a/NuGet.config +++ b/NuGet.config @@ -9,8 +9,13 @@ - + + + + + + - + https://github.com/dotnet/cecil - e51bd3677d5674fa34bf5676c5fc5562206bf94e + 788a8a7481c01a7d235110cdea2ca5bfb34210d4 - + https://github.com/dotnet/emsdk - 763d10a1a251be35337ee736832bfde3f9200672 + dc8e3478c4aa5f6a103329333c2bdbcd07a07741 - + https://github.com/dotnet/emsdk - 763d10a1a251be35337ee736832bfde3f9200672 + dc8e3478c4aa5f6a103329333c2bdbcd07a07741 - + https://github.com/dotnet/emsdk - 763d10a1a251be35337ee736832bfde3f9200672 + dc8e3478c4aa5f6a103329333c2bdbcd07a07741 - + https://github.com/dotnet/source-build-reference-packages - c43ee853e96528e2f2eb0f6d8c151ddc07b6a844 + 9859d82ffce48f49b5e93fa46a38bdddc4ba26be - + https://github.com/dotnet/source-build-externals - 4df883d781a4290873b3b968afc0ff0df7132507 + ab469606a3e6b026dcac301e2dab96117c94faeb - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 - + https://github.com/dotnet/llvm-project - 966011b3b666d1bf58d86666add23a9d401ee26a + 5ad97991b0fc050c73bc3d49d425b1a0fbb8d8d2 https://github.com/dotnet/runtime @@ -320,21 +320,21 @@ https://github.com/dotnet/runtime b030c4dfdfa1bf287f10f96006619a06bc2000ae - + https://github.com/dotnet/xharness - 9794254fa909ff5adc46326e9b54009793f61dcd + 604c13925074041a51e4533959477c8b6888dcf5 - + https://github.com/dotnet/xharness - 9794254fa909ff5adc46326e9b54009793f61dcd + 604c13925074041a51e4533959477c8b6888dcf5 - + https://github.com/dotnet/xharness - 9794254fa909ff5adc46326e9b54009793f61dcd + 604c13925074041a51e4533959477c8b6888dcf5 - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -352,48 +352,48 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-optimization 9d7532585ce71e30ab55f0364d3cecccaf0775d1 - + https://github.com/dotnet/hotreload-utils - bf7e87a8574449a441bf905e2acd38e4aa25b3d4 + 3eb23e965fcc8cf3f6bec6e3e2543a81e52b6d20 - + https://github.com/dotnet/runtime-assets - e98370e661a19bdfed31eefb8740ecfad255f9ed + c77fd5058ea46e9d0b58f5c11b6808d6170e4e32 - + https://github.com/dotnet/roslyn - 3bff3622487486dec7794dfd0c71e05a52c313a4 + 5f78534e8ac55b615a3540e7c1ffedee9ced6e1e - + https://github.com/dotnet/roslyn - 3bff3622487486dec7794dfd0c71e05a52c313a4 + 5f78534e8ac55b615a3540e7c1ffedee9ced6e1e - + https://github.com/dotnet/roslyn - 3bff3622487486dec7794dfd0c71e05a52c313a4 + 5f78534e8ac55b615a3540e7c1ffedee9ced6e1e - + https://github.com/dotnet/roslyn-analyzers - 3d61c57c73c3dd5f1f407ef9cd3414d94bf0eaf2 + 16865ea61910500f1022ad2b96c499e5df02c228 - + https://github.com/dotnet/roslyn-analyzers - 3d61c57c73c3dd5f1f407ef9cd3414d94bf0eaf2 + 16865ea61910500f1022ad2b96c499e5df02c228 - + https://github.com/dotnet/roslyn - 3bff3622487486dec7794dfd0c71e05a52c313a4 + 5f78534e8ac55b615a3540e7c1ffedee9ced6e1e - + https://github.com/dotnet/sdk - 5b9d9d4677ea31d954533e9de2f95a3ea638135d + 8128984181a05a7dc0de748ad3371e0a7f153f35 - + https://github.com/dotnet/sdk - 5b9d9d4677ea31d954533e9de2f95a3ea638135d + 8128984181a05a7dc0de748ad3371e0a7f153f35 diff --git a/eng/Versions.props b/eng/Versions.props index 24c0c9e1048042..64002194d43947 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -1,16 +1,16 @@ - 9.0.0 + 9.0.9 9 0 - 0 + 9 9.0.100 - 8.0.11 + 8.0.$([MSBuild]::Add($(PatchVersion),11)) 7.0.20 6.0.36 - rtm + servicing @@ -36,17 +36,17 @@ - 3.11.0-beta1.24508.2 - 9.0.0-preview.24508.2 + 3.11.0-beta1.25173.3 + 9.0.0-preview.25173.3 - 4.12.0-3.24516.15 - 4.12.0-3.24516.15 - 4.12.0-3.24516.15 + 4.12.0-3.25377.4 + 4.12.0-3.25377.4 + 4.12.0-3.25377.4 - 9.0.100-rtm.24512.1 + 9.0.109 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 2.9.0-beta.24516.2 - 9.0.0-beta.24516.2 - 2.9.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 - 9.0.0-beta.24516.2 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 2.9.0-beta.25366.1 + 9.0.0-beta.25366.1 + 2.9.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 + 9.0.0-beta.25366.1 1.4.0 @@ -141,20 +141,20 @@ 8.0.0 8.0.0 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 - 9.0.0-beta.24459.2 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 + 9.0.0-beta.25313.1 1.0.0-prerelease.24462.2 1.0.0-prerelease.24462.2 @@ -164,7 +164,7 @@ 1.0.0-prerelease.24462.2 2.0.0 - 17.10.0-beta1.24272.1 + 17.12.0-beta1.24603.5 2.0.0-beta4.24324.3 3.1.7 2.1.0 @@ -184,10 +184,10 @@ 1.4.0 17.4.0-preview-20220707-01 - 9.0.0-prerelease.24405.1 - 9.0.0-prerelease.24405.1 - 9.0.0-prerelease.24405.1 - 9.0.0-alpha.0.24514.3 + 9.0.0-prerelease.25375.3 + 9.0.0-prerelease.25375.3 + 9.0.0-prerelease.25375.3 + 9.0.0-alpha.0.25330.3 3.12.0 4.5.0 6.0.0 @@ -215,54 +215,55 @@ 9.0.0-preview-20241010.1 - 0.11.5-alpha.24515.1 + 0.11.5-alpha.25370.2 9.0.0-rtm.24511.16 - 9.0.0-rtm.24516.3 + 9.0.0-rtm.25371.1 9.0.0-rtm.24466.4 - 2.4.3 + 2.4.8 9.0.0-alpha.1.24167.3 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 - 9.0.0-rtm.24528.2 - 9.0.0 + 9.0.9-servicing.25418.4 + 9.0.9 $(MicrosoftNETWorkloadEmscriptenCurrentManifest90100Version) 1.1.87-gba258badda 1.0.0-v3.14.0.5722 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 - 19.1.0-alpha.1.24519.2 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 + 19.1.0-alpha.1.25414.3 3.1.7 1.0.406601 - $(MicrosoftDotNetApiCompatTaskVersion) + + 9.0.107 9.0.0-alpha.1.24175.1 $(MicrosoftNETRuntimeEmscriptenVersion) $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index ba53ebfbd51334..abe80a2a0e09c9 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -134,6 +134,10 @@ jobs: signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea + ${{ else }}: + ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca env: TeamName: $(_TeamName) MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml index c4713c8b6ede8a..d47f09d58fd9a8 100644 --- a/eng/common/core-templates/job/source-build.yml +++ b/eng/common/core-templates/job/source-build.yml @@ -26,6 +26,8 @@ parameters: # Specifies the build script to invoke to perform the build in the repo. The default # './build.sh' should work for typical Arcade repositories, but this is customizable for # difficult situations. + # buildArguments: '' + # Specifies additional build arguments to pass to the build script. # jobProperties: {} # A list of job properties to inject at the top level, for potential extensibility beyond # container and pool. diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 205fb5b3a39563..8b833332b3ee96 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -1,7 +1,7 @@ parameters: runAsPublic: false - sourceIndexUploadPackageVersion: 2.0.0-20240522.1 - sourceIndexProcessBinlogPackageVersion: 1.0.1-20240522.1 + sourceIndexUploadPackageVersion: 2.0.0-20250425.2 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20250425.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 454fd75c7aff19..a8c0bd3b9214e5 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -44,6 +44,11 @@ parameters: displayName: Publish installers and checksums type: boolean default: true + + - name: requireDefaultChannels + displayName: Fail the build if there are no default channel(s) registrations for the current build + type: boolean + default: false - name: SDLValidationParameters type: object @@ -312,5 +317,6 @@ stages: -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true + -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/steps/generate-sbom.yml b/eng/common/core-templates/steps/generate-sbom.yml index d938b60e1bb534..56a090094824f4 100644 --- a/eng/common/core-templates/steps/generate-sbom.yml +++ b/eng/common/core-templates/steps/generate-sbom.yml @@ -38,7 +38,7 @@ steps: PackageName: ${{ parameters.packageName }} BuildDropPath: ${{ parameters.buildDropPath }} PackageVersion: ${{ parameters.packageVersion }} - ManifestDirPath: ${{ parameters.manifestDirPath }} + ManifestDirPath: ${{ parameters.manifestDirPath }}/$(ARTIFACT_NAME) ${{ if ne(parameters.IgnoreDirectories, '') }}: AdditionalComponentDetectorArgs: '--IgnoreDirectories ${{ parameters.IgnoreDirectories }}' diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index 2915d29bb7f6e6..37133b55b7541b 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -79,6 +79,7 @@ steps: ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ --restore --build --pack $publishArgs -bl \ + ${{ parameters.platform.buildArguments }} \ $officialBuildArgs \ $internalRuntimeDownloadArgs \ $internalRestoreArgs \ diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index 9a4e285a5ae3f0..9a7ecfbd42c5f3 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -40,7 +40,7 @@ if(TARGET_ARCH_NAME STREQUAL "arm") set(TOOLCHAIN "arm-linux-gnueabihf") endif() if(TIZEN) - set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf/9.2.0") + set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf") endif() elseif(TARGET_ARCH_NAME STREQUAL "arm64") set(CMAKE_SYSTEM_PROCESSOR aarch64) @@ -49,7 +49,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64") elseif(LINUX) set(TOOLCHAIN "aarch64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu") endif() elseif(FREEBSD) set(triple "aarch64-unknown-freebsd12") @@ -58,7 +58,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "armel") set(CMAKE_SYSTEM_PROCESSOR armv7l) set(TOOLCHAIN "arm-linux-gnueabi") if(TIZEN) - set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/9.2.0") + set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi") endif() elseif(TARGET_ARCH_NAME STREQUAL "armv6") set(CMAKE_SYSTEM_PROCESSOR armv6l) @@ -81,7 +81,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "riscv64") else() set(TOOLCHAIN "riscv64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu/13.1.0") + set(TIZEN_TOOLCHAIN "riscv64-tizen-linux-gnu") endif() endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") @@ -98,7 +98,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64") elseif(LINUX) set(TOOLCHAIN "x86_64-linux-gnu") if(TIZEN) - set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu") endif() elseif(FREEBSD) set(triple "x86_64-unknown-freebsd12") @@ -115,7 +115,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") set(TOOLCHAIN "i686-linux-gnu") endif() if(TIZEN) - set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu/9.2.0") + set(TIZEN_TOOLCHAIN "i586-tizen-linux-gnu") endif() else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm, arm64, armel, armv6, ppc64le, riscv64, s390x, x64 and x86 are supported!") @@ -127,30 +127,25 @@ endif() # Specify include paths if(TIZEN) - if(TARGET_ARCH_NAME STREQUAL "arm") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7hl-tizen-linux-gnueabihf) - endif() - if(TARGET_ARCH_NAME STREQUAL "armel") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi) - endif() - if(TARGET_ARCH_NAME STREQUAL "arm64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/aarch64-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "x86") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/i586-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "x64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/x86_64-tizen-linux-gnu) - endif() - if(TARGET_ARCH_NAME STREQUAL "riscv64") - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/) - include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}/include/c++/riscv64-tizen-linux-gnu) + function(find_toolchain_dir prefix) + # Dynamically find the version subdirectory + file(GLOB DIRECTORIES "${prefix}/*") + list(GET DIRECTORIES 0 FIRST_MATCH) + get_filename_component(TOOLCHAIN_VERSION ${FIRST_MATCH} NAME) + + set(TIZEN_TOOLCHAIN_PATH "${prefix}/${TOOLCHAIN_VERSION}" PARENT_SCOPE) + endfunction() + + if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$") + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + else() + find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") endif() + + message(STATUS "TIZEN_TOOLCHAIN_PATH set to: ${TIZEN_TOOLCHAIN_PATH}") + + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++) + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN}) endif() if(ANDROID) @@ -272,21 +267,21 @@ endif() if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$") if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") endif() elseif(TARGET_ARCH_NAME MATCHES "^(arm64|x64|riscv64)$") if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib64") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib64") add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64") - add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-Wl,--rpath-link=${TIZEN_TOOLCHAIN_PATH}") endif() elseif(TARGET_ARCH_NAME STREQUAL "s390x") add_toolchain_linker_flag("--target=${TOOLCHAIN}") @@ -297,10 +292,10 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86") endif() add_toolchain_linker_flag(-m32) if(TIZEN) - add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-B${TIZEN_TOOLCHAIN_PATH}") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib") add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib") - add_toolchain_linker_flag("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}") + add_toolchain_linker_flag("-L${TIZEN_TOOLCHAIN_PATH}") endif() elseif(ILLUMOS) add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib/amd64") diff --git a/eng/common/generate-sbom-prep.ps1 b/eng/common/generate-sbom-prep.ps1 index 3e5c1c74a1c50d..a0c7d792a76fbe 100644 --- a/eng/common/generate-sbom-prep.ps1 +++ b/eng/common/generate-sbom-prep.ps1 @@ -4,18 +4,26 @@ Param( . $PSScriptRoot\pipeline-logging-functions.ps1 +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +$ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" +$SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' +$SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName + +Write-Host "Artifact name before : $ArtifactName" +Write-Host "Artifact name after : $SafeArtifactName" + Write-Host "Creating dir $ManifestDirPath" + # create directory for sbom manifest to be placed -if (!(Test-Path -path $ManifestDirPath)) +if (!(Test-Path -path $SbomGenerationDir)) { - New-Item -ItemType Directory -path $ManifestDirPath - Write-Host "Successfully created directory $ManifestDirPath" + New-Item -ItemType Directory -path $SbomGenerationDir + Write-Host "Successfully created directory $SbomGenerationDir" } else{ Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." } Write-Host "Updating artifact name" -$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_' -Write-Host "Artifact name $artifact_name" -Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name" +Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" diff --git a/eng/common/generate-sbom-prep.sh b/eng/common/generate-sbom-prep.sh index d5c76dc827b496..b8ecca72bbf506 100644 --- a/eng/common/generate-sbom-prep.sh +++ b/eng/common/generate-sbom-prep.sh @@ -14,19 +14,24 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" . $scriptroot/pipeline-logging-functions.sh + +# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. +artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" +safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" manifest_dir=$1 -if [ ! -d "$manifest_dir" ] ; then - mkdir -p "$manifest_dir" - echo "Sbom directory created." $manifest_dir +# Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly +# with their own overwriting ours. So we create it as a sub directory of the requested manifest path. +sbom_generation_dir="$manifest_dir/$safe_artifact_name" + +if [ ! -d "$sbom_generation_dir" ] ; then + mkdir -p "$sbom_generation_dir" + echo "Sbom directory created." $sbom_generation_dir else Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." fi -artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" echo "Artifact name before : "$artifact_name -# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. -safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" echo "Artifact name after : "$safe_artifact_name export ARTIFACT_NAME=$safe_artifact_name echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config index 19d3d311b166f5..f70261ed689bce 100644 --- a/eng/common/internal/NuGet.config +++ b/eng/common/internal/NuGet.config @@ -4,4 +4,7 @@ + + + diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index 32f79dfb3402c0..feaa6d20812d8f 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -15,16 +15,6 @@ - - - - https://devdiv.pkgs.visualstudio.com/_packaging/dotnet-core-internal-tooling/nuget/v3/index.json; - - - $(RestoreSources); - https://devdiv.pkgs.visualstudio.com/_packaging/VS/nuget/v3/index.json; - - diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 90b58e32a87bfb..a261517ef90679 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -5,7 +5,8 @@ param( [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, - [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters + [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $RequireDefaultChannels ) try { @@ -33,6 +34,10 @@ try { if ("false" -eq $WaitPublishingFinish) { $optionalParams.Add("--no-wait") | Out-Null } + + if ("true" -eq $RequireDefaultChannels) { + $optionalParams.Add("--default-channels-required") | Out-Null + } & $darc add-build-to-channel ` --id $buildId ` diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index aab40de3fd9aca..4f0546dce1208d 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -64,7 +64,7 @@ try { $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty } if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.10.0-pre.4.0" -MemberType NoteProperty + $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.12.0" -MemberType NoteProperty } if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md index 5ef6c30ba92465..98bbc1ded0ba88 100644 --- a/eng/common/template-guidance.md +++ b/eng/common/template-guidance.md @@ -57,7 +57,7 @@ extends: Note: Multiple outputs are ONLY applicable to 1ES PT publishing (only usable when referencing `templates-official`). -# Development notes +## Development notes **Folder / file structure** diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 605692d2fb770c..817555505aa602 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -16,6 +16,7 @@ jobs: parameters: PackageVersion: ${{ parameters.packageVersion }} BuildDropPath: ${{ parameters.buildDropPath }} + ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom publishArtifacts: false # publish artifacts diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 22954477a5747f..9b3ad8840fdb28 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -42,7 +42,7 @@ [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1 +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 [string]$dotnetInstallScriptVersion = if (Test-Path variable:dotnetInstallScriptVersion) { $dotnetInstallScriptVersion } else { 'v1' } # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + $uri = "https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" Retry({ Write-Host "GET $uri" @@ -320,7 +320,7 @@ function InstallDotNet([string] $dotnetRoot, $variations += @($installParameters) $dotnetBuilds = $installParameters.Clone() - $dotnetbuilds.AzureFeed = "https://dotnetbuilds.azureedge.net/public" + $dotnetbuilds.AzureFeed = "https://ci.dot.net/public" $variations += @($dotnetBuilds) if ($runtimeSourceFeed) { @@ -383,8 +383,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # If the version of msbuild is going to be xcopied, # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/17.10.0-pre.4.0 - $defaultXCopyMSBuildVersion = '17.10.0-pre.4.0' + # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/17.12.0 + $defaultXCopyMSBuildVersion = '17.12.0' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { @@ -416,7 +416,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = # Locate Visual Studio installation or download x-copy msbuild. $vsInfo = LocateVisualStudio $vsRequirements - if ($vsInfo -ne $null) { + if ($vsInfo -ne $null -and $env:ForceUseXCopyMSBuild -eq $null) { # Ensure vsInstallDir has a trailing slash $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 00473c9f918d47..01b09b65796c17 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -54,7 +54,7 @@ warn_as_error=${warn_as_error:-true} use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} # Enable repos to use a particular version of the on-line dotnet-install scripts. -# default URL: https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh +# default URL: https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh dotnetInstallScriptVersion=${dotnetInstallScriptVersion:-'v1'} # True to use global NuGet cache instead of restoring packages to repository-local directory. @@ -232,7 +232,7 @@ function InstallDotNet { local public_location=("${installParameters[@]}") variations+=(public_location) - local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public") + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://ci.dot.net/public") variations+=(dotnetbuilds) if [[ -n "${6:-}" ]]; then @@ -295,7 +295,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local install_script_url="https://builds.dotnet.microsoft.com/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/eng/install-native-dependencies.sh b/eng/install-native-dependencies.sh index 41895e0b9254c8..f8c9db632860de 100755 --- a/eng/install-native-dependencies.sh +++ b/eng/install-native-dependencies.sh @@ -44,7 +44,7 @@ case "$os" in export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Skip brew update for now, see https://github.com/actions/setup-python/issues/577 # brew update --preinstall - brew bundle --no-upgrade --no-lock --file "$(dirname "$0")/Brewfile" + brew bundle --no-upgrade --file "$(dirname "$0")/Brewfile" ;; *) diff --git a/eng/packaging.targets b/eng/packaging.targets index 99912459fe02c1..a14c954df54dbc 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -27,8 +27,6 @@ PACKAGE.md $(BeforePack);ValidatePackageReadmeExists - - false true - - true false @@ -58,18 +48,6 @@ $(NoWarn);CP0003 - - - 0 - - - $(MajorVersion).$(MinorVersion).$(ServicingVersion) - $(Version)-$(VersionSuffix) - - @@ -155,7 +133,7 @@ - <_RuntimeSymbolPath Include="$(RuntimeSymbolPath)" /> + <_RuntimeSymbolPath Include="@(TfmRuntimeSpecificPackageFile->'%(RootDir)%(Directory)%(FileName).pdb')" Condition="'%(TfmRuntimeSpecificPackageFile.Extension)' == '.dll'" KeepMetadata="None" /> - - - - diff --git a/eng/pipelines/common/macos-sign-with-entitlements.yml b/eng/pipelines/common/macos-sign-with-entitlements.yml index 72a03b90f340d6..6a20a31481eb9d 100644 --- a/eng/pipelines/common/macos-sign-with-entitlements.yml +++ b/eng/pipelines/common/macos-sign-with-entitlements.yml @@ -30,12 +30,13 @@ steps: - task: EsrpCodeSigning@5 displayName: 'ESRP CodeSigning' inputs: - ConnectedServiceName: 'DotNet-Engineering-Services_KeyVault' - AppRegistrationClientId: '28ec6507-2167-4eaa-a294-34408cf5dd0e' - AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47' - AuthAKVName: 'EngKeyVault' - AuthCertName: 'DotNetCore-ESRP-AuthCert' - AuthSignCertName: 'DotNetCore-ESRP-AuthSignCert' + ConnectedServiceName: 'DotNetBuildESRP' + UseMSIAuthentication: true + EsrpClientId: '28ec6507-2167-4eaa-a294-34408cf5dd0e' + AppRegistrationClientId: '0ecbcdb7-8451-4cbe-940a-4ed97b08b955' + AppRegistrationTenantId: '975f013f-7f24-47e8-a7d3-abc4752bf346' + AuthAKVName: 'DotNetEngKeyVault' + AuthSignCertName: 'DotNet-ESRP-AuthSignCert' FolderPath: '$(Build.ArtifactStagingDirectory)/' Pattern: 'mac_entitled_to_sign.zip' UseMinimatch: true diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml index cf2b9f53e528b5..b99d425f52b58f 100644 --- a/eng/pipelines/common/templates/pipeline-with-resources.yml +++ b/eng/pipelines/common/templates/pipeline-with-resources.yml @@ -17,54 +17,49 @@ extends: containers: linux_arm: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm env: ROOTFS_DIR: /crossrootfs/arm - linux_armv6: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-cross-armv6-raspbian-10 - env: - ROOTFS_DIR: /crossrootfs/armv6 - linux_arm64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm64 env: ROOTFS_DIR: /crossrootfs/arm64 linux_musl_x64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-alpine-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64-alpine env: ROOTFS_DIR: /crossrootfs/x64 linux_musl_arm: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-alpine-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm-alpine env: ROOTFS_DIR: /crossrootfs/arm linux_musl_arm64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm64-alpine-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-arm64-alpine env: ROOTFS_DIR: /crossrootfs/arm64 # This container contains all required toolsets to build for Android and for Linux with bionic libc. android: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-android-amd64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-android-amd64 # This container contains all required toolsets to build for Android and for Linux with bionic libc and a special layout of OpenSSL. linux_bionic: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-android-openssl-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-android-openssl # This container contains all required toolsets to build for Android as well as tooling to build docker images. android_docker: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-android-docker-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-android-docker linux_x64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64 env: ROOTFS_DIR: /crossrootfs/x64 linux_x86: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-x86-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-x86 env: ROOTFS_DIR: /crossrootfs/x86 @@ -72,33 +67,32 @@ extends: image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04 linux_musl_x64_dev_innerloop: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-WithNode + image: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.21-amd64 linux_x64_sanitizer: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-amd64-net9.0-sanitizer + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64-sanitizer env: ROOTFS_DIR: /crossrootfs/x64 - # We use a CentOS Stream 8 image here to test building from source on CentOS Stream 8. + # We use a CentOS Stream image here to test building from source on CentOS Stream SourceBuild_centos_x64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8 - + image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9 # AlmaLinux 8 is a RHEL 8 rebuild, so we use it to test building from source on RHEL 8. SourceBuild_linux_x64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-source-build + image: mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-9-source-build-amd64 linux_s390x: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-s390x-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-s390x env: ROOTFS_DIR: /crossrootfs/s390x linux_ppc64le: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-ppc64le-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-ppc64le env: ROOTFS_DIR: /crossrootfs/ppc64le linux_riscv64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-riscv64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-riscv64 env: ROOTFS_DIR: /crossrootfs/riscv64 @@ -106,20 +100,20 @@ extends: image: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-gcc14-amd64 linux_x64_llvmaot: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9 browser_wasm: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-webassembly-amd64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-webassembly-amd64 env: ROOTFS_DIR: /crossrootfs/x64 wasi_wasm: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-webassembly-amd64-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-webassembly-amd64 env: ROOTFS_DIR: /crossrootfs/x64 freebsd_x64: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-freebsd-13-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-freebsd-13 env: ROOTFS_DIR: /crossrootfs/x64 @@ -132,4 +126,4 @@ extends: image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-debpkg rpmpkg: - image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-fpm-net9.0 + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-fpm diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index f50a2db9e81ec5..39676f8fd9b292 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -170,12 +170,12 @@ jobs: # OSX Public Build Pool (we don't have on-prem OSX BuildPool). ${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), eq(variables['System.TeamProject'], 'public')) }}: - vmImage: 'macos-12' + vmImage: 'macos-13' # OSX Internal Pool ${{ if and(in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator'), ne(variables['System.TeamProject'], 'public')) }}: name: "Azure Pipelines" - vmImage: 'macOS-12' + vmImage: 'macOS-13' os: macOS # Official Build Windows Pool diff --git a/eng/pipelines/coreclr/perf-non-wasm-jobs.yml b/eng/pipelines/coreclr/perf-non-wasm-jobs.yml index df9c99e5297d63..78b035fa0228ea 100644 --- a/eng/pipelines/coreclr/perf-non-wasm-jobs.yml +++ b/eng/pipelines/coreclr/perf-non-wasm-jobs.yml @@ -374,7 +374,7 @@ jobs: nameSuffix: PerfBDNApp isOfficialBuild: false pool: - vmImage: 'macos-12' + vmImage: 'macos-13' postBuildSteps: - template: /eng/pipelines/coreclr/templates/build-perf-bdn-app.yml parameters: diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml index a9dae35f177eb4..4d05678f0b7293 100644 --- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml +++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml @@ -34,11 +34,11 @@ jobs: # iOS Simulator/Mac Catalyst arm64 - ${{ if in(parameters.platform, 'maccatalyst_arm64', 'iossimulator_arm64') }}: - - OSX.1200.Arm64.Open + - OSX.14.Arm64.Open # iOS/tvOS Simulator x64 & MacCatalyst x64 - ${{ if in(parameters.platform, 'iossimulator_x64', 'tvossimulator_x64', 'maccatalyst_x64') }}: - - OSX.1200.Amd64.Open + - OSX.15.Amd64.Open # Android arm64 - ${{ if in(parameters.platform, 'android_arm64') }}: @@ -63,44 +63,44 @@ jobs: # Linux arm - ${{ if eq(parameters.platform, 'linux_arm') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Debian.12.Arm32.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 + - (Debian.12.Arm32.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Debian.12.Arm32)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 + - (Debian.12.Arm32)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 # Linux arm64 - ${{ if eq(parameters.platform, 'linux_arm64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Ubuntu.2004.Arm64.Open)Ubuntu.2004.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-helix-arm64v8 + - (Ubuntu.2204.Arm64.Open)Ubuntu.2204.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Ubuntu.2004.Arm64)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20.04-helix-arm64v8 + - (Ubuntu.2204.Arm64)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 # Linux musl x64 - ${{ if eq(parameters.platform, 'linux_musl_x64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.317.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64 + - (Alpine.322.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-amd64 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.317.Amd64)Ubuntu.2204.Amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64 + - (Alpine.322.Amd64)AzureLinux.3.Amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-amd64 # Linux musl arm32 - ${{ if eq(parameters.platform, 'linux_musl_arm') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.316.Arm32.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm32v7 + - (Alpine.322.Arm32.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-arm32v7 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.316.Arm32)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm32v7 + - (Alpine.322.Arm32)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-arm32v7 # Linux musl arm64 - ${{ if eq(parameters.platform, 'linux_musl_arm64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - (Alpine.317.Arm64.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8 + - (Alpine.322.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-arm64v8 - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - (Alpine.317.Arm64)Ubuntu.2004.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8 + - (Alpine.322.Arm64)Ubuntu.2204.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-arm64v8 # Linux x64 - ${{ if eq(parameters.platform, 'linux_x64') }}: - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - Ubuntu.2204.Amd64.Open + - AzureLinux.3.Amd64.Open - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - - Ubuntu.2204.Amd64 + - AzureLinux.3.Amd64 # OSX arm64 - ${{ if eq(parameters.platform, 'osx_arm64') }}: diff --git a/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml b/eng/pipelines/coreclr/templates/sign-diagnostic-files.yml index 2e6ec556150b8f..64c8ff12e4cb2d 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 @@ -69,7 +69,7 @@ steps: } if ($signingCert.Subject -ne "CN=.NET DAC, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" ` - -or $signingCert.Issuer -ne "CN=Microsoft Code Signing PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US") + -or $signingCert.Issuer -ne "CN=Microsoft Windows Code Signing PCA 2024, O=Microsoft Corporation, C=US") { throw "File $file not in expected trust chain." } diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml index 9794c736e2e823..0e83d79eb382d8 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml @@ -37,10 +37,9 @@ jobs: isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} # Don't trim tests on rolling builds ${{ if eq(variables['isRollingBuild'], true) }}: - buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=false + buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=false ${{ else }}: - # Tracking issue: https://github.com/dotnet/runtime/issues/82637 - buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=false + buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true /p:EnableAggressiveTrimming=true timeoutInMinutes: 480 # extra steps, run tests postBuildSteps: diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml index 7ce0a0c3568aac..75ad650c119d74 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml @@ -25,9 +25,7 @@ jobs: platforms: - iossimulator_x64 - tvossimulator_x64 - # don't run tests on arm64 PRs until we can get significantly more devices - - ${{ if eq(variables['isRollingBuild'], true) }}: - - iossimulator_arm64 + - iossimulator_arm64 variables: # map dependencies variables to local variables - name: librariesContainsChange @@ -61,9 +59,7 @@ jobs: platforms: - iossimulator_x64 - tvossimulator_x64 - # don't run tests on arm64 PRs until we can get significantly more devices - - ${{ if eq(variables['isRollingBuild'], true) }}: - - iossimulator_arm64 + - iossimulator_arm64 variables: - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: - name: _HelixSource @@ -109,9 +105,7 @@ jobs: platforms: - iossimulator_x64 - tvossimulator_x64 - # don't run tests on arm64 PRs until we can get significantly more devices - - ${{ if eq(variables['isRollingBuild'], true) }}: - - iossimulator_arm64 + - iossimulator_arm64 variables: - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: - name: _HelixSource diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 5b660a70bf7680..cb8447877b09d4 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -26,65 +26,50 @@ jobs: # Linux arm - ${{ if eq(parameters.platform, 'linux_arm') }}: - ${{ if or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Debian.12.Arm32.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 - - # Linux armv6 - - ${{ if eq(parameters.platform, 'linux_armv6') }}: - - (Raspbian.10.Armv6.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:raspbian-10-helix-arm32v6 - + - (Debian.12.Arm32.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm32v7 # Linux arm64 - ${{ if eq(parameters.platform, 'linux_arm64') }}: - - (Ubuntu.2204.Arm64.Open)Ubuntu.2004.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 + - ${{ if or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: + - (Ubuntu.2204.ArmArch.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-arm64v8 - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Debian.11.Arm64.Open)Ubuntu.2004.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm64v8 + - (AzureLinux.3.0.ArmArch.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-helix-arm64v8 # Linux musl x64 - ${{ if eq(parameters.platform, 'linux_musl_x64') }}: - - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Alpine.317.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-amd64 - - ${{ if or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Alpine.320.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.20-helix-amd64 - - (Alpine.318.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.18-helix-amd64 + - (Alpine.322.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-amd64 # Linux musl arm64 - - ${{ if and(eq(parameters.platform, 'linux_musl_arm64'), or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true))) }}: - - (Alpine.320.Arm64.Open)ubuntu.2004.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.20-helix-arm64v8 - - (Alpine.318.Arm64.Open)ubuntu.2004.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.18-helix-arm64v8 - - (Alpine.317.Arm64.Open)ubuntu.2004.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.17-helix-arm64v8 + - ${{ if eq(parameters.platform, 'linux_musl_arm64') }}: + - ${{ if or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: + - (Alpine.322.Arm64.Open)Ubuntu.2204.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.22-helix-arm64v8 + # Linux x64 - ${{ if eq(parameters.platform, 'linux_x64') }}: - - ${{ if and(eq(parameters.jobParameters.interpreter, ''), ne(parameters.jobParameters.isSingleFile, true)) }}: - - ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - - SLES.15.Amd64.Open - - (Centos.8.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-helix - - (Fedora.38.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-38-helix - - (Ubuntu.2204.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-amd64 - - (Debian.11.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - - ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - - ${{ if or(eq(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - SLES.15.Amd64.Open - - (Fedora.38.Amd64.Open)ubuntu.2204.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-38-helix - - Ubuntu.2204.Amd64.Open - - (Debian.11.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - - (Mariner.2.0.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64 - - (AzureLinux.3.0.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-helix-amd64 - - (openSUSE.15.2.Amd64.Open)Ubuntu.2204.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64 - - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Centos.8.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-helix - - (Debian.11.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - - Ubuntu.2204.Amd64.Open - ${{ if or(eq(parameters.jobParameters.interpreter, 'true'), eq(parameters.jobParameters.isSingleFile, true)) }}: # Limiting interp runs as we don't need as much coverage. - - (Debian.11.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64 - - # Linux s390x - - ${{ if eq(parameters.platform, 'linux_s390x') }}: - - Ubuntu.2004.S390X.Experimental.Open - - # Linux PPC64le - - ${{ if eq(parameters.platform, 'linux_ppc64le') }}: - - Ubuntu.2204.PPC64le.Experimental.Open + - (Debian.12.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-amd64 + + - ${{ else }}: + - ${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}: + # Mono path - test minimal scenario + - Ubuntu.2204.Amd64.Open + - ${{ else }}: + # CoreCLR path + - ${{ if and(eq(parameters.jobParameters.isExtraPlatformsBuild, true), ne(parameters.jobParameters.testScope, 'outerloop'))}}: + # extra-platforms CoreCLR (inner loop only) + - (Debian.12.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-amd64 + - (Mariner.2.0.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64 + + - ${{ if eq(parameters.jobParameters.testScope, 'outerloop') }}: + # outerloop only CoreCLR + - AzureLinux.3.Amd64.Open + + - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true))}}: + # inner and outer loop CoreCLR (general set) + - Ubuntu.2204.Amd64.Open + - (AzureLinux.3.0.Amd64.Open)AzureLinux.3.Amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-helix-amd64 + - (Centos.10.Amd64.Open)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream-10-helix-amd64 # OSX arm64 - ${{ if eq(parameters.platform, 'osx_arm64') }}: @@ -102,11 +87,11 @@ jobs: # iOS Simulator/Mac Catalyst arm64 - ${{ if in(parameters.platform, 'maccatalyst_arm64', 'iossimulator_arm64') }}: - - OSX.1200.Arm64.Open + - OSX.14.Arm64.Open # iOS/tvOS Simulator x64 & MacCatalyst x64 - ${{ if in(parameters.platform, 'iossimulator_x64', 'tvossimulator_x64', 'maccatalyst_x64') }}: - - OSX.1200.Amd64.Open + - OSX.15.Amd64.Open # iOS devices - ${{ if in(parameters.platform, 'ios_arm64') }}: @@ -130,7 +115,6 @@ jobs: - ${{ if ne(parameters.jobParameters.testScope, 'outerloop') }}: - (Windows.10.Amd64.ServerRS5.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2019-helix-amd64 - ${{ if or(ne(parameters.jobParameters.isExtraPlatformsBuild, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - Windows.81.Amd64.Open - Windows.Amd64.Server2022.Open - Windows.11.Amd64.Client.Open - ${{ if eq(parameters.jobParameters.testScope, 'outerloop') }}: @@ -168,18 +152,18 @@ jobs: # WASI - ${{ if eq(parameters.platform, 'wasi_wasm') }}: - - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly + - (Ubuntu.2204.Amd64)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # Browser WebAssembly - ${{ if eq(parameters.platform, 'browser_wasm') }}: - - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly + - (Ubuntu.2204.Amd64)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # Browser WebAssembly Firefox - ${{ if eq(parameters.platform, 'browser_wasm_firefox') }}: - - (Ubuntu.2204.Amd64)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly + - (Ubuntu.2204.Amd64)AzureLinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-webassembly # Browser WebAssembly windows - ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}: - - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-20240702174122-7aba2af + - (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly ${{ insert }}: ${{ parameters.jobParameters }} diff --git a/eng/pipelines/libraries/outerloop-mono.yml b/eng/pipelines/libraries/outerloop-mono.yml index b9d4bcfecd7b27..ee4ad24571cfc7 100644 --- a/eng/pipelines/libraries/outerloop-mono.yml +++ b/eng/pipelines/libraries/outerloop-mono.yml @@ -6,6 +6,7 @@ schedules: branches: include: - main + always: false # run only if there were changes since the last successful scheduled run. variables: - template: variables.yml diff --git a/eng/pipelines/libraries/outerloop.yml b/eng/pipelines/libraries/outerloop.yml index 597f298c37a3e0..14d26e86dd0b2f 100644 --- a/eng/pipelines/libraries/outerloop.yml +++ b/eng/pipelines/libraries/outerloop.yml @@ -6,7 +6,8 @@ schedules: branches: include: - main - - release/*.* + - release/*.0 + always: false # run only if there were changes since the last successful scheduled run. variables: - template: variables.yml diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 3290eda51ae02f..fdfd004b96eb3e 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -8,11 +8,11 @@ pr: schedules: - cron: "0 13 * * *" # 1PM UTC => 5 AM PST displayName: HttpStress nightly run + always: true branches: include: - main - - release/8.0 - - release/9.0 + - release/*-staging variables: - template: ../variables.yml @@ -37,7 +37,7 @@ extends: DUMPS_SHARE_MOUNT_ROOT: "/dumps-share" pool: name: $(DncEngPublicBuildPool) - demands: ImageOverride -equals 1es-ubuntu-1804-open + demands: ImageOverride -equals Build.Ubuntu.2204.Amd64.Open steps: - checkout: self diff --git a/eng/pipelines/libraries/stress/ssl.yml b/eng/pipelines/libraries/stress/ssl.yml index 230a2bef377304..ed1306990e294b 100644 --- a/eng/pipelines/libraries/stress/ssl.yml +++ b/eng/pipelines/libraries/stress/ssl.yml @@ -8,11 +8,11 @@ pr: schedules: - cron: "0 13 * * *" # 1PM UTC => 5 AM PST displayName: SslStress nightly run + always: true branches: include: - main - - release/8.0 - - release/9.0 + - release/*-staging variables: - template: ../variables.yml diff --git a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml index eb25d311890a98..482e2cc2b1e6f5 100644 --- a/eng/pipelines/official/jobs/prepare-signed-artifacts.yml +++ b/eng/pipelines/official/jobs/prepare-signed-artifacts.yml @@ -8,6 +8,9 @@ jobs: parameters: name: 'PrepareSignedArtifacts' displayName: 'Prepare Signed Artifacts' + + # Disable SBOM at job template level + enableSbom: false pool: name: $(DncEngInternalBuildPool) @@ -52,7 +55,11 @@ jobs: /p:DotNetSignType=$(_SignType) /bl:$(Build.SourcesDirectory)\prepare-artifacts.binlog displayName: Prepare artifacts and upload to build - + + - template: /eng/common/templates-official/steps/generate-sbom.yml + parameters: + BuildDropPath: $(Build.SourcesDirectory)\artifacts + - task: CopyFiles@2 displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs inputs: diff --git a/eng/pipelines/runtime-community.yml b/eng/pipelines/runtime-community.yml index b7a21f588973c1..446996e505b72b 100644 --- a/eng/pipelines/runtime-community.yml +++ b/eng/pipelines/runtime-community.yml @@ -71,17 +71,6 @@ extends: eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true), eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'], true), eq(variables['isRollingBuild'], true)) - # extra steps, run tests - postBuildSteps: - - template: /eng/pipelines/libraries/helix.yml - parameters: - creator: dotnet-bot - testRunNamePrefixSuffix: Mono_$(_BuildConfig) - condition: >- - or( - eq(variables['librariesContainsChange'], true), - eq(variables['monoContainsChange'], true), - eq(variables['isRollingBuild'], true)) # # Build the whole product using Mono diff --git a/eng/pipelines/runtime-ioslike.yml b/eng/pipelines/runtime-ioslike.yml index 1100ec500ce6ff..11477a3e175cba 100644 --- a/eng/pipelines/runtime-ioslike.yml +++ b/eng/pipelines/runtime-ioslike.yml @@ -4,6 +4,24 @@ trigger: none +# To reduce the load on the pipeline, enable it only for PRs that affect Mono LLVM related code. +pr: + branches: + include: + - main + - release/*.* + + paths: + include: + - src/mono/mono/mini/aot-*.* + - src/mono/mono/mini/llvm-*.* + - src/mono/mono/mini/mini-llvm-*.* + - src/mono/mono/mini/intrinsics.c + - src/mono/mono/mini/simd-*.* + - src/mono/mono/mini/decompose.c + - src/mono/mono/mini/method-to-ir.c + - src/mono/mono/mini/mini.c + variables: - template: /eng/pipelines/common/variables.yml diff --git a/eng/pipelines/runtime-llvm.yml b/eng/pipelines/runtime-llvm.yml index 5be2a5b063aaaa..6f3d16767ddbb3 100644 --- a/eng/pipelines/runtime-llvm.yml +++ b/eng/pipelines/runtime-llvm.yml @@ -28,6 +28,24 @@ schedules: - main always: false # run only if there were changes since the last successful scheduled run. +# To reduce the load on the pipeline, enable it only for PRs that affect Mono LLVM related code. +pr: + branches: + include: + - main + - release/*.* + + paths: + include: + - src/mono/mono/mini/aot-*.* + - src/mono/mono/mini/llvm-*.* + - src/mono/mono/mini/mini-llvm-*.* + - src/mono/mono/mini/intrinsics.c + - src/mono/mono/mini/simd-*.* + - src/mono/mono/mini/decompose.c + - src/mono/mono/mini/method-to-ir.c + - src/mono/mono/mini/mini.c + variables: - template: /eng/pipelines/common/variables.yml diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml index 55021be6e29ed4..22375d5c37c81a 100644 --- a/eng/pipelines/runtime-official.yml +++ b/eng/pipelines/runtime-official.yml @@ -41,11 +41,11 @@ extends: # Localization build # - - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/9.0') }}: + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: - template: /eng/common/templates-official/job/onelocbuild.yml parameters: MirrorRepo: runtime - MirrorBranch: release/9.0 + MirrorBranch: main LclSource: lclFilesfromPackage LclPackageId: 'LCL-JUNO-PROD-RUNTIME' @@ -382,7 +382,6 @@ extends: parameters: name: MonoRuntimePacks - # Build Mono AOT offset headers once, for consumption elsewhere # - template: /eng/pipelines/common/platform-matrix.yml @@ -661,7 +660,7 @@ extends: flattenFolders: true buildArgs: -s mono.workloads -c $(_BuildConfig) /p:PackageSource=$(Build.SourcesDirectory)/artifacts/workloadPackages /p:WorkloadOutputPath=$(Build.SourcesDirectory)/artifacts/workloads - + postBuildSteps: # Upload packages wrapping msis - template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index bcab359dde5792..8f6e4ab408dd08 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -836,21 +836,22 @@ extends: scenarios: - WasmTestOnChrome + # disabled: https://github.com/dotnet/runtime/issues/116492 # Library tests with full threading - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - browser_wasm - #- browser_wasm_win - nameSuffix: _Threading - extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - extraHelixArguments: /p:WasmEnableThreads=true - alwaysRun: ${{ variables.isRollingBuild }} - shouldRunSmokeOnly: onLibrariesAndIllinkChanges - scenarios: - - WasmTestOnChrome - - WasmTestOnFirefox - #- WasmTestOnNodeJS - this is not supported yet, https://github.com/dotnet/runtime/issues/85592 + # - template: /eng/pipelines/common/templates/wasm-library-tests.yml + # parameters: + # platforms: + # - browser_wasm + # #- browser_wasm_win + # nameSuffix: _Threading + # extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # extraHelixArguments: /p:WasmEnableThreads=true + # alwaysRun: ${{ variables.isRollingBuild }} + # shouldRunSmokeOnly: onLibrariesAndIllinkChanges + # scenarios: + # - WasmTestOnChrome + # - WasmTestOnFirefox + # #- WasmTestOnNodeJS - this is not supported yet, https://github.com/dotnet/runtime/issues/85592 # EAT Library tests - only run on linux - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml @@ -926,25 +927,25 @@ extends: # WASI/WASM - - template: /eng/pipelines/common/templates/wasm-library-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - nameSuffix: '_Smoke' - extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - shouldRunSmokeOnly: true - alwaysRun: ${{ variables.isRollingBuild }} - scenarios: - - WasmTestOnWasmtime - - - template: /eng/pipelines/common/templates/simple-wasm-build-tests.yml - parameters: - platforms: - - wasi_wasm - - wasi_wasm_win - extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) - alwaysRun: ${{ variables.isRollingBuild }} + # - template: /eng/pipelines/common/templates/wasm-library-tests.yml + # parameters: + # platforms: + # - wasi_wasm + # - wasi_wasm_win + # nameSuffix: '_Smoke' + # extraBuildArgs: /p:EnableAggressiveTrimming=true /p:RunWasmSamples=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # shouldRunSmokeOnly: true + # alwaysRun: ${{ variables.isRollingBuild }} + # scenarios: + # - WasmTestOnWasmtime + + # - template: /eng/pipelines/common/templates/simple-wasm-build-tests.yml + # parameters: + # platforms: + # - wasi_wasm + # - wasi_wasm_win + # extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + # alwaysRun: ${{ variables.isRollingBuild }} # # Android devices @@ -1010,8 +1011,7 @@ extends: jobParameters: testGroup: innerloop nameSuffix: AllSubsets_Mono - # Tracking issue: https://github.com/dotnet/runtime/issues/82637 - buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:RunSmokeTestsOnly=true /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:EnableAggressiveTrimming=false + buildArgs: -s mono+libs+libs.tests+host+packs -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:RunSmokeTestsOnly=true /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=false /p:BuildDarwinFrameworks=true /p:EnableAggressiveTrimming=true timeoutInMinutes: 480 condition: >- or( @@ -1087,8 +1087,7 @@ extends: runtimeFlavor: mono platforms: - maccatalyst_x64 - - ${{ if eq(variables['isRollingBuild'], true) }}: - - maccatalyst_arm64 + - maccatalyst_arm64 variables: # map dependencies variables to local variables - name: librariesContainsChange diff --git a/eng/testing/scenarios/BuildWasiAppsJobsList.txt b/eng/testing/scenarios/BuildWasiAppsJobsList.txt index 86c0517585a480..e69de29bb2d1d6 100644 --- a/eng/testing/scenarios/BuildWasiAppsJobsList.txt +++ b/eng/testing/scenarios/BuildWasiAppsJobsList.txt @@ -1,7 +0,0 @@ -Wasi.Build.Tests.InvariantTests -Wasi.Build.Tests.ILStripTests -Wasi.Build.Tests.SdkMissingTests -Wasi.Build.Tests.RuntimeConfigTests -Wasi.Build.Tests.WasiTemplateTests -Wasi.Build.Tests.PInvokeTableGeneratorTests -Wasi.Build.Tests.WasiLibraryModeTests diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets index a59cce6c49aeea..e2e36415a31834 100644 --- a/eng/testing/tests.ioslike.targets +++ b/eng/testing/tests.ioslike.targets @@ -16,7 +16,7 @@ <_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration) - <_AOTBuildCommand>$(_AOTBuildCommand) /p:XHARNESS_EXECUTION_DIR="$XHARNESS_EXECUTION_DIR" /p:RunAOTCompilation=$(RunAOTCompilation) /p:UseNativeAOTRuntime=$(UseNativeAOTRuntime) /p:TargetOS=$(TargetOS) /p:TargetArchitecture=$(TargetArchitecture) /p:MonoForceInterpreter=$(MonoForceInterpreter) /p:MonoEnableLLVM=true /p:DevTeamProvisioning=$(DevTeamProvisioning) /p:UsePortableRuntimePack=true /p:Configuration=$(Configuration) /p:EnableAggressiveTrimming=$(EnableAggressiveTrimming) + <_AOTBuildCommand>$(_AOTBuildCommand) /p:XHARNESS_EXECUTION_DIR="$XHARNESS_EXECUTION_DIR" /p:RunAOTCompilation=$(RunAOTCompilation) /p:UseNativeAOTRuntime=$(UseNativeAOTRuntime) /p:TargetOS=$(TargetOS) /p:TargetArchitecture=$(TargetArchitecture) /p:MonoForceInterpreter=$(MonoForceInterpreter) /p:MonoEnableLLVM=true /p:DevTeamProvisioning=$(DevTeamProvisioning) /p:UsePortableRuntimePack=$(UsePortableRuntimePack) /p:Configuration=$(Configuration) <_AOTBuildCommand Condition="'$(NativeLib)' != ''">$(_AOTBuildCommand) /p:NativeLib=$(NativeLib) /p:BundlesResources=$(BundlesResources) /p:ForceLibraryModeGenerateAppBundle=$(ForceLibraryModeGenerateAppBundle) <_AOTBuildCommand>$(_AOTBuildCommand) @@ -77,8 +77,6 @@ - @@ -156,12 +154,6 @@ <_AppleItemsToPass Include="@(ReferenceExtraPathFiles->'%(FileName)%(Extension)')" OriginalItemName__="AppleReferenceExtraPathFiles" /> - <_AppleItemsToPass Include="@(RuntimeHostConfigurationOption)" - OriginalItemName__="_AppleUsedRuntimeHostConfigurationOption" /> - - <_AppleItemsToPass Include="@(TrimmerRootAssembly)" - OriginalItemName__="TrimmerRootAssembly" /> - - + + true true $(NoWarn);IL2103;IL2025;IL2111;IL2122 - false false - false - false false - false + + + + + false + <_DefaultValueAttributeSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true + <_DesignerHostSupport Condition="'$(OverrideDefaultValueAndDesignerHostSupport)' == 'true'">true - - false - - diff --git a/src/coreclr/.nuget/Directory.Build.targets b/src/coreclr/.nuget/Directory.Build.targets index 379fbd65030b32..f30471ded8ae4f 100644 --- a/src/coreclr/.nuget/Directory.Build.targets +++ b/src/coreclr/.nuget/Directory.Build.targets @@ -4,7 +4,7 @@ $(ProductVersion) - $(PackageVersion) + $(PackageVersion) diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index f12b6166019a04..6d82de9b5cdf2a 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -13377,7 +13377,11 @@ void CordbProcess::HandleDebugEventForInteropDebugging(const DEBUG_EVENT * pEven { LOG((LF_CORDB, LL_INFO100000, "W32ET::W32EL: hijack complete will restore context...\n")); DT_CONTEXT tempContext = { 0 }; +#ifdef TARGET_X86 + tempContext.ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS; +#else tempContext.ContextFlags = DT_CONTEXT_FULL; +#endif HRESULT hr = pUnmanagedThread->GetThreadContext(&tempContext); _ASSERTE(SUCCEEDED(hr)); diff --git a/src/coreclr/debug/di/rsthread.cpp b/src/coreclr/debug/di/rsthread.cpp index 619b37c87ef8b8..cd7f79867a54d3 100644 --- a/src/coreclr/debug/di/rsthread.cpp +++ b/src/coreclr/debug/di/rsthread.cpp @@ -3721,9 +3721,15 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync() LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: hijackCtx started as:\n")); LogContext(GetHijackCtx()); - // Save the thread's full context. + // Save the thread's full context for all platforms except for x86 because we need the + // DT_CONTEXT_EXTENDED_REGISTERS to avoid getting incomplete information and corrupt the thread context DT_CONTEXT context; +#ifdef TARGET_X86 + context.ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS; +#else context.ContextFlags = DT_CONTEXT_FULL; +#endif + BOOL succ = DbiGetThreadContext(m_handle, &context); _ASSERTE(succ); // for debugging when GetThreadContext fails @@ -3733,7 +3739,12 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync() LOG((LF_CORDB, LL_ERROR, "CUT::SFCHFS: DbiGetThreadContext error=0x%x\n", error)); } +#ifdef TARGET_X86 + GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS; +#else GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL; +#endif + CORDbgCopyThreadContext(GetHijackCtx(), &context); LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: thread=0x%x Hijacking for sync. Original context is:\n", this)); LogContext(GetHijackCtx()); diff --git a/src/coreclr/debug/ee/controller.cpp b/src/coreclr/debug/ee/controller.cpp index fd26e7fe3135dd..1738eb5862fee7 100644 --- a/src/coreclr/debug/ee/controller.cpp +++ b/src/coreclr/debug/ee/controller.cpp @@ -25,6 +25,11 @@ const char *GetTType( TraceType tt); #define IsSingleStep(exception) ((exception) == EXCEPTION_SINGLE_STEP) +typedef enum __TailCallFunctionType { + TailCallThatReturns = 1, + StoreTailCallArgs = 2 +} TailCallFunctionType; + // ------------------------------------------------------------------------- // DebuggerController routines // ------------------------------------------------------------------------- @@ -5631,10 +5636,10 @@ static bool IsTailCallJitHelper(const BYTE * ip) // control flow will be a little peculiar in that the function will return // immediately, so we need special handling in the debugger for it. This // function detects that case to be used for those scenarios. -static bool IsTailCallThatReturns(const BYTE * ip, ControllerStackInfo* info) +static bool IsTailCall(const BYTE * ip, ControllerStackInfo* info, TailCallFunctionType type) { MethodDesc* pTailCallDispatcherMD = TailCallHelp::GetTailCallDispatcherMD(); - if (pTailCallDispatcherMD == NULL) + if (pTailCallDispatcherMD == NULL && type == TailCallFunctionType::TailCallThatReturns) { return false; } @@ -5650,6 +5655,11 @@ static bool IsTailCallThatReturns(const BYTE * ip, ControllerStackInfo* info) ? trace.GetMethodDesc() : g_pEEInterface->GetNativeCodeMethodDesc(trace.GetAddress()); + if (type == TailCallFunctionType::StoreTailCallArgs) + { + return (pTargetMD && pTargetMD->IsDynamicMethod() && pTargetMD->AsDynamicMethodDesc()->GetILStubType() == DynamicMethodDesc::StubTailCallStoreArgs); + } + if (pTargetMD != pTailCallDispatcherMD) { return false; @@ -5881,6 +5891,13 @@ bool DebuggerStepper::TrapStep(ControllerStackInfo *info, bool in) fCallingIntoFunclet = IsAddrWithinMethodIncludingFunclet(ji, info->m_activeFrame.md, walker.GetNextIP()) && ((CORDB_ADDRESS)(SIZE_T)walker.GetNextIP() != ji->m_addrOfCode); #endif + // If we are stepping into a tail call that uses the StoreTailCallArgs + // we need to enable the method enter, otherwise it will behave like a resume + if (in && IsTailCall(walker.GetNextIP(), info, TailCallFunctionType::StoreTailCallArgs)) + { + EnableMethodEnter(); + return true; + } // At this point, we know that the call/branch target is not // in the current method. The possible cases is that this is // a jump or a tailcall-via-helper. There are two separate @@ -5892,7 +5909,7 @@ bool DebuggerStepper::TrapStep(ControllerStackInfo *info, bool in) // is done by stepping out to the previous user function // (non IL stub). if ((fIsJump && !fCallingIntoFunclet) || IsTailCallJitHelper(walker.GetNextIP()) || - IsTailCallThatReturns(walker.GetNextIP(), info)) + IsTailCall(walker.GetNextIP(), info, TailCallFunctionType::TailCallThatReturns)) { // A step-over becomes a step-out for a tail call. if (!in) @@ -6038,7 +6055,7 @@ bool DebuggerStepper::TrapStep(ControllerStackInfo *info, bool in) return true; } - if (IsTailCallJitHelper(walker.GetNextIP()) || IsTailCallThatReturns(walker.GetNextIP(), info)) + if (IsTailCallJitHelper(walker.GetNextIP()) || IsTailCall(walker.GetNextIP(), info, TailCallFunctionType::TailCallThatReturns)) { if (!in) { @@ -7410,7 +7427,15 @@ bool DebuggerStepper::TriggerSingleStep(Thread *thread, const BYTE *ip) if (!g_pEEInterface->IsManagedNativeCode(ip)) { LOG((LF_CORDB,LL_INFO10000, "DS::TSS: not in managed code, Returning false (case 0)!\n")); - DisableSingleStep(); + // Sometimes we can get here with a callstack that is coming from an APC + // this will disable the single stepping and incorrectly resume an app that the user + // is stepping through. +#ifdef FEATURE_THREAD_ACTIVATION + if ((thread->m_State & Thread::TS_DebugWillSync) == 0) +#endif + { + DisableSingleStep(); + } return false; } diff --git a/src/coreclr/gc/CMakeLists.txt b/src/coreclr/gc/CMakeLists.txt index 89937554c04177..4ffe829dac687e 100644 --- a/src/coreclr/gc/CMakeLists.txt +++ b/src/coreclr/gc/CMakeLists.txt @@ -93,6 +93,10 @@ if(CLR_CMAKE_TARGET_ARCH_AMD64) list(APPEND GC_LINK_LIBRARIES gc_vxsort ) + list(APPEND GC_SOURCES + ${CLR_SRC_NATIVE_DIR}/minipal/cpufeatures.c + ) + include(${CLR_SRC_NATIVE_DIR}/minipal/configure.cmake) endif(CLR_CMAKE_TARGET_ARCH_AMD64) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 217e90d38c0228..c80e14e88f57e6 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -2430,6 +2430,8 @@ uint32_t gc_heap::m_high_memory_load_th; uint32_t gc_heap::v_high_memory_load_th; +uint32_t gc_heap::almost_high_memory_load_th; + bool gc_heap::is_restricted_physical_mem; uint64_t gc_heap::total_physical_mem = 0; @@ -2890,10 +2892,14 @@ bool gc_heap::trigger_initial_gen2_p = false; #ifdef BACKGROUND_GC bool gc_heap::trigger_bgc_for_rethreading_p = false; +int gc_heap::total_bgc_threads = 0; +int gc_heap::last_bgc_n_heaps = 0; +int gc_heap::last_total_bgc_threads = 0; #endif //BACKGROUND_GC #ifdef STRESS_DYNAMIC_HEAP_COUNT int gc_heap::heaps_in_this_gc = 0; +int gc_heap::bgc_to_ngc2_ratio = 0; #endif //STRESS_DYNAMIC_HEAP_COUNT #endif // DYNAMIC_HEAP_COUNT @@ -6404,7 +6410,11 @@ class heap_select if (GCToOSInterface::CanGetCurrentProcessorNumber()) { uint32_t proc_no = GCToOSInterface::GetCurrentProcessorNumber(); - proc_no_to_heap_no[proc_no] = (uint16_t)heap_number; + // For a 32-bit process running on a machine with > 64 procs, + // even though the process can only use up to 32 procs, the processor + // index can be >= 64; or in the cpu group case, if the process is not running in cpu group #0, + // the GetCurrentProcessorNumber will return a number that's >= 64. + proc_no_to_heap_no[proc_no % MAX_SUPPORTED_CPUS] = (uint16_t)heap_number; } } @@ -6426,7 +6436,11 @@ class heap_select if (GCToOSInterface::CanGetCurrentProcessorNumber()) { uint32_t proc_no = GCToOSInterface::GetCurrentProcessorNumber(); - int adjusted_heap = proc_no_to_heap_no[proc_no]; + // For a 32-bit process running on a machine with > 64 procs, + // even though the process can only use up to 32 procs, the processor + // index can be >= 64; or in the cpu group case, if the process is not running in cpu group #0, + // the GetCurrentProcessorNumber will return a number that's >= 64. + int adjusted_heap = proc_no_to_heap_no[proc_no % MAX_SUPPORTED_CPUS]; // with dynamic heap count, need to make sure the value is in range. if (adjusted_heap >= gc_heap::n_heaps) { @@ -10703,6 +10717,14 @@ size_t gc_heap::sort_mark_list() size_t region_index = get_basic_region_index_for_address (heap_segment_mem (region)); uint8_t* region_limit = heap_segment_allocated (region); + // Due to GC holes, x can point to something in a region that already got freed. And that region's + // allocated would be 0 and cause an infinite loop which is much harder to handle on production than + // simply throwing an exception. + if (region_limit == 0) + { + FATAL_GC_ERROR(); + } + uint8_t*** mark_list_piece_start_ptr = &mark_list_piece_start[region_index]; uint8_t*** mark_list_piece_end_ptr = &mark_list_piece_end[region_index]; #else // USE_REGIONS @@ -12733,35 +12755,29 @@ void gc_heap::rearrange_heap_segments(BOOL compacting) #endif //!USE_REGIONS #if defined(USE_REGIONS) -// trim down the list of free regions pointed at by free_list down to target_count, moving the extra ones to surplus_list -static void remove_surplus_regions (region_free_list* free_list, region_free_list* surplus_list, size_t target_count) +// trim down the list of regions pointed at by src down to target_count, moving the extra ones to dest +static void trim_region_list (region_free_list* dest, region_free_list* src, size_t target_count) { - while (free_list->get_num_free_regions() > target_count) + while (src->get_num_free_regions() > target_count) { - // remove one region from the heap's free list - heap_segment* region = free_list->unlink_region_front(); - - // and put it on the surplus list - surplus_list->add_region_front (region); + heap_segment* region = src->unlink_region_front(); + dest->add_region_front (region); } } -// add regions from surplus_list to free_list, trying to reach target_count -static int64_t add_regions (region_free_list* free_list, region_free_list* surplus_list, size_t target_count) +// add regions from src to dest, trying to grow the size of dest to target_count +static int64_t grow_region_list (region_free_list* dest, region_free_list* src, size_t target_count) { int64_t added_count = 0; - while (free_list->get_num_free_regions() < target_count) + while (dest->get_num_free_regions() < target_count) { - if (surplus_list->get_num_free_regions() == 0) + if (src->get_num_free_regions() == 0) break; added_count++; - // remove one region from the surplus list - heap_segment* region = surplus_list->unlink_region_front(); - - // and put it on the heap's free list - free_list->add_region_front (region); + heap_segment* region = src->unlink_region_front(); + dest->add_region_front (region); } return added_count; } @@ -13246,8 +13262,25 @@ void region_free_list::sort_by_committed_and_age() void gc_heap::age_free_regions (const char* msg) { + // If we are doing an ephemeral GC as a precursor to a BGC, then we will age all of the region + // kinds during the ephemeral GC and skip the call to age_free_regions during the BGC itself. bool age_all_region_kinds = (settings.condemned_generation == max_generation); + if (!age_all_region_kinds) + { +#ifdef MULTIPLE_HEAPS + gc_heap* hp = g_heaps[0]; +#else //MULTIPLE_HEAPS + gc_heap* hp = pGenGCHeap; +#endif //MULTIPLE_HEAPS + age_all_region_kinds = (hp->current_bgc_state == bgc_initialized); + } + + if (age_all_region_kinds) + { + global_free_huge_regions.age_free_regions(); + } + #ifdef MULTIPLE_HEAPS for (int i = 0; i < n_heaps; i++) { @@ -13273,10 +13306,55 @@ void gc_heap::age_free_regions (const char* msg) } } +// distribute_free_regions is called during all blocking GCs and in the start of the BGC mark phase +// unless we already called it during an ephemeral GC right before the BGC. +// +// Free regions are stored on the following permanent lists: +// - global_regions_to_decommit +// - global_free_huge_regions +// - (per-heap) free_regions +// and the following lists that are local to distribute_free_regions: +// - aged_regions +// - surplus_regions +// +// For reason_induced_aggressive GCs, we decommit all regions. Therefore, the below description is +// for other GC types. +// +// distribute_free_regions steps: +// +// 1. Process region ages +// a. Move all huge regions from free_regions to global_free_huge_regions. +// (The intention is that free_regions shouldn't contain any huge regions outside of the period +// where a GC reclaims them and distribute_free_regions moves them to global_free_huge_regions, +// though perhaps BGC can leave them there. Future work could verify and assert this.) +// b. Move any basic region in global_regions_to_decommit (which means we intended to decommit them +// but haven't done so yet) to surplus_regions +// c. Move all huge regions that are past the age threshold from global_free_huge_regions to aged_regions +// d. Move all basic/large regions that are past the age threshold from free_regions to aged_regions +// 2. Move all regions from aged_regions to global_regions_to_decommit. Note that the intention is to +// combine this with move_highest_free_regions in a future change, which is why we don't just do this +// in steps 1c/1d. +// 3. Compute the required per-heap budgets for SOH (basic regions) and the balance. The budget for LOH +// (large) is zero as we are using an entirely age-based approach. +// balance = (number of free regions) - budget +// 4. Decide if we are going to distribute or decommit a nonzero balance. To distribute, we adjust the +// per-heap budgets, so after this step the LOH (large) budgets can be positive. +// a. A negative balance (deficit) for SOH (basic) will be distributed it means we expect to use +// more memory than we have on the free lists. A negative balance for LOH (large) isn't possible +// for LOH since the budgets start at zero. +// b. For SOH (basic), we will decommit surplus regions unless we are in a foreground GC during BGC. +// c. For LOH (large), we will distribute surplus regions since we are using an entirely age-based +// approach. However, if we are in a high-memory-usage scenario, we will decommit. In this case, +// we will also decommit the huge regions in global_free_huge_regions. Note that they were not +// originally included in the balance because they are kept in a global list. Only basic/large +// regions are kept in per-heap lists where they can be distributed. +// 5. Implement the distribute-or-decommit strategy. To distribute, we simply move regions across heaps, +// using surplus_regions as a holding space. To decommit, for server GC we generally leave them on the +// global_regions_to_decommit list and decommit them over time. However, in high-memory-usage scenarios, +// we will immediately decommit some or all of these regions. For workstation GC, we decommit a limited +// amount and move the rest back to the (one) heap's free_list. void gc_heap::distribute_free_regions() { - const int kind_count = large_free_region + 1; - #ifdef MULTIPLE_HEAPS BOOL joined_last_gc_before_oom = FALSE; for (int i = 0; i < n_heaps; i++) @@ -13344,22 +13422,22 @@ void gc_heap::distribute_free_regions() } // first step: accumulate the number of free regions and the budget over all heaps - // and move huge regions to global free list - size_t total_num_free_regions[kind_count] = { 0, 0 }; - size_t total_budget_in_region_units[kind_count] = { 0, 0 }; + // + // The initial budget will only be calculated for basic free regions. For large regions, the initial budget + // is zero, and distribute-vs-decommit will be determined entirely by region ages and whether we are in a + // high memory usage scenario. Distributing a surplus/deficit of regions can change the budgets that are used. + size_t total_num_free_regions[count_distributed_free_region_kinds] = { 0, 0 }; + size_t total_budget_in_region_units[count_distributed_free_region_kinds] = { 0, 0 }; + + size_t heap_budget_in_region_units[count_distributed_free_region_kinds][MAX_SUPPORTED_CPUS] = {}; + size_t min_heap_budget_in_region_units[count_distributed_free_region_kinds][MAX_SUPPORTED_CPUS] = {}; + region_free_list aged_regions[count_free_region_kinds]; + region_free_list surplus_regions[count_distributed_free_region_kinds]; + + // we may still have regions left on the regions_to_decommit list - + // use these to fill the budget as well + surplus_regions[basic_free_region].transfer_regions (&global_regions_to_decommit[basic_free_region]); - size_t num_decommit_regions_by_time = 0; - size_t size_decommit_regions_by_time = 0; - size_t heap_budget_in_region_units[MAX_SUPPORTED_CPUS][kind_count]; - size_t min_heap_budget_in_region_units[MAX_SUPPORTED_CPUS]; - size_t region_size[kind_count] = { global_region_allocator.get_region_alignment(), global_region_allocator.get_large_region_alignment() }; - region_free_list surplus_regions[kind_count]; - for (int kind = basic_free_region; kind < kind_count; kind++) - { - // we may still have regions left on the regions_to_decommit list - - // use these to fill the budget as well - surplus_regions[kind].transfer_regions (&global_regions_to_decommit[kind]); - } #ifdef MULTIPLE_HEAPS for (int i = 0; i < n_heaps; i++) { @@ -13367,167 +13445,87 @@ void gc_heap::distribute_free_regions() #else //MULTIPLE_HEAPS { gc_heap* hp = pGenGCHeap; - // just to reduce the number of #ifdefs in the code below - const int i = 0; - const int n_heaps = 1; #endif //MULTIPLE_HEAPS - for (int kind = basic_free_region; kind < kind_count; kind++) - { - // If there are regions in free that haven't been used in AGE_IN_FREE_TO_DECOMMIT GCs we always decommit them. - region_free_list& region_list = hp->free_regions[kind]; - heap_segment* next_region = nullptr; - for (heap_segment* region = region_list.get_first_free_region(); region != nullptr; region = next_region) - { - next_region = heap_segment_next (region); - int age_in_free_to_decommit = min (max (AGE_IN_FREE_TO_DECOMMIT, n_heaps), MAX_AGE_IN_FREE); - // when we are about to get OOM, we'd like to discount the free regions that just have the initial page commit as they are not useful - if ((heap_segment_age_in_free (region) >= age_in_free_to_decommit) || - ((get_region_committed_size (region) == GC_PAGE_SIZE) && joined_last_gc_before_oom)) - { - num_decommit_regions_by_time++; - size_decommit_regions_by_time += get_region_committed_size (region); - dprintf (REGIONS_LOG, ("h%2d region %p age %2d, decommit", - i, heap_segment_mem (region), heap_segment_age_in_free (region))); - region_free_list::unlink_region (region); - region_free_list::add_region (region, global_regions_to_decommit); - } - } - - total_num_free_regions[kind] += region_list.get_num_free_regions(); - } - global_free_huge_regions.transfer_regions (&hp->free_regions[huge_free_region]); - - heap_budget_in_region_units[i][basic_free_region] = 0; - min_heap_budget_in_region_units[i] = 0; - heap_budget_in_region_units[i][large_free_region] = 0; - } - - for (int gen = soh_gen0; gen < total_generation_count; gen++) - { - if ((gen <= soh_gen2) && - total_budget_in_region_units[basic_free_region] >= (total_num_free_regions[basic_free_region] + - surplus_regions[basic_free_region].get_num_free_regions())) - { - // don't accumulate budget from higher soh generations if we cannot cover lower ones - dprintf (REGIONS_LOG, ("out of free regions - skipping gen %d budget = %zd >= avail %zd", - gen, - total_budget_in_region_units[basic_free_region], - total_num_free_regions[basic_free_region] + surplus_regions[basic_free_region].get_num_free_regions())); - continue; - } -#ifdef MULTIPLE_HEAPS - for (int i = 0; i < n_heaps; i++) - { - gc_heap* hp = g_heaps[i]; -#else //MULTIPLE_HEAPS - { - gc_heap* hp = pGenGCHeap; - // just to reduce the number of #ifdefs in the code below - const int i = 0; - const int n_heaps = 1; -#endif //MULTIPLE_HEAPS - ptrdiff_t budget_gen = max (hp->estimate_gen_growth (gen), (ptrdiff_t)0); - int kind = gen >= loh_generation; - size_t budget_gen_in_region_units = (budget_gen + (region_size[kind] - 1)) / region_size[kind]; - dprintf (REGIONS_LOG, ("h%2d gen %d has an estimated growth of %zd bytes (%zd regions)", i, gen, budget_gen, budget_gen_in_region_units)); - if (gen <= soh_gen2) - { - // preserve the budget for the previous generation - we should not go below that - min_heap_budget_in_region_units[i] = heap_budget_in_region_units[i][kind]; - } - heap_budget_in_region_units[i][kind] += budget_gen_in_region_units; - total_budget_in_region_units[kind] += budget_gen_in_region_units; - } } - dprintf (1, ("moved %2zd regions (%8zd) to decommit based on time", num_decommit_regions_by_time, size_decommit_regions_by_time)); + move_all_aged_regions(total_num_free_regions, aged_regions, joined_last_gc_before_oom); + // For now, we just decommit right away, but eventually these will be used in move_highest_free_regions + move_regions_to_decommit(aged_regions); - global_free_huge_regions.transfer_regions (&global_regions_to_decommit[huge_free_region]); + size_t total_basic_free_regions = total_num_free_regions[basic_free_region] + surplus_regions[basic_free_region].get_num_free_regions(); + total_budget_in_region_units[basic_free_region] = compute_basic_region_budgets(heap_budget_in_region_units[basic_free_region], min_heap_budget_in_region_units[basic_free_region], total_basic_free_regions); - size_t free_space_in_huge_regions = global_free_huge_regions.get_size_free_regions(); + bool aggressive_decommit_large_p = joined_last_gc_before_oom || dt_high_memory_load_p() || near_heap_hard_limit_p(); - ptrdiff_t num_regions_to_decommit[kind_count]; - int region_factor[kind_count] = { 1, LARGE_REGION_FACTOR }; -#ifdef TRACE_GC - const char* kind_name[count_free_region_kinds] = { "basic", "large", "huge"}; -#endif // TRACE_GC + int region_factor[count_distributed_free_region_kinds] = { 1, LARGE_REGION_FACTOR }; #ifndef MULTIPLE_HEAPS // just to reduce the number of #ifdefs in the code below const int n_heaps = 1; #endif //!MULTIPLE_HEAPS - size_t num_huge_region_units_to_consider[kind_count] = { 0, free_space_in_huge_regions / region_size[large_free_region] }; - - for (int kind = basic_free_region; kind < kind_count; kind++) + for (int kind = basic_free_region; kind < count_distributed_free_region_kinds; kind++) { - num_regions_to_decommit[kind] = surplus_regions[kind].get_num_free_regions(); - - dprintf(REGIONS_LOG, ("%zd %s free regions, %zd regions budget, %zd regions on decommit list, %zd huge regions to consider", + dprintf(REGIONS_LOG, ("%zd %s free regions, %zd regions budget, %zd regions on surplus list", total_num_free_regions[kind], - kind_name[kind], + free_region_kind_name[kind], total_budget_in_region_units[kind], - num_regions_to_decommit[kind], - num_huge_region_units_to_consider[kind])); + surplus_regions[kind].get_num_free_regions())); // check if the free regions exceed the budget // if so, put the highest free regions on the decommit list - total_num_free_regions[kind] += num_regions_to_decommit[kind]; + total_num_free_regions[kind] += surplus_regions[kind].get_num_free_regions(); - ptrdiff_t balance = total_num_free_regions[kind] + num_huge_region_units_to_consider[kind] - total_budget_in_region_units[kind]; + ptrdiff_t balance_to_distribute = total_num_free_regions[kind] - total_budget_in_region_units[kind]; - if ( -#ifdef BACKGROUND_GC - background_running_p() || -#endif - (balance < 0)) + if (distribute_surplus_p(balance_to_distribute, kind, aggressive_decommit_large_p)) { - dprintf (REGIONS_LOG, ("distributing the %zd %s regions deficit", -balance, kind_name[kind])); - #ifdef MULTIPLE_HEAPS - // we may have a deficit or - if background GC is going on - a surplus. + // we may have a deficit or - for large regions or if background GC is going on - a surplus. // adjust the budget per heap accordingly - if (balance != 0) + if (balance_to_distribute != 0) { + dprintf (REGIONS_LOG, ("distributing the %zd %s regions deficit", -balance_to_distribute, free_region_kind_name[kind])); + ptrdiff_t curr_balance = 0; ptrdiff_t rem_balance = 0; for (int i = 0; i < n_heaps; i++) { - curr_balance += balance; + curr_balance += balance_to_distribute; ptrdiff_t adjustment_per_heap = curr_balance / n_heaps; curr_balance -= adjustment_per_heap * n_heaps; - ptrdiff_t new_budget = (ptrdiff_t)heap_budget_in_region_units[i][kind] + adjustment_per_heap; - ptrdiff_t min_budget = (kind == basic_free_region) ? (ptrdiff_t)min_heap_budget_in_region_units[i] : 0; + ptrdiff_t new_budget = (ptrdiff_t)heap_budget_in_region_units[kind][i] + adjustment_per_heap; + ptrdiff_t min_budget = (ptrdiff_t)min_heap_budget_in_region_units[kind][i]; dprintf (REGIONS_LOG, ("adjusting the budget for heap %d from %zd %s regions by %zd to %zd", i, - heap_budget_in_region_units[i][kind], - kind_name[kind], + heap_budget_in_region_units[kind][i], + free_region_kind_name[kind], adjustment_per_heap, max (min_budget, new_budget))); - heap_budget_in_region_units[i][kind] = max (min_budget, new_budget); - rem_balance += new_budget - heap_budget_in_region_units[i][kind]; + heap_budget_in_region_units[kind][i] = max (min_budget, new_budget); + rem_balance += new_budget - heap_budget_in_region_units[kind][i]; } assert (rem_balance <= 0); - dprintf (REGIONS_LOG, ("remaining balance: %zd %s regions", rem_balance, kind_name[kind])); + dprintf (REGIONS_LOG, ("remaining balance: %zd %s regions", rem_balance, free_region_kind_name[kind])); // if we have a left over deficit, distribute that to the heaps that still have more than the minimum while (rem_balance < 0) { for (int i = 0; i < n_heaps; i++) { - size_t min_budget = (kind == basic_free_region) ? min_heap_budget_in_region_units[i] : 0; - if (heap_budget_in_region_units[i][kind] > min_budget) + size_t min_budget = min_heap_budget_in_region_units[kind][i]; + if (heap_budget_in_region_units[kind][i] > min_budget) { dprintf (REGIONS_LOG, ("adjusting the budget for heap %d from %zd %s regions by %d to %zd", i, - heap_budget_in_region_units[i][kind], - kind_name[kind], + heap_budget_in_region_units[kind][i], + free_region_kind_name[kind], -1, - heap_budget_in_region_units[i][kind] - 1)); + heap_budget_in_region_units[kind][i] - 1)); - heap_budget_in_region_units[i][kind] -= 1; + heap_budget_in_region_units[kind][i] -= 1; rem_balance += 1; if (rem_balance == 0) break; @@ -13539,35 +13537,44 @@ void gc_heap::distribute_free_regions() } else { - num_regions_to_decommit[kind] = balance; + assert (balance_to_distribute >= 0); + + ptrdiff_t balance_to_decommit = balance_to_distribute; + if (kind == large_free_region) + { + // huge regions aren't part of balance_to_distribute because they are kept in a global list + // and therefore can't be distributed across heaps + balance_to_decommit += global_free_huge_regions.get_size_free_regions() / global_region_allocator.get_large_region_alignment(); + } + dprintf(REGIONS_LOG, ("distributing the %zd %s regions, removing %zd regions", total_budget_in_region_units[kind], - kind_name[kind], - num_regions_to_decommit[kind])); + free_region_kind_name[kind], + balance)); - if (num_regions_to_decommit[kind] > 0) + if (balance_to_decommit > 0) { // remember how many regions we had on the decommit list already due to aging size_t num_regions_to_decommit_before = global_regions_to_decommit[kind].get_num_free_regions(); // put the highest regions on the decommit list - global_region_allocator.move_highest_free_regions (num_regions_to_decommit[kind]*region_factor[kind], + global_region_allocator.move_highest_free_regions (balance_to_decommit * region_factor[kind], kind == basic_free_region, global_regions_to_decommit); dprintf (REGIONS_LOG, ("Moved %zd %s regions to decommit list", - global_regions_to_decommit[kind].get_num_free_regions(), kind_name[kind])); + global_regions_to_decommit[kind].get_num_free_regions(), free_region_kind_name[kind])); if (kind == basic_free_region) { - // we should now have num_regions_to_decommit[kind] regions more on the decommit list + // we should now have 'balance' regions more on the decommit list assert (global_regions_to_decommit[kind].get_num_free_regions() == - num_regions_to_decommit_before + (size_t)num_regions_to_decommit[kind]); + num_regions_to_decommit_before + (size_t)balance_to_decommit); } else { dprintf (REGIONS_LOG, ("Moved %zd %s regions to decommit list", - global_regions_to_decommit[huge_free_region].get_num_free_regions(), kind_name[huge_free_region])); + global_regions_to_decommit[huge_free_region].get_num_free_regions(), free_region_kind_name[huge_free_region])); // cannot assert we moved any regions because there may be a single huge region with more than we want to decommit } @@ -13575,7 +13582,7 @@ void gc_heap::distribute_free_regions() } } - for (int kind = basic_free_region; kind < kind_count; kind++) + for (int kind = basic_free_region; kind < count_distributed_free_region_kinds; kind++) { #ifdef MULTIPLE_HEAPS // now go through all the heaps and remove any free regions above the target count @@ -13583,16 +13590,16 @@ void gc_heap::distribute_free_regions() { gc_heap* hp = g_heaps[i]; - if (hp->free_regions[kind].get_num_free_regions() > heap_budget_in_region_units[i][kind]) + if (hp->free_regions[kind].get_num_free_regions() > heap_budget_in_region_units[kind][i]) { dprintf (REGIONS_LOG, ("removing %zd %s regions from heap %d with %zd regions, budget is %zd", - hp->free_regions[kind].get_num_free_regions() - heap_budget_in_region_units[i][kind], - kind_name[kind], + hp->free_regions[kind].get_num_free_regions() - heap_budget_in_region_units[kind][i], + free_region_kind_name[kind], i, hp->free_regions[kind].get_num_free_regions(), - heap_budget_in_region_units[i][kind])); + heap_budget_in_region_units[kind][i])); - remove_surplus_regions (&hp->free_regions[kind], &surplus_regions[kind], heap_budget_in_region_units[i][kind]); + trim_region_list (&surplus_regions[kind], &hp->free_regions[kind], heap_budget_in_region_units[kind][i]); } } // finally go through all the heaps and distribute any surplus regions to heaps having too few free regions @@ -13606,15 +13613,15 @@ void gc_heap::distribute_free_regions() #endif //MULTIPLE_HEAPS // second pass: fill all the regions having less than budget - if (hp->free_regions[kind].get_num_free_regions() < heap_budget_in_region_units[i][kind]) + if (hp->free_regions[kind].get_num_free_regions() < heap_budget_in_region_units[kind][i]) { - int64_t num_added_regions = add_regions (&hp->free_regions[kind], &surplus_regions[kind], heap_budget_in_region_units[i][kind]); + int64_t num_added_regions = grow_region_list (&hp->free_regions[kind], &surplus_regions[kind], heap_budget_in_region_units[kind][i]); dprintf (REGIONS_LOG, ("added %zd %s regions to heap %d - now has %zd, budget is %zd", (size_t)num_added_regions, - kind_name[kind], + free_region_kind_name[kind], i, hp->free_regions[kind].get_num_free_regions(), - heap_budget_in_region_units[i][kind])); + heap_budget_in_region_units[kind][i])); } hp->free_regions[kind].sort_by_committed_and_age(); } @@ -13626,7 +13633,221 @@ void gc_heap::distribute_free_regions() } } + decide_on_decommit_strategy(aggressive_decommit_large_p); +} + +void gc_heap::move_all_aged_regions(size_t total_num_free_regions[count_distributed_free_region_kinds], region_free_list aged_regions[count_free_region_kinds], bool joined_last_gc_before_oom) +{ + move_aged_regions(aged_regions, global_free_huge_regions, huge_free_region, joined_last_gc_before_oom); + #ifdef MULTIPLE_HEAPS + for (int i = 0; i < n_heaps; i++) + { + gc_heap* hp = g_heaps[i]; +#else //MULTIPLE_HEAPS + { + gc_heap* hp = pGenGCHeap; +#endif //MULTIPLE_HEAPS + + for (int kind = basic_free_region; kind < count_distributed_free_region_kinds; kind++) + { + move_aged_regions(aged_regions, hp->free_regions[kind], static_cast(kind), joined_last_gc_before_oom); + total_num_free_regions[kind] += hp->free_regions[kind].get_num_free_regions(); + } + } +} + +void gc_heap::move_aged_regions(region_free_list dest[count_free_region_kinds], region_free_list& src, free_region_kind kind, bool joined_last_gc_before_oom) +{ + heap_segment* next_region = nullptr; + for (heap_segment* region = src.get_first_free_region(); region != nullptr; region = next_region) + { + next_region = heap_segment_next (region); + // when we are about to get OOM, we'd like to discount the free regions that just have the initial page commit as they are not useful + if (aged_region_p(region, kind) || + ((get_region_committed_size (region) == GC_PAGE_SIZE) && joined_last_gc_before_oom)) + { + region_free_list::unlink_region (region); + region_free_list::add_region (region, dest); + } + } +} + +bool gc_heap::aged_region_p(heap_segment* region, free_region_kind kind) +{ +#ifndef MULTIPLE_HEAPS + const int n_heaps = 1; +#endif + + int age_in_free_to_decommit; + switch (kind) + { + case basic_free_region: + age_in_free_to_decommit = max(AGE_IN_FREE_TO_DECOMMIT_BASIC, n_heaps); + break; + case large_free_region: + age_in_free_to_decommit = AGE_IN_FREE_TO_DECOMMIT_LARGE; + break; + case huge_free_region: + age_in_free_to_decommit = AGE_IN_FREE_TO_DECOMMIT_HUGE; + break; + default: + assert(!"unexpected kind"); + age_in_free_to_decommit = 0; + } + + age_in_free_to_decommit = min (age_in_free_to_decommit, MAX_AGE_IN_FREE); + return (heap_segment_age_in_free (region) >= age_in_free_to_decommit); +} + +void gc_heap::move_regions_to_decommit(region_free_list regions[count_free_region_kinds]) +{ + for (int kind = basic_free_region; kind < count_free_region_kinds; kind++) + { + dprintf (1, ("moved %2zd %s regions (%8zd) to decommit based on time", + regions[kind].get_num_free_regions(), free_region_kind_name[kind], regions[kind].get_size_committed_in_free())); + } + for (int kind = basic_free_region; kind < count_free_region_kinds; kind++) + { + heap_segment* next_region = nullptr; + for (heap_segment* region = regions[kind].get_first_free_region(); region != nullptr; region = next_region) + { + next_region = heap_segment_next (region); + dprintf (REGIONS_LOG, ("region %p age %2d, decommit", + heap_segment_mem (region), heap_segment_age_in_free (region))); + region_free_list::unlink_region (region); + region_free_list::add_region (region, global_regions_to_decommit); + } + } + for (int kind = basic_free_region; kind < count_free_region_kinds; kind++) + { + assert(regions[kind].get_num_free_regions() == 0); + } +} + +size_t gc_heap::compute_basic_region_budgets( + size_t heap_basic_budget_in_region_units[MAX_SUPPORTED_CPUS], + size_t min_heap_basic_budget_in_region_units[MAX_SUPPORTED_CPUS], + size_t total_basic_free_regions) +{ + const size_t region_size = global_region_allocator.get_region_alignment(); + size_t total_budget_in_region_units = 0; + + for (int gen = soh_gen0; gen <= max_generation; gen++) + { + if (total_budget_in_region_units >= total_basic_free_regions) + { + // don't accumulate budget from higher soh generations if we cannot cover lower ones + dprintf (REGIONS_LOG, ("out of free regions - skipping gen %d budget = %zd >= avail %zd", + gen, + total_budget_in_region_units, + total_basic_free_regions)); + break; + } + +#ifdef MULTIPLE_HEAPS + for (int i = 0; i < n_heaps; i++) + { + gc_heap* hp = g_heaps[i]; +#else //MULTIPLE_HEAPS + { + gc_heap* hp = pGenGCHeap; + // just to reduce the number of #ifdefs in the code below + const int i = 0; +#endif //MULTIPLE_HEAPS + ptrdiff_t budget_gen = max (hp->estimate_gen_growth (gen), (ptrdiff_t)0); + size_t budget_gen_in_region_units = (budget_gen + (region_size - 1)) / region_size; + dprintf (REGIONS_LOG, ("h%2d gen %d has an estimated growth of %zd bytes (%zd regions)", i, gen, budget_gen, budget_gen_in_region_units)); + + // preserve the budget for the previous generation - we should not go below that + min_heap_basic_budget_in_region_units[i] = heap_basic_budget_in_region_units[i]; + + heap_basic_budget_in_region_units[i] += budget_gen_in_region_units; + total_budget_in_region_units += budget_gen_in_region_units; + } + } + + return total_budget_in_region_units; +} + +bool gc_heap::near_heap_hard_limit_p() +{ + if (heap_hard_limit) + { + int current_percent_heap_hard_limit = (int)((float)current_total_committed * 100.0 / (float)heap_hard_limit); + dprintf (REGIONS_LOG, ("committed %zd is %d%% of limit %zd", + current_total_committed, current_percent_heap_hard_limit, heap_hard_limit)); + if (current_percent_heap_hard_limit >= 90) + { + return true; + } + } + + return false; +} + +bool gc_heap::distribute_surplus_p(ptrdiff_t balance, int kind, bool aggressive_decommit_large_p) +{ + if (balance < 0) + { + return true; + } + + if (kind == basic_free_region) + { +#ifdef BACKGROUND_GC + // This is detecting FGCs that run during BGCs. It is not detecting ephemeral GCs that + // (possibly) run right before a BGC as background_running_p() is not yet true at that point. + return (background_running_p() && (settings.condemned_generation != max_generation)); +#else + return false; +#endif + } + + return !aggressive_decommit_large_p; +} + +void gc_heap::decide_on_decommit_strategy(bool joined_last_gc_before_oom) +{ +#ifdef MULTIPLE_HEAPS + if (joined_last_gc_before_oom || g_low_memory_status) + { + dprintf (REGIONS_LOG, ("low memory - decommitting everything (last_gc_before_oom=%d, g_low_memory_status=%d)", joined_last_gc_before_oom, g_low_memory_status)); + + while (decommit_step(DECOMMIT_TIME_STEP_MILLISECONDS)) + { + } + return; + } + + ptrdiff_t size_to_decommit_for_heap_hard_limit = 0; + if (heap_hard_limit) + { + size_to_decommit_for_heap_hard_limit = (ptrdiff_t)(current_total_committed - (heap_hard_limit * (MAX_ALLOWED_MEM_LOAD / 100.0f))); + size_to_decommit_for_heap_hard_limit = max(size_to_decommit_for_heap_hard_limit, (ptrdiff_t)0); + } + + // For the various high memory load situations, we're not using the process size at all. In + // particular, if we had a large process and smaller processes running in the same container, + // then we will treat them the same if the container reaches reaches high_memory_load_th. In + // the future, we could consider additional complexity to try to reclaim more memory from + // larger processes than smaller ones. + ptrdiff_t size_to_decommit_for_physical = 0; + if (settings.entry_memory_load >= high_memory_load_th) + { + size_t entry_used_physical_mem = total_physical_mem - entry_available_physical_mem; + size_t goal_used_physical_mem = (size_t)(((almost_high_memory_load_th) / 100.0) * total_physical_mem); + size_to_decommit_for_physical = entry_used_physical_mem - goal_used_physical_mem; + } + + size_t size_to_decommit = max(size_to_decommit_for_heap_hard_limit, size_to_decommit_for_physical); + if (size_to_decommit > 0) + { + dprintf (REGIONS_LOG, ("low memory - decommitting %zd (for heap_hard_limit: %zd, for physical: %zd)", size_to_decommit, size_to_decommit_for_heap_hard_limit, size_to_decommit_for_physical)); + + decommit_step(size_to_decommit / DECOMMIT_SIZE_PER_MILLISECOND); + } + for (int kind = basic_free_region; kind < count_free_region_kinds; kind++) { if (global_regions_to_decommit[kind].get_num_free_regions() != 0) @@ -13662,6 +13883,7 @@ void gc_heap::distribute_free_regions() } #endif //MULTIPLE_HEAPS } + #endif //USE_REGIONS #ifdef WRITE_WATCH @@ -14182,6 +14404,11 @@ HRESULT gc_heap::initialize_gc (size_t soh_segment_size, if ((dynamic_adaptation_mode == dynamic_adaptation_to_application_sizes) && (conserve_mem_setting == 0)) conserve_mem_setting = 5; + +#ifdef STRESS_DYNAMIC_HEAP_COUNT + bgc_to_ngc2_ratio = (int)GCConfig::GetGCDBGCRatio(); + dprintf (1, ("bgc_to_ngc2_ratio is %d", bgc_to_ngc2_ratio)); +#endif #endif //DYNAMIC_HEAP_COUNT if (conserve_mem_setting < 0) @@ -21071,6 +21298,18 @@ int gc_heap::joined_generation_to_condemn (BOOL should_evaluate_elevation, if (!((n == max_generation) && *blocking_collection_p)) { n = max_generation; + +#ifdef STRESS_DYNAMIC_HEAP_COUNT + if (bgc_to_ngc2_ratio) + { + int r = (int)gc_rand::get_rand ((bgc_to_ngc2_ratio + 1) * 10); + dprintf (6666, ("%d - making this full GC %s", r, ((r < 10) ? "NGC2" : "BGC"))); + if (r < 10) + { + *blocking_collection_p = TRUE; + } + } +#endif //STRESS_DYNAMIC_HEAP_COUNT } } } @@ -24332,12 +24571,37 @@ void gc_heap::garbage_collect (int n) size_t saved_bgc_th_count_creation_failed = bgc_th_count_creation_failed; #endif //DYNAMIC_HEAP_COUNT + // This is the count of threads that GCToEEInterface::CreateThread reported successful for. + int total_bgc_threads_running = 0; for (int i = 0; i < n_heaps; i++) { - prepare_bgc_thread (g_heaps[i]); + gc_heap* hp = g_heaps[i]; + if (prepare_bgc_thread (hp)) + { + assert (hp->bgc_thread_running); + if (!hp->bgc_thread_running) + { + dprintf (6666, ("h%d prepare succeeded but running is still false!", i)); + GCToOSInterface::DebugBreak(); + } + total_bgc_threads_running++; + } + else + { + break; + } } #ifdef DYNAMIC_HEAP_COUNT + // Even if we don't do a BGC, we need to record how many threads were successfully created because those will + // be running. + total_bgc_threads = max (total_bgc_threads, total_bgc_threads_running); + + if (total_bgc_threads_running != n_heaps) + { + dprintf (6666, ("wanted to have %d BGC threads but only have %d", n_heaps, total_bgc_threads_running)); + } + add_to_bgc_th_creation_history (current_gc_index, (bgc_th_count_created - saved_bgc_th_count_created), (bgc_th_count_created_th_existed - saved_bgc_th_count_created_th_existed), @@ -24369,7 +24633,15 @@ void gc_heap::garbage_collect (int n) for (int i = 0; i < n_heaps; i++) { gc_heap* hp = g_heaps[i]; - if (!(hp->bgc_thread) || !hp->commit_mark_array_bgc_init()) + + if (!(hp->bgc_thread_running)) + { + assert (!(hp->bgc_thread)); + } + + // In theory we could be in a situation where bgc_thread_running is false but bgc_thread is non NULL. We don't + // support this scenario so don't do a BGC. + if (!(hp->bgc_thread_running && hp->bgc_thread && hp->commit_mark_array_bgc_init())) { do_concurrent_p = FALSE; break; @@ -24389,8 +24661,37 @@ void gc_heap::garbage_collect (int n) } #endif //MULTIPLE_HEAPS +#ifdef DYNAMIC_HEAP_COUNT + dprintf (6666, ("last BGC saw %d heaps and %d total threads, currently %d heaps and %d total threads, %s BGC", + last_bgc_n_heaps, last_total_bgc_threads, n_heaps, total_bgc_threads, (do_concurrent_p ? "doing" : "not doing"))); +#endif //DYNAMIC_HEAP_COUNT + if (do_concurrent_p) { +#ifdef DYNAMIC_HEAP_COUNT + int diff = n_heaps - last_bgc_n_heaps; + if (diff > 0) + { + int saved_idle_bgc_thread_count = dynamic_heap_count_data.idle_bgc_thread_count; + int max_idle_event_count = min (n_heaps, last_total_bgc_threads); + int idle_events_to_set = max_idle_event_count - last_bgc_n_heaps; + if (idle_events_to_set > 0) + { + Interlocked::ExchangeAdd (&dynamic_heap_count_data.idle_bgc_thread_count, -idle_events_to_set); + dprintf (6666, ("%d BGC threads exist, setting %d idle events for h%d-h%d, total idle %d -> %d", + total_bgc_threads, idle_events_to_set, last_bgc_n_heaps, (last_bgc_n_heaps + idle_events_to_set - 1), + saved_idle_bgc_thread_count, VolatileLoadWithoutBarrier (&dynamic_heap_count_data.idle_bgc_thread_count))); + for (int heap_idx = last_bgc_n_heaps; heap_idx < max_idle_event_count; heap_idx++) + { + g_heaps[heap_idx]->bgc_idle_thread_event.Set(); + } + } + } + + last_bgc_n_heaps = n_heaps; + last_total_bgc_threads = total_bgc_threads; +#endif //DYNAMIC_HEAP_COUNT + #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP SoftwareWriteWatch::EnableForGCHeap(); #endif //FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP @@ -25918,9 +26219,6 @@ void gc_heap::check_heap_count () for (int heap_idx = n_heaps; heap_idx < new_n_heaps; heap_idx++) { g_heaps[heap_idx]->gc_idle_thread_event.Set(); -#ifdef BACKGROUND_GC - g_heaps[heap_idx]->bgc_idle_thread_event.Set(); -#endif //BACKGROUND_GC } } @@ -37637,6 +37935,19 @@ void gc_heap::gc_thread_stub (void* arg) void gc_heap::bgc_thread_stub (void* arg) { gc_heap* heap = (gc_heap*)arg; + +#ifdef STRESS_DYNAMIC_HEAP_COUNT + // We should only do this every so often; otherwise we'll never be able to do a BGC + int r = (int)gc_rand::get_rand (30); + bool wait_p = (r < 10); + + if (wait_p) + { + GCToOSInterface::Sleep (100); + } + dprintf (6666, ("h%d %s", heap->heap_number, (wait_p ? "waited" : "did not wait"))); +#endif + heap->bgc_thread = GCToEEInterface::GetThread(); assert(heap->bgc_thread != nullptr); heap->bgc_thread_function(); @@ -38380,6 +38691,16 @@ void gc_heap::background_mark_phase () if (bgc_t_join.joined()) #endif //MULTIPLE_HEAPS { +#ifdef USE_REGIONS + // There's no need to distribute a second time if we just did an ephemeral GC, and we don't want to + // age the free regions twice. + if (!do_ephemeral_gc_p) + { + distribute_free_regions (); + age_free_regions ("BGC"); + } +#endif //USE_REGIONS + #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP // Resetting write watch for software write watch is pretty fast, much faster than for hardware write watch. Reset // can be done while the runtime is suspended or after the runtime is restarted, the preference was to reset while @@ -39429,6 +39750,8 @@ void gc_heap::add_to_bgc_th_creation_history (size_t gc_index, size_t count_crea } #endif //DYNAMIC_HEAP_COUNT +// If this returns TRUE, we are saying we expect that thread to be there. However, when that thread is available to work is indeterministic. +// But when we actually start a BGC, naturally we'll need to wait till it gets to the point it can work. BOOL gc_heap::prepare_bgc_thread(gc_heap* gh) { BOOL success = FALSE; @@ -39440,7 +39763,19 @@ BOOL gc_heap::prepare_bgc_thread(gc_heap* gh) dprintf (2, ("GC thread not running")); if (gh->bgc_thread == 0) { +#ifdef STRESS_DYNAMIC_HEAP_COUNT + // to stress, we just don't actually try to create the thread to simulate a failure + int r = (int)gc_rand::get_rand (100); + bool try_to_create_p = (r > 10); + BOOL thread_created_p = (try_to_create_p ? create_bgc_thread (gh) : FALSE); + if (!thread_created_p) + { + dprintf (6666, ("h%d we failed to create the thread, %s", gh->heap_number, (try_to_create_p ? "tried" : "didn't try"))); + } + if (thread_created_p) +#else //STRESS_DYNAMIC_HEAP_COUNT if (create_bgc_thread(gh)) +#endif //STRESS_DYNAMIC_HEAP_COUNT { success = TRUE; thread_created = TRUE; @@ -39458,8 +39793,11 @@ BOOL gc_heap::prepare_bgc_thread(gc_heap* gh) else { #ifdef DYNAMIC_HEAP_COUNT + // This would be a very unusual scenario where GCToEEInterface::CreateThread told us it failed yet the thread was created. bgc_th_count_created_th_existed++; + dprintf (6666, ("h%d we cannot have a thread that runs yet CreateThread reported it failed to create it", gh->heap_number)); #endif //DYNAMIC_HEAP_COUNT + assert (!"GCToEEInterface::CreateThread returned FALSE yet the thread was created!"); } } else @@ -39657,7 +39995,7 @@ void gc_heap::bgc_thread_function() while (1) { // Wait for work to do... - dprintf (3, ("bgc thread: waiting...")); + dprintf (6666, ("h%d bgc thread: waiting...", heap_number)); cooperative_mode = enable_preemptive (); //current_thread->m_fPreemptiveGCDisabled = 0; @@ -39706,36 +40044,71 @@ void gc_heap::bgc_thread_function() continue; } } + +#ifdef STRESS_DYNAMIC_HEAP_COUNT + if (n_heaps <= heap_number) + { + uint32_t delay_ms = (uint32_t)gc_rand::get_rand (200); + GCToOSInterface::Sleep (delay_ms); + } +#endif //STRESS_DYNAMIC_HEAP_COUNT + // if we signal the thread with no concurrent work to do -> exit if (!settings.concurrent) { - dprintf (3, ("no concurrent GC needed, exiting")); + dprintf (6666, ("h%d no concurrent GC needed, exiting", heap_number)); + +#ifdef STRESS_DYNAMIC_HEAP_COUNT + flush_gc_log (true); + GCToOSInterface::DebugBreak(); +#endif break; } - gc_background_running = TRUE; - dprintf (2, (ThreadStressLog::gcStartBgcThread(), heap_number, - generation_free_list_space (generation_of (max_generation)), - generation_free_obj_space (generation_of (max_generation)), - dd_fragmentation (dynamic_data_of (max_generation)))); #ifdef DYNAMIC_HEAP_COUNT if (n_heaps <= heap_number) { + Interlocked::Increment (&dynamic_heap_count_data.idle_bgc_thread_count); add_to_bgc_hc_history (hc_record_bgc_inactive); // this is the case where we have more background GC threads than heaps // - wait until we're told to continue... - dprintf (9999, ("BGC thread %d idle (%d heaps) (gc%Id)", heap_number, n_heaps, VolatileLoadWithoutBarrier (&settings.gc_index))); + dprintf (6666, ("BGC%Id h%d going idle (%d heaps), idle count is now %d", + VolatileLoadWithoutBarrier (&settings.gc_index), heap_number, n_heaps, VolatileLoadWithoutBarrier (&dynamic_heap_count_data.idle_bgc_thread_count))); bgc_idle_thread_event.Wait(INFINITE, FALSE); - dprintf (9999, ("BGC thread %d waking from idle (%d heaps) (gc%Id)", heap_number, n_heaps, VolatileLoadWithoutBarrier (&settings.gc_index))); + dprintf (6666, ("BGC%Id h%d woke from idle (%d heaps), idle count is now %d", + VolatileLoadWithoutBarrier (&settings.gc_index), heap_number, n_heaps, VolatileLoadWithoutBarrier (&dynamic_heap_count_data.idle_bgc_thread_count))); continue; } else { + if (heap_number == 0) + { + const int spin_count = 1024; + int idle_bgc_thread_count = total_bgc_threads - n_heaps; + dprintf (6666, ("n_heaps %d, total %d bgc threads, bgc idle should be %d and is %d", + n_heaps, total_bgc_threads, idle_bgc_thread_count, VolatileLoadWithoutBarrier (&dynamic_heap_count_data.idle_bgc_thread_count))); + if (idle_bgc_thread_count != dynamic_heap_count_data.idle_bgc_thread_count) + { + dprintf (6666, ("current idle is %d, trying to get to %d", + VolatileLoadWithoutBarrier (&dynamic_heap_count_data.idle_bgc_thread_count), idle_bgc_thread_count)); + spin_and_wait (spin_count, (idle_bgc_thread_count == dynamic_heap_count_data.idle_bgc_thread_count)); + } + } + add_to_bgc_hc_history (hc_record_bgc_active); } #endif //DYNAMIC_HEAP_COUNT + if (heap_number == 0) + { + gc_background_running = TRUE; + dprintf (6666, (ThreadStressLog::gcStartBgcThread(), heap_number, + generation_free_list_space (generation_of (max_generation)), + generation_free_obj_space (generation_of (max_generation)), + dd_fragmentation (dynamic_data_of (max_generation)))); + } + gc1(); #ifndef DOUBLY_LINKED_FL @@ -53224,7 +53597,7 @@ bool gc_heap::compute_memory_settings(bool is_initialization, uint32_t& nhp, uin if (highmem_th_from_config) { high_memory_load_th = min (99u, highmem_th_from_config); - v_high_memory_load_th = min (99u, (highmem_th_from_config + 7)); + v_high_memory_load_th = min (99u, (high_memory_load_th + 7)); #ifdef FEATURE_EVENT_TRACE high_mem_percent_from_config = highmem_th_from_config; #endif //FEATURE_EVENT_TRACE @@ -53249,6 +53622,7 @@ bool gc_heap::compute_memory_settings(bool is_initialization, uint32_t& nhp, uin } m_high_memory_load_th = min ((high_memory_load_th + 5), v_high_memory_load_th); + almost_high_memory_load_th = (high_memory_load_th > 5) ? (high_memory_load_th - 5) : 1; // avoid underflow of high_memory_load_th - 5 return true; } diff --git a/src/coreclr/gc/gcconfig.h b/src/coreclr/gc/gcconfig.h index 6952355a677bd2..c74a3b1f286ab7 100644 --- a/src/coreclr/gc/gcconfig.h +++ b/src/coreclr/gc/gcconfig.h @@ -142,8 +142,9 @@ class GCConfigStringHolder INT_CONFIG (GCSpinCountUnit, "GCSpinCountUnit", NULL, 0, "Specifies the spin count unit used by the GC.") \ INT_CONFIG (GCDynamicAdaptationMode, "GCDynamicAdaptationMode", "System.GC.DynamicAdaptationMode", 1, "Enable the GC to dynamically adapt to application sizes.") \ INT_CONFIG (GCDTargetTCP, "GCDTargetTCP", "System.GC.DTargetTCP", 0, "Specifies the target tcp for DATAS") \ - BOOL_CONFIG (GCLogBGCThreadId, "GCLogBGCThreadId", NULL, false, "Specifies if BGC ThreadId should be logged") - + INT_CONFIG (GCDBGCRatio, " GCDBGCRatio", NULL, 0, "Specifies the ratio of BGC to NGC2 for HC change") \ + BOOL_CONFIG (GCLogBGCThreadId, "GCLogBGCThreadId", NULL, false, "Specifies if BGC ThreadId should be logged") \ + BOOL_CONFIG (GCCacheSizeFromSysConf, "GCCacheSizeFromSysConf", NULL, false, "Specifies using sysconf to retrieve the last level cache size for Unix.") // This class is responsible for retreiving configuration information // for how the GC should operate. diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index 9486645259936a..fbbb5847b96830 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -1416,14 +1416,19 @@ enum interesting_data_point #ifdef USE_REGIONS enum free_region_kind { - basic_free_region, - large_free_region, - huge_free_region, - count_free_region_kinds, + basic_free_region = 0, + large_free_region = 1, + count_distributed_free_region_kinds = 2, + huge_free_region = 2, + count_free_region_kinds = 3, }; static_assert(count_free_region_kinds == FREE_REGION_KINDS, "Keep count_free_region_kinds in sync with FREE_REGION_KINDS, changing this is not a version breaking change."); +#ifdef TRACE_GC +static const char * const free_region_kind_name[count_free_region_kinds] = { "basic", "large", "huge"}; +#endif // TRACE_GC + class region_free_list { size_t num_free_regions; @@ -1732,6 +1737,14 @@ class gc_heap PER_HEAP_ISOLATED_METHOD void compute_gc_and_ephemeral_range (int condemned_gen_number, bool end_of_gc_p); PER_HEAP_ISOLATED_METHOD void distribute_free_regions(); + PER_HEAP_ISOLATED_METHOD void move_all_aged_regions(size_t total_num_free_regions[count_distributed_free_region_kinds], region_free_list aged_regions[count_free_region_kinds], bool joined_last_gc_before_oom); + PER_HEAP_ISOLATED_METHOD void move_aged_regions(region_free_list dest[count_free_region_kinds], region_free_list& src, free_region_kind kind, bool joined_last_gc_before_oom); + PER_HEAP_ISOLATED_METHOD bool aged_region_p(heap_segment* region, free_region_kind kind); + PER_HEAP_ISOLATED_METHOD void move_regions_to_decommit(region_free_list oregions[count_free_region_kinds]); + PER_HEAP_ISOLATED_METHOD size_t compute_basic_region_budgets(size_t heap_basic_budget_in_region_units[MAX_SUPPORTED_CPUS], size_t min_heap_basic_budget_in_region_units[MAX_SUPPORTED_CPUS], size_t total_basic_free_regions); + PER_HEAP_ISOLATED_METHOD bool near_heap_hard_limit_p(); + PER_HEAP_ISOLATED_METHOD bool distribute_surplus_p(ptrdiff_t balance, int kind, bool aggressive_decommit_large_p); + PER_HEAP_ISOLATED_METHOD void decide_on_decommit_strategy(bool joined_last_gc_before_oom); PER_HEAP_ISOLATED_METHOD void age_free_regions (const char* msg); @@ -5175,6 +5188,9 @@ class gc_heap int last_n_heaps; // don't start a GC till we see (n_max_heaps - new_n_heaps) number of threads idling VOLATILE(int32_t) idle_thread_count; +#ifdef BACKGROUND_GC + VOLATILE(int32_t) idle_bgc_thread_count; +#endif bool init_only_p; bool should_change_heap_count; @@ -5202,6 +5218,17 @@ class gc_heap // This is set when change_heap_count wants the next GC to be a BGC for rethreading gen2 FL // and reset during that BGC. PER_HEAP_ISOLATED_FIELD_MAINTAINED bool trigger_bgc_for_rethreading_p; + // BGC threads are created on demand but we don't destroy the ones we created. This + // is to track how many we've created. They may or may not be active depending on + // if they are needed. + PER_HEAP_ISOLATED_FIELD_MAINTAINED int total_bgc_threads; + + // HC last BGC observed. + PER_HEAP_ISOLATED_FIELD_MAINTAINED int last_bgc_n_heaps; + // Number of total BGC threads last BGC observed. This tells us how many new BGC threads have + // been created since. Note that just because a BGC thread is created doesn't mean it's used. + // We can fail at committing mark array and not proceed with the BGC. + PER_HEAP_ISOLATED_FIELD_MAINTAINED int last_total_bgc_threads; #endif //BACKGROUND_GC #endif //DYNAMIC_HEAP_COUNT @@ -5221,6 +5248,7 @@ class gc_heap PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint32_t high_memory_load_th; PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint32_t m_high_memory_load_th; PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint32_t v_high_memory_load_th; + PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint32_t almost_high_memory_load_th; PER_HEAP_ISOLATED_FIELD_INIT_ONLY bool is_restricted_physical_mem; PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint64_t mem_one_percent; PER_HEAP_ISOLATED_FIELD_INIT_ONLY uint64_t total_physical_mem; @@ -5352,6 +5380,9 @@ class gc_heap #ifdef DYNAMIC_HEAP_COUNT PER_HEAP_ISOLATED_FIELD_INIT_ONLY int dynamic_adaptation_mode; +#ifdef STRESS_DYNAMIC_HEAP_COUNT + PER_HEAP_ISOLATED_FIELD_INIT_ONLY int bgc_to_ngc2_ratio; +#endif //STRESS_DYNAMIC_HEAP_COUNT #endif //DYNAMIC_HEAP_COUNT /********************************************/ @@ -6189,7 +6220,9 @@ class heap_segment // GCs. We stop at 99. It's initialized to 0 when a region is added to // the region's free list. #define MAX_AGE_IN_FREE 99 - #define AGE_IN_FREE_TO_DECOMMIT 20 + #define AGE_IN_FREE_TO_DECOMMIT_BASIC 20 + #define AGE_IN_FREE_TO_DECOMMIT_LARGE 5 + #define AGE_IN_FREE_TO_DECOMMIT_HUGE 2 int age_in_free; // This is currently only used by regions that are swept in plan - // we then thread this list onto the generation's free list. diff --git a/src/coreclr/gc/sample/CMakeLists.txt b/src/coreclr/gc/sample/CMakeLists.txt index 1f297fd2313329..be894bf5d81be9 100644 --- a/src/coreclr/gc/sample/CMakeLists.txt +++ b/src/coreclr/gc/sample/CMakeLists.txt @@ -36,6 +36,7 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32) ../vxsort/smallsort/bitonic_sort.AVX512.int64_t.generated.cpp ../vxsort/smallsort/bitonic_sort.AVX512.int32_t.generated.cpp ../vxsort/smallsort/avx2_load_mask_tables.cpp + ${CLR_SRC_NATIVE_DIR}/minipal/cpufeatures.c ) endif (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32) diff --git a/src/coreclr/gc/unix/CMakeLists.txt b/src/coreclr/gc/unix/CMakeLists.txt index 83c0bf8a67d8b4..f88b039609881e 100644 --- a/src/coreclr/gc/unix/CMakeLists.txt +++ b/src/coreclr/gc/unix/CMakeLists.txt @@ -1,5 +1,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories("../env") +include_directories("..") include(configure.cmake) diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp index 879397c4493c40..7c2101431c9128 100644 --- a/src/coreclr/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/gc/unix/gcenv.unix.cpp @@ -18,8 +18,10 @@ #include "gcenv.structs.h" #include "gcenv.base.h" #include "gcenv.os.h" +#include "gcenv.ee.h" #include "gcenv.unix.inl" #include "volatile.h" +#include "gcconfig.h" #include "numasupport.h" #if HAVE_SWAPCTL @@ -862,10 +864,10 @@ bool ReadMemoryValueFromFile(const char* filename, uint64_t* val) return result; } -static size_t GetLogicalProcessorCacheSizeFromOS() +static void GetLogicalProcessorCacheSizeFromSysConf(size_t* cacheLevel, size_t* cacheSize) { - size_t cacheLevel = 0; - size_t cacheSize = 0; + assert (cacheLevel != nullptr); + assert (cacheSize != nullptr); #if defined(_SC_LEVEL1_DCACHE_SIZE) || defined(_SC_LEVEL2_CACHE_SIZE) || defined(_SC_LEVEL3_CACHE_SIZE) || defined(_SC_LEVEL4_CACHE_SIZE) const int cacheLevelNames[] = @@ -881,47 +883,105 @@ static size_t GetLogicalProcessorCacheSizeFromOS() long size = sysconf(cacheLevelNames[i]); if (size > 0) { - cacheSize = (size_t)size; - cacheLevel = i + 1; + *cacheSize = (size_t)size; + *cacheLevel = i + 1; break; } } #endif +} + +static void GetLogicalProcessorCacheSizeFromSysFs(size_t* cacheLevel, size_t* cacheSize) +{ + assert (cacheLevel != nullptr); + assert (cacheSize != nullptr); #if defined(TARGET_LINUX) && !defined(HOST_ARM) && !defined(HOST_X86) - if (cacheSize == 0) + // + // Retrieve cachesize via sysfs by reading the file /sys/devices/system/cpu/cpu0/cache/index{LastLevelCache}/size + // for the platform. Currently musl and arm64 should be only cases to use + // this method to determine cache size. + // + size_t level; + char path_to_size_file[] = "/sys/devices/system/cpu/cpu0/cache/index-/size"; + char path_to_level_file[] = "/sys/devices/system/cpu/cpu0/cache/index-/level"; + int index = 40; + assert(path_to_size_file[index] == '-'); + assert(path_to_level_file[index] == '-'); + + for (int i = 0; i < 5; i++) { - // - // Fallback to retrieve cachesize via /sys/.. if sysconf was not available - // for the platform. Currently musl and arm64 should be only cases to use - // this method to determine cache size. - // - size_t level; - char path_to_size_file[] = "/sys/devices/system/cpu/cpu0/cache/index-/size"; - char path_to_level_file[] = "/sys/devices/system/cpu/cpu0/cache/index-/level"; - int index = 40; - assert(path_to_size_file[index] == '-'); - assert(path_to_level_file[index] == '-'); - - for (int i = 0; i < 5; i++) - { - path_to_size_file[index] = (char)(48 + i); + path_to_size_file[index] = (char)(48 + i); - uint64_t cache_size_from_sys_file = 0; + uint64_t cache_size_from_sys_file = 0; - if (ReadMemoryValueFromFile(path_to_size_file, &cache_size_from_sys_file)) - { - cacheSize = std::max(cacheSize, (size_t)cache_size_from_sys_file); + if (ReadMemoryValueFromFile(path_to_size_file, &cache_size_from_sys_file)) + { + *cacheSize = std::max(*cacheSize, (size_t)cache_size_from_sys_file); - path_to_level_file[index] = (char)(48 + i); - if (ReadMemoryValueFromFile(path_to_level_file, &level)) - { - cacheLevel = level; - } + path_to_level_file[index] = (char)(48 + i); + if (ReadMemoryValueFromFile(path_to_level_file, &level)) + { + *cacheLevel = level; } } } +#endif +} + +static void GetLogicalProcessorCacheSizeFromHeuristic(size_t* cacheLevel, size_t* cacheSize) +{ + assert (cacheLevel != nullptr); + assert (cacheSize != nullptr); + +#if (defined(TARGET_LINUX) && !defined(TARGET_APPLE)) + { + // Use the following heuristics at best depending on the CPU count + // 1 ~ 4 : 4 MB + // 5 ~ 16 : 8 MB + // 17 ~ 64 : 16 MB + // 65+ : 32 MB + DWORD logicalCPUs = g_processAffinitySet.Count(); + if (logicalCPUs < 5) + { + *cacheSize = 4; + } + else if (logicalCPUs < 17) + { + *cacheSize = 8; + } + else if (logicalCPUs < 65) + { + *cacheSize = 16; + } + else + { + *cacheSize = 32; + } + + *cacheSize *= (1024 * 1024); + } #endif +} + +static size_t GetLogicalProcessorCacheSizeFromOS() +{ + size_t cacheLevel = 0; + size_t cacheSize = 0; + + if (GCConfig::GetGCCacheSizeFromSysConf()) + { + GetLogicalProcessorCacheSizeFromSysConf(&cacheLevel, &cacheSize); + } + + if (cacheSize == 0) + { + GetLogicalProcessorCacheSizeFromSysFs(&cacheLevel, &cacheSize); + if (cacheSize == 0) + { + GetLogicalProcessorCacheSizeFromHeuristic(&cacheLevel, &cacheSize); + } + } #if HAVE_SYSCTLBYNAME if (cacheSize == 0) @@ -948,32 +1008,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS() #if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_APPLE) if (cacheLevel != 3) { - // We expect to get the L3 cache size for Arm64 but currently expected to be missing that info - // from most of the machines. - // Hence, just use the following heuristics at best depending on the CPU count - // 1 ~ 4 : 4 MB - // 5 ~ 16 : 8 MB - // 17 ~ 64 : 16 MB - // 65+ : 32 MB - DWORD logicalCPUs = g_processAffinitySet.Count(); - if (logicalCPUs < 5) - { - cacheSize = 4; - } - else if (logicalCPUs < 17) - { - cacheSize = 8; - } - else if (logicalCPUs < 65) - { - cacheSize = 16; - } - else - { - cacheSize = 32; - } - - cacheSize *= (1024 * 1024); + GetLogicalProcessorCacheSizeFromHeuristic(&cacheLevel, &cacheSize); } #endif diff --git a/src/coreclr/gc/vxsort/isa_detection.cpp b/src/coreclr/gc/vxsort/isa_detection.cpp index 93c7288663c42f..b069c8be9bee04 100644 --- a/src/coreclr/gc/vxsort/isa_detection.cpp +++ b/src/coreclr/gc/vxsort/isa_detection.cpp @@ -2,14 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. #include "common.h" - -#ifdef TARGET_WINDOWS -#include -#include -#endif - #include "do_vxsort.h" +#include + enum class SupportedISA { None = 0, @@ -17,77 +13,12 @@ enum class SupportedISA AVX512F = 1 << (int)InstructionSet::AVX512F }; -#if defined(TARGET_AMD64) && defined(TARGET_WINDOWS) - -SupportedISA DetermineSupportedISA() -{ - // register definitions to make the following code more readable - enum reg - { - EAX = 0, - EBX = 1, - ECX = 2, - EDX = 3, - COUNT = 4 - }; - - // bit definitions to make code more readable - enum bits - { - OCXSAVE = 1<<27, - AVX = 1<<28, - AVX2 = 1<< 5, - AVX512F = 1<<16, - AVX512DQ = 1<<17, - }; - int reg[COUNT]; - - __cpuid(reg, 0); - if (reg[EAX] < 7) - return SupportedISA::None; - - __cpuid(reg, 1); - - // both AVX and OCXSAVE feature flags must be enabled - if ((reg[ECX] & (OCXSAVE|AVX)) != (OCXSAVE | AVX)) - return SupportedISA::None; - - // get xcr0 register - DWORD64 xcr0 = _xgetbv(0); - - // get OS XState info - DWORD64 FeatureMask = GetEnabledXStateFeatures(); - - // get processor extended feature flag info - __cpuidex(reg, 7, 0); - - // check if all of AVX2, AVX512F and AVX512DQ are supported by both processor and OS - if ((reg[EBX] & (AVX2 | AVX512F | AVX512DQ)) == (AVX2 | AVX512F | AVX512DQ) && - (xcr0 & 0xe6) == 0xe6 && - (FeatureMask & (XSTATE_MASK_AVX | XSTATE_MASK_AVX512)) == (XSTATE_MASK_AVX | XSTATE_MASK_AVX512)) - { - return (SupportedISA)((int)SupportedISA::AVX2 | (int)SupportedISA::AVX512F); - } - - // check if AVX2 is supported by both processor and OS - if ((reg[EBX] & AVX2) && - (xcr0 & 0x06) == 0x06 && - (FeatureMask & XSTATE_MASK_AVX) == XSTATE_MASK_AVX) - { - return SupportedISA::AVX2; - } - - return SupportedISA::None; -} - -#elif defined(TARGET_UNIX) - SupportedISA DetermineSupportedISA() { - __builtin_cpu_init(); - if (__builtin_cpu_supports("avx2")) + int cpuFeatures = minipal_getcpufeatures(); + if ((cpuFeatures & XArchIntrinsicConstants_Avx2) != 0) { - if (__builtin_cpu_supports("avx512f")) + if ((cpuFeatures & XArchIntrinsicConstants_Avx512) != 0) return (SupportedISA)((int)SupportedISA::AVX2 | (int)SupportedISA::AVX512F); else return SupportedISA::AVX2; @@ -98,8 +29,6 @@ SupportedISA DetermineSupportedISA() } } -#endif // defined(TARGET_UNIX) - static bool s_initialized; static SupportedISA s_supportedISA; diff --git a/src/coreclr/ildasm/dasm.cpp b/src/coreclr/ildasm/dasm.cpp index f94a5846672d96..7c2b3eabd36597 100644 --- a/src/coreclr/ildasm/dasm.cpp +++ b/src/coreclr/ildasm/dasm.cpp @@ -1914,7 +1914,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr, for(n=0; n < numElements; n++) { if(n) appendStr(out," "); - sprintf_s(str, 64, "%.*g", 8, (double)(*((float*)dataPtr))); + sprintf_s(str, 64, "%#.8g", (double)(*((float*)dataPtr))); float df = (float)atof(str); // Must compare as underlying bytes, not floating point otherwise optimizer will // try to enregister and compare 80-bit precision number with 32-bit precision number!!!! @@ -1933,7 +1933,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr, { if(n) appendStr(out," "); char *pch; - sprintf_s(str, 64, "%.*g", 17, *((double*)dataPtr)); + sprintf_s(str, 64, "%#.17g", *((double*)dataPtr)); double df = strtod(str, &pch); // Must compare as underlying bytes, not floating point otherwise optimizer will // try to enregister and compare 80-bit precision number with 64-bit precision number!!!! @@ -2605,7 +2605,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void case ELEMENT_TYPE_R4: { char szf[32]; - sprintf_s(szf, 32, "%.*g", 8, (double)MDDV.m_fltValue); + sprintf_s(szf, 32, "%#.8g", (double)MDDV.m_fltValue); float df = (float)atof(szf); // Must compare as underlying bytes, not floating point otherwise optimizer will // try to enregister and compare 80-bit precision number with 32-bit precision number!!!! @@ -2619,7 +2619,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void case ELEMENT_TYPE_R8: { char szf[32], *pch; - sprintf_s(szf, 32, "%.*g", 17, MDDV.m_dblValue); + sprintf_s(szf, 32, "%#.17g", MDDV.m_dblValue); double df = strtod(szf, &pch); //atof(szf); szf[31]=0; // Must compare as underlying bytes, not floating point otherwise optimizer will diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 068ee41bbb72a5..cab2f6c71d7447 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -2374,10 +2374,10 @@ class ICorStaticInfo bool fDoubleAlignHint = false ) = 0; - // This is only called for Value classes. It returns a boolean array - // in representing of 'cls' from a GC perspective. The class is - // assumed to be an array of machine words - // (of length // getClassSize(cls) / TARGET_POINTER_SIZE), + // Returns a boolean array representing 'cls' from a GC perspective. + // The class is assumed to be an array of machine words + // (of length getClassSize(cls) / TARGET_POINTER_SIZE for value classes + // and getHeapClassSize(cls) / TARGET_POINTER_SIZE for reference types), // 'gcPtrs' is a pointer to an array of uint8_ts of this length. // getClassGClayout fills in this array so that gcPtrs[i] is set // to one of the CorInfoGCType values which is the GC type of diff --git a/src/coreclr/inc/eetwain.h b/src/coreclr/inc/eetwain.h index c7b1be02e5c638..4ee7b9a7b84b6e 100644 --- a/src/coreclr/inc/eetwain.h +++ b/src/coreclr/inc/eetwain.h @@ -273,6 +273,7 @@ virtual GenericParamContextType GetParamContextType(PREGDISPLAY pContext, */ virtual void * GetGSCookieAddr(PREGDISPLAY pContext, EECodeInfo * pCodeInfo, + unsigned flags, CodeManState * pState) = 0; #ifndef USE_GC_INFO_DECODER @@ -541,6 +542,7 @@ PTR_VOID GetExactGenericsToken(SIZE_T baseStackSlot, virtual void * GetGSCookieAddr(PREGDISPLAY pContext, EECodeInfo * pCodeInfo, + unsigned flags, CodeManState * pState); diff --git a/src/coreclr/interop/trackerobjectmanager.cpp b/src/coreclr/interop/trackerobjectmanager.cpp index d4302054baedba..0df78164906dcc 100644 --- a/src/coreclr/interop/trackerobjectmanager.cpp +++ b/src/coreclr/interop/trackerobjectmanager.cpp @@ -84,7 +84,10 @@ namespace STDMETHODIMP HostServices::ReleaseDisconnectedReferenceSources() { - return InteropLibImports::WaitForRuntimeFinalizerForExternal(); + // We'd like to call InteropLibImports::WaitForRuntimeFinalizerForExternal() here, but this could + // lead to deadlock if the finalizer thread is trying to get back to this thread, because we are + // not pumping anymore. Disable this for now. See: https://github.com/dotnet/runtime/issues/109538. + return S_OK; } STDMETHODIMP HostServices::NotifyEndOfReferenceTrackingOnThread() diff --git a/src/coreclr/jit/assertionprop.cpp b/src/coreclr/jit/assertionprop.cpp index 3d61a698a08d5c..f720ca6c826cba 100644 --- a/src/coreclr/jit/assertionprop.cpp +++ b/src/coreclr/jit/assertionprop.cpp @@ -2211,6 +2211,22 @@ AssertionInfo Compiler::optAssertionGenJtrue(GenTree* tree) // If op1 is lcl and op2 is const or lcl, create assertion. if ((op1->gtOper == GT_LCL_VAR) && (op2->OperIsConst() || (op2->gtOper == GT_LCL_VAR))) // Fix for Dev10 851483 { + // Watch out for cases where long local(s) are implicitly truncated. + // + LclVarDsc* const lcl1Dsc = lvaGetDesc(op1->AsLclVarCommon()); + if ((lcl1Dsc->TypeGet() == TYP_LONG) && (op1->TypeGet() != TYP_LONG)) + { + return NO_ASSERTION_INDEX; + } + if (op2->OperIs(GT_LCL_VAR)) + { + LclVarDsc* const lcl2Dsc = lvaGetDesc(op2->AsLclVarCommon()); + if ((lcl2Dsc->TypeGet() == TYP_LONG) && (op2->TypeGet() != TYP_LONG)) + { + return NO_ASSERTION_INDEX; + } + } + return optCreateJtrueAssertions(op1, op2, assertionKind); } else if (!optLocalAssertionProp) diff --git a/src/coreclr/jit/block.cpp b/src/coreclr/jit/block.cpp index be2ba15e254690..b00dc1282a2900 100644 --- a/src/coreclr/jit/block.cpp +++ b/src/coreclr/jit/block.cpp @@ -267,15 +267,21 @@ FlowEdge* Compiler::BlockPredsWithEH(BasicBlock* blk) // 'blk'. // // Arguments: -// blk - Block to get dominance predecessors for. +// blk - Block to get dominance predecessors for. // // Returns: -// List of edges. +// List of edges. // // Remarks: -// Differs from BlockPredsWithEH only in the treatment of handler blocks; -// enclosed blocks are never dominance preds, while all predecessors of -// blocks in the 'try' are (currently only the first try block expected). +// Differs from BlockPredsWithEH only in the treatment of handler blocks; +// enclosed blocks are never dominance preds, while all predecessors of +// blocks in the 'try' are (currently only the first try block expected). +// +// There are additional complications due to spurious flow because of +// two-pass EH. In the flow graph with EH edges we can see entries into the +// try from filters outside the try, to blocks other than the "try-begin" +// block. Hence we need to consider the full set of blocks in the try region +// when considering the block dominance preds. // FlowEdge* Compiler::BlockDominancePreds(BasicBlock* blk) { @@ -284,14 +290,6 @@ FlowEdge* Compiler::BlockDominancePreds(BasicBlock* blk) return blk->bbPreds; } - EHblkDsc* ehblk = ehGetBlockHndDsc(blk); - if (!ehblk->HasFinallyOrFaultHandler() || (ehblk->ebdHndBeg != blk)) - { - return ehblk->ebdTryBeg->bbPreds; - } - - // Finally/fault handlers can be preceded by enclosing filters due to 2 - // pass EH, so add those and keep them cached. BlockToFlowEdgeMap* domPreds = GetDominancePreds(); FlowEdge* res; if (domPreds->Lookup(blk, &res)) @@ -299,29 +297,11 @@ FlowEdge* Compiler::BlockDominancePreds(BasicBlock* blk) return res; } - res = ehblk->ebdTryBeg->bbPreds; - if (ehblk->HasFinallyOrFaultHandler() && (ehblk->ebdHndBeg == blk)) + EHblkDsc* ehblk = ehGetBlockHndDsc(blk); + res = BlockPredsWithEH(blk); + for (BasicBlock* predBlk : ehblk->ebdTryBeg->PredBlocks()) { - // block is a finally or fault handler; all enclosing filters are predecessors - unsigned enclosing = ehblk->ebdEnclosingTryIndex; - while (enclosing != EHblkDsc::NO_ENCLOSING_INDEX) - { - EHblkDsc* enclosingDsc = ehGetDsc(enclosing); - if (enclosingDsc->HasFilter()) - { - for (BasicBlock* filterBlk = enclosingDsc->ebdFilter; filterBlk != enclosingDsc->ebdHndBeg; - filterBlk = filterBlk->Next()) - { - res = new (this, CMK_FlowEdge) FlowEdge(filterBlk, blk, res); - - assert(filterBlk->VisitEHEnclosedHandlerSecondPassSuccs(this, [blk](BasicBlock* succ) { - return succ == blk ? BasicBlockVisit::Abort : BasicBlockVisit::Continue; - }) == BasicBlockVisit::Abort); - } - } - - enclosing = enclosingDsc->ebdEnclosingTryIndex; - } + res = new (this, CMK_FlowEdge) FlowEdge(predBlk, blk, res); } domPreds->Set(blk, res); diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index 4102d4c7711150..32506047d2269d 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -6268,6 +6268,18 @@ void CodeGen::genCallInstruction(GenTreeCall* call X86_ARG(target_ssize_t stackA { retSize = emitTypeSize(retTypeDesc->GetReturnRegType(0)); secondRetSize = emitTypeSize(retTypeDesc->GetReturnRegType(1)); + + if (retTypeDesc->GetABIReturnReg(1, call->GetUnmanagedCallConv()) == REG_INTRET) + { + // If the second return register is REG_INTRET, then the first + // return is expected to be in a SIMD register. + // The emitter has hardcoded belief that retSize corresponds to + // REG_INTRET and secondRetSize to REG_INTRET_1, so fix up the + // situation here. + assert(!EA_IS_GCREF_OR_BYREF(retSize)); + retSize = secondRetSize; + secondRetSize = EA_UNKNOWN; + } } else { diff --git a/src/coreclr/jit/emitarm64.cpp b/src/coreclr/jit/emitarm64.cpp index 2a5c947de175c5..624a737234fcbb 100644 --- a/src/coreclr/jit/emitarm64.cpp +++ b/src/coreclr/jit/emitarm64.cpp @@ -217,7 +217,6 @@ void emitter::emitInsSanityCheck(instrDesc* id) case IF_BR_1B: // BR_1B ................ ......nnnnn..... Rn if (emitComp->IsTargetAbi(CORINFO_NATIVEAOT_ABI) && id->idIsTlsGD()) { - assert(isGeneralRegister(id->idReg1())); assert(id->idAddr()->iiaAddr != nullptr); } else @@ -9184,11 +9183,14 @@ void emitter::emitIns_Call(EmitCallType callType, if (emitComp->IsTargetAbi(CORINFO_NATIVEAOT_ABI) && EA_IS_CNS_TLSGD_RELOC(retSize)) { // For NativeAOT linux/arm64, we need to also record the relocation of methHnd. - // Since we do not have space to embed it in instrDesc, we store the register in - // reg1 and instead use the `iiaAdd` to store the method handle. Likewise, during - // emitOutputInstr, we retrieve the register from reg1 for this specific case. + // Since we do not have space to embed it in instrDesc, we use the `iiaAddr` to + // store the method handle. + // The target handle need to be always in R2 and hence the assert check. + // We cannot use reg1 and reg2 fields of instrDesc because they contain the gc + // registers (emitEncodeCallGCregs()) that are live across the call. + + assert(ireg == REG_R2); id->idSetTlsGD(); - id->idReg1(ireg); id->idAddr()->iiaAddr = (BYTE*)methHnd; } else @@ -10990,12 +10992,13 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) { emitRecordRelocation(odst, (CORINFO_METHOD_HANDLE)id->idAddr()->iiaAddr, IMAGE_REL_AARCH64_TLSDESC_CALL); - code |= insEncodeReg_Rn(id->idReg1()); // nnnnn + code |= insEncodeReg_Rn(REG_R2); // nnnnn } else { code |= insEncodeReg_Rn(id->idReg3()); // nnnnn } + dst += emitOutputCall(ig, dst, id, code); sz = id->idIsLargeCall() ? sizeof(instrDescCGCA) : sizeof(instrDesc); break; @@ -13315,7 +13318,15 @@ void emitter::emitDispInsHelp( case IF_BR_1B: // BR_1B ................ ......nnnnn..... Rn // The size of a branch target is always EA_PTRSIZE assert(insOptsNone(id->idInsOpt())); - emitDispReg(id->idReg3(), EA_PTRSIZE, false); + + if (emitComp->IsTargetAbi(CORINFO_NATIVEAOT_ABI) && id->idIsTlsGD()) + { + emitDispReg(REG_R2, EA_PTRSIZE, false); + } + else + { + emitDispReg(id->idReg3(), EA_PTRSIZE, false); + } break; case IF_LS_1A: // LS_1A XX...V..iiiiiiii iiiiiiiiiiittttt Rt PC imm(1MB) diff --git a/src/coreclr/jit/fgprofilesynthesis.cpp b/src/coreclr/jit/fgprofilesynthesis.cpp index b9ff493c87d49f..3bbf61986ff605 100644 --- a/src/coreclr/jit/fgprofilesynthesis.cpp +++ b/src/coreclr/jit/fgprofilesynthesis.cpp @@ -1408,12 +1408,14 @@ void ProfileSynthesis::GaussSeidelSolver() countVector[block->bbNum] = newWeight; // Remember max absolute and relative change - // (note rel residual will be infinite at times, that's ok) + // (note rel residual will be as large as 1e9 at times, that's ok) // // Note we are using a "point" bound here ("infinity norm") rather than say // computing the L2-norm of the entire residual vector. // - weight_t const blockRelResidual = change / oldWeight; + // Avoid dividing by zero if oldWeight is very small. + // + weight_t const blockRelResidual = change / max(oldWeight, 1e-12); if ((relResidualBlock == nullptr) || (blockRelResidual > relResidual)) { diff --git a/src/coreclr/jit/gcencode.cpp b/src/coreclr/jit/gcencode.cpp index ae05bf797f86ab..a1e9f935327d37 100644 --- a/src/coreclr/jit/gcencode.cpp +++ b/src/coreclr/jit/gcencode.cpp @@ -49,8 +49,21 @@ ReturnKind GCInfo::getReturnKind() case 1: return VarTypeToReturnKind(retTypeDesc.GetReturnRegType(0)); case 2: - return GetStructReturnKind(VarTypeToReturnKind(retTypeDesc.GetReturnRegType(0)), - VarTypeToReturnKind(retTypeDesc.GetReturnRegType(1))); + { + var_types first = retTypeDesc.GetReturnRegType(0); + var_types second = retTypeDesc.GetReturnRegType(1); +#ifdef UNIX_AMD64_ABI + if (varTypeUsesFloatReg(first)) + { + // first does not consume an int register in this case so an obj/ref + // in the second ReturnKind would actually be found in the first int reg. + first = second; + second = TYP_UNDEF; + } +#endif // UNIX_AMD64_ABI + return GetStructReturnKind(VarTypeToReturnKind(first), + VarTypeToReturnKind(second)); + } default: #ifdef DEBUG for (unsigned i = 0; i < regCount; i++) diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index 20645cbc3660f8..76660c67f26f42 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -30167,7 +30167,7 @@ unsigned* SsaNumInfo::GetOutlinedNumSlot(Compiler* compiler, unsigned index) con // Copy over all of the already encoded numbers. if (!baseNum.IsInvalid()) { - for (int i = 0; i < SIMPLE_NUM_COUNT; i++) + for (int i = 0; i < count; i++) { pFirstSlot[i] = baseNum.GetNum(compiler, i); } diff --git a/src/coreclr/jit/morphblock.cpp b/src/coreclr/jit/morphblock.cpp index f21cc2355a4861..ed1479804ceb6b 100644 --- a/src/coreclr/jit/morphblock.cpp +++ b/src/coreclr/jit/morphblock.cpp @@ -250,8 +250,6 @@ void MorphInitBlockHelper::PropagateBlockAssertions() // void MorphInitBlockHelper::PropagateExpansionAssertions() { - // Consider doing this for FieldByField as well - // if (m_comp->optLocalAssertionProp && (m_transformationDecision == BlockTransformation::OneStoreBlock)) { m_comp->fgAssertionGen(m_store); @@ -408,6 +406,7 @@ void MorphInitBlockHelper::TryInitFieldByField() if (m_comp->fgGlobalMorph && m_dstLclNode->IsLastUse(i)) { JITDUMP("Field-by-field init skipping write to dead field V%02u\n", fieldLclNum); + m_comp->fgKillDependentAssertionsSingle(m_dstLclNum DEBUGARG(m_store)); continue; } @@ -1236,6 +1235,7 @@ GenTree* MorphCopyBlockHelper::CopyFieldByField() { INDEBUG(unsigned dstFieldLclNum = m_comp->lvaGetDesc(m_dstLclNum)->lvFieldLclStart + i); JITDUMP("Field-by-field copy skipping write to dead field V%02u\n", dstFieldLclNum); + m_comp->fgKillDependentAssertionsSingle(m_dstLclNum DEBUGARG(m_store)); continue; } diff --git a/src/coreclr/jit/promotion.cpp b/src/coreclr/jit/promotion.cpp index 7fe9bffa70e943..c426cf37e2e1a0 100644 --- a/src/coreclr/jit/promotion.cpp +++ b/src/coreclr/jit/promotion.cpp @@ -1885,41 +1885,79 @@ void ReplaceVisitor::InsertPreStatementReadBacks() // 3. Creating embedded stores in ReplaceLocal disables local copy prop for // that local (see ReplaceLocal). - for (GenTreeLclVarCommon* lcl : m_currentStmt->LocalsTreeList()) + // Normally, we read back only for the uses we will see. However, with + // implicit EH flow we may also read back all replacements mid-tree (see + // InsertMidTreeReadBacks). So for that case we read back everything. This + // is a correctness requirement for QMARKs, but we do it indiscriminately + // for the same reasons as mentioned above. + if (((m_currentStmt->GetRootNode()->gtFlags & (GTF_EXCEPT | GTF_CALL)) != 0) && + m_compiler->ehBlockHasExnFlowDsc(m_currentBlock)) { - if (lcl->TypeIs(TYP_STRUCT)) - { - continue; - } + JITDUMP( + "Reading back pending replacements before statement with possible exception side effect inside block in try region\n"); - AggregateInfo* agg = m_aggregates.Lookup(lcl->GetLclNum()); - if (agg == nullptr) + for (AggregateInfo* agg : m_aggregates) { - continue; + for (Replacement& rep : agg->Replacements) + { + InsertPreStatementReadBackIfNecessary(agg->LclNum, rep); + } } - - size_t index = Promotion::BinarySearch(agg->Replacements, lcl->GetLclOffs()); - if ((ssize_t)index < 0) + } + else + { + // Otherwise just read back the locals we see uses of. + for (GenTreeLclVarCommon* lcl : m_currentStmt->LocalsTreeList()) { - continue; - } + if (lcl->TypeIs(TYP_STRUCT)) + { + continue; + } - Replacement& rep = agg->Replacements[index]; - if (rep.NeedsReadBack) - { - JITDUMP("Reading back replacement V%02u.[%03u..%03u) -> V%02u before [%06u]:\n", agg->LclNum, rep.Offset, - rep.Offset + genTypeSize(rep.AccessType), rep.LclNum, - Compiler::dspTreeID(m_currentStmt->GetRootNode())); + AggregateInfo* agg = m_aggregates.Lookup(lcl->GetLclNum()); + if (agg == nullptr) + { + continue; + } - GenTree* readBack = Promotion::CreateReadBack(m_compiler, agg->LclNum, rep); - Statement* stmt = m_compiler->fgNewStmtFromTree(readBack); - DISPSTMT(stmt); - m_compiler->fgInsertStmtBefore(m_currentBlock, m_currentStmt, stmt); - ClearNeedsReadBack(rep); + size_t index = + Promotion::BinarySearch(agg->Replacements, lcl->GetLclOffs()); + if ((ssize_t)index < 0) + { + continue; + } + + InsertPreStatementReadBackIfNecessary(agg->LclNum, agg->Replacements[index]); } } } +//------------------------------------------------------------------------ +// InsertPreStatementReadBackIfNecessary: +// Insert a read back of the specified replacement before the current +// statement, if the replacement needs it. +// +// Parameters: +// aggLclNum - Struct local +// rep - The replacement +// +void ReplaceVisitor::InsertPreStatementReadBackIfNecessary(unsigned aggLclNum, Replacement& rep) +{ + if (!rep.NeedsReadBack) + { + return; + } + + JITDUMP("Reading back replacement V%02u.[%03u..%03u) -> V%02u before [%06u]:\n", aggLclNum, rep.Offset, + rep.Offset + genTypeSize(rep.AccessType), rep.LclNum, Compiler::dspTreeID(m_currentStmt->GetRootNode())); + + GenTree* readBack = Promotion::CreateReadBack(m_compiler, aggLclNum, rep); + Statement* stmt = m_compiler->fgNewStmtFromTree(readBack); + DISPSTMT(stmt); + m_compiler->fgInsertStmtBefore(m_currentBlock, m_currentStmt, stmt); + ClearNeedsReadBack(rep); +} + //------------------------------------------------------------------------ // VisitOverlappingReplacements: // Call a function for every replacement that overlaps a specified segment. diff --git a/src/coreclr/jit/promotion.h b/src/coreclr/jit/promotion.h index 28481a97eaf88b..a8c54d4000f341 100644 --- a/src/coreclr/jit/promotion.h +++ b/src/coreclr/jit/promotion.h @@ -290,6 +290,7 @@ class ReplaceVisitor : public GenTreeVisitor bool VisitOverlappingReplacements(unsigned lcl, unsigned offs, unsigned size, Func func); void InsertPreStatementReadBacks(); + void InsertPreStatementReadBackIfNecessary(unsigned aggLclNum, Replacement& rep); void InsertPreStatementWriteBacks(); GenTree** InsertMidTreeReadBacks(GenTree** use); diff --git a/src/coreclr/jit/simdashwintrinsic.cpp b/src/coreclr/jit/simdashwintrinsic.cpp index bfb24b6c7ed317..fbd4762544644d 100644 --- a/src/coreclr/jit/simdashwintrinsic.cpp +++ b/src/coreclr/jit/simdashwintrinsic.cpp @@ -917,6 +917,11 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic, return gtNewSimdCeilNode(retType, op1, simdBaseJitType, simdSize); } + case NI_VectorT_Create: + { + return gtNewSimdCreateBroadcastNode(simdType, op1, simdBaseJitType, simdSize); + } + case NI_VectorT_Floor: { return gtNewSimdFloorNode(retType, op1, simdBaseJitType, simdSize); @@ -1247,15 +1252,6 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic, return gtNewSimdBinOpNode(GT_OR, retType, op1, op2, simdBaseJitType, simdSize); } - case NI_VectorT_Create: - { - assert(retType == TYP_VOID); - - copyBlkDst = op1; - copyBlkSrc = gtNewSimdCreateBroadcastNode(simdType, op2, simdBaseJitType, simdSize); - break; - } - case NI_VectorT_CreateSequence: { return gtNewSimdCreateSequenceNode(simdType, op1, op2, simdBaseJitType, simdSize); diff --git a/src/coreclr/jit/simdashwintrinsiclistarm64.h b/src/coreclr/jit/simdashwintrinsiclistarm64.h index 6bbea32494f315..2ca159110dc4c7 100644 --- a/src/coreclr/jit/simdashwintrinsiclistarm64.h +++ b/src/coreclr/jit/simdashwintrinsiclistarm64.h @@ -64,8 +64,8 @@ SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt32, SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt32Native, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt32Native, NI_Illegal}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt64, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt64}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt64Native, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt64Native}, SimdAsHWIntrinsicFlag::None) -SIMD_AS_HWINTRINSIC_ID(VectorT, Create, 1, {NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create}, SimdAsHWIntrinsicFlag::None) -SIMD_AS_HWINTRINSIC_ID(VectorT, CreateSequence, 2, {NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence}, SimdAsHWIntrinsicFlag::SpillSideEffectsOp1) +SIMD_AS_HWINTRINSIC_ID(VectorT, Create, 1, {NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create}, SimdAsHWIntrinsicFlag::KeepBaseTypeFromRet) +SIMD_AS_HWINTRINSIC_ID(VectorT, CreateSequence, 2, {NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence}, SimdAsHWIntrinsicFlag::KeepBaseTypeFromRet | SimdAsHWIntrinsicFlag::SpillSideEffectsOp1) SIMD_AS_HWINTRINSIC_ID(VectorT, Dot, 2, {NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_Illegal, NI_Illegal, NI_VectorT_Dot, NI_VectorT_Dot}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, Equals, 2, {NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, EqualsAny, 2, {NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny}, SimdAsHWIntrinsicFlag::None) diff --git a/src/coreclr/jit/simdashwintrinsiclistxarch.h b/src/coreclr/jit/simdashwintrinsiclistxarch.h index 1d769f27e4f97d..6baf3143cd02d3 100644 --- a/src/coreclr/jit/simdashwintrinsiclistxarch.h +++ b/src/coreclr/jit/simdashwintrinsiclistxarch.h @@ -64,8 +64,8 @@ SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt32, SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt32Native, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt32Native, NI_Illegal}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt64, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt64}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, ConvertToUInt64Native, 1, {NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_Illegal, NI_VectorT_ConvertToUInt64Native}, SimdAsHWIntrinsicFlag::None) -SIMD_AS_HWINTRINSIC_ID(VectorT, Create, 1, {NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create}, SimdAsHWIntrinsicFlag::None) -SIMD_AS_HWINTRINSIC_ID(VectorT, CreateSequence, 2, {NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence}, SimdAsHWIntrinsicFlag::SpillSideEffectsOp1) +SIMD_AS_HWINTRINSIC_ID(VectorT, Create, 1, {NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create, NI_VectorT_Create}, SimdAsHWIntrinsicFlag::KeepBaseTypeFromRet) +SIMD_AS_HWINTRINSIC_ID(VectorT, CreateSequence, 2, {NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence, NI_VectorT_CreateSequence}, SimdAsHWIntrinsicFlag::KeepBaseTypeFromRet | SimdAsHWIntrinsicFlag::SpillSideEffectsOp1) SIMD_AS_HWINTRINSIC_ID(VectorT, Dot, 2, {NI_Illegal, NI_Illegal, NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_VectorT_Dot, NI_Illegal, NI_Illegal, NI_VectorT_Dot, NI_VectorT_Dot}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, Equals, 2, {NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals, NI_VectorT_Equals}, SimdAsHWIntrinsicFlag::None) SIMD_AS_HWINTRINSIC_ID(VectorT, EqualsAny, 2, {NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny, NI_VectorT_EqualsAny}, SimdAsHWIntrinsicFlag::None) diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CachedInterfaceDispatch.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CachedInterfaceDispatch.cs index 7a242497f30826..9a1b1ad7ef985a 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CachedInterfaceDispatch.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/CachedInterfaceDispatch.cs @@ -82,14 +82,46 @@ private static IntPtr RhResolveDispatch(object pObject, MethodTable* interfaceTy } [RuntimeExport("RhResolveDispatchOnType")] - private static IntPtr RhResolveDispatchOnType(MethodTable* pInstanceType, MethodTable* pInterfaceType, ushort slot, MethodTable** ppGenericContext) + private static IntPtr RhResolveDispatchOnType(MethodTable* pInstanceType, MethodTable* pInterfaceType, ushort slot) { return DispatchResolve.FindInterfaceMethodImplementationTarget(pInstanceType, pInterfaceType, slot, + flags: default, + ppGenericContext: null); + } + + [RuntimeExport("RhResolveStaticDispatchOnType")] + private static IntPtr RhResolveStaticDispatchOnType(MethodTable* pInstanceType, MethodTable* pInterfaceType, ushort slot, MethodTable** ppGenericContext) + { + return DispatchResolve.FindInterfaceMethodImplementationTarget(pInstanceType, + pInterfaceType, + slot, + DispatchResolve.ResolveFlags.Static, ppGenericContext); } + [RuntimeExport("RhResolveDynamicInterfaceCastableDispatchOnType")] + private static IntPtr RhResolveDynamicInterfaceCastableDispatchOnType(MethodTable* pInstanceType, MethodTable* pInterfaceType, ushort slot, MethodTable** ppGenericContext) + { + IntPtr result = DispatchResolve.FindInterfaceMethodImplementationTarget(pInstanceType, + pInterfaceType, + slot, + DispatchResolve.ResolveFlags.IDynamicInterfaceCastable, + ppGenericContext); + + if ((result & (nint)DispatchMapCodePointerFlags.RequiresInstantiatingThunkFlag) != 0) + { + result &= ~(nint)DispatchMapCodePointerFlags.RequiresInstantiatingThunkFlag; + } + else + { + *ppGenericContext = null; + } + + return result; + } + private static unsafe IntPtr RhResolveDispatchWorker(object pObject, void* cell, ref DispatchCellInfo cellInfo) { // Type of object we're dispatching on. @@ -97,13 +129,10 @@ private static unsafe IntPtr RhResolveDispatchWorker(object pObject, void* cell, if (cellInfo.CellType == DispatchCellType.InterfaceAndSlot) { - // Type whose DispatchMap is used. Usually the same as the above but for types which implement IDynamicInterfaceCastable - // we may repeat this process with an alternate type. - MethodTable* pResolvingInstanceType = pInstanceType; - - IntPtr pTargetCode = DispatchResolve.FindInterfaceMethodImplementationTarget(pResolvingInstanceType, + IntPtr pTargetCode = DispatchResolve.FindInterfaceMethodImplementationTarget(pInstanceType, cellInfo.InterfaceType, cellInfo.InterfaceSlot, + flags: default, ppGenericContext: null); if (pTargetCode == IntPtr.Zero && pInstanceType->IsIDynamicInterfaceCastable) { diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/DispatchResolve.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/DispatchResolve.cs index 349415c743aa9a..271fdd231c611a 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/DispatchResolve.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/DispatchResolve.cs @@ -13,21 +13,21 @@ internal static unsafe class DispatchResolve public static IntPtr FindInterfaceMethodImplementationTarget(MethodTable* pTgtType, MethodTable* pItfType, ushort itfSlotNumber, + ResolveFlags flags, /* out */ MethodTable** ppGenericContext) { + // We set this bit below during second pass, callers should not set it. + Debug.Assert((flags & ResolveFlags.DefaultInterfaceImplementation) == 0); + // Start at the current type and work up the inheritance chain MethodTable* pCur = pTgtType; - // We first look at non-default implementation. Default implementations are only considered - // if the "old algorithm" didn't come up with an answer. - bool fDoDefaultImplementationLookup = false; - again: while (pCur != null) { ushort implSlotNumber; if (FindImplSlotForCurrentType( - pCur, pItfType, itfSlotNumber, fDoDefaultImplementationLookup, &implSlotNumber, ppGenericContext)) + pCur, pItfType, itfSlotNumber, flags, &implSlotNumber, ppGenericContext)) { IntPtr targetMethod; if (implSlotNumber < pCur->NumVtableSlots) @@ -58,9 +58,9 @@ public static IntPtr FindInterfaceMethodImplementationTarget(MethodTable* pTgtTy } // If we haven't found an implementation, do a second pass looking for a default implementation. - if (!fDoDefaultImplementationLookup) + if ((flags & ResolveFlags.DefaultInterfaceImplementation) == 0) { - fDoDefaultImplementationLookup = true; + flags |= ResolveFlags.DefaultInterfaceImplementation; pCur = pTgtType; goto again; } @@ -72,10 +72,13 @@ public static IntPtr FindInterfaceMethodImplementationTarget(MethodTable* pTgtTy private static bool FindImplSlotForCurrentType(MethodTable* pTgtType, MethodTable* pItfType, ushort itfSlotNumber, - bool fDoDefaultImplementationLookup, + ResolveFlags flags, ushort* pImplSlotNumber, MethodTable** ppGenericContext) { + // We set this below during second pass, callers should not set this. + Debug.Assert((flags & ResolveFlags.Variant) == 0); + bool fRes = false; // If making a call and doing virtual resolution don't look into the dispatch map, @@ -96,16 +99,14 @@ private static bool FindImplSlotForCurrentType(MethodTable* pTgtType, // result in interesting behavior such as a derived type only overriding one particular instantiation // and funneling all the dispatches to it, but its the algorithm. - bool fDoVariantLookup = false; // do not check variance for first scan of dispatch map - fRes = FindImplSlotInSimpleMap( - pTgtType, pItfType, itfSlotNumber, pImplSlotNumber, ppGenericContext, fDoVariantLookup, fDoDefaultImplementationLookup); + pTgtType, pItfType, itfSlotNumber, pImplSlotNumber, ppGenericContext, flags); if (!fRes) { - fDoVariantLookup = true; // check variance for second scan of dispatch map + flags |= ResolveFlags.Variant; // check variance for second scan of dispatch map fRes = FindImplSlotInSimpleMap( - pTgtType, pItfType, itfSlotNumber, pImplSlotNumber, ppGenericContext, fDoVariantLookup, fDoDefaultImplementationLookup); + pTgtType, pItfType, itfSlotNumber, pImplSlotNumber, ppGenericContext, flags); } } @@ -117,8 +118,7 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, uint itfSlotNumber, ushort* pImplSlotNumber, MethodTable** ppGenericContext, - bool actuallyCheckVariance, - bool checkDefaultImplementations) + ResolveFlags flags) { Debug.Assert(pTgtType->HasDispatchMap, "Missing dispatch map"); @@ -130,7 +130,7 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, bool fCheckVariance = false; bool fArrayCovariance = false; - if (actuallyCheckVariance) + if ((flags & ResolveFlags.Variant) != 0) { fCheckVariance = pItfType->HasGenericVariance; fArrayCovariance = pTgtType->IsArray; @@ -166,8 +166,8 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, } } - // It only makes sense to ask for generic context if we're asking about a static method - bool fStaticDispatch = ppGenericContext != null; + bool fStaticDispatch = (flags & ResolveFlags.Static) != 0; + bool checkDefaultImplementations = (flags & ResolveFlags.DefaultInterfaceImplementation) != 0; // We either scan the instance or static portion of the dispatch map. Depends on what the caller wants. DispatchMap* pMap = pTgtType->DispatchMap; @@ -190,8 +190,11 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, // If this is a static method, the entry point is not usable without generic context. // (Instance methods acquire the generic context from their `this`.) + // Same for IDynamicInterfaceCastable (that has a `this` but it's not useful) if (fStaticDispatch) *ppGenericContext = GetGenericContextSource(pTgtType, i); + else if ((flags & ResolveFlags.IDynamicInterfaceCastable) != 0) + *ppGenericContext = pTgtType; return true; } @@ -231,8 +234,11 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, // If this is a static method, the entry point is not usable without generic context. // (Instance methods acquire the generic context from their `this`.) + // Same for IDynamicInterfaceCastable (that has a `this` but it's not useful) if (fStaticDispatch) *ppGenericContext = GetGenericContextSource(pTgtType, i); + else if ((flags & ResolveFlags.IDynamicInterfaceCastable) != 0) + *ppGenericContext = pTgtType; return true; } @@ -253,5 +259,13 @@ private static bool FindImplSlotInSimpleMap(MethodTable* pTgtType, _ => pTgtType->InterfaceMap[usEncodedValue - StaticVirtualMethodContextSource.ContextFromFirstInterface] }; } + + public enum ResolveFlags + { + Variant = 0x1, + DefaultInterfaceImplementation = 0x2, + Static = 0x4, + IDynamicInterfaceCastable = 0x8, + } } } diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs index c3f92d067dd243..20427987539c39 100644 --- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs +++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs @@ -1066,10 +1066,14 @@ private static unsafe bool CacheMiss(MethodTable* pSourceType, MethodTable* pTar bool result = TypeCast.AreTypesAssignableInternalUncached(pSourceType, pTargetType, variation, &newList); // - // Update the cache + // Update the cache. We only consider type-based conversion rules here. + // Therefore a negative result cannot rule out convertibility for IDynamicInterfaceCastable. // - nuint sourceAndVariation = (nuint)pSourceType + (uint)variation; - s_castCache.TrySet(sourceAndVariation, (nuint)pTargetType, result); + if (result || !(pTargetType->IsInterface && pSourceType->IsIDynamicInterfaceCastable)) + { + nuint sourceAndVariation = (nuint)pSourceType + (uint)variation; + s_castCache.TrySet(sourceAndVariation, (nuint)pTargetType, result); + } return result; } @@ -1252,13 +1256,11 @@ internal static unsafe bool AreTypesAssignableInternalUncached(MethodTable* pSou } // - // Update the cache + // Update the cache. We only consider type-based conversion rules here. + // Therefore a negative result cannot rule out convertibility for IDynamicInterfaceCastable. // - if (!pSourceType->IsIDynamicInterfaceCastable) + if (retObj != null || !(pTargetType->IsInterface && pSourceType->IsIDynamicInterfaceCastable)) { - // - // Update the cache - // nuint sourceAndVariation = (nuint)pSourceType + (uint)AssignmentVariation.BoxedSource; s_castCache.TrySet(sourceAndVariation, (nuint)pTargetType, retObj != null); } @@ -1293,14 +1295,11 @@ private static unsafe object CheckCastAny_NoCacheLookup(MethodTable* pTargetType obj = CheckCastClass(pTargetType, obj); } - if (!pSourceType->IsIDynamicInterfaceCastable) - { - // - // Update the cache - // - nuint sourceAndVariation = (nuint)pSourceType + (uint)AssignmentVariation.BoxedSource; - s_castCache.TrySet(sourceAndVariation, (nuint)pTargetType, true); - } + // + // Update the cache + // + nuint sourceAndVariation = (nuint)pSourceType + (uint)AssignmentVariation.BoxedSource; + s_castCache.TrySet(sourceAndVariation, (nuint)pTargetType, true); return obj; } diff --git a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp index 060e19f3c525e2..569cf36e84fa50 100644 --- a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp +++ b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp @@ -485,6 +485,9 @@ int32_t __stdcall RhpHardwareExceptionHandler(uintptr_t faultCode, uintptr_t fau #else // TARGET_UNIX +uintptr_t GetSSP(CONTEXT *pContext); +void SetSSP(CONTEXT *pContext, uintptr_t ssp); + static bool g_ContinueOnFatalErrors = false; // Set the runtime to continue search when encountering an unhandled runtime exception. Once done it is forever. @@ -539,22 +542,16 @@ int32_t __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs) // When the CET is enabled, the interruption happens on the ret instruction in the calee. // We need to "pop" rsp to the caller, as if the ret has consumed it. interruptedContext->SetSp(interruptedContext->GetSp() + 8); + uintptr_t ssp = GetSSP(interruptedContext); + SetSSP(interruptedContext, ssp + 8); } // Change the IP to be at the original return site, as if we have returned to the caller. // That IP is an interruptible safe point, so we can suspend right there. - uintptr_t origIp = interruptedContext->GetIp(); interruptedContext->SetIp((uintptr_t)pThread->GetHijackedReturnAddress()); pThread->InlineSuspend(interruptedContext); - if (areShadowStacksEnabled) - { - // Undo the "pop", so that the ret could now succeed. - interruptedContext->SetSp(interruptedContext->GetSp() - 8); - interruptedContext->SetIp(origIp); - } - ASSERT(!pThread->IsHijacked()); return EXCEPTION_CONTINUE_EXECUTION; } diff --git a/src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp b/src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp index 23e985357d343a..8eddc1d3440d26 100644 --- a/src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp +++ b/src/coreclr/nativeaot/Runtime/HandleTableHelpers.cpp @@ -70,3 +70,57 @@ FCIMPL2(void, RhUnregisterRefCountedHandleCallback, void * pCallout, MethodTable RestrictedCallouts::UnregisterRefCountedHandleCallback(pCallout, pTypeFilter); } FCIMPLEND + +// This structure mirrors the managed type System.Runtime.InteropServices.ComWrappers.ManagedObjectWrapper. +struct ManagedObjectWrapper +{ + intptr_t HolderHandle; + uint64_t RefCount; + + int32_t UserDefinedCount; + void* /* ComInterfaceEntry */ UserDefined; + void* /* InternalComInterfaceDispatch* */ Dispatches; + + int32_t /* CreateComInterfaceFlagsEx */ Flags; + + uint32_t AddRef() + { + return GetComCount((uint64_t)PalInterlockedIncrement64((int64_t*)&RefCount)); + } + + static const uint64_t ComRefCountMask = 0x000000007fffffffUL; + + static uint32_t GetComCount(uint64_t c) + { + return (uint32_t)(c & ComRefCountMask); + } +}; + +// This structure mirrors the managed type System.Runtime.InteropServices.ComWrappers.InternalComInterfaceDispatch. +struct InternalComInterfaceDispatch +{ + void* Vtable; + ManagedObjectWrapper* _thisPtr; +}; + +static ManagedObjectWrapper* ToManagedObjectWrapper(void* dispatchPtr) +{ + return ((InternalComInterfaceDispatch*)dispatchPtr)->_thisPtr; +} + +// +// AddRef is implemented in native code so that it does not need to synchronize with the GC. This is important because Xaml +// invokes AddRef while holding a lock that it *also* holds while a GC is in progress. If AddRef was managed, we would have +// to synchronize with the GC before entering AddRef, which would deadlock with the other thread holding Xaml's lock. +// +static uint32_t __stdcall IUnknown_AddRef(void* pComThis) +{ + ManagedObjectWrapper* wrapper = ToManagedObjectWrapper(pComThis); + return wrapper->AddRef(); +} + +FCIMPL0(void*, RhGetIUnknownAddRef) +{ + return (void*)&IUnknown_AddRef; +} +FCIMPLEND diff --git a/src/coreclr/nativeaot/Runtime/RestrictedCallouts.h b/src/coreclr/nativeaot/Runtime/RestrictedCallouts.h index 2c1a2e61e0951b..cf0295db456038 100644 --- a/src/coreclr/nativeaot/Runtime/RestrictedCallouts.h +++ b/src/coreclr/nativeaot/Runtime/RestrictedCallouts.h @@ -97,6 +97,6 @@ class RestrictedCallouts static CrstStatic s_sLock; // Prototypes for the callouts. - typedef void (F_CALL_CONV * GcRestrictedCallbackFunction)(uint32_t uiCondemnedGeneration); + typedef void (* GcRestrictedCallbackFunction)(uint32_t uiCondemnedGeneration); typedef CLR_BOOL (* HandleTableRestrictedCallbackFunction)(Object * pObject); }; diff --git a/src/coreclr/nativeaot/Runtime/threadstore.cpp b/src/coreclr/nativeaot/Runtime/threadstore.cpp index c2b42491a387d9..c03907e4eed665 100644 --- a/src/coreclr/nativeaot/Runtime/threadstore.cpp +++ b/src/coreclr/nativeaot/Runtime/threadstore.cpp @@ -162,7 +162,7 @@ void ThreadStore::DetachCurrentThread() } // Unregister from OS notifications - // This can return false if detach notification is spurious and does not belong to this thread. + // This can return false if a thread did not register for OS notification. if (!PalDetachThread(pDetachingThread)) { return; diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkInline.h b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkInline.h index 983f17a36aba0a..2380bacdf02a1b 100644 --- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkInline.h +++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkInline.h @@ -30,6 +30,13 @@ FORCEINLINE int32_t PalInterlockedIncrement(_Inout_ int32_t volatile *pDst) return result; } +FORCEINLINE int64_t PalInterlockedIncrement64(_Inout_ int64_t volatile *pDst) +{ + int64_t result = __sync_add_and_fetch(pDst, 1); + PalInterlockedOperationBarrier(); + return result; +} + FORCEINLINE int32_t PalInterlockedDecrement(_Inout_ int32_t volatile *pDst) { int32_t result = __sync_sub_and_fetch(pDst, 1); diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc index b1a437d8b57ead..b12b4071593ab4 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc @@ -16,15 +16,6 @@ .macro NESTED_END Name, Section LEAF_END \Name, \Section -#if defined(__APPLE__) - .set LOCAL_LABEL(\Name\()_Size), . - C_FUNC(\Name) - .section __LD,__compact_unwind,regular,debug - .quad C_FUNC(\Name) - .long LOCAL_LABEL(\Name\()_Size) - .long 0x04000000 # DWARF - .quad 0 - .quad 0 -#endif .endm .macro PATCH_LABEL Name diff --git a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkInline.h b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkInline.h index 1f2a74dcd15100..595c7f663b9d13 100644 --- a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkInline.h +++ b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkInline.h @@ -67,6 +67,17 @@ FORCEINLINE int64_t PalInterlockedExchange64(_Inout_ int64_t volatile *pDst, int iOldValue) != iOldValue); return iOldValue; } + +FORCEINLINE int64_t PalInterlockedIncrement64(_Inout_ int64_t volatile *Addend) +{ + int64_t Old; + do { + Old = *Addend; + } while (PalInterlockedCompareExchange64(Addend, + Old + 1, + Old) != Old); + return Old + 1; +} #else // HOST_X86 EXTERN_C int64_t _InterlockedExchange64(int64_t volatile *, int64_t); #pragma intrinsic(_InterlockedExchange64) @@ -74,6 +85,13 @@ FORCEINLINE int64_t PalInterlockedExchange64(_Inout_ int64_t volatile *pDst, int { return _InterlockedExchange64(pDst, iValue); } + +EXTERN_C int64_t _InterlockedIncrement64(int64_t volatile *); +#pragma intrinsic(_InterlockedIncrement64) +FORCEINLINE int64_t PalInterlockedIncrement64(_Inout_ int64_t volatile *pDst) +{ + return _InterlockedIncrement64(pDst); +} #endif // HOST_X86 #if defined(HOST_AMD64) || defined(HOST_ARM64) diff --git a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp index 86013f7a964d28..f7bfcd68bdad75 100644 --- a/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp +++ b/src/coreclr/nativeaot/Runtime/windows/PalRedhawkMinWin.cpp @@ -1006,3 +1006,25 @@ REDHAWK_PALEXPORT void PalFlushInstructionCache(_In_ void* pAddress, size_t size FlushInstructionCache(GetCurrentProcess(), pAddress, size); } +#ifdef TARGET_AMD64 +uintptr_t GetSSP(CONTEXT *pContext) +{ + XSAVE_CET_U_FORMAT* pCET = (XSAVE_CET_U_FORMAT*)LocateXStateFeature(pContext, XSTATE_CET_U, NULL); + if ((pCET != NULL) && (pCET->Ia32CetUMsr != 0)) + { + return pCET->Ia32Pl3SspMsr; + } + + return 0; +} + +void SetSSP(CONTEXT *pContext, uintptr_t ssp) +{ + XSAVE_CET_U_FORMAT* pCET = (XSAVE_CET_U_FORMAT*)LocateXStateFeature(pContext, XSTATE_CET_U, NULL); + if (pCET != NULL) + { + pCET->Ia32Pl3SspMsr = ssp; + pCET->Ia32CetUMsr = 1; + } +} +#endif // TARGET_AMD64 diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml index 507b4c14936921..6bfe8b6b9ffdda 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml @@ -825,6 +825,10 @@ CP0001 T:System.Runtime.CompilerServices.StaticClassConstructionContext + + CP0001 + T:Internal.TypeSystem.LockFreeReaderHashtableOfPointers`2 + CP0002 M:System.Reflection.MethodBase.GetParametersAsSpan diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs index 7db11a82041778..4e376c5b803922 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/Augments/RuntimeAugments.cs @@ -493,7 +493,7 @@ public static bool IsDynamicType(RuntimeTypeHandle typeHandle) public static unsafe IntPtr ResolveStaticDispatchOnType(RuntimeTypeHandle instanceType, RuntimeTypeHandle interfaceType, int slot, out RuntimeTypeHandle genericContext) { MethodTable* genericContextPtr = default; - IntPtr result = RuntimeImports.RhResolveDispatchOnType(instanceType.ToMethodTable(), interfaceType.ToMethodTable(), checked((ushort)slot), &genericContextPtr); + IntPtr result = RuntimeImports.RhResolveStaticDispatchOnType(instanceType.ToMethodTable(), interfaceType.ToMethodTable(), checked((ushort)slot), &genericContextPtr); if (result != IntPtr.Zero) genericContext = new RuntimeTypeHandle(genericContextPtr); else diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/SharedCodeHelpers.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/SharedCodeHelpers.cs index 482a9a7b357a7e..172f7a6590e35d 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/SharedCodeHelpers.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/SharedCodeHelpers.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime; + using Debug = System.Diagnostics.Debug; namespace Internal.Runtime.CompilerHelpers @@ -12,15 +14,13 @@ internal static class SharedCodeHelpers { public static unsafe MethodTable* GetOrdinalInterface(MethodTable* pType, ushort interfaceIndex) { - Debug.Assert(interfaceIndex <= pType->NumInterfaces); + Debug.Assert(interfaceIndex < pType->NumInterfaces); return pType->InterfaceMap[interfaceIndex]; } public static unsafe MethodTable* GetCurrentSharedThunkContext() { - // TODO: We should return the current context from the ThunkPool - // https://github.com/dotnet/runtimelab/issues/1442 - return null; + return (MethodTable*)RuntimeImports.GetCurrentInteropThunkContext(); } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/IDynamicInterfaceCastableSupport.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/IDynamicInterfaceCastableSupport.cs index 54878128ff9823..a1e146fb1b0a8c 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/IDynamicInterfaceCastableSupport.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/IDynamicInterfaceCastableSupport.cs @@ -4,6 +4,12 @@ using System; using System.Runtime; using System.Runtime.InteropServices; +using System.Threading; + +using Internal.Runtime.Augments; +using Internal.TypeSystem; + +using Debug = System.Diagnostics.Debug; namespace Internal.Runtime { @@ -15,6 +21,8 @@ internal static bool IDynamicCastableIsInterfaceImplemented(IDynamicInterfaceCas return instance.IsInterfaceImplemented(new RuntimeTypeHandle(interfaceType), throwIfNotImplemented); } + private static readonly object s_thunkPoolHeap = RuntimeAugments.CreateThunksHeap(RuntimeImports.GetInteropCommonStubAddress()); + [RuntimeExport("IDynamicCastableGetInterfaceImplementation")] internal static IntPtr IDynamicCastableGetInterfaceImplementation(IDynamicInterfaceCastable instance, MethodTable* interfaceType, ushort slot) { @@ -28,11 +36,30 @@ internal static IntPtr IDynamicCastableGetInterfaceImplementation(IDynamicInterf { ThrowInvalidOperationException(implType); } - IntPtr result = RuntimeImports.RhResolveDispatchOnType(implType, interfaceType, slot); + + MethodTable* genericContext = null; + IntPtr result = RuntimeImports.RhResolveDynamicInterfaceCastableDispatchOnType(implType, interfaceType, slot, &genericContext); if (result == IntPtr.Zero) { IDynamicCastableGetInterfaceImplementationFailure(instance, interfaceType, implType); } + + if (genericContext != null) + { + if (!s_thunkHashtable.TryGetValue(new InstantiatingThunkKey(result, (nint)genericContext), out nint thunk)) + { + thunk = RuntimeAugments.AllocateThunk(s_thunkPoolHeap); + RuntimeAugments.SetThunkData(s_thunkPoolHeap, thunk, (nint)genericContext, result); + nint thunkInHashtable = s_thunkHashtable.AddOrGetExisting(thunk); + if (thunkInHashtable != thunk) + { + RuntimeAugments.FreeThunk(s_thunkPoolHeap, thunk); + thunk = thunkInHashtable; + } + } + + result = thunk; + } return result; } @@ -67,5 +94,46 @@ private static void IDynamicCastableGetInterfaceImplementationFailure(object ins throw new EntryPointNotFoundException(); } + + private static readonly InstantiatingThunkHashtable s_thunkHashtable = new InstantiatingThunkHashtable(); + + private class InstantiatingThunkHashtable : LockFreeReaderHashtableOfPointers + { + protected override bool CompareKeyToValue(InstantiatingThunkKey key, nint value) + { + bool result = RuntimeAugments.TryGetThunkData(s_thunkPoolHeap, value, out nint context, out nint target); + Debug.Assert(result); + return key.Target == target && key.Context == context; + } + + protected override bool CompareValueToValue(nint value1, nint value2) + { + bool result1 = RuntimeAugments.TryGetThunkData(s_thunkPoolHeap, value1, out nint context1, out nint target1); + Debug.Assert(result1); + + bool result2 = RuntimeAugments.TryGetThunkData(s_thunkPoolHeap, value2, out nint context2, out nint target2); + Debug.Assert(result2); + return context1 == context2 && target1 == target2; + } + + protected override nint ConvertIntPtrToValue(nint pointer) => pointer; + protected override nint ConvertValueToIntPtr(nint value) => value; + protected override nint CreateValueFromKey(InstantiatingThunkKey key) => throw new NotImplementedException(); + protected override int GetKeyHashCode(InstantiatingThunkKey key) => HashCode.Combine(key.Target, key.Context); + + protected override int GetValueHashCode(nint value) + { + bool result = RuntimeAugments.TryGetThunkData(s_thunkPoolHeap, value, out nint context, out nint target); + Debug.Assert(result); + return HashCode.Combine(target, context); + } + } + + private struct InstantiatingThunkKey + { + public readonly nint Target; + public readonly nint Context; + public InstantiatingThunkKey(nint target, nint context) => (Target, Context) = (target, context); + } } } diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index fc97632716fd2a..06d92c3b8b5d5e 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -332,6 +332,9 @@ Utilities\LockFreeReaderHashtable.cs + + Utilities\LockFreeReaderHashtableOfPointers.cs + System\Collections\Generic\LowLevelList.cs diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs index cc33e85d73917c..87eb31d58022fe 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.NativeAot.cs @@ -40,37 +40,36 @@ public abstract partial class ComWrappers private static readonly Guid IID_IInspectable = new Guid(0xAF86E2E0, 0xB12D, 0x4c6a, 0x9C, 0x5A, 0xD7, 0xAA, 0x65, 0x10, 0x1E, 0x90); private static readonly Guid IID_IWeakReferenceSource = new Guid(0x00000038, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46); - private static readonly ConditionalWeakTable s_rcwTable = new ConditionalWeakTable(); + private static readonly ConditionalWeakTable s_nativeObjectWrapperTable = new ConditionalWeakTable(); private static readonly GCHandleSet s_referenceTrackerNativeObjectWrapperCache = new GCHandleSet(); - private readonly ConditionalWeakTable _ccwTable = new ConditionalWeakTable(); - private readonly Lock _lock = new Lock(useTrivialWaits: true); - private readonly Dictionary _rcwCache = new Dictionary(); + private readonly ConditionalWeakTable _managedObjectWrapperTable = new ConditionalWeakTable(); + private readonly RcwCache _rcwCache = new(); internal static bool TryGetComInstanceForIID(object obj, Guid iid, out IntPtr unknown, out long wrapperId) { if (obj == null - || !s_rcwTable.TryGetValue(obj, out NativeObjectWrapper? wrapper)) + || !s_nativeObjectWrapperTable.TryGetValue(obj, out NativeObjectWrapper? wrapper)) { unknown = IntPtr.Zero; wrapperId = 0; return false; } - wrapperId = wrapper._comWrappers.id; - return Marshal.QueryInterface(wrapper._externalComObject, iid, out unknown) == HResults.S_OK; + wrapperId = wrapper.ComWrappers.id; + return Marshal.QueryInterface(wrapper.ExternalComObject, iid, out unknown) == HResults.S_OK; } public static unsafe bool TryGetComInstance(object obj, out IntPtr unknown) { unknown = IntPtr.Zero; if (obj == null - || !s_rcwTable.TryGetValue(obj, out NativeObjectWrapper? wrapper)) + || !s_nativeObjectWrapperTable.TryGetValue(obj, out NativeObjectWrapper? wrapper)) { return false; } - return Marshal.QueryInterface(wrapper._externalComObject, IID_IUnknown, out unknown) == HResults.S_OK; + return Marshal.QueryInterface(wrapper.ExternalComObject, IID_IUnknown, out unknown) == HResults.S_OK; } public static unsafe bool TryGetObject(IntPtr unknown, [NotNullWhen(true)] out object? obj) @@ -484,9 +483,6 @@ public ManagedObjectWrapperReleaser(ManagedObjectWrapper* wrapper) // There are still outstanding references on the COM side. // This case should only be hit when an outstanding // tracker refcount exists from AddRefFromReferenceTracker. - // When implementing IReferenceTrackerHost, this should be - // reconsidered. - // https://github.com/dotnet/runtime/issues/85137 GC.ReRegisterForFinalize(this); } } @@ -494,12 +490,13 @@ public ManagedObjectWrapperReleaser(ManagedObjectWrapper* wrapper) internal unsafe class NativeObjectWrapper { - internal IntPtr _externalComObject; + private IntPtr _externalComObject; private IntPtr _inner; - internal ComWrappers _comWrappers; - internal readonly GCHandle _proxyHandle; - internal readonly GCHandle _proxyHandleTrackingResurrection; - internal readonly bool _aggregatedManagedObjectWrapper; + private ComWrappers _comWrappers; + private GCHandle _proxyHandle; + private GCHandle _proxyHandleTrackingResurrection; + private readonly bool _aggregatedManagedObjectWrapper; + private readonly bool _uniqueInstance; static NativeObjectWrapper() { @@ -522,18 +519,19 @@ public static NativeObjectWrapper Create(IntPtr externalComObject, IntPtr inner, } } - public NativeObjectWrapper(IntPtr externalComObject, IntPtr inner, ComWrappers comWrappers, object comProxy, CreateObjectFlags flags) + protected NativeObjectWrapper(IntPtr externalComObject, IntPtr inner, ComWrappers comWrappers, object comProxy, CreateObjectFlags flags) { _externalComObject = externalComObject; _inner = inner; _comWrappers = comWrappers; + _uniqueInstance = flags.HasFlag(CreateObjectFlags.UniqueInstance); _proxyHandle = GCHandle.Alloc(comProxy, GCHandleType.Weak); // We have a separate handle tracking resurrection as we want to make sure // we clean up the NativeObjectWrapper only after the RCW has been finalized // due to it can access the native object in the finalizer. At the same time, - // we want other callers which are using _proxyHandle such as the RCW cache to - // see the object as not alive once it is eligible for finalization. + // we want other callers which are using ProxyHandle such as the reference tracker runtime + // to see the object as not alive once it is eligible for finalization. _proxyHandleTrackingResurrection = GCHandle.Alloc(comProxy, GCHandleType.WeakTrackResurrection); // If this is an aggregation scenario and the identity object @@ -548,11 +546,17 @@ public NativeObjectWrapper(IntPtr externalComObject, IntPtr inner, ComWrappers c } } + internal IntPtr ExternalComObject => _externalComObject; + internal ComWrappers ComWrappers => _comWrappers; + internal GCHandle ProxyHandle => _proxyHandle; + internal bool IsUniqueInstance => _uniqueInstance; + internal bool IsAggregatedWithManagedObjectWrapper => _aggregatedManagedObjectWrapper; + public virtual void Release() { - if (_comWrappers != null) + if (!_uniqueInstance && _comWrappers is not null) { - _comWrappers.RemoveRCWFromCache(_externalComObject, _proxyHandle); + _comWrappers._rcwCache.Remove(_externalComObject, this); _comWrappers = null; } @@ -712,23 +716,23 @@ public unsafe IntPtr GetOrCreateComInterfaceForObject(object instance, CreateCom { ArgumentNullException.ThrowIfNull(instance); - ManagedObjectWrapperHolder? ccwValue; - if (_ccwTable.TryGetValue(instance, out ccwValue)) + ManagedObjectWrapperHolder? managedObjectWrapper; + if (_managedObjectWrapperTable.TryGetValue(instance, out managedObjectWrapper)) { - ccwValue.AddRef(); - return ccwValue.ComIp; + managedObjectWrapper.AddRef(); + return managedObjectWrapper.ComIp; } - ccwValue = _ccwTable.GetValue(instance, (c) => + managedObjectWrapper = _managedObjectWrapperTable.GetValue(instance, (c) => { - ManagedObjectWrapper* value = CreateCCW(c, flags); + ManagedObjectWrapper* value = CreateManagedObjectWrapper(c, flags); return new ManagedObjectWrapperHolder(value, c); }); - ccwValue.AddRef(); - return ccwValue.ComIp; + managedObjectWrapper.AddRef(); + return managedObjectWrapper.ComIp; } - private unsafe ManagedObjectWrapper* CreateCCW(object instance, CreateComInterfaceFlags flags) + private unsafe ManagedObjectWrapper* CreateManagedObjectWrapper(object instance, CreateComInterfaceFlags flags) { ComInterfaceEntry* userDefined = ComputeVtables(instance, flags, out int userDefinedCount); if ((userDefined == null && userDefinedCount != 0) || userDefinedCount < 0) @@ -799,7 +803,7 @@ public object GetOrCreateObjectForComInstance(IntPtr externalComObject, CreateOb if (!TryGetOrCreateObjectForComInstanceInternal(externalComObject, IntPtr.Zero, flags, null, out obj)) throw new ArgumentNullException(nameof(externalComObject)); - return obj!; + return obj; } /// @@ -841,7 +845,7 @@ public object GetOrRegisterObjectForComInstance(IntPtr externalComObject, Create if (!TryGetOrCreateObjectForComInstanceInternal(externalComObject, inner, flags, wrapper, out obj)) throw new ArgumentNullException(nameof(externalComObject)); - return obj!; + return obj; } private static unsafe ComInterfaceDispatch* TryGetComInterfaceDispatch(IntPtr comObject) @@ -917,7 +921,6 @@ private static void DetermineIdentityAndInner( } } -#pragma warning disable IDE0060 /// /// Get the currently registered managed object or creates a new managed object and registers it. /// @@ -932,7 +935,7 @@ private unsafe bool TryGetOrCreateObjectForComInstanceInternal( IntPtr innerMaybe, CreateObjectFlags flags, object? wrapperMaybe, - out object? retValue) + [NotNullWhen(true)] out object? retValue) { if (externalComObject == IntPtr.Zero) throw new ArgumentNullException(nameof(externalComObject)); @@ -949,137 +952,149 @@ private unsafe bool TryGetOrCreateObjectForComInstanceInternal( using ComHolder releaseIdentity = new ComHolder(identity); - if (!flags.HasFlag(CreateObjectFlags.UniqueInstance)) + // If the user has requested a unique instance, + // we will immediately create the object, register it, + // and return. + if (flags.HasFlag(CreateObjectFlags.UniqueInstance)) { - using (_lock.EnterScope()) - { - if (_rcwCache.TryGetValue(identity, out GCHandle handle)) - { - object? cachedWrapper = handle.Target; - if (cachedWrapper is not null) - { - retValue = cachedWrapper; - return true; - } - else - { - // The GCHandle has been clear out but the NativeObjectWrapper - // finalizer has not yet run to remove the entry from _rcwCache - _rcwCache.Remove(identity); - } - } + retValue = CreateAndRegisterObjectForComInstance(identity, inner, flags); + return retValue is not null; + } - if (wrapperMaybe is not null) - { - retValue = wrapperMaybe; - NativeObjectWrapper wrapper = NativeObjectWrapper.Create( - identity, - inner, - this, - retValue, - flags); - if (!s_rcwTable.TryAdd(retValue, wrapper)) - { - wrapper.Release(); - throw new NotSupportedException(); - } - _rcwCache.Add(identity, wrapper._proxyHandle); - AddWrapperToReferenceTrackerHandleCache(wrapper); - return true; - } - } - if (flags.HasFlag(CreateObjectFlags.Unwrap)) + // If we have a live cached wrapper currently, + // return that. + if (_rcwCache.FindProxyForComInstance(identity) is object liveCachedWrapper) + { + retValue = liveCachedWrapper; + return true; + } + + // If the user tried to provide a pre-created managed wrapper, try to register + // that object as the wrapper. + if (wrapperMaybe is not null) + { + retValue = RegisterObjectForComInstance(identity, inner, wrapperMaybe, flags); + return retValue is not null; + } + + // Check if the provided COM instance is actually a managed object wrapper from this + // ComWrappers instance, and use it if it is. + if (flags.HasFlag(CreateObjectFlags.Unwrap)) + { + ComInterfaceDispatch* comInterfaceDispatch = TryGetComInterfaceDispatch(identity); + if (comInterfaceDispatch != null) { - ComInterfaceDispatch* comInterfaceDispatch = TryGetComInterfaceDispatch(identity); - if (comInterfaceDispatch != null) + // If we found a managed object wrapper in this ComWrappers instance + // and it has the same identity pointer as the one we're creating a NativeObjectWrapper for, + // unwrap it. We don't AddRef the wrapper as we don't take a reference to it. + // + // A managed object can have multiple managed object wrappers, with a max of one per context. + // Let's say we have a managed object A and ComWrappers instances C1 and C2. Let B1 and B2 be the + // managed object wrappers for A created with C1 and C2 respectively. + // If we are asked to create an EOC for B1 with the unwrap flag on the C2 ComWrappers instance, + // we will create a new wrapper. In this scenario, we'll only unwrap B2. + object unwrapped = ComInterfaceDispatch.GetInstance(comInterfaceDispatch); + if (_managedObjectWrapperTable.TryGetValue(unwrapped, out ManagedObjectWrapperHolder? unwrappedWrapperInThisContext)) { - // If we found a managed object wrapper in this ComWrappers instance - // and it's has the same identity pointer as the one we're creating a NativeObjectWrapper for, - // unwrap it. We don't AddRef the wrapper as we don't take a reference to it. - // - // A managed object can have multiple managed object wrappers, with a max of one per context. - // Let's say we have a managed object A and ComWrappers instances C1 and C2. Let B1 and B2 be the - // managed object wrappers for A created with C1 and C2 respectively. - // If we are asked to create an EOC for B1 with the unwrap flag on the C2 ComWrappers instance, - // we will create a new wrapper. In this scenario, we'll only unwrap B2. - object unwrapped = ComInterfaceDispatch.GetInstance(comInterfaceDispatch); - if (_ccwTable.TryGetValue(unwrapped, out ManagedObjectWrapperHolder? unwrappedWrapperInThisContext)) + // The unwrapped object has a CCW in this context. Compare with identity + // so we can see if it's the CCW for the unwrapped object in this context. + if (unwrappedWrapperInThisContext.ComIp == identity) { - // The unwrapped object has a CCW in this context. Compare with identity - // so we can see if it's the CCW for the unwrapped object in this context. - if (unwrappedWrapperInThisContext.ComIp == identity) - { - retValue = unwrapped; - return true; - } + retValue = unwrapped; + return true; } } } } - retValue = CreateObject(identity, flags); - if (retValue == null) + // If the user didn't provide a wrapper and couldn't unwrap a managed object wrapper, + // create a new wrapper. + retValue = CreateAndRegisterObjectForComInstance(identity, inner, flags); + return retValue is not null; + } + + private object? CreateAndRegisterObjectForComInstance(IntPtr identity, IntPtr inner, CreateObjectFlags flags) + { + object? retValue = CreateObject(identity, flags); + if (retValue is null) { // If ComWrappers instance cannot create wrapper, we can do nothing here. - return false; + return null; } - if (flags.HasFlag(CreateObjectFlags.UniqueInstance)) + return RegisterObjectForComInstance(identity, inner, retValue, flags); + } + + private object RegisterObjectForComInstance(IntPtr identity, IntPtr inner, object comProxy, CreateObjectFlags flags) + { + NativeObjectWrapper nativeObjectWrapper = NativeObjectWrapper.Create( + identity, + inner, + this, + comProxy, + flags); + + object actualProxy = comProxy; + NativeObjectWrapper actualWrapper = nativeObjectWrapper; + if (!nativeObjectWrapper.IsUniqueInstance) { - NativeObjectWrapper wrapper = NativeObjectWrapper.Create( - identity, - inner, - null, // No need to cache NativeObjectWrapper for unique instances. They are not cached. - retValue, - flags); - if (!s_rcwTable.TryAdd(retValue, wrapper)) + // Add our entry to the cache here, using an already existing entry if someone else beat us to it. + (actualWrapper, actualProxy) = _rcwCache.GetOrAddProxyForComInstance(identity, nativeObjectWrapper, comProxy); + if (actualWrapper != nativeObjectWrapper) { - wrapper.Release(); - throw new NotSupportedException(); + // We raced with another thread to map identity to nativeObjectWrapper + // and lost the race. We will use the other thread's nativeObjectWrapper, so we can release ours. + nativeObjectWrapper.Release(); } - AddWrapperToReferenceTrackerHandleCache(wrapper); - return true; } - using (_lock.EnterScope()) + // At this point, actualProxy is the RCW object for the identity + // and actualWrapper is the NativeObjectWrapper that is in the RCW cache (if not unique) that associates the identity with actualProxy. + // Register the NativeObjectWrapper to handle lifetime tracking of the references to the COM object. + RegisterWrapperForObject(actualWrapper, actualProxy); + + return actualProxy; + } + + private void RegisterWrapperForObject(NativeObjectWrapper wrapper, object comProxy) + { + // When we call into RegisterWrapperForObject, there is only one valid non-"unique instance" wrapper for a given + // COM instance, which is already registered in the RCW cache. + // If we find a wrapper in the table that is a different NativeObjectWrapper instance + // then it must be for a different COM instance. + // It's possible that we could race here with another thread that is trying to register the same comProxy + // for the same COM instance, but in that case we'll be passed the same NativeObjectWrapper instance + // for both threads. In that case, it doesn't matter which thread adds the entry to the NativeObjectWrapper table + // as the entry is always the same pair. + Debug.Assert(wrapper.ProxyHandle.Target == comProxy); + Debug.Assert(wrapper.IsUniqueInstance || _rcwCache.FindProxyForComInstance(wrapper.ExternalComObject) == comProxy); + + if (s_nativeObjectWrapperTable.TryGetValue(comProxy, out NativeObjectWrapper? registeredWrapper) + && registeredWrapper != wrapper) { - object? cachedWrapper = null; - if (_rcwCache.TryGetValue(identity, out var existingHandle)) - { - cachedWrapper = existingHandle.Target; - if (cachedWrapper is null) - { - // The GCHandle has been clear out but the NativeObjectWrapper - // finalizer has not yet run to remove the entry from _rcwCache - _rcwCache.Remove(identity); - } - } + Debug.Assert(registeredWrapper.ExternalComObject != wrapper.ExternalComObject); + wrapper.Release(); + throw new NotSupportedException(); + } - if (cachedWrapper is not null) - { - retValue = cachedWrapper; - } - else - { - NativeObjectWrapper wrapper = NativeObjectWrapper.Create( - identity, - inner, - this, - retValue, - flags); - if (!s_rcwTable.TryAdd(retValue, wrapper)) - { - wrapper.Release(); - throw new NotSupportedException(); - } - _rcwCache.Add(identity, wrapper._proxyHandle); - AddWrapperToReferenceTrackerHandleCache(wrapper); - } + registeredWrapper = GetValueFromRcwTable(comProxy, wrapper); + if (registeredWrapper != wrapper) + { + Debug.Assert(registeredWrapper.ExternalComObject != wrapper.ExternalComObject); + wrapper.Release(); + throw new NotSupportedException(); } - return true; + // Always register our wrapper to the reference tracker handle cache here. + // We may not be the thread that registered the handle, but we need to ensure that the wrapper + // is registered before we return to user code. Otherwise the wrapper won't be walked by the + // TrackerObjectManager and we could end up missing a section of the object graph. + // This cache deduplicates, so it is okay that the wrapper will be registered multiple times. + AddWrapperToReferenceTrackerHandleCache(registeredWrapper); + + // Separate out into a local function to avoid the closure and delegate allocation unless we need it. + static NativeObjectWrapper GetValueFromRcwTable(object userObject, NativeObjectWrapper newWrapper) => s_nativeObjectWrapperTable.GetValue(userObject, _ => newWrapper); } -#pragma warning restore IDE0060 private static void AddWrapperToReferenceTrackerHandleCache(NativeObjectWrapper wrapper) { @@ -1089,16 +1104,94 @@ private static void AddWrapperToReferenceTrackerHandleCache(NativeObjectWrapper } } - private void RemoveRCWFromCache(IntPtr comPointer, GCHandle expectedValue) + private sealed class RcwCache { - using (_lock.EnterScope()) + private readonly Lock _lock = new Lock(useTrivialWaits: true); + private readonly Dictionary _cache = []; + + /// + /// Gets the current RCW proxy object for if it exists in the cache or inserts a new entry with . + /// + /// The com instance we want to get or record an RCW for. + /// The for . + /// The proxy object that is associated with . + /// The proxy object currently in the cache for or the proxy object owned by if no entry exists and the corresponding native wrapper. + public (NativeObjectWrapper actualWrapper, object actualProxy) GetOrAddProxyForComInstance(IntPtr comPointer, NativeObjectWrapper wrapper, object comProxy) + { + lock (_lock) + { + Debug.Assert(wrapper.ProxyHandle.Target == comProxy); + ref GCHandle rcwEntry = ref CollectionsMarshal.GetValueRefOrAddDefault(_cache, comPointer, out bool exists); + if (!exists) + { + // Someone else didn't beat us to adding the entry to the cache. + // Add our entry here. + rcwEntry = GCHandle.Alloc(wrapper, GCHandleType.Weak); + } + else if (rcwEntry.Target is not (NativeObjectWrapper cachedWrapper)) + { + Debug.Assert(rcwEntry.IsAllocated); + // The target was collected, so we need to update the cache entry. + rcwEntry.Target = wrapper; + } + else + { + object? existingProxy = cachedWrapper.ProxyHandle.Target; + // The target NativeObjectWrapper was not collected, but we need to make sure + // that the proxy object is still alive. + if (existingProxy is not null) + { + // The existing proxy object is still alive, we will use that. + return (cachedWrapper, existingProxy); + } + + // The proxy object was collected, so we need to update the cache entry. + rcwEntry.Target = wrapper; + } + + // We either added an entry to the cache or updated an existing entry that was dead. + // Return our target object. + return (wrapper, comProxy); + } + } + + public object? FindProxyForComInstance(IntPtr comPointer) { - // TryGetOrCreateObjectForComInstanceInternal may have put a new entry into the cache - // in the time between the GC cleared the contents of the GC handle but before the - // NativeObjectWrapper finalizer ran. - if (_rcwCache.TryGetValue(comPointer, out GCHandle cachedValue) && expectedValue.Equals(cachedValue)) + lock (_lock) { - _rcwCache.Remove(comPointer); + if (_cache.TryGetValue(comPointer, out GCHandle existingHandle)) + { + if (existingHandle.Target is NativeObjectWrapper { ProxyHandle.Target: object cachedProxy }) + { + // The target exists and is still alive. Return it. + return cachedProxy; + } + + // The target was collected, so we need to remove the entry from the cache. + _cache.Remove(comPointer); + existingHandle.Free(); + } + + return null; + } + } + + public void Remove(IntPtr comPointer, NativeObjectWrapper wrapper) + { + lock (_lock) + { + // TryGetOrCreateObjectForComInstanceInternal may have put a new entry into the cache + // in the time between the GC cleared the contents of the GC handle but before the + // NativeObjectWrapper finalizer ran. + // Only remove the entry if the target of the GC handle is the NativeObjectWrapper + // or is null (indicating that the corresponding NativeObjectWrapper has been scheduled for finalization). + if (_cache.TryGetValue(comPointer, out GCHandle cachedRef) + && (wrapper == cachedRef.Target + || cachedRef.Target is null)) + { + _cache.Remove(comPointer); + cachedRef.Free(); + } } } } @@ -1157,7 +1250,7 @@ public static void RegisterForMarshalling(ComWrappers instance) public static unsafe void GetIUnknownImpl(out IntPtr fpQueryInterface, out IntPtr fpAddRef, out IntPtr fpRelease) { fpQueryInterface = (IntPtr)(delegate* unmanaged)&ComWrappers.IUnknown_QueryInterface; - fpAddRef = (IntPtr)(delegate* unmanaged)&ComWrappers.IUnknown_AddRef; + fpAddRef = RuntimeImports.RhGetIUnknownAddRef(); // Implemented in C/C++ to avoid GC transitions fpRelease = (IntPtr)(delegate* unmanaged)&ComWrappers.IUnknown_Release; } @@ -1233,7 +1326,7 @@ internal static void ReleaseExternalObjectsFromCurrentThread() if (nativeObjectWrapper != null && nativeObjectWrapper._contextToken == contextToken) { - object? target = nativeObjectWrapper._proxyHandle.Target; + object? target = nativeObjectWrapper.ProxyHandle.Target; if (target != null) { objects.Add(target); @@ -1260,7 +1353,7 @@ internal static unsafe void WalkExternalTrackerObjects() if (nativeObjectWrapper != null && nativeObjectWrapper.TrackerObject != IntPtr.Zero) { - FindReferenceTargetsCallback.s_currentRootObjectHandle = nativeObjectWrapper._proxyHandle; + FindReferenceTargetsCallback.s_currentRootObjectHandle = nativeObjectWrapper.ProxyHandle; if (IReferenceTracker.FindTrackerTargets(nativeObjectWrapper.TrackerObject, TrackerObjectManager.s_findReferencesTargetCallback) != HResults.S_OK) { walkFailed = true; @@ -1287,7 +1380,7 @@ internal static void DetachNonPromotedObjects() ReferenceTrackerNativeObjectWrapper? nativeObjectWrapper = Unsafe.As(weakNativeObjectWrapperHandle.Target); if (nativeObjectWrapper != null && nativeObjectWrapper.TrackerObject != IntPtr.Zero && - !RuntimeImports.RhIsPromoted(nativeObjectWrapper._proxyHandle.Target)) + !RuntimeImports.RhIsPromoted(nativeObjectWrapper.ProxyHandle.Target)) { // Notify the wrapper it was not promoted and is being collected. TrackerObjectManager.BeforeWrapperFinalized(nativeObjectWrapper.TrackerObject); @@ -1302,13 +1395,6 @@ internal static unsafe int IUnknown_QueryInterface(IntPtr pThis, Guid* guid, Int return wrapper->QueryInterface(in *guid, out *ppObject); } - [UnmanagedCallersOnly] - internal static unsafe uint IUnknown_AddRef(IntPtr pThis) - { - ManagedObjectWrapper* wrapper = ComInterfaceDispatch.ToManagedObjectWrapper((ComInterfaceDispatch*)pThis); - return wrapper->AddRef(); - } - [UnmanagedCallersOnly] internal static unsafe uint IUnknown_Release(IntPtr pThis) { @@ -1381,8 +1467,7 @@ private static unsafe IntPtr CreateDefaultIReferenceTrackerTargetVftbl() { IntPtr* vftbl = (IntPtr*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ComWrappers), 7 * sizeof(IntPtr)); vftbl[0] = (IntPtr)(delegate* unmanaged)&ComWrappers.IReferenceTrackerTarget_QueryInterface; - vftbl[1] = (IntPtr)(delegate* unmanaged)&ComWrappers.IUnknown_AddRef; - vftbl[2] = (IntPtr)(delegate* unmanaged)&ComWrappers.IUnknown_Release; + GetIUnknownImpl(out _, out vftbl[1], out vftbl[2]); vftbl[3] = (IntPtr)(delegate* unmanaged)&ComWrappers.IReferenceTrackerTarget_AddRefFromReferenceTracker; vftbl[4] = (IntPtr)(delegate* unmanaged)&ComWrappers.IReferenceTrackerTarget_ReleaseFromReferenceTracker; vftbl[5] = (IntPtr)(delegate* unmanaged)&ComWrappers.IReferenceTrackerTarget_Peg; @@ -1418,15 +1503,10 @@ internal static unsafe int IReferenceTrackerHost_DisconnectUnusedReferenceSource [UnmanagedCallersOnly] internal static unsafe int IReferenceTrackerHost_ReleaseDisconnectedReferenceSources(IntPtr pThis) { - try - { - GC.WaitForPendingFinalizers(); - return HResults.S_OK; - } - catch (Exception e) - { - return Marshal.GetHRForException(e); - } + // We'd like to call GC.WaitForPendingFinalizers() here, but this could lead to deadlock + // if the finalizer thread is trying to get back to this thread, because we are not pumping + // anymore. Disable this for now. See: https://github.com/dotnet/runtime/issues/109538. + return HResults.S_OK; } [UnmanagedCallersOnly] @@ -1621,7 +1701,7 @@ private static unsafe bool PossiblyComObject(object target) // If the RCW is an aggregated RCW, then the managed object cannot be recreated from the IUnknown // as the outer IUnknown wraps the managed object. In this case, don't create a weak reference backed // by a COM weak reference. - return s_rcwTable.TryGetValue(target, out NativeObjectWrapper? wrapper) && !wrapper._aggregatedManagedObjectWrapper; + return s_nativeObjectWrapperTable.TryGetValue(target, out NativeObjectWrapper? wrapper) && !wrapper.IsAggregatedWithManagedObjectWrapper; } private static unsafe IntPtr ObjectToComWeakRef(object target, out long wrapperId) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs index 7f833e613e5c4b..56477a7f39c83c 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs @@ -469,12 +469,15 @@ internal static unsafe int RhCompatibleReentrantWaitAny(bool alertable, int time [MethodImplAttribute(MethodImplOptions.InternalCall)] [RuntimeImport(RuntimeLibrary, "RhResolveDispatchOnType")] - internal static extern unsafe IntPtr RhResolveDispatchOnType(MethodTable* instanceType, MethodTable* interfaceType, ushort slot, MethodTable** pGenericContext); + internal static extern unsafe IntPtr RhResolveDispatchOnType(MethodTable* instanceType, MethodTable* interfaceType, ushort slot); - internal static unsafe IntPtr RhResolveDispatchOnType(MethodTable* instanceType, MethodTable* interfaceType, ushort slot) - { - return RhResolveDispatchOnType(instanceType, interfaceType, slot, null); - } + [MethodImplAttribute(MethodImplOptions.InternalCall)] + [RuntimeImport(RuntimeLibrary, "RhResolveStaticDispatchOnType")] + internal static extern unsafe IntPtr RhResolveStaticDispatchOnType(MethodTable* instanceType, MethodTable* interfaceType, ushort slot, MethodTable** pGenericContext); + + [MethodImplAttribute(MethodImplOptions.InternalCall)] + [RuntimeImport(RuntimeLibrary, "RhResolveDynamicInterfaceCastableDispatchOnType")] + internal static extern unsafe IntPtr RhResolveDynamicInterfaceCastableDispatchOnType(MethodTable* instanceType, MethodTable* interfaceType, ushort slot, MethodTable** pGenericContext); [MethodImplAttribute(MethodImplOptions.InternalCall)] [RuntimeImport(RuntimeLibrary, "RhGetRuntimeHelperForType")] @@ -508,6 +511,10 @@ internal enum GcRestrictedCalloutKind [RuntimeImport(RuntimeLibrary, "RhUnregisterRefCountedHandleCallback")] internal static extern unsafe void RhUnregisterRefCountedHandleCallback(IntPtr pCalloutMethod, MethodTable* pTypeFilter); + [MethodImplAttribute(MethodImplOptions.InternalCall)] + [RuntimeImport(RuntimeLibrary, "RhGetIUnknownAddRef")] + internal static extern IntPtr RhGetIUnknownAddRef(); + #if FEATURE_OBJCMARSHAL [MethodImplAttribute(MethodImplOptions.InternalCall)] [RuntimeImport(RuntimeLibrary, "RhRegisterObjectiveCMarshalBeginEndCallback")] diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj b/src/coreclr/nativeaot/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj index b00904e556f2ca..09881516e2950c 100644 --- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj +++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/System.Private.TypeLoader.csproj @@ -200,9 +200,6 @@ Internal\TypeSystem\ThrowHelper.Common.cs - - LockFreeReaderHashtableOfPointers.cs - Internal\TypeSystem\Utilities\ExceptionTypeNameFormatter.cs diff --git a/src/coreclr/pal/inc/unixasmmacrosamd64.inc b/src/coreclr/pal/inc/unixasmmacrosamd64.inc index bc6d770a51824a..31093a4073d2ed 100644 --- a/src/coreclr/pal/inc/unixasmmacrosamd64.inc +++ b/src/coreclr/pal/inc/unixasmmacrosamd64.inc @@ -16,15 +16,6 @@ .macro NESTED_END Name, Section LEAF_END \Name, \Section -#if defined(__APPLE__) - .set LOCAL_LABEL(\Name\()_Size), . - C_FUNC(\Name) - .section __LD,__compact_unwind,regular,debug - .quad C_FUNC(\Name) - .long LOCAL_LABEL(\Name\()_Size) - .long 0x04000000 # DWARF - .quad 0 - .quad 0 -#endif .endm .macro PATCH_LABEL Name diff --git a/src/coreclr/pal/src/exception/machexception.cpp b/src/coreclr/pal/src/exception/machexception.cpp index 5f1bf97605784b..fdb3d8dc837c15 100644 --- a/src/coreclr/pal/src/exception/machexception.cpp +++ b/src/coreclr/pal/src/exception/machexception.cpp @@ -1325,7 +1325,7 @@ void MachExceptionInfo::RestoreState(mach_port_t thread) kern_return_t machret = thread_set_state(thread, x86_THREAD_STATE, (thread_state_t)&ThreadState, x86_THREAD_STATE_COUNT); CHECK_MACH("thread_set_state(thread)", machret); - machret = thread_set_state(thread, FloatState.ash.flavor, (thread_state_t)&FloatState, FloatState.ash.count); + machret = thread_set_state(thread, FloatState.ash.flavor, (thread_state_t)&FloatState.ufs, FloatState.ash.count); CHECK_MACH("thread_set_state(float)", machret); machret = thread_set_state(thread, x86_DEBUG_STATE, (thread_state_t)&DebugState, x86_DEBUG_STATE_COUNT); diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index ec518417ef8386..9504e6995c5506 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -105,6 +105,9 @@ extern "C" } \ } while (false) +// On macOS 26, sem_open fails if debugger and debugee are signed with different team ids. +// Use fifos instead of semaphores to avoid this issue, https://github.com/dotnet/runtime/issues/116545 +#define ENABLE_RUNTIME_EVENTS_OVER_PIPES #endif // __APPLE__ #ifdef __NetBSD__ @@ -1432,21 +1435,217 @@ static uint64_t HashSemaphoreName(uint64_t a, uint64_t b) static const char *const TwoWayNamedPipePrefix = "clr-debug-pipe"; static const char* IpcNameFormat = "%s-%d-%llu-%s"; -/*++ - PAL_NotifyRuntimeStarted +#ifdef ENABLE_RUNTIME_EVENTS_OVER_PIPES +static const char* RuntimeStartupPipeName = "st"; +static const char* RuntimeContinuePipeName = "co"; - Signals the debugger waiting for runtime startup notification to continue and - waits until the debugger signals us to continue. +#define PIPE_OPEN_RETRY_DELAY_NS 500000000 // 500 ms -Parameters: - None +typedef enum +{ + RuntimeEventsOverPipes_Disabled = 0, + RuntimeEventsOverPipes_Succeeded = 1, + RuntimeEventsOverPipes_Failed = 2, +} RuntimeEventsOverPipes; -Return value: - TRUE - successfully launched by debugger, FALSE - not launched or some failure in the handshake ---*/ +typedef enum +{ + RuntimeEvent_Unknown = 0, + RuntimeEvent_Started = 1, + RuntimeEvent_Continue = 2, +} RuntimeEvent; + +static +int +OpenPipe(const char* name, int mode) +{ + int fd = -1; + int flags = mode | O_NONBLOCK; + +#if defined(FD_CLOEXEC) + flags |= O_CLOEXEC; +#endif + + while (fd == -1) + { + fd = open(name, flags); + if (fd == -1) + { + if (mode == O_WRONLY && errno == ENXIO) + { + PAL_nanosleep(PIPE_OPEN_RETRY_DELAY_NS); + continue; + } + else if (errno == EINTR) + { + continue; + } + else + { + break; + } + } + } + + if (fd != -1) + { + flags = fcntl(fd, F_GETFL); + if (flags != -1) + { + flags &= ~O_NONBLOCK; + if (fcntl(fd, F_SETFL, flags) == -1) + { + close(fd); + fd = -1; + } + } + else + { + close(fd); + fd = -1; + } + } + + return fd; +} + +static +void +ClosePipe(int fd) +{ + if (fd != -1) + { + while (close(fd) < 0 && errno == EINTR); + } +} + +static +RuntimeEventsOverPipes +NotifyRuntimeUsingPipes() +{ + RuntimeEventsOverPipes result = RuntimeEventsOverPipes_Disabled; + char startupPipeName[MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH]; + char continuePipeName[MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH]; + int startupPipeFd = -1; + int continuePipeFd = -1; + size_t offset = 0; + + LPCSTR applicationGroupId = PAL_GetApplicationGroupId(); + + PAL_GetTransportPipeName(continuePipeName, gPID, applicationGroupId, RuntimeContinuePipeName); + TRACE("NotifyRuntimeUsingPipes: opening continue '%s' pipe\n", continuePipeName); + + continuePipeFd = OpenPipe(continuePipeName, O_RDONLY); + if (continuePipeFd == -1) + { + if (errno == ENOENT || errno == EACCES) + { + TRACE("NotifyRuntimeUsingPipes: pipe %s not found/accessible, runtime events over pipes disabled\n", continuePipeName); + } + else + { + TRACE("NotifyRuntimeUsingPipes: open(%s) failed: %d (%s)\n", continuePipeName, errno, strerror(errno)); + result = RuntimeEventsOverPipes_Failed; + } + + goto exit; + } + + PAL_GetTransportPipeName(startupPipeName, gPID, applicationGroupId, RuntimeStartupPipeName); + TRACE("NotifyRuntimeUsingPipes: opening startup '%s' pipe\n", startupPipeName); + + startupPipeFd = OpenPipe(startupPipeName, O_WRONLY); + if (startupPipeFd == -1) + { + if (errno == ENOENT || errno == EACCES) + { + TRACE("NotifyRuntimeUsingPipes: pipe %s not found/accessible, runtime events over pipes disabled\n", startupPipeName); + } + else + { + TRACE("NotifyRuntimeUsingPipes: open(%s) failed: %d (%s)\n", startupPipeName, errno, strerror(errno)); + result = RuntimeEventsOverPipes_Failed; + } + + goto exit; + } + + TRACE("NotifyRuntimeUsingPipes: sending started event\n"); + + { + unsigned char event = (unsigned char)RuntimeEvent_Started; + unsigned char *buffer = &event; + int bytesToWrite = sizeof(event); + int bytesWritten = 0; + + do + { + bytesWritten = write(startupPipeFd, buffer + offset, bytesToWrite - offset); + if (bytesWritten > 0) + { + offset += bytesWritten; + } + } + while ((bytesWritten > 0 && offset < bytesToWrite) || (bytesWritten == -1 && errno == EINTR)); + + if (offset != bytesToWrite) + { + TRACE("NotifyRuntimeUsingPipes: write(%s) failed: %d (%s)\n", startupPipeName, errno, strerror(errno)); + goto exit; + } + } + + TRACE("NotifyRuntimeUsingPipes: waiting on continue event\n"); + + { + unsigned char event = (unsigned char)RuntimeEvent_Unknown; + unsigned char *buffer = &event; + int bytesToRead = sizeof(event); + int bytesRead = 0; + + offset = 0; + do + { + bytesRead = read(continuePipeFd, buffer + offset, bytesToRead - offset); + if (bytesRead > 0) + { + offset += bytesRead; + } + } + while ((bytesRead > 0 && offset < bytesToRead) || (bytesRead == -1 && errno == EINTR)); + + if (offset == bytesToRead && event == (unsigned char)RuntimeEvent_Continue) + { + TRACE("NotifyRuntimeUsingPipes: received continue event\n"); + } + else + { + TRACE("NotifyRuntimeUsingPipes: received invalid event\n"); + goto exit; + } + } + + result = RuntimeEventsOverPipes_Succeeded; + +exit: + + if (startupPipeFd != -1) + { + ClosePipe(startupPipeFd); + } + + if (continuePipeFd != -1) + { + ClosePipe(continuePipeFd); + } + + return result; +} +#endif // ENABLE_RUNTIME_EVENTS_OVER_PIPES + +static BOOL -PALAPI -PAL_NotifyRuntimeStarted() +NotifyRuntimeUsingSemaphores() { char startupSemName[CLR_SEM_MAX_NAMELEN]; char continueSemName[CLR_SEM_MAX_NAMELEN]; @@ -1467,13 +1666,13 @@ PAL_NotifyRuntimeStarted() CreateSemaphoreName(startupSemName, RuntimeStartupSemaphoreName, unambiguousProcessDescriptor, applicationGroupId); CreateSemaphoreName(continueSemName, RuntimeContinueSemaphoreName, unambiguousProcessDescriptor, applicationGroupId); - TRACE("PAL_NotifyRuntimeStarted opening continue '%s' startup '%s'\n", continueSemName, startupSemName); + TRACE("NotifyRuntimeUsingSemaphores: opening continue '%s' startup '%s'\n", continueSemName, startupSemName); // Open the debugger startup semaphore. If it doesn't exists, then we do nothing and return startupSem = sem_open(startupSemName, 0); if (startupSem == SEM_FAILED) { - TRACE("sem_open(%s) failed: %d (%s)\n", startupSemName, errno, strerror(errno)); + TRACE("NotifyRuntimeUsingSemaphores: sem_open(%s) failed: %d (%s)\n", startupSemName, errno, strerror(errno)); goto exit; } @@ -1496,7 +1695,7 @@ PAL_NotifyRuntimeStarted() { if (EINTR == errno) { - TRACE("sem_wait() failed with EINTR; re-waiting"); + TRACE("NotifyRuntimeUsingSemaphores: sem_wait() failed with EINTR; re-waiting"); continue; } ASSERT("sem_wait(continueSem) failed: errno is %d (%s)\n", errno, strerror(errno)); @@ -1518,6 +1717,45 @@ PAL_NotifyRuntimeStarted() return launched; } +/*++ + PAL_NotifyRuntimeStarted + + Signals the debugger waiting for runtime startup notification to continue and + waits until the debugger signals us to continue. + +Parameters: + None + +Return value: + TRUE - successfully launched by debugger, FALSE - not launched or some failure in the handshake +--*/ +BOOL +PALAPI +PAL_NotifyRuntimeStarted() +{ +#ifdef ENABLE_RUNTIME_EVENTS_OVER_PIPES + // Test pipes as runtime event transport. + RuntimeEventsOverPipes result = NotifyRuntimeUsingPipes(); + switch (result) + { + case RuntimeEventsOverPipes_Disabled: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake disabled, try semaphores\n"); + return NotifyRuntimeUsingSemaphores(); + case RuntimeEventsOverPipes_Failed: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake failed\n"); + return FALSE; + case RuntimeEventsOverPipes_Succeeded: + TRACE("PAL_NotifyRuntimeStarted: pipe handshake succeeded\n"); + return TRUE; + default: + // Unexpected result. + return FALSE; + } +#else + return NotifyRuntimeUsingSemaphores(); +#endif // ENABLE_RUNTIME_EVENTS_OVER_PIPES +} + LPCSTR PALAPI PAL_GetApplicationGroupId() diff --git a/src/coreclr/tools/Common/Internal/Runtime/RuntimeConstants.cs b/src/coreclr/tools/Common/Internal/Runtime/RuntimeConstants.cs index 8ce74a03072b4d..9d356cb066813d 100644 --- a/src/coreclr/tools/Common/Internal/Runtime/RuntimeConstants.cs +++ b/src/coreclr/tools/Common/Internal/Runtime/RuntimeConstants.cs @@ -43,6 +43,11 @@ internal static class SpecialDispatchMapSlot public const ushort Reabstraction = 0xFFFF; } + internal static class DispatchMapCodePointerFlags + { + public const int RequiresInstantiatingThunkFlag = 2; + } + internal static class SpecialGVMInterfaceEntry { public const uint Diamond = 0xFFFFFFFF; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index f29717b0d3a2c3..b9bdb5e55f7924 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -2287,6 +2287,10 @@ private int MarkGcField(byte* gcPtrs, CorInfoGCType gcType) private int GatherClassGCLayout(MetadataType type, byte* gcPtrs) { int result = 0; + + if (type.MetadataBaseType is { ContainsGCPointers: true } baseType) + result += GatherClassGCLayout(baseType, gcPtrs); + bool isInlineArray = type.IsInlineArray; foreach (var field in type.GetFields()) diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs index 0decdff50a7a0d..af6aac636146ed 100644 --- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs +++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using Debug = System.Diagnostics.Debug; +#nullable disable + namespace Internal.TypeSystem { /// diff --git a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs index 60084f4d03d1be..6d278e4b9597a8 100644 --- a/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs +++ b/src/coreclr/tools/aot/ILCompiler.Build.Tasks/ComputeManagedAssembliesToCompileToNative.cs @@ -5,6 +5,7 @@ using Microsoft.Build.Utilities; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; @@ -99,16 +100,20 @@ public override bool Execute() var list = new List(); var assembliesToSkipPublish = new List(); var satelliteAssemblies = new List(); - var nativeAotFrameworkAssembliesToUse = new HashSet(); + var nativeAotFrameworkAssembliesToUse = new Dictionary(); foreach (ITaskItem taskItem in SdkAssemblies) { - nativeAotFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); + var fileName = Path.GetFileName(taskItem.ItemSpec); + if (!nativeAotFrameworkAssembliesToUse.ContainsKey(fileName)) + nativeAotFrameworkAssembliesToUse.Add(fileName, taskItem); } foreach (ITaskItem taskItem in FrameworkAssemblies) { - nativeAotFrameworkAssembliesToUse.Add(Path.GetFileName(taskItem.ItemSpec)); + var fileName = Path.GetFileName(taskItem.ItemSpec); + if (!nativeAotFrameworkAssembliesToUse.ContainsKey(fileName)) + nativeAotFrameworkAssembliesToUse.Add(fileName, taskItem); } foreach (ITaskItem taskItem in Assemblies) @@ -153,8 +158,21 @@ public override bool Execute() // Remove any assemblies whose implementation we want to come from NativeAOT's package. // Currently that's System.Private.* SDK assemblies and a bunch of framework assemblies. - if (nativeAotFrameworkAssembliesToUse.Contains(assemblyFileName)) + if (nativeAotFrameworkAssembliesToUse.TryGetValue(assemblyFileName, out ITaskItem frameworkItem)) { + if (GetFileVersion(itemSpec).CompareTo(GetFileVersion(frameworkItem.ItemSpec)) > 0) + { + if (assemblyFileName == "System.Private.CoreLib.dll") + { + Log.LogError($"Overriding System.Private.CoreLib.dll with a newer version is not supported. Attempted to use {itemSpec} instead of {frameworkItem.ItemSpec}."); + } + else + { + // Allow OOB references with higher version to take precedence over the framework assemblies. + list.Add(taskItem); + } + } + assembliesToSkipPublish.Add(taskItem); continue; } @@ -196,6 +214,12 @@ public override bool Execute() SatelliteAssemblies = satelliteAssemblies.ToArray(); return true; + + static Version GetFileVersion(string path) + { + var versionInfo = FileVersionInfo.GetVersionInfo(path); + return new Version(versionInfo.FileMajorPart, versionInfo.FileMinorPart, versionInfo.FileBuildPart, versionInfo.FilePrivatePart); + } } } } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.InterfaceThunks.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.InterfaceThunks.cs index 51bf6a6888e2ff..b9c8f7aa3566bb 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.InterfaceThunks.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.InterfaceThunks.cs @@ -62,13 +62,11 @@ namespace ILCompiler // Contains functionality related to instantiating thunks for default interface methods public partial class CompilerTypeSystemContext { - private const int UseContextFromRuntime = -1; - /// /// For a shared (canonical) default interface method, gets a method that can be used to call the /// method on a specific implementing class. /// - public MethodDesc GetDefaultInterfaceMethodImplementationThunk(MethodDesc targetMethod, TypeDesc implementingClass, DefType interfaceOnDefinition) + public MethodDesc GetDefaultInterfaceMethodImplementationThunk(MethodDesc targetMethod, TypeDesc implementingClass, DefType interfaceOnDefinition, out int interfaceIndex) { Debug.Assert(targetMethod.IsSharedByGenericInstantiations); Debug.Assert(!targetMethod.Signature.IsStatic); @@ -76,11 +74,16 @@ public MethodDesc GetDefaultInterfaceMethodImplementationThunk(MethodDesc target Debug.Assert(interfaceOnDefinition.GetTypeDefinition() == targetMethod.OwningType.GetTypeDefinition()); Debug.Assert(targetMethod.OwningType.IsInterface); - int interfaceIndex; + bool useContextFromRuntime = false; if (implementingClass.IsInterface) { Debug.Assert(((MetadataType)implementingClass).IsDynamicInterfaceCastableImplementation()); - interfaceIndex = UseContextFromRuntime; + useContextFromRuntime = true; + } + + if (useContextFromRuntime && targetMethod.OwningType == implementingClass) + { + interfaceIndex = -1; } else { @@ -90,7 +93,7 @@ public MethodDesc GetDefaultInterfaceMethodImplementationThunk(MethodDesc target // Get a method that will inject the appropriate instantiation context to the // target default interface method. - var methodKey = new DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey(targetMethod, interfaceIndex); + var methodKey = new DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey(targetMethod, interfaceIndex, useContextFromRuntime); MethodDesc thunk = _dimThunkHashtable.GetOrCreateValue(methodKey); return thunk; @@ -117,11 +120,13 @@ private struct DefaultInterfaceMethodImplementationInstantiationThunkHashtableKe { public readonly MethodDesc TargetMethod; public readonly int InterfaceIndex; + public bool UseContextFromRuntime; - public DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey(MethodDesc targetMethod, int interfaceIndex) + public DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey(MethodDesc targetMethod, int interfaceIndex, bool useContextFromRuntime) { TargetMethod = targetMethod; InterfaceIndex = interfaceIndex; + UseContextFromRuntime = useContextFromRuntime; } } @@ -138,17 +143,19 @@ protected override int GetValueHashCode(DefaultInterfaceMethodImplementationInst protected override bool CompareKeyToValue(DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey key, DefaultInterfaceMethodImplementationInstantiationThunk value) { return ReferenceEquals(key.TargetMethod, value.TargetMethod) && - key.InterfaceIndex == value.InterfaceIndex; + key.InterfaceIndex == value.InterfaceIndex && + key.UseContextFromRuntime == value.UseContextFromRuntime; } protected override bool CompareValueToValue(DefaultInterfaceMethodImplementationInstantiationThunk value1, DefaultInterfaceMethodImplementationInstantiationThunk value2) { return ReferenceEquals(value1.TargetMethod, value2.TargetMethod) && - value1.InterfaceIndex == value2.InterfaceIndex; + value1.InterfaceIndex == value2.InterfaceIndex && + value1.UseContextFromRuntime == value2.UseContextFromRuntime; } protected override DefaultInterfaceMethodImplementationInstantiationThunk CreateValueFromKey(DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey key) { TypeDesc owningTypeOfThunks = ((CompilerTypeSystemContext)key.TargetMethod.Context).GeneratedAssembly.GetGlobalModuleType(); - return new DefaultInterfaceMethodImplementationInstantiationThunk(owningTypeOfThunks, key.TargetMethod, key.InterfaceIndex); + return new DefaultInterfaceMethodImplementationInstantiationThunk(owningTypeOfThunks, key.TargetMethod, key.InterfaceIndex, key.UseContextFromRuntime); } } private DefaultInterfaceMethodImplementationInstantiationThunkHashtable _dimThunkHashtable = new DefaultInterfaceMethodImplementationInstantiationThunkHashtable(); @@ -162,8 +169,9 @@ private sealed partial class DefaultInterfaceMethodImplementationInstantiationTh private readonly DefaultInterfaceMethodImplementationWithHiddenParameter _nakedTargetMethod; private readonly TypeDesc _owningType; private readonly int _interfaceIndex; + private readonly bool _useContextFromRuntime; - public DefaultInterfaceMethodImplementationInstantiationThunk(TypeDesc owningType, MethodDesc targetMethod, int interfaceIndex) + public DefaultInterfaceMethodImplementationInstantiationThunk(TypeDesc owningType, MethodDesc targetMethod, int interfaceIndex, bool useContextFromRuntime) { Debug.Assert(targetMethod.OwningType.IsInterface); Debug.Assert(!targetMethod.Signature.IsStatic); @@ -172,6 +180,7 @@ public DefaultInterfaceMethodImplementationInstantiationThunk(TypeDesc owningTyp _targetMethod = targetMethod; _nakedTargetMethod = new DefaultInterfaceMethodImplementationWithHiddenParameter(targetMethod, owningType); _interfaceIndex = interfaceIndex; + _useContextFromRuntime = useContextFromRuntime; } public override TypeSystemContext Context => _targetMethod.Context; @@ -180,6 +189,8 @@ public DefaultInterfaceMethodImplementationInstantiationThunk(TypeDesc owningTyp public int InterfaceIndex => _interfaceIndex; + public bool UseContextFromRuntime => _useContextFromRuntime; + public override MethodSignature Signature => _targetMethod.Signature; public MethodDesc TargetMethod => _targetMethod; @@ -202,7 +213,7 @@ public override string DiagnosticName public MethodDesc BaseMethod => _targetMethod; - public string Prefix => $"__InstantiatingStub_{_interfaceIndex}_"; + public string Prefix => $"__InstantiatingStub_{(uint)_interfaceIndex}_{(_useContextFromRuntime ? "_FromRuntime" : "")}_"; public override MethodIL EmitIL() { @@ -230,7 +241,7 @@ public override MethodIL EmitIL() } // Load the instantiating argument. - if (_interfaceIndex == UseContextFromRuntime) + if (_useContextFromRuntime) { codeStream.Emit(ILOpcode.call, emit.NewToken(getCurrentContext)); } @@ -238,6 +249,10 @@ public override MethodIL EmitIL() { codeStream.EmitLdArg(0); codeStream.Emit(ILOpcode.ldfld, emit.NewToken(eeTypeField)); + } + + if (_interfaceIndex >= 0) + { codeStream.EmitLdc(_interfaceIndex); codeStream.Emit(ILOpcode.call, emit.NewToken(getOrdinalInterfaceMethod)); } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs index a27a77882ab130..722618c759d562 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs @@ -539,10 +539,10 @@ public sealed override IEnumerable GetConditionalSt if (!isStaticInterfaceMethod && defaultIntfMethod.IsCanonicalMethod(CanonicalFormKind.Any)) { // Canonical instance default methods need to go through a thunk that adds the right generic context - defaultIntfMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(defaultIntfMethod, defType.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType); + defaultIntfMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(defaultIntfMethod, defType.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType, out int providingInterfaceIndex); // The above thunk will index into interface list to find the right context. Make sure to keep all interfaces prior to this one - for (int i = 0; i < interfaceIndex; i++) + for (int i = 0; i <= providingInterfaceIndex; i++) { result.Add(new CombinedDependencyListEntry( factory.InterfaceUse(defTypeRuntimeInterfaces[i].GetTypeDefinition()), diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs index dfa6c0967282e2..f0b9fbf532457e 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/SealedVTableNode.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using Internal.Runtime; using Internal.Text; using Internal.TypeSystem; @@ -218,10 +219,10 @@ public bool BuildSealedVTableSlots(NodeFactory factory, bool relocsOnly) { // Canonical instance default interface methods need to go through a thunk that acquires the generic context from `this`. // Static methods have their generic context passed explicitly. - canonImplMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(canonImplMethod, declType.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType); + canonImplMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(canonImplMethod, declType.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType, out int providingInterfaceIndex); // The above thunk will index into interface list to find the right context. Make sure to keep all interfaces prior to this one - for (int i = 0; i < interfaceIndex; i++) + for (int i = 0; i <= providingInterfaceIndex; i++) { _nonRelocationDependencies ??= new DependencyList(); _nonRelocationDependencies.Add(factory.InterfaceUse(declTypeRuntimeInterfaces[i].GetTypeDefinition()), "Interface with shared default methods folows this"); @@ -267,14 +268,20 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly) if (BuildSealedVTableSlots(factory, relocsOnly)) { + bool isSharedDynamicInterfaceCastableImpl = _type.IsInterface + && _type.IsCanonicalSubtype(CanonicalFormKind.Any) + && ((MetadataType)_type).IsDynamicInterfaceCastableImplementation(); + for (int i = 0; i < _sealedVTableEntries.Count; i++) { IMethodNode relocTarget = _sealedVTableEntries[i].Target; + int delta = isSharedDynamicInterfaceCastableImpl ? DispatchMapCodePointerFlags.RequiresInstantiatingThunkFlag : 0; + if (factory.Target.SupportsRelativePointers) - objData.EmitReloc(relocTarget, RelocType.IMAGE_REL_BASED_RELPTR32); + objData.EmitReloc(relocTarget, RelocType.IMAGE_REL_BASED_RELPTR32, delta); else - objData.EmitPointerReloc(relocTarget); + objData.EmitPointerReloc(relocTarget, delta); } } diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataNode.cs index 87a2c829c0269b..36ec3d8b265af0 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataNode.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataNode.cs @@ -130,6 +130,18 @@ public static void GetMetadataDependencies(ref DependencyList dependencies, Node default: Debug.Assert(type.IsDefType); + // We generally postpone creating MethodTables until absolutely needed. + // IDynamicInterfaceCastableImplementation is special in the sense that just obtaining a System.Type + // (by e.g. browsing custom attribute metadata) gives the user enough to pass this to runtime APIs + // that need a MethodTable. We don't have a legitimate type handle without the MethodTable. Other + // kinds of APIs that expect a MethodTable have enough dataflow annotation to trigger warnings. + // There's no dataflow annotations on the IDynamicInterfaceCastable.GetInterfaceImplementation API. + if (type.IsInterface && ((MetadataType)type).IsDynamicInterfaceCastableImplementation()) + { + dependencies ??= new DependencyList(); + dependencies.Add(nodeFactory.ReflectedType(type), "Reflected IDynamicInterfaceCastableImplementation"); + } + TypeDesc typeDefinition = type.GetTypeDefinition(); if (typeDefinition != type) { diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SubstitutedILProvider.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SubstitutedILProvider.cs index 6b339f8a89d2e3..fd2442c4b6b41c 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SubstitutedILProvider.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SubstitutedILProvider.cs @@ -748,12 +748,12 @@ private bool TryGetConstantArgument(MethodIL methodIL, byte[] body, OpcodeFlags[ { BodySubstitution substitution = _substitutionProvider.GetSubstitution(method); if (substitution != null && substitution.Value is int - && (opcode != ILOpcode.callvirt || !method.IsVirtual)) + && ((opcode != ILOpcode.callvirt && !method.Signature.IsStatic) || !method.IsVirtual)) { constant = (int)substitution.Value; return true; } - if ((opcode != ILOpcode.callvirt || !method.IsVirtual) + if (((opcode != ILOpcode.callvirt && !method.Signature.IsStatic) || !method.IsVirtual) && TryGetMethodConstantValue(method, out constant)) { return true; diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp index 3a1ab790f4753f..3df24664ff2df5 100644 --- a/src/coreclr/vm/ceemain.cpp +++ b/src/coreclr/vm/ceemain.cpp @@ -862,31 +862,18 @@ void EEStartupHelper() #ifdef PROFILING_SUPPORTED // Initialize the profiling services. + // This must happen before Thread::HasStarted() that fires profiler notifications is called on the finalizer thread. hr = ProfilingAPIUtility::InitializeProfiling(); _ASSERTE(SUCCEEDED(hr)); IfFailGo(hr); #endif // PROFILING_SUPPORTED - InitializeExceptionHandling(); - - // - // Install our global exception filter - // - if (!InstallUnhandledExceptionFilter()) - { - IfFailGo(E_FAIL); - } - - // throws on error - SetupThread(); - -#ifdef DEBUGGING_SUPPORTED - // Notify debugger once the first thread is created to finish initialization. - if (g_pDebugInterface != NULL) - { - g_pDebugInterface->StartupPhase2(GetThread()); - } +#ifdef TARGET_WINDOWS + // Create the finalizer thread on windows earlier, as we will need to wait for + // the completion of its initialization part that initializes COM as that has to be done + // before the first Thread is attached. Thus we want to give the thread a bit more time. + FinalizerThread::FinalizerThreadCreate(); #endif InitPreStubManager(); @@ -902,8 +889,6 @@ void EEStartupHelper() InitJITHelpers1(); InitJITHelpers2(); - SyncBlockCache::Attach(); - // Set up the sync block SyncBlockCache::Start(); @@ -918,6 +903,48 @@ void EEStartupHelper() IfFailGo(hr); + InitializeExceptionHandling(); + + // + // Install our global exception filter + // + if (!InstallUnhandledExceptionFilter()) + { + IfFailGo(E_FAIL); + } + +#ifdef TARGET_WINDOWS + // g_pGCHeap->Initialize() above could take nontrivial time, so by now the finalizer thread + // should have initialized FLS slot for thread cleanup notifications. + // And ensured that COM is initialized (must happen before allocating FLS slot). + // Make sure that this was done before we start creating Thread objects + // Ex: The call to SetupThread below will create and attach a Thread object. + // Event pipe might also do that. + FinalizerThread::WaitForFinalizerThreadStart(); +#endif + + // throws on error + _ASSERTE(GetThreadNULLOk() == NULL); + SetupThread(); + +#ifdef DEBUGGING_SUPPORTED + // Notify debugger once the first thread is created to finish initialization. + if (g_pDebugInterface != NULL) + { + g_pDebugInterface->StartupPhase2(GetThread()); + } +#endif + +#ifndef TARGET_WINDOWS + // This isn't done as part of InitializeGarbageCollector() above because + // debugger must be initialized before creating EE thread objects + FinalizerThread::FinalizerThreadCreate(); +#else + // On windows the finalizer thread is already partially created and is waiting + // right before doing HasStarted(). We will release it now. + FinalizerThread::EnableFinalization(); +#endif + #ifdef FEATURE_PERFTRACING // Finish setting up rest of EventPipe - specifically enable SampleProfiler if it was requested at startup. // SampleProfiler needs to cooperate with the GC which hasn't fully finished setting up in the first part of the @@ -926,10 +953,6 @@ void EEStartupHelper() #endif // FEATURE_PERFTRACING GenAnalysis::Initialize(); - // This isn't done as part of InitializeGarbageCollector() above because thread - // creation requires AppDomains to have been set up. - FinalizerThread::FinalizerThreadCreate(); - // Now we really have fully initialized the garbage collector SetGarbageCollectorFullyInitialized(); @@ -1707,6 +1730,137 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error. #endif // !defined(CORECLR_EMBEDDED) +static void RuntimeThreadShutdown(void* thread) +{ + Thread* pThread = (Thread*)thread; + _ASSERTE(pThread == GetThreadNULLOk()); + + if (pThread) + { +#ifdef FEATURE_COMINTEROP + // reset the CoInitialize state + // so we don't call CoUninitialize during thread detach + pThread->ResetCoInitialized(); +#endif // FEATURE_COMINTEROP + // For case where thread calls ExitThread directly, we need to reset the + // frame pointer. Otherwise stackwalk would AV. We need to do it in cooperative mode. + // We need to set m_GCOnTransitionsOK so this thread won't trigger GC when toggle GC mode + if (pThread->m_pFrame != FRAME_TOP) + { +#ifdef _DEBUG + pThread->m_GCOnTransitionsOK = FALSE; +#endif + GCX_COOP_NO_DTOR(); + pThread->m_pFrame = FRAME_TOP; + GCX_COOP_NO_DTOR_END(); + } + + pThread->DetachThread(TRUE); + } + else + { + // Since we don't actually cleanup the TLS data along this path, verify that it is already cleaned up + AssertThreadStaticDataFreed(); + } + + ThreadDetaching(); +} + +#ifdef TARGET_WINDOWS + +// Index for the fiber local storage of the attached thread pointer +static uint32_t g_flsIndex = FLS_OUT_OF_INDEXES; + +#define FLS_STATE_CLEAR 0 +#define FLS_STATE_ARMED 1 +#define FLS_STATE_INVOKED 2 + +static __declspec(thread) byte t_flsState; + +// This is called when each *fiber* is destroyed. When the home fiber of a thread is destroyed, +// it means that the thread itself is destroyed. +// Since we receive that notification outside of the Loader Lock, it allows us to safely acquire +// the ThreadStore lock in the RuntimeThreadShutdown. +static void __stdcall FiberDetachCallback(void* lpFlsData) +{ + _ASSERTE(g_flsIndex != FLS_OUT_OF_INDEXES); + _ASSERTE(lpFlsData); + + if (t_flsState == FLS_STATE_ARMED) + { + RuntimeThreadShutdown(lpFlsData); + } + + t_flsState = FLS_STATE_INVOKED; +} + +void InitFlsSlot() +{ + // We use fiber detach callbacks to run our thread shutdown code because the fiber detach + // callback is made without the OS loader lock + g_flsIndex = FlsAlloc(FiberDetachCallback); + if (g_flsIndex == FLS_OUT_OF_INDEXES) + { + COMPlusThrowWin32(); + } +} + +// Register the thread with OS to be notified when thread is about to be destroyed +// It fails fast if a different thread was already registered with the current fiber. +// Parameters: +// thread - thread to attach +static void OsAttachThread(void* thread) +{ + _ASSERTE(g_flsIndex != FLS_OUT_OF_INDEXES); + + if (t_flsState == FLS_STATE_INVOKED) + { + _ASSERTE_ALL_BUILDS(!"Attempt to execute managed code after the .NET runtime thread state has been destroyed."); + } + + t_flsState = FLS_STATE_ARMED; + + // Associate the current fiber with the current thread. This makes the current fiber the thread's "home" + // fiber. This fiber is the only fiber allowed to execute managed code on this thread. When this fiber + // is destroyed, we consider the thread to be destroyed. + _ASSERTE(thread != NULL); + FlsSetValue(g_flsIndex, thread); +} + +// Detach thread from OS notifications. +// It fails fast if some other thread value was attached to the current fiber. +// Parameters: +// thread - thread to detach +void OsDetachThread(void* thread) +{ + ASSERT(g_flsIndex != FLS_OUT_OF_INDEXES); + void* threadFromCurrentFiber = FlsGetValue(g_flsIndex); + + if (threadFromCurrentFiber == NULL) + { + // Thread is not attached. + // This could come from DestroyThread called when refcount reaches 0 + // and the thread may have already been detached or never attached. + // We leave t_flsState as-is to keep track whether our callback has been called. + return; + } + + if (threadFromCurrentFiber != thread) + { + _ASSERTE_ALL_BUILDS(!"Detaching a thread from the wrong fiber"); + } + + // Leave the existing FLS value, to keep the callback "armed" so that we could observe the termination callback. + // After that we will not allow to attach as we will no longer be able to clean up. + t_flsState = FLS_STATE_CLEAR; +} + +void EnsureTlsDestructionMonitor() +{ + OsAttachThread(GetThread()); +} + +#else struct TlsDestructionMonitor { bool m_activated = false; @@ -1720,36 +1874,7 @@ struct TlsDestructionMonitor { if (m_activated) { - Thread* thread = GetThreadNULLOk(); - if (thread) - { -#ifdef FEATURE_COMINTEROP - // reset the CoInitialize state - // so we don't call CoUninitialize during thread detach - thread->ResetCoInitialized(); -#endif // FEATURE_COMINTEROP - // For case where thread calls ExitThread directly, we need to reset the - // frame pointer. Otherwise stackwalk would AV. We need to do it in cooperative mode. - // We need to set m_GCOnTransitionsOK so this thread won't trigger GC when toggle GC mode - if (thread->m_pFrame != FRAME_TOP) - { -#ifdef _DEBUG - thread->m_GCOnTransitionsOK = FALSE; -#endif - GCX_COOP_NO_DTOR(); - thread->m_pFrame = FRAME_TOP; - GCX_COOP_NO_DTOR_END(); - } - - thread->DetachThread(TRUE); - } - else - { - // Since we don't actually cleanup the TLS data along this path, verify that it is already cleaned up - AssertThreadStaticDataFreed(); - } - - ThreadDetaching(); + RuntimeThreadShutdown(GetThreadNULLOk()); } } }; @@ -1763,6 +1888,8 @@ void EnsureTlsDestructionMonitor() tls_destructionMonitor.Activate(); } +#endif + #ifdef DEBUGGING_SUPPORTED // // InitializeDebugger initialized the Runtime-side COM+ Debugging Services diff --git a/src/coreclr/vm/ceemain.h b/src/coreclr/vm/ceemain.h index 1404a5a04237ff..120082d30572ca 100644 --- a/src/coreclr/vm/ceemain.h +++ b/src/coreclr/vm/ceemain.h @@ -46,6 +46,10 @@ void ForceEEShutdown(ShutdownCompleteAction sca = SCA_ExitProcessWhenShutdownCom void ThreadDetaching(); void EnsureTlsDestructionMonitor(); +#ifdef TARGET_WINDOWS +void InitFlsSlot(); +void OsDetachThread(void* thread); +#endif void SetLatchedExitCode (INT32 code); INT32 GetLatchedExitCode (void); diff --git a/src/coreclr/vm/dacenumerablehash.inl b/src/coreclr/vm/dacenumerablehash.inl index c2522e156647e4..7a615da7616fec 100644 --- a/src/coreclr/vm/dacenumerablehash.inl +++ b/src/coreclr/vm/dacenumerablehash.inl @@ -345,45 +345,50 @@ DPTR(VALUE) DacEnumerableHashTable::BaseFindFirstEntryByHash do { DWORD cBuckets = GetLength(curBuckets); +// DAC hardening for invalid process state +#ifdef DACCESS_COMPILE + if (cBuckets > 0) +#endif + { + // Compute which bucket the entry belongs in based on the hash. + // +2 to skip "length" and "next" slots + DWORD dwBucket = iHash % cBuckets + SKIP_SPECIAL_SLOTS; - // Compute which bucket the entry belongs in based on the hash. - // +2 to skip "length" and "next" slots - DWORD dwBucket = iHash % cBuckets + SKIP_SPECIAL_SLOTS; - - // Point at the first entry in the bucket chain that stores entries with the given hash code. - PTR_VolatileEntry pEntry = VolatileLoadWithoutBarrier(&curBuckets[dwBucket]); - TADDR expectedEndSentinel = ComputeEndSentinel(BaseEndSentinel(curBuckets), dwBucket); + // Point at the first entry in the bucket chain that stores entries with the given hash code. + PTR_VolatileEntry pEntry = VolatileLoadWithoutBarrier(&curBuckets[dwBucket]); + TADDR expectedEndSentinel = ComputeEndSentinel(BaseEndSentinel(curBuckets), dwBucket); - // Walk the bucket chain one entry at a time. - while (!IsEndSentinel(pEntry)) - { - if (pEntry->m_iHashValue == iHash) + // Walk the bucket chain one entry at a time. + while (!IsEndSentinel(pEntry)) { - // We've found our match. + if (pEntry->m_iHashValue == iHash) + { + // We've found our match. - // Record our current search state into the provided context so that a subsequent call to - // BaseFindNextEntryByHash can pick up the search where it left off. - pContext->m_pEntry = dac_cast(pEntry); - pContext->m_curBuckets = curBuckets; - pContext->m_expectedEndSentinel = dac_cast(expectedEndSentinel); + // Record our current search state into the provided context so that a subsequent call to + // BaseFindNextEntryByHash can pick up the search where it left off. + pContext->m_pEntry = dac_cast(pEntry); + pContext->m_curBuckets = curBuckets; + pContext->m_expectedEndSentinel = dac_cast(expectedEndSentinel); - // Return the address of the sub-classes' embedded entry structure. - return VALUE_FROM_VOLATILE_ENTRY(pEntry); - } + // Return the address of the sub-classes' embedded entry structure. + return VALUE_FROM_VOLATILE_ENTRY(pEntry); + } - // Move to the next entry in the chain. - pEntry = VolatileLoadWithoutBarrier(&pEntry->m_pNextEntry); - } + // Move to the next entry in the chain. + pEntry = VolatileLoadWithoutBarrier(&pEntry->m_pNextEntry); + } - if (!AcceptableEndSentinel(pEntry, expectedEndSentinel)) - { - // If we hit this logic, we've managed to hit a case where the linked list was in the process of being - // moved to a new set of buckets while we were walking the list, and we walked part of the list of the - // bucket in the old hash table (which is fine), and part of the list in the new table, which may not - // be the correct bucket to walk. Most notably, the situation that can cause this will cause the list in - // the old bucket to be missing items. Restart the lookup, as the linked list is unlikely to still be under - // edit a second time. - continue; + if (!AcceptableEndSentinel(pEntry, expectedEndSentinel)) + { + // If we hit this logic, we've managed to hit a case where the linked list was in the process of being + // moved to a new set of buckets while we were walking the list, and we walked part of the list of the + // bucket in the old hash table (which is fine), and part of the list in the new table, which may not + // be the correct bucket to walk. Most notably, the situation that can cause this will cause the list in + // the old bucket to be missing items. Restart the lookup, as the linked list is unlikely to still be under + // edit a second time. + continue; + } } // in a rare case if resize is in progress, look in the new table as well. diff --git a/src/coreclr/vm/eetwain.cpp b/src/coreclr/vm/eetwain.cpp index 5746c44de4a770..618077b1b105c7 100644 --- a/src/coreclr/vm/eetwain.cpp +++ b/src/coreclr/vm/eetwain.cpp @@ -1952,6 +1952,7 @@ PTR_VOID EECodeManager::GetExactGenericsToken(SIZE_T baseStackSlot, void * EECodeManager::GetGSCookieAddr(PREGDISPLAY pContext, EECodeInfo * pCodeInfo, + unsigned flags, CodeManState * pState) { CONTRACTL { @@ -1969,6 +1970,14 @@ void * EECodeManager::GetGSCookieAddr(PREGDISPLAY pContext, } #endif +#ifdef HAS_LIGHTUNWIND + // LightUnwind does not track sufficient context to compute GS cookie address + if (flags & LightUnwind) + { + return NULL; + } +#endif + #ifndef USE_GC_INFO_DECODER _ASSERTE(sizeof(CodeManStateBuf) <= sizeof(pState->stateBuf)); diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp index 8418202b933893..9328ac24876456 100644 --- a/src/coreclr/vm/excep.cpp +++ b/src/coreclr/vm/excep.cpp @@ -6533,11 +6533,12 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo // When the CET is enabled, the interruption happens on the ret instruction in the calee. // We need to "pop" rsp to the caller, as if the ret has consumed it. interruptedContext->Rsp += 8; + DWORD64 ssp = GetSSP(interruptedContext); + SetSSP(interruptedContext, ssp + 8); } // Change the IP to be at the original return site, as if we have returned to the caller. // That IP is an interruptible safe point, so we can suspend right there. - uintptr_t origIp = interruptedContext->Rip; interruptedContext->Rip = (uintptr_t)pThread->GetHijackedReturnAddress(); FrameWithCookie frame(pExceptionInfo->ContextRecord); @@ -6545,13 +6546,6 @@ VEH_ACTION WINAPI CLRVectoredExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo CommonTripThread(); frame.Pop(pThread); - if (areShadowStacksEnabled) - { - // Undo the "pop", so that the ret could now succeed. - interruptedContext->Rsp = interruptedContext->Rsp - 8; - interruptedContext->Rip = origIp; - } - return VEH_CONTINUE_EXECUTION; } #endif diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index f9426d46f0029b..264a29d17bf32c 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -2054,6 +2054,7 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification( { pGSCookie = (GSCookie*)cfThisFrame.GetCodeManager()->GetGSCookieAddr(cfThisFrame.pRD, &cfThisFrame.codeInfo, + 0 /* CodeManFlags */, &cfThisFrame.codeManState); if (pGSCookie) { diff --git a/src/coreclr/vm/finalizerthread.cpp b/src/coreclr/vm/finalizerthread.cpp index 97ace9a32353b8..ef666c863eed2e 100644 --- a/src/coreclr/vm/finalizerthread.cpp +++ b/src/coreclr/vm/finalizerthread.cpp @@ -433,11 +433,20 @@ DWORD WINAPI FinalizerThread::FinalizerThreadStart(void *args) LOG((LF_GC, LL_INFO10, "Finalizer thread starting...\n")); -#if defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(FEATURE_COMINTEROP) - // Make sure the finalizer thread is set to MTA to avoid hitting - // DevDiv Bugs 180773 - [Stress Failure] AV at CoreCLR!SafeQueryInterfaceHelper - GetFinalizerThread()->SetApartment(Thread::AS_InMTA); -#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT && !FEATURE_COMINTEROP +#ifdef TARGET_WINDOWS +#ifdef FEATURE_COMINTEROP + // Making finalizer thread MTA early ensures that COM is initialized before we initialize our thread + // termination callback. + ::CoInitializeEx(NULL, COINIT_MULTITHREADED); + g_fComStarted = true; +#endif + + InitFlsSlot(); + + // handshake with EE initialization, as now we can attach Thread objects to native threads. + hEventFinalizerDone->Set(); + WaitForFinalizerEvent (hEventFinalizer); +#endif s_FinalizerThreadOK = GetFinalizerThread()->HasStarted(); @@ -550,6 +559,15 @@ void FinalizerThread::SignalFinalizationDone(int observedFullGcCount) hEventFinalizerDone->Set(); } +void FinalizerThread::WaitForFinalizerThreadStart() +{ + // this should be only called during EE startup + _ASSERTE(!g_fEEStarted); + + hEventFinalizerDone->Wait(INFINITE,FALSE); + hEventFinalizerDone->Reset(); +} + // Wait for the finalizer thread to complete one pass. void FinalizerThread::FinalizerThreadWait() { diff --git a/src/coreclr/vm/finalizerthread.h b/src/coreclr/vm/finalizerthread.h index 03aae7b4e9cf6d..eda53d2e2d7a69 100644 --- a/src/coreclr/vm/finalizerthread.h +++ b/src/coreclr/vm/finalizerthread.h @@ -65,6 +65,8 @@ class FinalizerThread } } + static void WaitForFinalizerThreadStart(); + static void FinalizerThreadWait(); static void SignalFinalizationDone(int observedFullGcCount); diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp index a96ced9828dfc2..c5342d0fdbab6f 100644 --- a/src/coreclr/vm/interoputil.cpp +++ b/src/coreclr/vm/interoputil.cpp @@ -1414,22 +1414,8 @@ VOID EnsureComStarted(BOOL fCoInitCurrentThread) } CONTRACTL_END; - if (g_fComStarted == FALSE) - { - FinalizerThread::GetFinalizerThread()->SetRequiresCoInitialize(); - - // Attempt to set the thread's apartment model (to MTA by default). May not - // succeed (if someone beat us to the punch). That doesn't matter (since - // COM+ objects are now apartment agile), we only care that a CoInitializeEx - // has been performed on this thread by us. - if (fCoInitCurrentThread) - GetThread()->SetApartment(Thread::AS_InMTA); - - // set the finalizer event - FinalizerThread::EnableFinalization(); - - g_fComStarted = TRUE; - } + // COM is expected to be started on finalizer thread during startup + _ASSERTE(g_fComStarted); } HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread) @@ -1446,15 +1432,8 @@ HRESULT EnsureComStartedNoThrow(BOOL fCoInitCurrentThread) HRESULT hr = S_OK; - if (!g_fComStarted) - { - GCX_COOP(); - EX_TRY - { - EnsureComStarted(fCoInitCurrentThread); - } - EX_CATCH_HRESULT(hr); - } + // COM is expected to be started on finalizer thread during startup + _ASSERTE(g_fComStarted); return hr; } diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp index 8b7239896a0ea6..50607f57d9e911 100644 --- a/src/coreclr/vm/method.cpp +++ b/src/coreclr/vm/method.cpp @@ -1324,6 +1324,15 @@ ReturnKind MethodDesc::ParseReturnKindFromSig(INDEBUG(bool supportStringConstruc regKinds[i] = RT_Scalar; } } + + if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE) + { + // Skip over SSE types since they do not consume integer registers. + // An obj/byref in the 2nd eight bytes will be in the first integer register. + regKinds[0] = regKinds[1]; + regKinds[1] = RT_Scalar; + } + ReturnKind structReturnKind = GetStructReturnKind(regKinds[0], regKinds[1]); return structReturnKind; } @@ -3687,10 +3696,14 @@ MethodDesc::EnumMemoryRegions(CLRDataEnumMemoryFlags flags) ILCodeVersion ilVersion = pCodeVersionManager->GetActiveILCodeVersion(dac_cast(this)); if (!ilVersion.IsNull()) { - ilVersion.GetActiveNativeCodeVersion(dac_cast(this)); - ilVersion.GetVersionId(); - ilVersion.GetRejitState(); - ilVersion.GetIL(); + EX_TRY + { + ilVersion.GetActiveNativeCodeVersion(dac_cast(this)); + ilVersion.GetVersionId(); + ilVersion.GetRejitState(); + ilVersion.GetIL(); + } + EX_CATCH_RETHROW_ONLY_COR_E_OPERATIONCANCELLED } #endif diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 27dfd82a691ed9..bebe82d2927835 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -4360,7 +4360,10 @@ void MethodTable::DoFullyLoad(Generics::RecursionGraph * const pVisited, const ClassLoader::ValidateMethodsWithCovariantReturnTypes(this); } - if ((level == CLASS_LOADED) && CORDisableJITOptimizations(this->GetModule()->GetDebuggerInfoBits()) && !HasInstantiation()) + if ((level == CLASS_LOADED) && + CORDisableJITOptimizations(this->GetModule()->GetDebuggerInfoBits()) && + !HasInstantiation() && + !GetModule()->GetDomainAssembly()->IsLoading()) // Do not do this during the vtable fixup stage of C++/CLI assembly loading. See https://github.com/dotnet/runtime/issues/110365 { if (g_fEEStarted) { diff --git a/src/coreclr/vm/peassembly.cpp b/src/coreclr/vm/peassembly.cpp index 3f54dbff556af2..8594e62c9a0e6b 100644 --- a/src/coreclr/vm/peassembly.cpp +++ b/src/coreclr/vm/peassembly.cpp @@ -518,7 +518,6 @@ BOOL PEAssembly::GetResource(LPCSTR szName, DWORD *cbResource, } CONTRACTL_END; - mdToken mdLinkRef; DWORD dwResourceFlags; DWORD dwOffset; @@ -567,30 +566,31 @@ BOOL PEAssembly::GetResource(LPCSTR szName, DWORD *cbResource, } - switch(TypeFromToken(mdLinkRef)) { + switch(TypeFromToken(mdLinkRef)) + { case mdtAssemblyRef: { if (pAssembly == NULL) return FALSE; AssemblySpec spec; - spec.InitializeSpec(mdLinkRef, GetMDImport(), pAssembly); - DomainAssembly* pDomainAssembly = spec.LoadDomainAssembly(FILE_LOADED); + spec.InitializeSpec(mdLinkRef, pAssembly->GetMDImport(), pAssembly); + Assembly* pLoadedAssembly = spec.LoadAssembly(FILE_LOADED); if (dwLocation) { if (pAssemblyRef) - *pAssemblyRef = pDomainAssembly->GetAssembly(); + *pAssemblyRef = pLoadedAssembly; *dwLocation = *dwLocation | 2; // ResourceLocation.containedInAnotherAssembly } - return GetResource(szName, - cbResource, - pbInMemoryResource, - pAssemblyRef, - szFileName, - dwLocation, - pDomainAssembly->GetAssembly()); + return pLoadedAssembly->GetResource( + szName, + cbResource, + pbInMemoryResource, + pAssemblyRef, + szFileName, + dwLocation); } case mdtFile: diff --git a/src/coreclr/vm/prestub.cpp b/src/coreclr/vm/prestub.cpp index 0ad45e1110ceb4..99086a462a26fb 100644 --- a/src/coreclr/vm/prestub.cpp +++ b/src/coreclr/vm/prestub.cpp @@ -1445,11 +1445,18 @@ namespace DWORD declArgCount; IfFailThrow(CorSigUncompressData_EndPtr(pSig1, pEndSig1, &declArgCount)); + if (pSig1 >= pEndSig1) + ThrowHR(META_E_BAD_SIGNATURE); - // UnsafeAccessors for fields require return types be byref. - // This was explicitly checked in TryGenerateUnsafeAccessor(). + // UnsafeAccessors for fields require return types be byref. However, we first need to + // consume any custom modifiers which are prior to the expected ELEMENT_TYPE_BYREF in + // the RetType signature (II.23.2.11). + _ASSERTE(state.IgnoreCustomModifiers); // We should always ignore custom modifiers for field look-up. + MetaSig::ConsumeCustomModifiers(pSig1, pEndSig1); if (pSig1 >= pEndSig1) ThrowHR(META_E_BAD_SIGNATURE); + + // The ELEMENT_TYPE_BYREF was explicitly checked in TryGenerateUnsafeAccessor(). CorElementType byRefType = CorSigUncompressElementType(pSig1); _ASSERTE(byRefType == ELEMENT_TYPE_BYREF); @@ -1497,7 +1504,7 @@ namespace TokenPairList list { nullptr }; MetaSig::CompareState state{ &list }; - state.IgnoreCustomModifiers = false; + state.IgnoreCustomModifiers = true; if (!DoesFieldMatchUnsafeAccessorDeclaration(cxt, pField, state)) continue; diff --git a/src/coreclr/vm/profilingenumerators.cpp b/src/coreclr/vm/profilingenumerators.cpp index c55d40ffbeed9e..ac924f5032c7ee 100644 --- a/src/coreclr/vm/profilingenumerators.cpp +++ b/src/coreclr/vm/profilingenumerators.cpp @@ -556,9 +556,11 @@ HRESULT ProfilerThreadEnum::Init() } CONTRACTL_END; + // If EnumThreads is called from a profiler callback where the runtime is already suspended, + // don't recursively acquire/release the ThreadStore Lock. // If a profiler has requested that the runtime suspend to do stack snapshots, it // will be holding the ThreadStore lock already - ThreadStoreLockHolder tsLock(!g_profControlBlock.fProfilerRequestedRuntimeSuspend); + ThreadStoreLockHolder tsLock(!ThreadStore::HoldingThreadStore() && !g_profControlBlock.fProfilerRequestedRuntimeSuspend); Thread * pThread = NULL; diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index e99273beb5d133..77fa9989cfac2d 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -6873,8 +6873,8 @@ HRESULT ProfToEEInterfaceImpl::SuspendRuntime() return CORPROF_E_SUSPENSION_IN_PROGRESS; } - g_profControlBlock.fProfilerRequestedRuntimeSuspend = TRUE; ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_REASON::SUSPEND_FOR_PROFILER); + g_profControlBlock.fProfilerRequestedRuntimeSuspend = TRUE; return S_OK; } @@ -6912,8 +6912,8 @@ HRESULT ProfToEEInterfaceImpl::ResumeRuntime() return CORPROF_E_UNSUPPORTED_CALL_SEQUENCE; } - ThreadSuspend::RestartEE(FALSE /* bFinishedGC */, TRUE /* SuspendSucceeded */); g_profControlBlock.fProfilerRequestedRuntimeSuspend = FALSE; + ThreadSuspend::RestartEE(FALSE /* bFinishedGC */, TRUE /* SuspendSucceeded */); return S_OK; } @@ -7705,8 +7705,8 @@ HRESULT ProfToEEInterfaceImpl::EnumerateGCHeapObjects(ObjectCallback callback, v // SuspendEE() may race with other threads by design and this thread may block // arbitrarily long inside SuspendEE() for other threads to complete their own // suspensions. - g_profControlBlock.fProfilerRequestedRuntimeSuspend = TRUE; ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_REASON::SUSPEND_FOR_PROFILER); + g_profControlBlock.fProfilerRequestedRuntimeSuspend = TRUE; ownEESuspension = TRUE; } @@ -7738,8 +7738,8 @@ HRESULT ProfToEEInterfaceImpl::EnumerateGCHeapObjects(ObjectCallback callback, v if (ownEESuspension) { - ThreadSuspend::RestartEE(FALSE /* bFinishedGC */, TRUE /* SuspendSucceeded */); g_profControlBlock.fProfilerRequestedRuntimeSuspend = FALSE; + ThreadSuspend::RestartEE(FALSE /* bFinishedGC */, TRUE /* SuspendSucceeded */); } return hr; diff --git a/src/coreclr/vm/siginfo.cpp b/src/coreclr/vm/siginfo.cpp index facb809cd4841a..2b50fdfcfeaa49 100644 --- a/src/coreclr/vm/siginfo.cpp +++ b/src/coreclr/vm/siginfo.cpp @@ -3604,7 +3604,7 @@ BOOL CompareTypeTokens(mdToken tk1, mdToken tk2, ModuleBase *pModule1, ModuleBas #endif //!DACCESS_COMPILE } // CompareTypeTokens -static void ConsumeCustomModifiers(PCCOR_SIGNATURE& pSig, PCCOR_SIGNATURE pEndSig) +void MetaSig::ConsumeCustomModifiers(PCCOR_SIGNATURE& pSig, PCCOR_SIGNATURE pEndSig) { mdToken tk; CorElementType type; diff --git a/src/coreclr/vm/siginfo.hpp b/src/coreclr/vm/siginfo.hpp index fab9a79260d2d1..49f14b57c34bee 100644 --- a/src/coreclr/vm/siginfo.hpp +++ b/src/coreclr/vm/siginfo.hpp @@ -945,6 +945,14 @@ class MetaSig //------------------------------------------------------------------ CorElementType GetByRefType(TypeHandle* pTy) const; + //------------------------------------------------------------------ + // Consume the custom modifiers, if any, in the current signature + // and update it. + // This is a non destructive operation if the current signature is not + // pointing at a sequence of ELEMENT_TYPE_CMOD_REQD or ELEMENT_TYPE_CMOD_OPT. + //------------------------------------------------------------------ + static void ConsumeCustomModifiers(PCCOR_SIGNATURE& pSig, PCCOR_SIGNATURE pEndSig); + // Struct used to capture in/out state during the comparison // of element types. struct CompareState diff --git a/src/coreclr/vm/stackwalk.cpp b/src/coreclr/vm/stackwalk.cpp index b333249637d37e..fcf0a2e7f64853 100644 --- a/src/coreclr/vm/stackwalk.cpp +++ b/src/coreclr/vm/stackwalk.cpp @@ -3185,6 +3185,7 @@ void StackFrameIterator::PreProcessingForManagedFrames(void) m_pCachedGSCookie = (GSCookie*)m_crawl.GetCodeManager()->GetGSCookieAddr( m_crawl.pRD, &m_crawl.codeInfo, + m_codeManFlags, &m_crawl.codeManState); #endif // !DACCESS_COMPILE diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp index 868fffca0c0552..4186bccd8846a9 100644 --- a/src/coreclr/vm/syncblk.cpp +++ b/src/coreclr/vm/syncblk.cpp @@ -625,13 +625,6 @@ void SyncBlockCache::CleanupSyncBlocks() } EE_END_FINALLY; } -// create the sync block cache -/* static */ -void SyncBlockCache::Attach() -{ - LIMITED_METHOD_CONTRACT; -} - // create the sync block cache /* static */ void SyncBlockCache::Start() diff --git a/src/coreclr/vm/threads.cpp b/src/coreclr/vm/threads.cpp index 8c60b2b5a7982f..9a614a037221ce 100644 --- a/src/coreclr/vm/threads.cpp +++ b/src/coreclr/vm/threads.cpp @@ -353,13 +353,23 @@ void SetThread(Thread* t) { LIMITED_METHOD_CONTRACT + Thread* origThread = gCurrentThreadInfo.m_pThread; gCurrentThreadInfo.m_pThread = t; if (t != NULL) { + _ASSERTE(origThread == NULL); InitializeCurrentThreadsStaticData(t); EnsureTlsDestructionMonitor(); t->InitRuntimeThreadLocals(); } +#ifdef TARGET_WINDOWS + else if (origThread != NULL) + { + // Unregister from OS notifications + // This can return false if a thread did not register for OS notification. + OsDetachThread(origThread); + } +#endif // Clear or set the app domain to the one domain based on if the thread is being nulled out or set gCurrentThreadInfo.m_pAppDomain = t == NULL ? NULL : AppDomain::GetCurrentDomain(); @@ -865,7 +875,7 @@ void DestroyThread(Thread *th) // Public function: DetachThread() // Marks the thread as needing to be destroyed, but doesn't destroy it yet. //------------------------------------------------------------------------- -HRESULT Thread::DetachThread(BOOL fDLLThreadDetach) +HRESULT Thread::DetachThread(BOOL inTerminationCallback) { // !!! Can not use contract here. // !!! Contract depends on Thread object for GC_TRIGGERS. @@ -890,9 +900,9 @@ HRESULT Thread::DetachThread(BOOL fDLLThreadDetach) pErrorInfo->Release(); } - // Revoke our IInitializeSpy registration only if we are not in DLL_THREAD_DETACH + // Revoke our IInitializeSpy registration only if we are not in a thread termination callback // (COM will do it or may have already done it automatically in that case). - if (!fDLLThreadDetach) + if (!inTerminationCallback) { RevokeApartmentSpy(); } @@ -2886,6 +2896,12 @@ void Thread::OnThreadTerminate(BOOL holdingLock) } + if (m_State & TS_DebugWillSync) + { + ResetThreadState(TS_DebugWillSync); + InterlockedDecrement(&m_DebugWillSyncCount); + } + SetThreadState(TS_Dead); ThreadStore::s_pThreadStore->m_DeadThreadCount++; ThreadStore::s_pThreadStore->IncrementDeadThreadCountForGCTrigger(); diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h index 8d3e74ee6fedb8..562b97b68bdf63 100644 --- a/src/coreclr/vm/threads.h +++ b/src/coreclr/vm/threads.h @@ -685,7 +685,7 @@ class Thread }; public: - HRESULT DetachThread(BOOL fDLLThreadDetach); + HRESULT DetachThread(BOOL inTerminationCallback); void SetThreadState(ThreadState ts) { diff --git a/src/coreclr/vm/threadstatics.cpp b/src/coreclr/vm/threadstatics.cpp index 885453073508c5..889e9ea3cf4c63 100644 --- a/src/coreclr/vm/threadstatics.cpp +++ b/src/coreclr/vm/threadstatics.cpp @@ -377,7 +377,7 @@ void FreeLoaderAllocatorHandlesForTLSData(Thread *pThread) #endif for (const auto& entry : g_pThreadStaticCollectibleTypeIndices->CollectibleEntries()) { - _ASSERTE((entry.TlsIndex.GetIndexOffset() <= pThread->cLoaderHandles) || allRemainingIndicesAreNotValid); + _ASSERTE((entry.TlsIndex.GetIndexOffset() >= pThread->cLoaderHandles) || !allRemainingIndicesAreNotValid); if (entry.TlsIndex.GetIndexOffset() >= pThread->cLoaderHandles) { #ifndef _DEBUG @@ -390,7 +390,9 @@ void FreeLoaderAllocatorHandlesForTLSData(Thread *pThread) { if (pThread->pLoaderHandles[entry.TlsIndex.GetIndexOffset()] != (LOADERHANDLE)NULL) { - entry.pMT->GetLoaderAllocator()->FreeHandle(pThread->pLoaderHandles[entry.TlsIndex.GetIndexOffset()]); + LoaderAllocator *pLoaderAllocator = entry.pMT->GetLoaderAllocator(); + if (pLoaderAllocator->IsExposedObjectLive()) + pLoaderAllocator->FreeHandle(pThread->pLoaderHandles[entry.TlsIndex.GetIndexOffset()]); pThread->pLoaderHandles[entry.TlsIndex.GetIndexOffset()] = (LOADERHANDLE)NULL; } } diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index 71f59672eba1c7..2ddc2c3b120c99 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -5746,8 +5746,9 @@ BOOL CheckActivationSafePoint(SIZE_T ip) Thread *pThread = GetThreadNULLOk(); // The criteria for safe activation is to be running managed code. - // Also we are not interested in handling interruption if we are already in preemptive mode. - BOOL isActivationSafePoint = pThread != NULL && + // Also we are not interested in handling interruption if we are already in preemptive mode nor if we are single stepping + BOOL isActivationSafePoint = pThread != NULL && + (pThread->m_StateNC & Thread::TSNC_DebuggerIsStepping) == 0 && pThread->PreemptiveGCDisabled() && ExecutionManager::IsManagedCode(ip); @@ -5932,7 +5933,12 @@ bool Thread::InjectActivation(ActivationReason reason) { return true; } - + // Avoid APC calls when the thread is in single step state to avoid any + // wrong resume because it's running a native code. + if ((m_StateNC & Thread::TSNC_DebuggerIsStepping) != 0) + { + return false; + } #ifdef FEATURE_SPECIAL_USER_MODE_APC _ASSERTE(UseSpecialUserModeApc()); diff --git a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj index f48ee38a1d78c0..3df2520bb07878 100644 --- a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj +++ b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-debian.proj @@ -6,7 +6,7 @@ - + diff --git a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-opensuse.42.proj b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-opensuse.42.proj index 6453d117728d4e..369bf7f7cabfcd 100644 --- a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-opensuse.42.proj +++ b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-opensuse.42.proj @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-sles.12.proj b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-sles.12.proj index 912692f5d7f26f..f007b2acb63ee8 100644 --- a/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-sles.12.proj +++ b/src/installer/pkg/sfx/installers/dotnet-runtime-deps/dotnet-runtime-deps-sles.12.proj @@ -5,6 +5,6 @@ - + \ No newline at end of file diff --git a/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs b/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs index 2f486fda3bd327..57e7172faf0e43 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs @@ -191,6 +191,33 @@ public void AppHost_DisableCetCompat() .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion); } + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void AppHost_DotNetRoot_DevicePath() + { + string appExe = sharedTestState.App.AppExe; + + string dotnetPath = $@"\\?\{TestContext.BuiltDotNet.BinPath}"; + Command.Create(appExe) + .CaptureStdErr() + .CaptureStdOut() + .DotNetRoot(dotnetPath, TestContext.BuildArchitecture) + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello World") + .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion); + + dotnetPath = $@"\\.\{TestContext.BuiltDotNet.BinPath}"; + Command.Create(appExe) + .CaptureStdErr() + .CaptureStdOut() + .DotNetRoot(dotnetPath, TestContext.BuildArchitecture) + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello World") + .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion); + } + [Fact] public void RuntimeConfig_FilePath_Breaks_MAX_PATH_Threshold() { diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs index 3d5b902ff1ad4f..f16e4e1d0e8e7a 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Comhost.cs @@ -111,6 +111,35 @@ public void ActivateClass_IgnoreAppLocalHostFxr() } } + [Fact] + public void ActivateClass_IgnoreWorkingDirectory() + { + using (TestArtifact cwd = TestArtifact.Create("cwd")) + { + // Validate that hosting components in the working directory will not be used + File.Copy(Binaries.CoreClr.MockPath, Path.Combine(cwd.Location, Binaries.CoreClr.FileName)); + File.Copy(Binaries.HostFxr.MockPath_5_0, Path.Combine(cwd.Location, Binaries.HostFxr.FileName)); + File.Copy(Binaries.HostPolicy.MockPath, Path.Combine(cwd.Location, Binaries.HostPolicy.FileName)); + + string[] args = { + "comhost", + "synchronous", + "1", + sharedState.ComHostPath, + sharedState.ClsidString + }; + sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath) + .WorkingDirectory(cwd.Location) + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("New instance of Server created") + .And.HaveStdOutContaining($"Activation of {sharedState.ClsidString} succeeded.") + .And.ResolveHostFxr(TestContext.BuiltDotNet) + .And.ResolveHostPolicy(TestContext.BuiltDotNet) + .And.ResolveCoreClr(TestContext.BuiltDotNet); + } + } + [Fact] public void ActivateClass_ValidateIErrorInfoResult() { diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs index fa00b0419a85ef..35d6e2af1298e4 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/Ijwhost.cs @@ -89,6 +89,32 @@ public void LoadLibrary_ContextConfig(bool load_isolated) } } + [Fact] + public void LoadLibrary_IgnoreWorkingDirectory() + { + using (TestArtifact cwd = TestArtifact.Create("cwd")) + { + // Validate that hosting components in the working directory will not be used + File.Copy(Binaries.CoreClr.MockPath, Path.Combine(cwd.Location, Binaries.CoreClr.FileName)); + File.Copy(Binaries.HostFxr.MockPath_5_0, Path.Combine(cwd.Location, Binaries.HostFxr.FileName)); + File.Copy(Binaries.HostPolicy.MockPath, Path.Combine(cwd.Location, Binaries.HostPolicy.FileName)); + + string [] args = { + "ijwhost", + sharedState.IjwApp.AppDll, + "NativeEntryPoint" + }; + sharedState.CreateNativeHostCommand(args, TestContext.BuiltDotNet.BinPath) + .WorkingDirectory(cwd.Location) + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("[C++/CLI] NativeEntryPoint: calling managed class") + .And.HaveStdOutContaining("[C++/CLI] ManagedClass: AssemblyLoadContext = \"Default\" System.Runtime.Loader.DefaultAssemblyLoadContext") + .And.ResolveHostFxr(TestContext.BuiltDotNet) + .And.ResolveHostPolicy(TestContext.BuiltDotNet) + .And.ResolveCoreClr(TestContext.BuiltDotNet); + } + } [Fact] public void LoadLibraryWithoutRuntimeConfigButActiveRuntime() diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs index 39cdc5edb4ca35..6f7cae81047915 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/LoadAssemblyAndGetFunctionPointer.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.IO; using System.Linq; using Microsoft.DotNet.Cli.Build.Framework; @@ -231,6 +232,37 @@ public void CallDelegateOnComponentContext_UnhandledException() .And.ExecuteFunctionPointerWithException(entryPoint, 1); } + [Fact] + public void CallDelegateOnComponentContext_IgnoreWorkingDirectory() + { + using (TestArtifact cwd = TestArtifact.Create("cwd")) + { + // Validate that hosting components in the working directory will not be used + File.Copy(Binaries.CoreClr.MockPath, Path.Combine(cwd.Location, Binaries.CoreClr.FileName)); + File.Copy(Binaries.HostPolicy.MockPath, Path.Combine(cwd.Location, Binaries.HostPolicy.FileName)); + + var component = sharedState.Component; + string[] args = + { + ComponentLoadAssemblyAndGetFunctionPointerArg, + sharedState.HostFxrPath, + component.RuntimeConfigJson, + component.AppDll, + sharedState.ComponentTypeName, + sharedState.ComponentEntryPoint1, + }; + + sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot) + .WorkingDirectory(cwd.Location) + .Execute() + .Should().Pass() + .And.InitializeContextForConfig(component.RuntimeConfigJson) + .And.ExecuteFunctionPointer(sharedState.ComponentEntryPoint1, 1, 1) + .And.ResolveHostPolicy(TestContext.BuiltDotNet) + .And.ResolveCoreClr(TestContext.BuiltDotNet); + } + } + public class SharedTestState : SharedTestStateBase { public string HostFxrPath { get; } diff --git a/src/installer/tests/HostActivation.Tests/NativeHosting/FunctionPointerResultExtensions.cs b/src/installer/tests/HostActivation.Tests/NativeHosting/NativeHostingResultExtensions.cs similarity index 69% rename from src/installer/tests/HostActivation.Tests/NativeHosting/FunctionPointerResultExtensions.cs rename to src/installer/tests/HostActivation.Tests/NativeHosting/NativeHostingResultExtensions.cs index 09fdc52bc186bf..9a0447a219dcb9 100644 --- a/src/installer/tests/HostActivation.Tests/NativeHosting/FunctionPointerResultExtensions.cs +++ b/src/installer/tests/HostActivation.Tests/NativeHosting/NativeHostingResultExtensions.cs @@ -2,10 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.IO; namespace Microsoft.DotNet.CoreSetup.Test.HostActivation.NativeHosting { - internal static class FunctionPointerResultExtensions + internal static class NativeHostingResultExtensions { public static FluentAssertions.AndConstraint ExecuteFunctionPointer(this CommandResultAssertions assertion, string methodName, int callCount, int returnValue) { @@ -47,5 +48,21 @@ public static FluentAssertions.AndConstraint ExecuteWit { return assertion.HaveStdOutContaining($"{assemblyName}: Location = '{location}'"); } + + public static FluentAssertions.AndConstraint ResolveHostFxr(this CommandResultAssertions assertion, Microsoft.DotNet.Cli.Build.DotNetCli dotnet) + { + return assertion.HaveStdErrContaining($"Resolved fxr [{dotnet.GreatestVersionHostFxrFilePath}]"); + } + + public static FluentAssertions.AndConstraint ResolveHostPolicy(this CommandResultAssertions assertion, Microsoft.DotNet.Cli.Build.DotNetCli dotnet) + { + return assertion.HaveStdErrContaining($"{Binaries.HostPolicy.FileName} directory is [{dotnet.GreatestVersionSharedFxPath}]"); + } + + public static FluentAssertions.AndConstraint ResolveCoreClr(this CommandResultAssertions assertion, Microsoft.DotNet.Cli.Build.DotNetCli dotnet) + { + return assertion.HaveStdErrContaining($"CoreCLR path = '{Path.Combine(dotnet.GreatestVersionSharedFxPath, Binaries.CoreClr.FileName)}'") + .And.HaveStdErrContaining($"CoreCLR dir = '{dotnet.GreatestVersionSharedFxPath}{Path.DirectorySeparatorChar}'"); + } } } diff --git a/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs b/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs index 0ebb0912af4f3f..fe18bf10fdd73c 100644 --- a/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs +++ b/src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs @@ -156,6 +156,29 @@ public void DotNetRoot_IncorrectLayout_Fails() .And.HaveStdErrContaining($"The required library {Binaries.HostFxr.FileName} could not be found."); } + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void DevicePath() + { + string appExe = $@"\\?\{sharedTestState.App.AppExe}"; + Command.Create(appExe) + .CaptureStdErr() + .CaptureStdOut() + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello World") + .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion); + + appExe = $@"\\.\{sharedTestState.App.AppExe}"; + Command.Create(appExe) + .CaptureStdErr() + .CaptureStdOut() + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello World") + .And.HaveStdOutContaining(TestContext.MicrosoftNETCoreAppVersion); + } + public class SharedTestState : IDisposable { public TestApp App { get; } diff --git a/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs b/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs index d440d3eae2caa2..5afab32a0881d2 100644 --- a/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs +++ b/src/installer/tests/HostActivation.Tests/SymbolicLinks.cs @@ -2,8 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using FluentAssertions; using Microsoft.DotNet.Cli.Build.Framework; @@ -21,6 +23,165 @@ public SymbolicLinks(SymbolicLinks.SharedTestState fixture) sharedTestState = fixture; } + [Theory] + [InlineData("a/b/SymlinkToFrameworkDependentApp")] + [InlineData("a/SymlinkToFrameworkDependentApp")] + public void Symlink_all_files_fx(string symlinkRelativePath) + { + using var testDir = TestArtifact.Create("symlink"); + Directory.CreateDirectory(Path.Combine(testDir.Location, Path.GetDirectoryName(symlinkRelativePath))); + + // Symlink every file in the app directory + var symlinks = new List(); + try + { + foreach (var file in Directory.EnumerateFiles(sharedTestState.FrameworkDependentApp.Location)) + { + var fileName = Path.GetFileName(file); + var symlinkPath = Path.Combine(testDir.Location, symlinkRelativePath, fileName); + Directory.CreateDirectory(Path.GetDirectoryName(symlinkPath)); + symlinks.Add(new SymLink(symlinkPath, file)); + } + + var result = Command.Create(Path.Combine(testDir.Location, symlinkRelativePath, Path.GetFileName(sharedTestState.FrameworkDependentApp.AppExe))) + .CaptureStdErr() + .CaptureStdOut() + .DotNetRoot(TestContext.BuiltDotNet.BinPath) + .Execute(); + + // This should succeed on all platforms, but for different reasons: + // * Windows: The apphost will look next to the symlink for the app dll and find the symlinked dll + // * Unix: The apphost will look next to the resolved apphost for the app dll and find the real thing + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + finally + { + foreach (var symlink in symlinks) + { + symlink.Dispose(); + } + } + } + + [Theory] + [InlineData("a/b/SymlinkToFrameworkDependentApp")] + [InlineData("a/SymlinkToFrameworkDependentApp")] + public void Symlink_split_files_fx(string symlinkRelativePath) + { + using var testDir = TestArtifact.Create("symlink"); + + // Split the app into two directories, one for the apphost and one for the rest of the files + var appHostDir = Path.Combine(testDir.Location, "apphost"); + var appFilesDir = Path.Combine(testDir.Location, "appfiles"); + Directory.CreateDirectory(appHostDir); + Directory.CreateDirectory(appFilesDir); + + var appHostName = Path.GetFileName(sharedTestState.FrameworkDependentApp.AppExe); + + File.Copy( + sharedTestState.FrameworkDependentApp.AppExe, + Path.Combine(appHostDir, appHostName)); + + foreach (var file in Directory.EnumerateFiles(sharedTestState.FrameworkDependentApp.Location)) + { + var fileName = Path.GetFileName(file); + if (fileName != appHostName) + { + File.Copy(file, Path.Combine(appFilesDir, fileName)); + } + } + + // Symlink all of the above into a single directory + var targetPath = Path.Combine(testDir.Location, symlinkRelativePath); + Directory.CreateDirectory(targetPath); + var symlinks = new List(); + try + { + foreach (var file in Directory.EnumerateFiles(appFilesDir)) + { + var fileName = Path.GetFileName(file); + var symlinkPath = Path.Combine(targetPath, fileName); + Directory.CreateDirectory(Path.GetDirectoryName(symlinkPath)); + symlinks.Add(new SymLink(symlinkPath, file)); + } + symlinks.Add(new SymLink( + Path.Combine(targetPath, appHostName), + Path.Combine(appHostDir, appHostName))); + + var result = Command.Create(Path.Combine(targetPath, appHostName)) + .CaptureStdErr() + .CaptureStdOut() + .DotNetRoot(TestContext.BuiltDotNet.BinPath) + .Execute(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + // On Windows, the apphost will look next to the symlink for the app dll and find the symlinks + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + else + { + // On Unix, the apphost will not find the app files next to the symlink + result + .Should().Fail() + .And.HaveStdErrContaining("The application to execute does not exist"); + } + } + finally + { + foreach (var symlink in symlinks) + { + symlink.Dispose(); + } + } + } + + [Theory] + [InlineData("a/b/SymlinkToFrameworkDependentApp")] + [InlineData("a/SymlinkToFrameworkDependentApp")] + public void Symlink_all_files_self_contained(string symlinkRelativePath) + { + using var testDir = TestArtifact.Create("symlink"); + Directory.CreateDirectory(Path.Combine(testDir.Location, Path.GetDirectoryName(symlinkRelativePath))); + + // Symlink every file in the app directory + var symlinks = new List(); + try + { + foreach (var file in Directory.EnumerateFiles(sharedTestState.SelfContainedApp.Location)) + { + var fileName = Path.GetFileName(file); + var symlinkPath = Path.Combine(testDir.Location, symlinkRelativePath, fileName); + Directory.CreateDirectory(Path.GetDirectoryName(symlinkPath)); + symlinks.Add(new SymLink(symlinkPath, file)); + } + + var result = Command.Create(Path.Combine(testDir.Location, symlinkRelativePath, Path.GetFileName(sharedTestState.FrameworkDependentApp.AppExe))) + .CaptureStdErr() + .CaptureStdOut() + .DotNetRoot(TestContext.BuiltDotNet.BinPath) + .Execute(); + + // This should succeed on all platforms, but for different reasons: + // * Windows: The apphost will look next to the symlink for the files and find the symlinks + // * Unix: The apphost will look next to the resolved apphost for the files and find the real thing + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + finally + { + foreach (var symlink in symlinks) + { + symlink.Dispose(); + } + } + } + [Theory] [InlineData ("a/b/SymlinkToApphost")] [InlineData ("a/SymlinkToApphost")] @@ -33,12 +194,23 @@ public void Run_apphost_behind_symlink(string symlinkRelativePath) var symlinkFullPath = Path.Combine(testDir.Location, symlinkRelativePath); using var symlink = new SymLink(symlinkFullPath, sharedTestState.SelfContainedApp.AppExe); - Command.Create(symlinkFullPath) + var result = Command.Create(symlinkFullPath) .CaptureStdErr() .CaptureStdOut() - .Execute() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .Execute(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + result + .Should().Fail() + .And.HaveStdErrContaining("The application to execute does not exist"); + } + else + { + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } } } @@ -63,12 +235,23 @@ public void Run_apphost_behind_transitive_symlinks(string firstSymlinkRelativePa Directory.CreateDirectory(Path.GetDirectoryName(symlink1Path)); using var symlink1 = new SymLink(symlink1Path, symlink2Path); - Command.Create(symlink1.SrcPath) + var result = Command.Create(symlink1.SrcPath) .CaptureStdErr() .CaptureStdOut() - .Execute() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .Execute(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + result + .Should().Fail() + .And.HaveStdErrContaining("The application to execute does not exist"); + } + else + { + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } } } @@ -86,13 +269,24 @@ public void Run_framework_dependent_app_behind_symlink(string symlinkRelativePat Directory.CreateDirectory(Path.Combine(testDir.Location, Path.GetDirectoryName(symlinkRelativePath))); using var symlink = new SymLink(Path.Combine(testDir.Location, symlinkRelativePath), sharedTestState.FrameworkDependentApp.AppExe); - Command.Create(symlink.SrcPath) + var result = Command.Create(symlink.SrcPath) .CaptureStdErr() .CaptureStdOut() .DotNetRoot(TestContext.BuiltDotNet.BinPath) - .Execute() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .Execute(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + result + .Should().Fail() + .And.HaveStdErrContaining("The application to execute does not exist"); + } + else + { + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } } } @@ -144,12 +338,23 @@ public void Put_dotnet_behind_symlink() var dotnetSymlink = Path.Combine(testDir.Location, Binaries.DotNet.FileName); using var symlink = new SymLink(dotnetSymlink, TestContext.BuiltDotNet.DotnetExecutablePath); - Command.Create(symlink.SrcPath, sharedTestState.SelfContainedApp.AppDll) + var result = Command.Create(symlink.SrcPath, sharedTestState.SelfContainedApp.AppDll) .CaptureStdErr() .CaptureStdOut() - .Execute() - .Should().Pass() - .And.HaveStdOutContaining("Hello World"); + .Execute(); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + result + .Should().Fail() + .And.HaveStdErrContaining($"[{Path.Combine(testDir.Location, "host", "fxr")}] does not exist"); + } + else + { + result + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } } } diff --git a/src/libraries/Common/src/Interop/Interop.Ldap.cs b/src/libraries/Common/src/Interop/Interop.Ldap.cs index 90c0ba997cd962..512242230093ff 100644 --- a/src/libraries/Common/src/Interop/Interop.Ldap.cs +++ b/src/libraries/Common/src/Interop/Interop.Ldap.cs @@ -157,6 +157,8 @@ internal enum LdapOption LDAP_OPT_ROOTDSE_CACHE = 0x9a, // Not Supported in Linux LDAP_OPT_DEBUG_LEVEL = 0x5001, LDAP_OPT_URI = 0x5006, // Not Supported in Windows + LDAP_OPT_X_TLS_CACERTDIR = 0x6003, // Not Supported in Windows + LDAP_OPT_X_TLS_NEWCTX = 0x600F, // Not Supported in Windows LDAP_OPT_X_SASL_REALM = 0x6101, LDAP_OPT_X_SASL_AUTHCID = 0x6102, LDAP_OPT_X_SASL_AUTHZID = 0x6103 diff --git a/src/libraries/Common/src/Interop/OSX/Interop.libobjc.cs b/src/libraries/Common/src/Interop/OSX/Interop.libobjc.cs index 7274cb569051d7..73c57af7ec249c 100644 --- a/src/libraries/Common/src/Interop/OSX/Interop.libobjc.cs +++ b/src/libraries/Common/src/Interop/OSX/Interop.libobjc.cs @@ -46,14 +46,17 @@ internal static Version GetOperatingSystemVersion() } } - if (major == 10 && minor == 16) +#if TARGET_OSX + if (major == 16) { - // We get "compat" version for 11.0 unless we build with updated SDK. - // Hopefully that will be before 11.x comes out - // For now, this maps 10.16 to 11.0. - major = 11; - minor = 0; + // MacOS Tahoe returns a compatibility version unless it is built with a new SDK. Map the compatibility + // version to the "correct" version. This assumes the minor versions will map unchanged. + // 16.0 => 26.0 + // 16.1 => 26.1 + // etc + major = 26; } +#endif return new Version(major, minor, patch); } diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs index 9f3d05e43e96af..b9d755d988203f 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs @@ -123,7 +123,14 @@ internal static unsafe ReadOnlySpan SslGetAlpnSelected(SafeSslHandle ssl) internal static partial IntPtr SslGetCertificate(IntPtr ssl); [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslGetPeerCertChain")] - internal static partial SafeSharedX509StackHandle SslGetPeerCertChain(SafeSslHandle ssl); + private static partial SafeSharedX509StackHandle SslGetPeerCertChain_private(SafeSslHandle ssl); + + internal static SafeSharedX509StackHandle SslGetPeerCertChain(SafeSslHandle ssl) + { + return SafeInteriorHandle.OpenInteriorHandle( + SslGetPeerCertChain_private, + ssl); + } [LibraryImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslGetPeerFinished")] internal static partial int SslGetPeerFinished(SafeSslHandle ssl, IntPtr buf, int count); diff --git a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs index e76fa9b67e5bcb..42b58b7df198d7 100644 --- a/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs +++ b/src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs @@ -336,6 +336,16 @@ public struct WINHTTP_ASYNC_RESULT public uint dwError; } + [StructLayout(LayoutKind.Sequential)] + public unsafe struct WINHTTP_CONNECTION_INFO + { + // This field is actually 4 bytes, but we use nuint to avoid alignment issues for x64. + // If we want to read this field in the future, we need to change type and make sure + // alignment is correct for necessary archs. + public nuint cbSize; + public fixed byte LocalAddress[128]; + public fixed byte RemoteAddress[128]; + } [StructLayout(LayoutKind.Sequential)] public struct tcp_keepalive diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCertContextHandleWithKeyContainerDeletion.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCertContextHandleWithKeyContainerDeletion.cs index 7488f624b90c47..59a84bc923097c 100644 --- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCertContextHandleWithKeyContainerDeletion.cs +++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCertContextHandleWithKeyContainerDeletion.cs @@ -50,10 +50,16 @@ internal static void DeleteKeyContainer(SafeCertContextHandle pCertContext) string providerName = Marshal.PtrToStringUni((IntPtr)(pProvInfo->pwszProvName))!; string keyContainerName = Marshal.PtrToStringUni((IntPtr)(pProvInfo->pwszContainerName))!; + CngKeyOpenOptions openOpts = CngKeyOpenOptions.None; + + if ((pProvInfo->dwFlags & Interop.Crypt32.CryptAcquireContextFlags.CRYPT_MACHINE_KEYSET) != 0) + { + openOpts = CngKeyOpenOptions.MachineKey; + } try { - using (CngKey cngKey = CngKey.Open(keyContainerName, new CngProvider(providerName))) + using (CngKey cngKey = CngKey.Open(keyContainerName, new CngProvider(providerName), openOpts)) { cngKey.Delete(); } diff --git a/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml b/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml index 3523d7762232af..1a7f36e6f047bd 100644 --- a/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml +++ b/src/libraries/Common/tests/System/DirectoryServices/LDAP.Configuration.xml @@ -1,6 +1,6 @@ -To enable the tests marked with [ConditionalFact(nameof(IsLdapConfigurationExist))], you need to setup an LDAP server and provide the needed server info here. +To enable the tests marked with [ConditionalFact(nameof(IsLdapConfigurationExist))], you need to setup an LDAP server as described below and set the environment variable LDAP_TEST_SERVER_INDEX to the appropriate offset into the XML section found at the end of this file. To ship, we should test on both an Active Directory LDAP server, and at least one other server, as behaviors are a little different. However for local testing, it is easiest to connect to an OpenDJ LDAP server in a docker container (eg., in WSL2). @@ -11,7 +11,7 @@ OPENDJ SERVER test it with this command - it should return some results in WSL2 - ldapsearch -h localhost -p 1389 -D 'cn=admin,dc=example,dc=com' -x -w password + ldapsearch -H ldap://localhost:1389 -D 'cn=admin,dc=example,dc=com' -x -w password this command views the status @@ -24,16 +24,16 @@ SLAPD OPENLDAP SERVER and to test and view status - ldapsearch -h localhost -p 390 -D 'cn=admin,dc=example,dc=com' -x -w password + ldapsearch -H ldap://localhost:390 -D 'cn=admin,dc=example,dc=com' -x -w password docker exec -it slapd01 slapcat SLAPD OPENLDAP SERVER WITH TLS ============================== -The osixia/openldap container image automatically creates a TLS lisener with a self-signed certificate. This can be used to test TLS. +The osixia/openldap container image automatically creates a TLS listener with a self-signed certificate. This can be used to test TLS. -Start the container, with TLS on port 1636, without client certificate verification: +Start the container, with TLS on port 1636, but without client certificate verification: docker run --publish 1389:389 --publish 1636:636 --name ldap --hostname ldap.local --detach --rm --env LDAP_TLS_VERIFY_CLIENT=never --env LDAP_ADMIN_PASSWORD=password osixia/openldap --loglevel debug @@ -56,6 +56,8 @@ To test and view the status: ldapsearch -H ldaps://ldap.local:1636 -b dc=example,dc=org -x -D cn=admin,dc=example,dc=org -w password +use '-d 1' or '-d 2' for debugging. + ACTIVE DIRECTORY ================ @@ -65,7 +67,7 @@ When running against Active Directory from a Windows client, you should not see If you are running your AD server as a VM on the same machine that you are running WSL2, you must execute this command on the host to bridge the two Hyper-V networks so that it is visible from WSL2: - Get-NetIPInterface | where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} | Set-NetIPInterface -Forwarding Enabled + Get-NetIPInterface | where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (Default Switch)'} | Set-NetIPInterface -Forwarding Enabled The WSL2 VM should now be able to see the AD VM by IP address. To make it visible by host name, it's probably easiest to just add it to /etc/hosts. @@ -82,7 +84,7 @@ Note: @@ -105,15 +107,6 @@ Note: ServerBind,None False - - danmose-ldap.danmose-domain.com - DC=danmose-domain,DC=com - 389 - danmose-domain\Administrator - %TESTPASSWORD% - ServerBind,None - True - ldap.local DC=example,DC=org @@ -124,5 +117,14 @@ Note: true False + + danmose-ldap.danmose-domain.com + DC=danmose-domain,DC=com + 389 + danmose-domain\Administrator + %TESTPASSWORD% + ServerBind,None + True + diff --git a/src/libraries/Common/tests/System/Net/Configuration.Http.cs b/src/libraries/Common/tests/System/Net/Configuration.Http.cs index f568e54f261d22..15d426ce9bab42 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"); @@ -87,6 +87,7 @@ public static Uri[] GetEchoServerList() 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); 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 dd9db9bbe1f087..c9cdd591bb4016 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" @@ -1361,7 +1362,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/ResponseStreamTest.cs b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs index 7f58fd5b2424e8..61958c04a26b0c 100644 --- a/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs @@ -230,6 +230,99 @@ await client.GetAsync(remoteServer.EchoUri, HttpCompletionOption.ResponseHeaders #if NET + 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"); + } + + using 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)); + } + } + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsChromium))] public async Task BrowserHttpHandler_Streaming() { @@ -486,7 +579,7 @@ public async Task BrowserHttpHandler_StreamingRequest_Http1Fails() [OuterLoop] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsChromium))] - public async Task BrowserHttpHandler_StreamingResponse() + public async Task BrowserHttpHandler_StreamingResponseLarge() { var WebAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey("WebAssemblyEnableStreamingResponse"); 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 667e99c29dc398..f9f8b0c24f2e01 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 @@ -22,26 +22,22 @@ 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; - - // Echo back JSON encoded payload. - RequestInformation info = await RequestInformation.CreateAsync(context.Request); - string echoJson = info.SerializeToJson(); - - byte[] bytes = Encoding.UTF8.GetBytes(echoJson); + var qs = context.Request.QueryString.HasValue ? context.Request.QueryString.Value : ""; var delay = 0; - if (context.Request.QueryString.HasValue) + if (qs.Contains("delay1sec")) { - if (context.Request.QueryString.Value.Contains("delay1sec")) - { - delay = 1000; - } - else if (context.Request.QueryString.Value.Contains("delay10sec")) - { - delay = 10000; - } + delay = 1000; + } + else if (qs.Contains("delay10sec")) + { + delay = 10000; + } + + if (qs.Contains("abortBeforeHeaders")) + { + context.Abort(); + return; } if (delay > 0) @@ -49,6 +45,14 @@ public static async Task InvokeAsync(HttpContext context) 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()) { @@ -60,11 +64,32 @@ public static async Task InvokeAsync(HttpContext context) context.Response.ContentLength = bytes.Length; } - if (delay > 0) + await context.Response.StartAsync(CancellationToken.None); + + if (qs.Contains("abortAfterHeaders")) + { + await Task.Delay(10); + context.Abort(); + return; + } + + if (HttpMethods.IsHead(context.Request.Method)) + { + return; + } + + if (delay > 0 || qs.Contains("abortDuringBody")) { - await context.Response.StartAsync(CancellationToken.None); 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(); diff --git a/src/libraries/Common/tests/System/TimeProviderTests.cs b/src/libraries/Common/tests/System/TimeProviderTests.cs index 119a35610f1f51..e0840f09d1cdbb 100644 --- a/src/libraries/Common/tests/System/TimeProviderTests.cs +++ b/src/libraries/Common/tests/System/TimeProviderTests.cs @@ -143,7 +143,9 @@ public void TestProviderTimer(TimeProvider provider, int minMilliseconds) state.TokenSource.Token.WaitHandle.WaitOne(Timeout.InfiniteTimeSpan); state.TokenSource.Dispose(); - Assert.Equal(4, state.Counter); + // In normal conditions, the timer callback should be called 4 times. Sometimes the timer callback could be queued and fired after the timer was disposed. + Assert.True(state.Counter >= 4, $"The timer callback was expected to be called at least 4 times, but was called {state.Counter} times"); + Assert.Equal(400, state.Period); Assert.True(minMilliseconds <= state.Stopwatch.ElapsedMilliseconds, $"The total fired periods {state.Stopwatch.ElapsedMilliseconds}ms expected to be greater then the expected min {minMilliseconds}ms"); } diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 8681d16fd9fb4b..db6f7b863a0891 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -50,9 +50,12 @@ public static partial class PlatformDetection throw new PlatformNotSupportedException(); private static readonly Version s_openssl3Version = new Version(3, 0, 0); - public static bool IsOpenSsl3 => !IsApplePlatform && !IsWindows && !IsAndroid && !IsBrowser ? - GetOpenSslVersion() >= s_openssl3Version : - false; + private static readonly Version s_openssl3_4Version = new Version(3, 4, 0); + private static readonly Version s_openssl3_5Version = new Version(3, 5, 0); + + public static bool IsOpenSsl3 => IsOpenSslVersionAtLeast(s_openssl3Version); + public static bool IsOpenSsl3_4 => IsOpenSslVersionAtLeast(s_openssl3_4Version); + public static bool IsOpenSsl3_5 => IsOpenSslVersionAtLeast(s_openssl3_5Version); /// /// If gnulibc is available, returns the release, such as "stable". @@ -139,6 +142,18 @@ private static Version GetOpenSslVersion() return s_opensslVersion; } + // The "IsOpenSsl" properties answer false on Apple, even if OpenSSL is present for lightup, + // as they are answering the question "is OpenSSL the primary crypto provider". + private static bool IsOpenSslVersionAtLeast(Version minVersion) + { + if (IsApplePlatform || IsWindows || IsAndroid || IsBrowser) + { + return false; + } + + return GetOpenSslVersion() >= minVersion; + } + private static Version ToVersion(string versionString) { // In some distros/versions we cannot discover the distro version; return something valid. diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs index 6a166b298cd517..1cd57d147a77ed 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Windows.cs @@ -26,6 +26,7 @@ public static partial class PlatformDetection public static bool IsWindows10OrLater => IsWindowsVersionOrLater(10, 0); public static bool IsWindowsServer2019 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 17763; public static bool IsWindowsServer2022 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 20348; + public static bool IsWindowsServer2025 => IsWindows && IsNotWindowsNanoServer && GetWindowsVersion() == 10 && GetWindowsMinorVersion() == 0 && GetWindowsBuildVersion() == 26100; public static bool IsWindowsNanoServer => IsWindows && (IsNotWindowsIoTCore && GetWindowsInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); public static bool IsWindowsServerCore => IsWindows && GetWindowsInstallationType().Equals("Server Core", StringComparison.OrdinalIgnoreCase); public static int WindowsVersion => IsWindows ? (int)GetWindowsVersion() : -1; diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 67cde84c48389b..d8e81fd4d9a7c6 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -168,8 +168,8 @@ private static bool GetLinqExpressionsBuiltWithIsInterpretingOnly() return !(bool)typeof(LambdaExpression).GetMethod("get_CanCompileToIL").Invoke(null, Array.Empty()); } - // Drawing is not supported on non windows platforms in .NET 7.0+. - public static bool IsDrawingSupported => IsWindows && IsNotWindowsNanoServer && IsNotWindowsServerCore; + // Drawing is not supported on non windows platforms in .NET 7.0+ and on Mono. + public static bool IsDrawingSupported => IsWindows && IsNotWindowsNanoServer && IsNotWindowsServerCore && IsNotMonoRuntime; public static bool IsAsyncFileIOSupported => !IsBrowser && !IsWasi; @@ -288,6 +288,12 @@ public static bool IsMetadataTokenSupported public static bool IsNotBuiltWithAggressiveTrimming => !IsBuiltWithAggressiveTrimming; public static bool IsTrimmedWithILLink => IsBuiltWithAggressiveTrimming && !IsNativeAot; +#if NET + public static bool DataSetXmlSerializationIsSupported => AppContext.TryGetSwitch("System.Data.DataSet.XmlSerializationIsSupported", out bool isSupported) ? isSupported : true; +#else + public static bool DataSetXmlSerializationIsSupported => true; +#endif + // Windows - Schannel supports alpn from win8.1/2012 R2 and higher. // Linux - OpenSsl supports alpn from openssl 1.0.2 and higher. // Android - Platform supports alpn from API level 29 and higher diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 7ccc19377a2efb..77b995afb43bef 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -35,8 +35,6 @@ false false - - true diff --git a/src/libraries/Directory.Build.targets b/src/libraries/Directory.Build.targets index 5a3fff449e7bba..631ee908d4723e 100644 --- a/src/libraries/Directory.Build.targets +++ b/src/libraries/Directory.Build.targets @@ -72,12 +72,11 @@ + '$(IsPackable)' == 'true'"> <_IsWindowsDesktopApp Condition="$(WindowsDesktopCoreAppLibrary.Contains('$(AssemblyName);'))">true <_IsAspNetCoreApp Condition="$(AspNetCoreAppLibrary.Contains('$(AssemblyName);'))">true <_AssemblyInTargetingPack Condition="('$(IsNETCoreAppSrc)' == 'true' or '$(IsNetCoreAppRef)' == 'true' or '$(_IsAspNetCoreApp)' == 'true' or '$(_IsWindowsDesktopApp)' == 'true') and '$(TargetFrameworkIdentifier)' != '.NETFramework'">true - $(MajorVersion).$(MinorVersion).0.$(ServicingVersion) + $(MajorVersion).$(MinorVersion).0.$(PatchVersion) diff --git a/src/libraries/Microsoft.Bcl.Cryptography/src/System/Security/Cryptography/NetStandardShims.cs b/src/libraries/Microsoft.Bcl.Cryptography/src/System/Security/Cryptography/NetStandardShims.cs index 1e81d7a01b023c..d35c4738c5cb6e 100644 --- a/src/libraries/Microsoft.Bcl.Cryptography/src/System/Security/Cryptography/NetStandardShims.cs +++ b/src/libraries/Microsoft.Bcl.Cryptography/src/System/Security/Cryptography/NetStandardShims.cs @@ -100,25 +100,14 @@ internal static bool TryGetHashAndReset( Span destination, out int bytesWritten) { - int hashSize = hash.AlgorithmName.Name switch - { - nameof(HashAlgorithmName.MD5) => 128 >> 3, - nameof(HashAlgorithmName.SHA1) => 160 >> 3, - nameof(HashAlgorithmName.SHA256) => 256 >> 3, - nameof(HashAlgorithmName.SHA384) => 384 >> 3, - nameof(HashAlgorithmName.SHA512) => 512 >> 3, - _ => throw new CryptographicException(), - }; - - if (destination.Length < hashSize) + byte[] actual = hash.GetHashAndReset(); + + if (destination.Length < actual.Length) { bytesWritten = 0; return false; } - byte[] actual = hash.GetHashAndReset(); - Debug.Assert(actual.Length == hashSize); - actual.AsSpan().CopyTo(destination); bytesWritten = actual.Length; return true; diff --git a/src/libraries/Microsoft.Extensions.DependencyModel/tests/Microsoft.Extensions.DependencyModel.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyModel/tests/Microsoft.Extensions.DependencyModel.Tests.csproj index 7717367bbbbe14..70fd9e556fb285 100644 --- a/src/libraries/Microsoft.Extensions.DependencyModel/tests/Microsoft.Extensions.DependencyModel.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyModel/tests/Microsoft.Extensions.DependencyModel.Tests.csproj @@ -18,4 +18,7 @@ + + + diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj index 2beeab918e6969..6c3acbcaeb4f43 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/Microsoft.Extensions.Logging.Console.Tests.csproj @@ -10,6 +10,6 @@ - + diff --git a/src/libraries/Microsoft.NET.WebAssembly.Threading/src/CompatibilitySuppressions.xml b/src/libraries/Microsoft.NET.WebAssembly.Threading/src/CompatibilitySuppressions.xml deleted file mode 100644 index 8af156c8764265..00000000000000 --- a/src/libraries/Microsoft.NET.WebAssembly.Threading/src/CompatibilitySuppressions.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - PKV006 - net8.0 - - \ No newline at end of file diff --git a/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs b/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs index 593096b7a7a35a..5a4382b34bb960 100644 --- a/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs +++ b/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs @@ -6,7 +6,7 @@ namespace Microsoft.Xml.Serialization.GeneratedAssembly { public class XmlSerializationWriter1 : System.Xml.Serialization.XmlSerializationWriter { - public void Write107_TypeWithXmlElementProperty(object o) { + public void Write111_TypeWithXmlElementProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithXmlElementProperty", @""); @@ -16,7 +16,7 @@ public void Write107_TypeWithXmlElementProperty(object o) { Write2_TypeWithXmlElementProperty(@"TypeWithXmlElementProperty", @"", ((global::TypeWithXmlElementProperty)o), true, false); } - public void Write108_TypeWithXmlDocumentProperty(object o) { + public void Write112_TypeWithXmlDocumentProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithXmlDocumentProperty", @""); @@ -26,7 +26,7 @@ public void Write108_TypeWithXmlDocumentProperty(object o) { Write3_TypeWithXmlDocumentProperty(@"TypeWithXmlDocumentProperty", @"", ((global::TypeWithXmlDocumentProperty)o), true, false); } - public void Write109_TypeWithBinaryProperty(object o) { + public void Write113_TypeWithBinaryProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithBinaryProperty", @""); @@ -36,7 +36,7 @@ public void Write109_TypeWithBinaryProperty(object o) { Write4_TypeWithBinaryProperty(@"TypeWithBinaryProperty", @"", ((global::TypeWithBinaryProperty)o), true, false); } - public void Write110_Item(object o) { + public void Write114_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithDateTimeOffsetProperties", @""); @@ -46,7 +46,7 @@ public void Write110_Item(object o) { Write5_Item(@"TypeWithDateTimeOffsetProperties", @"", ((global::TypeWithDateTimeOffsetProperties)o), true, false); } - public void Write111_TypeWithTimeSpanProperty(object o) { + public void Write115_TypeWithTimeSpanProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithTimeSpanProperty", @""); @@ -56,7 +56,7 @@ public void Write111_TypeWithTimeSpanProperty(object o) { Write6_TypeWithTimeSpanProperty(@"TypeWithTimeSpanProperty", @"", ((global::TypeWithTimeSpanProperty)o), true, false); } - public void Write112_Item(object o) { + public void Write116_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithDefaultTimeSpanProperty", @""); @@ -66,7 +66,7 @@ public void Write112_Item(object o) { Write7_Item(@"TypeWithDefaultTimeSpanProperty", @"", ((global::TypeWithDefaultTimeSpanProperty)o), true, false); } - public void Write113_TypeWithByteProperty(object o) { + public void Write117_TypeWithByteProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithByteProperty", @""); @@ -76,7 +76,7 @@ public void Write113_TypeWithByteProperty(object o) { Write8_TypeWithByteProperty(@"TypeWithByteProperty", @"", ((global::TypeWithByteProperty)o), true, false); } - public void Write114_TypeWithXmlNodeArrayProperty(object o) { + public void Write118_TypeWithXmlNodeArrayProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithXmlNodeArrayProperty", @""); @@ -86,7 +86,7 @@ public void Write114_TypeWithXmlNodeArrayProperty(object o) { Write9_TypeWithXmlNodeArrayProperty(@"TypeWithXmlNodeArrayProperty", @"", ((global::TypeWithXmlNodeArrayProperty)o), true, false); } - public void Write115_Animal(object o) { + public void Write119_Animal(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Animal", @""); @@ -96,7 +96,7 @@ public void Write115_Animal(object o) { Write10_Animal(@"Animal", @"", ((global::Animal)o), true, false); } - public void Write116_Dog(object o) { + public void Write120_Dog(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Dog", @""); @@ -106,7 +106,7 @@ public void Write116_Dog(object o) { Write12_Dog(@"Dog", @"", ((global::Dog)o), true, false); } - public void Write117_DogBreed(object o) { + public void Write121_DogBreed(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"DogBreed", @""); @@ -115,7 +115,7 @@ public void Write117_DogBreed(object o) { WriteElementString(@"DogBreed", @"", Write11_DogBreed(((global::DogBreed)o))); } - public void Write118_Group(object o) { + public void Write122_Group(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Group", @""); @@ -125,7 +125,7 @@ public void Write118_Group(object o) { Write14_Group(@"Group", @"", ((global::Group)o), true, false); } - public void Write119_Vehicle(object o) { + public void Write123_Vehicle(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Vehicle", @""); @@ -135,7 +135,7 @@ public void Write119_Vehicle(object o) { Write13_Vehicle(@"Vehicle", @"", ((global::Vehicle)o), true, false); } - public void Write120_Employee(object o) { + public void Write124_Employee(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Employee", @""); @@ -145,7 +145,7 @@ public void Write120_Employee(object o) { Write15_Employee(@"Employee", @"", ((global::Employee)o), true, false); } - public void Write121_BaseClass(object o) { + public void Write125_BaseClass(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"BaseClass", @""); @@ -155,7 +155,7 @@ public void Write121_BaseClass(object o) { Write17_BaseClass(@"BaseClass", @"", ((global::BaseClass)o), true, false); } - public void Write122_DerivedClass(object o) { + public void Write126_DerivedClass(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DerivedClass", @""); @@ -165,7 +165,7 @@ public void Write122_DerivedClass(object o) { Write16_DerivedClass(@"DerivedClass", @"", ((global::DerivedClass)o), true, false); } - public void Write123_PurchaseOrder(object o) { + public void Write127_PurchaseOrder(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"PurchaseOrder", @"http://www.contoso1.com"); @@ -175,7 +175,7 @@ public void Write123_PurchaseOrder(object o) { Write20_PurchaseOrder(@"PurchaseOrder", @"http://www.contoso1.com", ((global::PurchaseOrder)o), false, false); } - public void Write124_Address(object o) { + public void Write128_Address(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Address", @""); @@ -185,7 +185,7 @@ public void Write124_Address(object o) { Write21_Address(@"Address", @"", ((global::Address)o), true, false); } - public void Write125_OrderedItem(object o) { + public void Write129_OrderedItem(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"OrderedItem", @""); @@ -195,7 +195,7 @@ public void Write125_OrderedItem(object o) { Write22_OrderedItem(@"OrderedItem", @"", ((global::OrderedItem)o), true, false); } - public void Write126_AliasedTestType(object o) { + public void Write130_AliasedTestType(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"AliasedTestType", @""); @@ -205,7 +205,7 @@ public void Write126_AliasedTestType(object o) { Write23_AliasedTestType(@"AliasedTestType", @"", ((global::AliasedTestType)o), true, false); } - public void Write127_BaseClass1(object o) { + public void Write131_BaseClass1(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"BaseClass1", @""); @@ -215,7 +215,7 @@ public void Write127_BaseClass1(object o) { Write24_BaseClass1(@"BaseClass1", @"", ((global::BaseClass1)o), true, false); } - public void Write128_DerivedClass1(object o) { + public void Write132_DerivedClass1(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DerivedClass1", @""); @@ -225,7 +225,7 @@ public void Write128_DerivedClass1(object o) { Write25_DerivedClass1(@"DerivedClass1", @"", ((global::DerivedClass1)o), true, false); } - public void Write129_ArrayOfDateTime(object o) { + public void Write133_ArrayOfDateTime(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"ArrayOfDateTime", @""); @@ -250,7 +250,7 @@ public void Write129_ArrayOfDateTime(object o) { } } - public void Write130_Orchestra(object o) { + public void Write134_Orchestra(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Orchestra", @""); @@ -260,7 +260,7 @@ public void Write130_Orchestra(object o) { Write27_Orchestra(@"Orchestra", @"", ((global::Orchestra)o), true, false); } - public void Write131_Instrument(object o) { + public void Write135_Instrument(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Instrument", @""); @@ -270,7 +270,7 @@ public void Write131_Instrument(object o) { Write26_Instrument(@"Instrument", @"", ((global::Instrument)o), true, false); } - public void Write132_Brass(object o) { + public void Write136_Brass(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Brass", @""); @@ -280,7 +280,7 @@ public void Write132_Brass(object o) { Write28_Brass(@"Brass", @"", ((global::Brass)o), true, false); } - public void Write133_Trumpet(object o) { + public void Write137_Trumpet(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Trumpet", @""); @@ -290,7 +290,7 @@ public void Write133_Trumpet(object o) { Write29_Trumpet(@"Trumpet", @"", ((global::Trumpet)o), true, false); } - public void Write134_Pet(object o) { + public void Write138_Pet(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Pet", @""); @@ -300,7 +300,7 @@ public void Write134_Pet(object o) { Write30_Pet(@"Pet", @"", ((global::Pet)o), true, false); } - public void Write135_DefaultValuesSetToNaN(object o) { + public void Write139_DefaultValuesSetToNaN(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DefaultValuesSetToNaN", @""); @@ -310,7 +310,7 @@ public void Write135_DefaultValuesSetToNaN(object o) { Write31_DefaultValuesSetToNaN(@"DefaultValuesSetToNaN", @"", ((global::DefaultValuesSetToNaN)o), true, false); } - public void Write136_Item(object o) { + public void Write140_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DefaultValuesSetToPositiveInfinity", @""); @@ -320,7 +320,7 @@ public void Write136_Item(object o) { Write32_Item(@"DefaultValuesSetToPositiveInfinity", @"", ((global::DefaultValuesSetToPositiveInfinity)o), true, false); } - public void Write137_Item(object o) { + public void Write141_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DefaultValuesSetToNegativeInfinity", @""); @@ -330,7 +330,7 @@ public void Write137_Item(object o) { Write33_Item(@"DefaultValuesSetToNegativeInfinity", @"", ((global::DefaultValuesSetToNegativeInfinity)o), true, false); } - public void Write138_RootElement(object o) { + public void Write142_RootElement(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"RootElement", @""); @@ -340,7 +340,7 @@ public void Write138_RootElement(object o) { Write34_Item(@"RootElement", @"", ((global::TypeWithMismatchBetweenAttributeAndPropertyType)o), true, false); } - public void Write139_TypeWithLinkedProperty(object o) { + public void Write143_TypeWithLinkedProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithLinkedProperty", @""); @@ -350,7 +350,7 @@ public void Write139_TypeWithLinkedProperty(object o) { Write35_TypeWithLinkedProperty(@"TypeWithLinkedProperty", @"", ((global::TypeWithLinkedProperty)o), true, false); } - public void Write140_Document(object o) { + public void Write144_Document(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Document", @"http://example.com"); @@ -360,7 +360,7 @@ public void Write140_Document(object o) { Write36_MsgDocumentType(@"Document", @"http://example.com", ((global::MsgDocumentType)o), true, false); } - public void Write141_RootClass(object o) { + public void Write145_RootClass(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"RootClass", @""); @@ -370,7 +370,7 @@ public void Write141_RootClass(object o) { Write39_RootClass(@"RootClass", @"", ((global::RootClass)o), true, false); } - public void Write142_Parameter(object o) { + public void Write146_Parameter(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Parameter", @""); @@ -380,7 +380,7 @@ public void Write142_Parameter(object o) { Write38_Parameter(@"Parameter", @"", ((global::Parameter)o), true, false); } - public void Write143_XElementWrapper(object o) { + public void Write147_XElementWrapper(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"XElementWrapper", @""); @@ -390,7 +390,7 @@ public void Write143_XElementWrapper(object o) { Write40_XElementWrapper(@"XElementWrapper", @"", ((global::XElementWrapper)o), true, false); } - public void Write144_XElementStruct(object o) { + public void Write148_XElementStruct(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"XElementStruct", @""); @@ -399,7 +399,7 @@ public void Write144_XElementStruct(object o) { Write41_XElementStruct(@"XElementStruct", @"", ((global::XElementStruct)o), false); } - public void Write145_XElementArrayWrapper(object o) { + public void Write149_XElementArrayWrapper(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"XElementArrayWrapper", @""); @@ -409,7 +409,7 @@ public void Write145_XElementArrayWrapper(object o) { Write42_XElementArrayWrapper(@"XElementArrayWrapper", @"", ((global::XElementArrayWrapper)o), true, false); } - public void Write146_TypeWithDateTimeStringProperty(object o) { + public void Write150_TypeWithDateTimeStringProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithDateTimeStringProperty", @""); @@ -419,7 +419,7 @@ public void Write146_TypeWithDateTimeStringProperty(object o) { Write43_TypeWithDateTimeStringProperty(@"TypeWithDateTimeStringProperty", @"", ((global::SerializationTypes.TypeWithDateTimeStringProperty)o), true, false); } - public void Write147_SimpleType(object o) { + public void Write151_SimpleType(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"SimpleType", @""); @@ -429,7 +429,7 @@ public void Write147_SimpleType(object o) { Write44_SimpleType(@"SimpleType", @"", ((global::SerializationTypes.SimpleType)o), true, false); } - public void Write148_TypeWithGetSetArrayMembers(object o) { + public void Write152_TypeWithGetSetArrayMembers(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithGetSetArrayMembers", @""); @@ -439,7 +439,7 @@ public void Write148_TypeWithGetSetArrayMembers(object o) { Write45_TypeWithGetSetArrayMembers(@"TypeWithGetSetArrayMembers", @"", ((global::SerializationTypes.TypeWithGetSetArrayMembers)o), true, false); } - public void Write149_TypeWithGetOnlyArrayProperties(object o) { + public void Write153_TypeWithGetOnlyArrayProperties(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithGetOnlyArrayProperties", @""); @@ -449,36 +449,46 @@ public void Write149_TypeWithGetOnlyArrayProperties(object o) { Write46_TypeWithGetOnlyArrayProperties(@"TypeWithGetOnlyArrayProperties", @"", ((global::SerializationTypes.TypeWithGetOnlyArrayProperties)o), true, false); } - public void Write150_StructNotSerializable(object o) { + public void Write154_TypeWithArraylikeMembers(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"TypeWithArraylikeMembers", @""); + return; + } + TopLevelElement(); + Write47_TypeWithArraylikeMembers(@"TypeWithArraylikeMembers", @"", ((global::SerializationTypes.TypeWithArraylikeMembers)o), true, false); + } + + public void Write155_StructNotSerializable(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"StructNotSerializable", @""); return; } - Write47_StructNotSerializable(@"StructNotSerializable", @"", ((global::SerializationTypes.StructNotSerializable)o), false); + Write48_StructNotSerializable(@"StructNotSerializable", @"", ((global::SerializationTypes.StructNotSerializable)o), false); } - public void Write151_TypeWithMyCollectionField(object o) { + public void Write156_TypeWithMyCollectionField(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithMyCollectionField", @""); return; } TopLevelElement(); - Write48_TypeWithMyCollectionField(@"TypeWithMyCollectionField", @"", ((global::SerializationTypes.TypeWithMyCollectionField)o), true, false); + Write49_TypeWithMyCollectionField(@"TypeWithMyCollectionField", @"", ((global::SerializationTypes.TypeWithMyCollectionField)o), true, false); } - public void Write152_Item(object o) { + public void Write157_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithReadOnlyMyCollectionProperty", @""); return; } TopLevelElement(); - Write49_Item(@"TypeWithReadOnlyMyCollectionProperty", @"", ((global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)o), true, false); + Write50_Item(@"TypeWithReadOnlyMyCollectionProperty", @"", ((global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)o), true, false); } - public void Write153_ArrayOfAnyType(object o) { + public void Write158_ArrayOfAnyType(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"ArrayOfAnyType", @""); @@ -500,335 +510,335 @@ public void Write153_ArrayOfAnyType(object o) { } } - public void Write154_MyEnum(object o) { + public void Write159_MyEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"MyEnum", @""); return; } - WriteElementString(@"MyEnum", @"", Write50_MyEnum(((global::SerializationTypes.MyEnum)o))); + WriteElementString(@"MyEnum", @"", Write51_MyEnum(((global::SerializationTypes.MyEnum)o))); } - public void Write155_TypeWithEnumMembers(object o) { + public void Write160_TypeWithEnumMembers(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithEnumMembers", @""); return; } TopLevelElement(); - Write51_TypeWithEnumMembers(@"TypeWithEnumMembers", @"", ((global::SerializationTypes.TypeWithEnumMembers)o), true, false); + Write52_TypeWithEnumMembers(@"TypeWithEnumMembers", @"", ((global::SerializationTypes.TypeWithEnumMembers)o), true, false); } - public void Write156_DCStruct(object o) { + public void Write161_DCStruct(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"DCStruct", @""); return; } - Write52_DCStruct(@"DCStruct", @"", ((global::SerializationTypes.DCStruct)o), false); + Write53_DCStruct(@"DCStruct", @"", ((global::SerializationTypes.DCStruct)o), false); } - public void Write157_DCClassWithEnumAndStruct(object o) { + public void Write162_DCClassWithEnumAndStruct(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DCClassWithEnumAndStruct", @""); return; } TopLevelElement(); - Write53_DCClassWithEnumAndStruct(@"DCClassWithEnumAndStruct", @"", ((global::SerializationTypes.DCClassWithEnumAndStruct)o), true, false); + Write54_DCClassWithEnumAndStruct(@"DCClassWithEnumAndStruct", @"", ((global::SerializationTypes.DCClassWithEnumAndStruct)o), true, false); } - public void Write158_BuiltInTypes(object o) { + public void Write163_BuiltInTypes(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"BuiltInTypes", @""); return; } TopLevelElement(); - Write54_BuiltInTypes(@"BuiltInTypes", @"", ((global::SerializationTypes.BuiltInTypes)o), true, false); + Write55_BuiltInTypes(@"BuiltInTypes", @"", ((global::SerializationTypes.BuiltInTypes)o), true, false); } - public void Write159_TypeA(object o) { + public void Write164_TypeA(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeA", @""); return; } TopLevelElement(); - Write55_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)o), true, false); + Write56_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)o), true, false); } - public void Write160_TypeB(object o) { + public void Write165_TypeB(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeB", @""); return; } TopLevelElement(); - Write56_TypeB(@"TypeB", @"", ((global::SerializationTypes.TypeB)o), true, false); + Write57_TypeB(@"TypeB", @"", ((global::SerializationTypes.TypeB)o), true, false); } - public void Write161_TypeHasArrayOfASerializedAsB(object o) { + public void Write166_TypeHasArrayOfASerializedAsB(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeHasArrayOfASerializedAsB", @""); return; } TopLevelElement(); - Write57_TypeHasArrayOfASerializedAsB(@"TypeHasArrayOfASerializedAsB", @"", ((global::SerializationTypes.TypeHasArrayOfASerializedAsB)o), true, false); + Write58_TypeHasArrayOfASerializedAsB(@"TypeHasArrayOfASerializedAsB", @"", ((global::SerializationTypes.TypeHasArrayOfASerializedAsB)o), true, false); } - public void Write162_Item(object o) { + public void Write167_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"__TypeNameWithSpecialCharacters漢ñ", @""); return; } TopLevelElement(); - Write58_Item(@"__TypeNameWithSpecialCharacters漢ñ", @"", ((global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ)o), true, false); + Write59_Item(@"__TypeNameWithSpecialCharacters漢ñ", @"", ((global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ)o), true, false); } - public void Write163_BaseClassWithSamePropertyName(object o) { + public void Write168_BaseClassWithSamePropertyName(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"BaseClassWithSamePropertyName", @""); return; } TopLevelElement(); - Write59_BaseClassWithSamePropertyName(@"BaseClassWithSamePropertyName", @"", ((global::SerializationTypes.BaseClassWithSamePropertyName)o), true, false); + Write60_BaseClassWithSamePropertyName(@"BaseClassWithSamePropertyName", @"", ((global::SerializationTypes.BaseClassWithSamePropertyName)o), true, false); } - public void Write164_DerivedClassWithSameProperty(object o) { + public void Write169_DerivedClassWithSameProperty(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DerivedClassWithSameProperty", @""); return; } TopLevelElement(); - Write60_DerivedClassWithSameProperty(@"DerivedClassWithSameProperty", @"", ((global::SerializationTypes.DerivedClassWithSameProperty)o), true, false); + Write61_DerivedClassWithSameProperty(@"DerivedClassWithSameProperty", @"", ((global::SerializationTypes.DerivedClassWithSameProperty)o), true, false); } - public void Write165_DerivedClassWithSameProperty2(object o) { + public void Write170_DerivedClassWithSameProperty2(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"DerivedClassWithSameProperty2", @""); return; } TopLevelElement(); - Write61_DerivedClassWithSameProperty2(@"DerivedClassWithSameProperty2", @"", ((global::SerializationTypes.DerivedClassWithSameProperty2)o), true, false); + Write62_DerivedClassWithSameProperty2(@"DerivedClassWithSameProperty2", @"", ((global::SerializationTypes.DerivedClassWithSameProperty2)o), true, false); } - public void Write166_Item(object o) { + public void Write171_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithDateTimePropertyAsXmlTime", @""); return; } TopLevelElement(); - Write62_Item(@"TypeWithDateTimePropertyAsXmlTime", @"", ((global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime)o), true, false); + Write63_Item(@"TypeWithDateTimePropertyAsXmlTime", @"", ((global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime)o), true, false); } - public void Write167_TypeWithByteArrayAsXmlText(object o) { + public void Write172_TypeWithByteArrayAsXmlText(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithByteArrayAsXmlText", @""); return; } TopLevelElement(); - Write63_TypeWithByteArrayAsXmlText(@"TypeWithByteArrayAsXmlText", @"", ((global::SerializationTypes.TypeWithByteArrayAsXmlText)o), true, false); + Write64_TypeWithByteArrayAsXmlText(@"TypeWithByteArrayAsXmlText", @"", ((global::SerializationTypes.TypeWithByteArrayAsXmlText)o), true, false); } - public void Write168_SimpleDC(object o) { + public void Write173_SimpleDC(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"SimpleDC", @""); return; } TopLevelElement(); - Write64_SimpleDC(@"SimpleDC", @"", ((global::SerializationTypes.SimpleDC)o), true, false); + Write65_SimpleDC(@"SimpleDC", @"", ((global::SerializationTypes.SimpleDC)o), true, false); } - public void Write169_Item(object o) { + public void Write174_Item(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"TypeWithXmlTextAttributeOnArray", @"http://schemas.xmlsoap.org/ws/2005/04/discovery"); return; } TopLevelElement(); - Write65_Item(@"TypeWithXmlTextAttributeOnArray", @"http://schemas.xmlsoap.org/ws/2005/04/discovery", ((global::SerializationTypes.TypeWithXmlTextAttributeOnArray)o), false, false); + Write66_Item(@"TypeWithXmlTextAttributeOnArray", @"http://schemas.xmlsoap.org/ws/2005/04/discovery", ((global::SerializationTypes.TypeWithXmlTextAttributeOnArray)o), false, false); } - public void Write170_EnumFlags(object o) { + public void Write175_EnumFlags(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"EnumFlags", @""); return; } - WriteElementString(@"EnumFlags", @"", Write66_EnumFlags(((global::SerializationTypes.EnumFlags)o))); + WriteElementString(@"EnumFlags", @"", Write67_EnumFlags(((global::SerializationTypes.EnumFlags)o))); } - public void Write171_ClassImplementsInterface(object o) { + public void Write176_ClassImplementsInterface(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"ClassImplementsInterface", @""); return; } TopLevelElement(); - Write67_ClassImplementsInterface(@"ClassImplementsInterface", @"", ((global::SerializationTypes.ClassImplementsInterface)o), true, false); + Write68_ClassImplementsInterface(@"ClassImplementsInterface", @"", ((global::SerializationTypes.ClassImplementsInterface)o), true, false); } - public void Write172_WithStruct(object o) { + public void Write177_WithStruct(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"WithStruct", @""); return; } TopLevelElement(); - Write69_WithStruct(@"WithStruct", @"", ((global::SerializationTypes.WithStruct)o), true, false); + Write70_WithStruct(@"WithStruct", @"", ((global::SerializationTypes.WithStruct)o), true, false); } - public void Write173_SomeStruct(object o) { + public void Write178_SomeStruct(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"SomeStruct", @""); return; } - Write68_SomeStruct(@"SomeStruct", @"", ((global::SerializationTypes.SomeStruct)o), false); + Write69_SomeStruct(@"SomeStruct", @"", ((global::SerializationTypes.SomeStruct)o), false); } - public void Write174_WithEnums(object o) { + public void Write179_WithEnums(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"WithEnums", @""); return; } TopLevelElement(); - Write72_WithEnums(@"WithEnums", @"", ((global::SerializationTypes.WithEnums)o), true, false); + Write73_WithEnums(@"WithEnums", @"", ((global::SerializationTypes.WithEnums)o), true, false); } - public void Write175_WithNullables(object o) { + public void Write180_WithNullables(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"WithNullables", @""); return; } TopLevelElement(); - Write73_WithNullables(@"WithNullables", @"", ((global::SerializationTypes.WithNullables)o), true, false); + Write74_WithNullables(@"WithNullables", @"", ((global::SerializationTypes.WithNullables)o), true, false); } - public void Write176_ByteEnum(object o) { + public void Write181_ByteEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"ByteEnum", @""); return; } - WriteElementString(@"ByteEnum", @"", Write74_ByteEnum(((global::SerializationTypes.ByteEnum)o))); + WriteElementString(@"ByteEnum", @"", Write75_ByteEnum(((global::SerializationTypes.ByteEnum)o))); } - public void Write177_SByteEnum(object o) { + public void Write182_SByteEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"SByteEnum", @""); return; } - WriteElementString(@"SByteEnum", @"", Write75_SByteEnum(((global::SerializationTypes.SByteEnum)o))); + WriteElementString(@"SByteEnum", @"", Write76_SByteEnum(((global::SerializationTypes.SByteEnum)o))); } - public void Write178_ShortEnum(object o) { + public void Write183_ShortEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"ShortEnum", @""); return; } - WriteElementString(@"ShortEnum", @"", Write71_ShortEnum(((global::SerializationTypes.ShortEnum)o))); + WriteElementString(@"ShortEnum", @"", Write72_ShortEnum(((global::SerializationTypes.ShortEnum)o))); } - public void Write179_IntEnum(object o) { + public void Write184_IntEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"IntEnum", @""); return; } - WriteElementString(@"IntEnum", @"", Write70_IntEnum(((global::SerializationTypes.IntEnum)o))); + WriteElementString(@"IntEnum", @"", Write71_IntEnum(((global::SerializationTypes.IntEnum)o))); } - public void Write180_UIntEnum(object o) { + public void Write185_UIntEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"UIntEnum", @""); return; } - WriteElementString(@"UIntEnum", @"", Write76_UIntEnum(((global::SerializationTypes.UIntEnum)o))); + WriteElementString(@"UIntEnum", @"", Write77_UIntEnum(((global::SerializationTypes.UIntEnum)o))); } - public void Write181_LongEnum(object o) { + public void Write186_LongEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"LongEnum", @""); return; } - WriteElementString(@"LongEnum", @"", Write77_LongEnum(((global::SerializationTypes.LongEnum)o))); + WriteElementString(@"LongEnum", @"", Write78_LongEnum(((global::SerializationTypes.LongEnum)o))); } - public void Write182_ULongEnum(object o) { + public void Write187_ULongEnum(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"ULongEnum", @""); return; } - WriteElementString(@"ULongEnum", @"", Write78_ULongEnum(((global::SerializationTypes.ULongEnum)o))); + WriteElementString(@"ULongEnum", @"", Write79_ULongEnum(((global::SerializationTypes.ULongEnum)o))); } - public void Write183_AttributeTesting(object o) { + public void Write188_AttributeTesting(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"AttributeTesting", @""); return; } TopLevelElement(); - Write80_XmlSerializerAttributes(@"AttributeTesting", @"", ((global::SerializationTypes.XmlSerializerAttributes)o), false, false); + Write81_XmlSerializerAttributes(@"AttributeTesting", @"", ((global::SerializationTypes.XmlSerializerAttributes)o), false, false); } - public void Write184_ItemChoiceType(object o) { + public void Write189_ItemChoiceType(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"ItemChoiceType", @""); return; } - WriteElementString(@"ItemChoiceType", @"", Write79_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)o))); + WriteElementString(@"ItemChoiceType", @"", Write80_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)o))); } - public void Write185_TypeWithAnyAttribute(object o) { + public void Write190_TypeWithAnyAttribute(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithAnyAttribute", @""); return; } TopLevelElement(); - Write81_TypeWithAnyAttribute(@"TypeWithAnyAttribute", @"", ((global::SerializationTypes.TypeWithAnyAttribute)o), true, false); + Write82_TypeWithAnyAttribute(@"TypeWithAnyAttribute", @"", ((global::SerializationTypes.TypeWithAnyAttribute)o), true, false); } - public void Write186_KnownTypesThroughConstructor(object o) { + public void Write191_KnownTypesThroughConstructor(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"KnownTypesThroughConstructor", @""); return; } TopLevelElement(); - Write82_KnownTypesThroughConstructor(@"KnownTypesThroughConstructor", @"", ((global::SerializationTypes.KnownTypesThroughConstructor)o), true, false); + Write83_KnownTypesThroughConstructor(@"KnownTypesThroughConstructor", @"", ((global::SerializationTypes.KnownTypesThroughConstructor)o), true, false); } - public void Write187_SimpleKnownTypeValue(object o) { + public void Write192_SimpleKnownTypeValue(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"SimpleKnownTypeValue", @""); return; } TopLevelElement(); - Write83_SimpleKnownTypeValue(@"SimpleKnownTypeValue", @"", ((global::SerializationTypes.SimpleKnownTypeValue)o), true, false); + Write84_SimpleKnownTypeValue(@"SimpleKnownTypeValue", @"", ((global::SerializationTypes.SimpleKnownTypeValue)o), true, false); } - public void Write188_Item(object o) { + public void Write193_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"ClassImplementingIXmlSerialiable", @""); @@ -838,236 +848,266 @@ public void Write188_Item(object o) { WriteSerializable((System.Xml.Serialization.IXmlSerializable)((global::SerializationTypes.ClassImplementingIXmlSerialiable)o), @"ClassImplementingIXmlSerialiable", @"", true, true); } - public void Write189_TypeWithPropertyNameSpecified(object o) { + public void Write194_TypeWithPropertyNameSpecified(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithPropertyNameSpecified", @""); return; } TopLevelElement(); - Write84_TypeWithPropertyNameSpecified(@"TypeWithPropertyNameSpecified", @"", ((global::SerializationTypes.TypeWithPropertyNameSpecified)o), true, false); + Write85_TypeWithPropertyNameSpecified(@"TypeWithPropertyNameSpecified", @"", ((global::SerializationTypes.TypeWithPropertyNameSpecified)o), true, false); } - public void Write190_TypeWithXmlSchemaFormAttribute(object o) { + public void Write195_TypeWithXmlSchemaFormAttribute(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithXmlSchemaFormAttribute", @""); return; } TopLevelElement(); - Write85_TypeWithXmlSchemaFormAttribute(@"TypeWithXmlSchemaFormAttribute", @"", ((global::SerializationTypes.TypeWithXmlSchemaFormAttribute)o), true, false); + Write86_TypeWithXmlSchemaFormAttribute(@"TypeWithXmlSchemaFormAttribute", @"", ((global::SerializationTypes.TypeWithXmlSchemaFormAttribute)o), true, false); } - public void Write191_MyXmlType(object o) { + public void Write196_MyXmlType(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"MyXmlType", @""); return; } TopLevelElement(); - Write86_Item(@"MyXmlType", @"", ((global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute)o), true, false); + Write87_Item(@"MyXmlType", @"", ((global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute)o), true, false); } - public void Write192_Item(object o) { + public void Write197_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithSchemaFormInXmlAttribute", @""); return; } TopLevelElement(); - Write87_Item(@"TypeWithSchemaFormInXmlAttribute", @"", ((global::SerializationTypes.TypeWithSchemaFormInXmlAttribute)o), true, false); + Write88_Item(@"TypeWithSchemaFormInXmlAttribute", @"", ((global::SerializationTypes.TypeWithSchemaFormInXmlAttribute)o), true, false); } - public void Write193_Item(object o) { + public void Write198_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithNonPublicDefaultConstructor", @""); return; } TopLevelElement(); - Write88_Item(@"TypeWithNonPublicDefaultConstructor", @"", ((global::SerializationTypes.TypeWithNonPublicDefaultConstructor)o), true, false); + Write89_Item(@"TypeWithNonPublicDefaultConstructor", @"", ((global::SerializationTypes.TypeWithNonPublicDefaultConstructor)o), true, false); } - public void Write194_ServerSettings(object o) { + public void Write199_ServerSettings(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"ServerSettings", @""); return; } TopLevelElement(); - Write89_ServerSettings(@"ServerSettings", @"", ((global::SerializationTypes.ServerSettings)o), true, false); + Write90_ServerSettings(@"ServerSettings", @"", ((global::SerializationTypes.ServerSettings)o), true, false); } - public void Write195_TypeWithXmlQualifiedName(object o) { + public void Write200_TypeWithXmlQualifiedName(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithXmlQualifiedName", @""); return; } TopLevelElement(); - Write90_TypeWithXmlQualifiedName(@"TypeWithXmlQualifiedName", @"", ((global::SerializationTypes.TypeWithXmlQualifiedName)o), true, false); + Write91_TypeWithXmlQualifiedName(@"TypeWithXmlQualifiedName", @"", ((global::SerializationTypes.TypeWithXmlQualifiedName)o), true, false); } - public void Write196_TypeWith2DArrayProperty2(object o) { + public void Write201_TypeWith2DArrayProperty2(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWith2DArrayProperty2", @""); return; } TopLevelElement(); - Write91_TypeWith2DArrayProperty2(@"TypeWith2DArrayProperty2", @"", ((global::SerializationTypes.TypeWith2DArrayProperty2)o), true, false); + Write92_TypeWith2DArrayProperty2(@"TypeWith2DArrayProperty2", @"", ((global::SerializationTypes.TypeWith2DArrayProperty2)o), true, false); } - public void Write197_Item(object o) { + public void Write202_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithPropertiesHavingDefaultValue", @""); return; } TopLevelElement(); - Write92_Item(@"TypeWithPropertiesHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithPropertiesHavingDefaultValue)o), true, false); + Write93_Item(@"TypeWithPropertiesHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithPropertiesHavingDefaultValue)o), true, false); } - public void Write198_Item(object o) { + public void Write203_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithEnumPropertyHavingDefaultValue", @""); return; } TopLevelElement(); - Write93_Item(@"TypeWithEnumPropertyHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue)o), true, false); + Write94_Item(@"TypeWithEnumPropertyHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue)o), true, false); } - public void Write199_Item(object o) { + public void Write204_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithEnumFlagPropertyHavingDefaultValue", @""); return; } TopLevelElement(); - Write94_Item(@"TypeWithEnumFlagPropertyHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue)o), true, false); + Write95_Item(@"TypeWithEnumFlagPropertyHavingDefaultValue", @"", ((global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue)o), true, false); } - public void Write200_TypeWithShouldSerializeMethod(object o) { + public void Write205_TypeWithShouldSerializeMethod(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithShouldSerializeMethod", @""); return; } TopLevelElement(); - Write95_TypeWithShouldSerializeMethod(@"TypeWithShouldSerializeMethod", @"", ((global::SerializationTypes.TypeWithShouldSerializeMethod)o), true, false); + Write96_TypeWithShouldSerializeMethod(@"TypeWithShouldSerializeMethod", @"", ((global::SerializationTypes.TypeWithShouldSerializeMethod)o), true, false); } - public void Write201_Item(object o) { + public void Write206_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"KnownTypesThroughConstructorWithArrayProperties", @""); return; } TopLevelElement(); - Write96_Item(@"KnownTypesThroughConstructorWithArrayProperties", @"", ((global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties)o), true, false); + Write97_Item(@"KnownTypesThroughConstructorWithArrayProperties", @"", ((global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties)o), true, false); } - public void Write202_Item(object o) { + public void Write207_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"KnownTypesThroughConstructorWithValue", @""); return; } TopLevelElement(); - Write97_Item(@"KnownTypesThroughConstructorWithValue", @"", ((global::SerializationTypes.KnownTypesThroughConstructorWithValue)o), true, false); + Write98_Item(@"KnownTypesThroughConstructorWithValue", @"", ((global::SerializationTypes.KnownTypesThroughConstructorWithValue)o), true, false); } - public void Write203_Item(object o) { + public void Write208_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithTypesHavingCustomFormatter", @""); return; } TopLevelElement(); - Write98_Item(@"TypeWithTypesHavingCustomFormatter", @"", ((global::SerializationTypes.TypeWithTypesHavingCustomFormatter)o), true, false); + Write99_Item(@"TypeWithTypesHavingCustomFormatter", @"", ((global::SerializationTypes.TypeWithTypesHavingCustomFormatter)o), true, false); } - public void Write204_Item(object o) { + public void Write209_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithArrayPropertyHavingChoice", @""); return; } TopLevelElement(); - Write100_Item(@"TypeWithArrayPropertyHavingChoice", @"", ((global::SerializationTypes.TypeWithArrayPropertyHavingChoice)o), true, false); + Write101_Item(@"TypeWithArrayPropertyHavingChoice", @"", ((global::SerializationTypes.TypeWithArrayPropertyHavingChoice)o), true, false); + } + + public void Write210_Item(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"TypeWithPropertyHavingComplexChoice", @""); + return; + } + TopLevelElement(); + Write104_Item(@"TypeWithPropertyHavingComplexChoice", @"", ((global::SerializationTypes.TypeWithPropertyHavingComplexChoice)o), true, false); } - public void Write205_MoreChoices(object o) { + public void Write211_MoreChoices(object o) { WriteStartDocument(); if (o == null) { WriteEmptyTag(@"MoreChoices", @""); return; } - WriteElementString(@"MoreChoices", @"", Write99_MoreChoices(((global::SerializationTypes.MoreChoices)o))); + WriteElementString(@"MoreChoices", @"", Write100_MoreChoices(((global::SerializationTypes.MoreChoices)o))); + } + + public void Write212_ComplexChoiceA(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"ComplexChoiceA", @""); + return; + } + TopLevelElement(); + Write103_ComplexChoiceA(@"ComplexChoiceA", @"", ((global::SerializationTypes.ComplexChoiceA)o), true, false); + } + + public void Write213_ComplexChoiceB(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"ComplexChoiceB", @""); + return; + } + TopLevelElement(); + Write102_ComplexChoiceB(@"ComplexChoiceB", @"", ((global::SerializationTypes.ComplexChoiceB)o), true, false); } - public void Write206_TypeWithFieldsOrdered(object o) { + public void Write214_TypeWithFieldsOrdered(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithFieldsOrdered", @""); return; } TopLevelElement(); - Write101_TypeWithFieldsOrdered(@"TypeWithFieldsOrdered", @"", ((global::SerializationTypes.TypeWithFieldsOrdered)o), true, false); + Write105_TypeWithFieldsOrdered(@"TypeWithFieldsOrdered", @"", ((global::SerializationTypes.TypeWithFieldsOrdered)o), true, false); } - public void Write207_Item(object o) { + public void Write215_Item(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeWithKnownTypesOfCollectionsWithConflictingXmlName", @""); return; } TopLevelElement(); - Write102_Item(@"TypeWithKnownTypesOfCollectionsWithConflictingXmlName", @"", ((global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)o), true, false); + Write106_Item(@"TypeWithKnownTypesOfCollectionsWithConflictingXmlName", @"", ((global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)o), true, false); } - public void Write208_Root(object o) { + public void Write216_Root(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Root", @""); return; } TopLevelElement(); - Write105_Item(@"Root", @"", ((global::SerializationTypes.NamespaceTypeNameClashContainer)o), true, false); + Write109_Item(@"Root", @"", ((global::SerializationTypes.NamespaceTypeNameClashContainer)o), true, false); } - public void Write209_TypeClashB(object o) { + public void Write217_TypeClashB(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeClashB", @""); return; } TopLevelElement(); - Write104_TypeNameClash(@"TypeClashB", @"", ((global::SerializationTypes.TypeNameClashB.TypeNameClash)o), true, false); + Write108_TypeNameClash(@"TypeClashB", @"", ((global::SerializationTypes.TypeNameClashB.TypeNameClash)o), true, false); } - public void Write210_TypeClashA(object o) { + public void Write218_TypeClashA(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"TypeClashA", @""); return; } TopLevelElement(); - Write103_TypeNameClash(@"TypeClashA", @"", ((global::SerializationTypes.TypeNameClashA.TypeNameClash)o), true, false); + Write107_TypeNameClash(@"TypeClashA", @"", ((global::SerializationTypes.TypeNameClashA.TypeNameClash)o), true, false); } - public void Write211_Person(object o) { + public void Write219_Person(object o) { WriteStartDocument(); if (o == null) { WriteNullTagLiteral(@"Person", @""); return; } TopLevelElement(); - Write106_Person(@"Person", @"", ((global::Outer.Person)o), true, false); + Write110_Person(@"Person", @"", ((global::Outer.Person)o), true, false); } - void Write106_Person(string n, string ns, global::Outer.Person o, bool isNullable, bool needType) { + void Write110_Person(string n, string ns, global::Outer.Person o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -1088,7 +1128,7 @@ void Write106_Person(string n, string ns, global::Outer.Person o, bool isNullabl WriteEndElement(o); } - void Write103_TypeNameClash(string n, string ns, global::SerializationTypes.TypeNameClashA.TypeNameClash o, bool isNullable, bool needType) { + void Write107_TypeNameClash(string n, string ns, global::SerializationTypes.TypeNameClashA.TypeNameClash o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -1107,7 +1147,7 @@ void Write103_TypeNameClash(string n, string ns, global::SerializationTypes.Type WriteEndElement(o); } - void Write104_TypeNameClash(string n, string ns, global::SerializationTypes.TypeNameClashB.TypeNameClash o, bool isNullable, bool needType) { + void Write108_TypeNameClash(string n, string ns, global::SerializationTypes.TypeNameClashB.TypeNameClash o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -1126,7 +1166,7 @@ void Write104_TypeNameClash(string n, string ns, global::SerializationTypes.Type WriteEndElement(o); } - void Write105_Item(string n, string ns, global::SerializationTypes.NamespaceTypeNameClashContainer o, bool isNullable, bool needType) { + void Write109_Item(string n, string ns, global::SerializationTypes.NamespaceTypeNameClashContainer o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -1145,7 +1185,7 @@ void Write105_Item(string n, string ns, global::SerializationTypes.NamespaceType global::SerializationTypes.TypeNameClashA.TypeNameClash[] a = (global::SerializationTypes.TypeNameClashA.TypeNameClash[])o.@A; if (a != null) { for (int ia = 0; ia < a.Length; ia++) { - Write103_TypeNameClash(@"A", @"", ((global::SerializationTypes.TypeNameClashA.TypeNameClash)a[ia]), false, false); + Write107_TypeNameClash(@"A", @"", ((global::SerializationTypes.TypeNameClashA.TypeNameClash)a[ia]), false, false); } } } @@ -1153,14 +1193,14 @@ void Write105_Item(string n, string ns, global::SerializationTypes.NamespaceType global::SerializationTypes.TypeNameClashB.TypeNameClash[] a = (global::SerializationTypes.TypeNameClashB.TypeNameClash[])o.@B; if (a != null) { for (int ia = 0; ia < a.Length; ia++) { - Write104_TypeNameClash(@"B", @"", ((global::SerializationTypes.TypeNameClashB.TypeNameClash)a[ia]), false, false); + Write108_TypeNameClash(@"B", @"", ((global::SerializationTypes.TypeNameClashB.TypeNameClash)a[ia]), false, false); } } } WriteEndElement(o); } - void Write102_Item(string n, string ns, global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName o, bool isNullable, bool needType) { + void Write106_Item(string n, string ns, global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -1191,195 +1231,211 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable } else { if (t == typeof(global::Outer.Person)) { - Write106_Person(n, ns,(global::Outer.Person)o, isNullable, true); + Write110_Person(n, ns,(global::Outer.Person)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.NamespaceTypeNameClashContainer)) { - Write105_Item(n, ns,(global::SerializationTypes.NamespaceTypeNameClashContainer)o, isNullable, true); + Write109_Item(n, ns,(global::SerializationTypes.NamespaceTypeNameClashContainer)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeNameClashB.TypeNameClash)) { - Write104_TypeNameClash(n, ns,(global::SerializationTypes.TypeNameClashB.TypeNameClash)o, isNullable, true); + Write108_TypeNameClash(n, ns,(global::SerializationTypes.TypeNameClashB.TypeNameClash)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeNameClashA.TypeNameClash)) { - Write103_TypeNameClash(n, ns,(global::SerializationTypes.TypeNameClashA.TypeNameClash)o, isNullable, true); + Write107_TypeNameClash(n, ns,(global::SerializationTypes.TypeNameClashA.TypeNameClash)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)) { - Write102_Item(n, ns,(global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)o, isNullable, true); + Write106_Item(n, ns,(global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithFieldsOrdered)) { - Write101_TypeWithFieldsOrdered(n, ns,(global::SerializationTypes.TypeWithFieldsOrdered)o, isNullable, true); + Write105_TypeWithFieldsOrdered(n, ns,(global::SerializationTypes.TypeWithFieldsOrdered)o, isNullable, true); + return; + } + if (t == typeof(global::SerializationTypes.TypeWithPropertyHavingComplexChoice)) { + Write104_Item(n, ns,(global::SerializationTypes.TypeWithPropertyHavingComplexChoice)o, isNullable, true); + return; + } + if (t == typeof(global::SerializationTypes.ComplexChoiceA)) { + Write103_ComplexChoiceA(n, ns,(global::SerializationTypes.ComplexChoiceA)o, isNullable, true); + return; + } + if (t == typeof(global::SerializationTypes.ComplexChoiceB)) { + Write102_ComplexChoiceB(n, ns,(global::SerializationTypes.ComplexChoiceB)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithArrayPropertyHavingChoice)) { - Write100_Item(n, ns,(global::SerializationTypes.TypeWithArrayPropertyHavingChoice)o, isNullable, true); + Write101_Item(n, ns,(global::SerializationTypes.TypeWithArrayPropertyHavingChoice)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithTypesHavingCustomFormatter)) { - Write98_Item(n, ns,(global::SerializationTypes.TypeWithTypesHavingCustomFormatter)o, isNullable, true); + Write99_Item(n, ns,(global::SerializationTypes.TypeWithTypesHavingCustomFormatter)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.KnownTypesThroughConstructorWithValue)) { - Write97_Item(n, ns,(global::SerializationTypes.KnownTypesThroughConstructorWithValue)o, isNullable, true); + Write98_Item(n, ns,(global::SerializationTypes.KnownTypesThroughConstructorWithValue)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties)) { - Write96_Item(n, ns,(global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties)o, isNullable, true); + Write97_Item(n, ns,(global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithShouldSerializeMethod)) { - Write95_TypeWithShouldSerializeMethod(n, ns,(global::SerializationTypes.TypeWithShouldSerializeMethod)o, isNullable, true); + Write96_TypeWithShouldSerializeMethod(n, ns,(global::SerializationTypes.TypeWithShouldSerializeMethod)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue)) { - Write94_Item(n, ns,(global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue)o, isNullable, true); + Write95_Item(n, ns,(global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue)) { - Write93_Item(n, ns,(global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue)o, isNullable, true); + Write94_Item(n, ns,(global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithPropertiesHavingDefaultValue)) { - Write92_Item(n, ns,(global::SerializationTypes.TypeWithPropertiesHavingDefaultValue)o, isNullable, true); + Write93_Item(n, ns,(global::SerializationTypes.TypeWithPropertiesHavingDefaultValue)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWith2DArrayProperty2)) { - Write91_TypeWith2DArrayProperty2(n, ns,(global::SerializationTypes.TypeWith2DArrayProperty2)o, isNullable, true); + Write92_TypeWith2DArrayProperty2(n, ns,(global::SerializationTypes.TypeWith2DArrayProperty2)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithXmlQualifiedName)) { - Write90_TypeWithXmlQualifiedName(n, ns,(global::SerializationTypes.TypeWithXmlQualifiedName)o, isNullable, true); + Write91_TypeWithXmlQualifiedName(n, ns,(global::SerializationTypes.TypeWithXmlQualifiedName)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.ServerSettings)) { - Write89_ServerSettings(n, ns,(global::SerializationTypes.ServerSettings)o, isNullable, true); + Write90_ServerSettings(n, ns,(global::SerializationTypes.ServerSettings)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithNonPublicDefaultConstructor)) { - Write88_Item(n, ns,(global::SerializationTypes.TypeWithNonPublicDefaultConstructor)o, isNullable, true); + Write89_Item(n, ns,(global::SerializationTypes.TypeWithNonPublicDefaultConstructor)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute)) { - Write86_Item(n, ns,(global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute)o, isNullable, true); + Write87_Item(n, ns,(global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithXmlSchemaFormAttribute)) { - Write85_TypeWithXmlSchemaFormAttribute(n, ns,(global::SerializationTypes.TypeWithXmlSchemaFormAttribute)o, isNullable, true); + Write86_TypeWithXmlSchemaFormAttribute(n, ns,(global::SerializationTypes.TypeWithXmlSchemaFormAttribute)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithPropertyNameSpecified)) { - Write84_TypeWithPropertyNameSpecified(n, ns,(global::SerializationTypes.TypeWithPropertyNameSpecified)o, isNullable, true); + Write85_TypeWithPropertyNameSpecified(n, ns,(global::SerializationTypes.TypeWithPropertyNameSpecified)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.SimpleKnownTypeValue)) { - Write83_SimpleKnownTypeValue(n, ns,(global::SerializationTypes.SimpleKnownTypeValue)o, isNullable, true); + Write84_SimpleKnownTypeValue(n, ns,(global::SerializationTypes.SimpleKnownTypeValue)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.KnownTypesThroughConstructor)) { - Write82_KnownTypesThroughConstructor(n, ns,(global::SerializationTypes.KnownTypesThroughConstructor)o, isNullable, true); + Write83_KnownTypesThroughConstructor(n, ns,(global::SerializationTypes.KnownTypesThroughConstructor)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithAnyAttribute)) { - Write81_TypeWithAnyAttribute(n, ns,(global::SerializationTypes.TypeWithAnyAttribute)o, isNullable, true); + Write82_TypeWithAnyAttribute(n, ns,(global::SerializationTypes.TypeWithAnyAttribute)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.XmlSerializerAttributes)) { - Write80_XmlSerializerAttributes(n, ns,(global::SerializationTypes.XmlSerializerAttributes)o, isNullable, true); + Write81_XmlSerializerAttributes(n, ns,(global::SerializationTypes.XmlSerializerAttributes)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.WithNullables)) { - Write73_WithNullables(n, ns,(global::SerializationTypes.WithNullables)o, isNullable, true); + Write74_WithNullables(n, ns,(global::SerializationTypes.WithNullables)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.WithEnums)) { - Write72_WithEnums(n, ns,(global::SerializationTypes.WithEnums)o, isNullable, true); + Write73_WithEnums(n, ns,(global::SerializationTypes.WithEnums)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.WithStruct)) { - Write69_WithStruct(n, ns,(global::SerializationTypes.WithStruct)o, isNullable, true); + Write70_WithStruct(n, ns,(global::SerializationTypes.WithStruct)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.SomeStruct)) { - Write68_SomeStruct(n, ns,(global::SerializationTypes.SomeStruct)o, true); + Write69_SomeStruct(n, ns,(global::SerializationTypes.SomeStruct)o, true); return; } if (t == typeof(global::SerializationTypes.ClassImplementsInterface)) { - Write67_ClassImplementsInterface(n, ns,(global::SerializationTypes.ClassImplementsInterface)o, isNullable, true); + Write68_ClassImplementsInterface(n, ns,(global::SerializationTypes.ClassImplementsInterface)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithXmlTextAttributeOnArray)) { - Write65_Item(n, ns,(global::SerializationTypes.TypeWithXmlTextAttributeOnArray)o, isNullable, true); + Write66_Item(n, ns,(global::SerializationTypes.TypeWithXmlTextAttributeOnArray)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.SimpleDC)) { - Write64_SimpleDC(n, ns,(global::SerializationTypes.SimpleDC)o, isNullable, true); + Write65_SimpleDC(n, ns,(global::SerializationTypes.SimpleDC)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithByteArrayAsXmlText)) { - Write63_TypeWithByteArrayAsXmlText(n, ns,(global::SerializationTypes.TypeWithByteArrayAsXmlText)o, isNullable, true); + Write64_TypeWithByteArrayAsXmlText(n, ns,(global::SerializationTypes.TypeWithByteArrayAsXmlText)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime)) { - Write62_Item(n, ns,(global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime)o, isNullable, true); + Write63_Item(n, ns,(global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.BaseClassWithSamePropertyName)) { - Write59_BaseClassWithSamePropertyName(n, ns,(global::SerializationTypes.BaseClassWithSamePropertyName)o, isNullable, true); + Write60_BaseClassWithSamePropertyName(n, ns,(global::SerializationTypes.BaseClassWithSamePropertyName)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.DerivedClassWithSameProperty)) { - Write60_DerivedClassWithSameProperty(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty)o, isNullable, true); + Write61_DerivedClassWithSameProperty(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.DerivedClassWithSameProperty2)) { - Write61_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); + Write62_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ)) { - Write58_Item(n, ns,(global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ)o, isNullable, true); + Write59_Item(n, ns,(global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeHasArrayOfASerializedAsB)) { - Write57_TypeHasArrayOfASerializedAsB(n, ns,(global::SerializationTypes.TypeHasArrayOfASerializedAsB)o, isNullable, true); + Write58_TypeHasArrayOfASerializedAsB(n, ns,(global::SerializationTypes.TypeHasArrayOfASerializedAsB)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeB)) { - Write56_TypeB(n, ns,(global::SerializationTypes.TypeB)o, isNullable, true); + Write57_TypeB(n, ns,(global::SerializationTypes.TypeB)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeA)) { - Write55_TypeA(n, ns,(global::SerializationTypes.TypeA)o, isNullable, true); + Write56_TypeA(n, ns,(global::SerializationTypes.TypeA)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.BuiltInTypes)) { - Write54_BuiltInTypes(n, ns,(global::SerializationTypes.BuiltInTypes)o, isNullable, true); + Write55_BuiltInTypes(n, ns,(global::SerializationTypes.BuiltInTypes)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.DCClassWithEnumAndStruct)) { - Write53_DCClassWithEnumAndStruct(n, ns,(global::SerializationTypes.DCClassWithEnumAndStruct)o, isNullable, true); + Write54_DCClassWithEnumAndStruct(n, ns,(global::SerializationTypes.DCClassWithEnumAndStruct)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.DCStruct)) { - Write52_DCStruct(n, ns,(global::SerializationTypes.DCStruct)o, true); + Write53_DCStruct(n, ns,(global::SerializationTypes.DCStruct)o, true); return; } if (t == typeof(global::SerializationTypes.TypeWithEnumMembers)) { - Write51_TypeWithEnumMembers(n, ns,(global::SerializationTypes.TypeWithEnumMembers)o, isNullable, true); + Write52_TypeWithEnumMembers(n, ns,(global::SerializationTypes.TypeWithEnumMembers)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)) { - Write49_Item(n, ns,(global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)o, isNullable, true); + Write50_Item(n, ns,(global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithMyCollectionField)) { - Write48_TypeWithMyCollectionField(n, ns,(global::SerializationTypes.TypeWithMyCollectionField)o, isNullable, true); + Write49_TypeWithMyCollectionField(n, ns,(global::SerializationTypes.TypeWithMyCollectionField)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.StructNotSerializable)) { - Write47_StructNotSerializable(n, ns,(global::SerializationTypes.StructNotSerializable)o, true); + Write48_StructNotSerializable(n, ns,(global::SerializationTypes.StructNotSerializable)o, true); + return; + } + if (t == typeof(global::SerializationTypes.TypeWithArraylikeMembers)) { + Write47_TypeWithArraylikeMembers(n, ns,(global::SerializationTypes.TypeWithArraylikeMembers)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.TypeWithGetOnlyArrayProperties)) { @@ -1725,7 +1781,7 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable if (t == typeof(global::SerializationTypes.MyEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"MyEnum", @""); - Writer.WriteString(Write50_MyEnum((global::SerializationTypes.MyEnum)o)); + Writer.WriteString(Write51_MyEnum((global::SerializationTypes.MyEnum)o)); Writer.WriteEndElement(); return; } @@ -1736,7 +1792,7 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable global::SerializationTypes.TypeA[] a = (global::SerializationTypes.TypeA[])o; if (a != null) { for (int ia = 0; ia < a.Length; ia++) { - Write55_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)a[ia]), true, false); + Write56_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)a[ia]), true, false); } } } @@ -1746,63 +1802,63 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable if (t == typeof(global::SerializationTypes.EnumFlags)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"EnumFlags", @""); - Writer.WriteString(Write66_EnumFlags((global::SerializationTypes.EnumFlags)o)); + Writer.WriteString(Write67_EnumFlags((global::SerializationTypes.EnumFlags)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.IntEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"IntEnum", @""); - Writer.WriteString(Write70_IntEnum((global::SerializationTypes.IntEnum)o)); + Writer.WriteString(Write71_IntEnum((global::SerializationTypes.IntEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.ShortEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"ShortEnum", @""); - Writer.WriteString(Write71_ShortEnum((global::SerializationTypes.ShortEnum)o)); + Writer.WriteString(Write72_ShortEnum((global::SerializationTypes.ShortEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.ByteEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"ByteEnum", @""); - Writer.WriteString(Write74_ByteEnum((global::SerializationTypes.ByteEnum)o)); + Writer.WriteString(Write75_ByteEnum((global::SerializationTypes.ByteEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.SByteEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"SByteEnum", @""); - Writer.WriteString(Write75_SByteEnum((global::SerializationTypes.SByteEnum)o)); + Writer.WriteString(Write76_SByteEnum((global::SerializationTypes.SByteEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.UIntEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"UIntEnum", @""); - Writer.WriteString(Write76_UIntEnum((global::SerializationTypes.UIntEnum)o)); + Writer.WriteString(Write77_UIntEnum((global::SerializationTypes.UIntEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.LongEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"LongEnum", @""); - Writer.WriteString(Write77_LongEnum((global::SerializationTypes.LongEnum)o)); + Writer.WriteString(Write78_LongEnum((global::SerializationTypes.LongEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.ULongEnum)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"ULongEnum", @""); - Writer.WriteString(Write78_ULongEnum((global::SerializationTypes.ULongEnum)o)); + Writer.WriteString(Write79_ULongEnum((global::SerializationTypes.ULongEnum)o)); Writer.WriteEndElement(); return; } if (t == typeof(global::SerializationTypes.ItemChoiceType)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"ItemChoiceType", @""); - Writer.WriteString(Write79_ItemChoiceType((global::SerializationTypes.ItemChoiceType)o)); + Writer.WriteString(Write80_ItemChoiceType((global::SerializationTypes.ItemChoiceType)o)); Writer.WriteEndElement(); return; } @@ -1813,7 +1869,7 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable global::SerializationTypes.ItemChoiceType[] a = (global::SerializationTypes.ItemChoiceType[])o; if (a != null) { for (int ia = 0; ia < a.Length; ia++) { - WriteElementString(@"ItemChoiceType", @"", Write79_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)a[ia]))); + WriteElementString(@"ItemChoiceType", @"", Write80_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)a[ia]))); } } } @@ -1881,7 +1937,7 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable if (t == typeof(global::SerializationTypes.MoreChoices)) { Writer.WriteStartElement(n, ns); WriteXsiType(@"MoreChoices", @""); - Writer.WriteString(Write99_MoreChoices((global::SerializationTypes.MoreChoices)o)); + Writer.WriteString(Write100_MoreChoices((global::SerializationTypes.MoreChoices)o)); Writer.WriteEndElement(); return; } @@ -1893,7 +1949,7 @@ void Write1_Object(string n, string ns, global::System.Object o, bool isNullable WriteEndElement(o); } - string Write99_MoreChoices(global::SerializationTypes.MoreChoices v) { + string Write100_MoreChoices(global::SerializationTypes.MoreChoices v) { string s = null; switch (v) { case global::SerializationTypes.MoreChoices.@None: s = @"None"; break; @@ -1924,7 +1980,7 @@ void Write44_SimpleType(string n, string ns, global::SerializationTypes.SimpleTy WriteEndElement(o); } - string Write79_ItemChoiceType(global::SerializationTypes.ItemChoiceType v) { + string Write80_ItemChoiceType(global::SerializationTypes.ItemChoiceType v) { string s = null; switch (v) { case global::SerializationTypes.ItemChoiceType.@None: s = @"None"; break; @@ -1936,7 +1992,7 @@ string Write79_ItemChoiceType(global::SerializationTypes.ItemChoiceType v) { return s; } - string Write78_ULongEnum(global::SerializationTypes.ULongEnum v) { + string Write79_ULongEnum(global::SerializationTypes.ULongEnum v) { string s = null; switch (v) { case global::SerializationTypes.ULongEnum.@Option0: s = @"Option0"; break; @@ -1947,7 +2003,7 @@ string Write78_ULongEnum(global::SerializationTypes.ULongEnum v) { return s; } - string Write77_LongEnum(global::SerializationTypes.LongEnum v) { + string Write78_LongEnum(global::SerializationTypes.LongEnum v) { string s = null; switch (v) { case global::SerializationTypes.LongEnum.@Option0: s = @"Option0"; break; @@ -1958,7 +2014,7 @@ string Write77_LongEnum(global::SerializationTypes.LongEnum v) { return s; } - string Write76_UIntEnum(global::SerializationTypes.UIntEnum v) { + string Write77_UIntEnum(global::SerializationTypes.UIntEnum v) { string s = null; switch (v) { case global::SerializationTypes.UIntEnum.@Option0: s = @"Option0"; break; @@ -1969,7 +2025,7 @@ string Write76_UIntEnum(global::SerializationTypes.UIntEnum v) { return s; } - string Write75_SByteEnum(global::SerializationTypes.SByteEnum v) { + string Write76_SByteEnum(global::SerializationTypes.SByteEnum v) { string s = null; switch (v) { case global::SerializationTypes.SByteEnum.@Option0: s = @"Option0"; break; @@ -1980,7 +2036,7 @@ string Write75_SByteEnum(global::SerializationTypes.SByteEnum v) { return s; } - string Write74_ByteEnum(global::SerializationTypes.ByteEnum v) { + string Write75_ByteEnum(global::SerializationTypes.ByteEnum v) { string s = null; switch (v) { case global::SerializationTypes.ByteEnum.@Option0: s = @"Option0"; break; @@ -1991,7 +2047,7 @@ string Write74_ByteEnum(global::SerializationTypes.ByteEnum v) { return s; } - string Write71_ShortEnum(global::SerializationTypes.ShortEnum v) { + string Write72_ShortEnum(global::SerializationTypes.ShortEnum v) { string s = null; switch (v) { case global::SerializationTypes.ShortEnum.@Option0: s = @"Option0"; break; @@ -2002,7 +2058,7 @@ string Write71_ShortEnum(global::SerializationTypes.ShortEnum v) { return s; } - string Write70_IntEnum(global::SerializationTypes.IntEnum v) { + string Write71_IntEnum(global::SerializationTypes.IntEnum v) { string s = null; switch (v) { case global::SerializationTypes.IntEnum.@Option0: s = @"Option0"; break; @@ -2013,7 +2069,7 @@ string Write70_IntEnum(global::SerializationTypes.IntEnum v) { return s; } - string Write66_EnumFlags(global::SerializationTypes.EnumFlags v) { + string Write67_EnumFlags(global::SerializationTypes.EnumFlags v) { string s = null; switch (v) { case global::SerializationTypes.EnumFlags.@One: s = @"One"; break; @@ -2031,7 +2087,7 @@ string Write66_EnumFlags(global::SerializationTypes.EnumFlags v) { return s; } - void Write55_TypeA(string n, string ns, global::SerializationTypes.TypeA o, bool isNullable, bool needType) { + void Write56_TypeA(string n, string ns, global::SerializationTypes.TypeA o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -2050,7 +2106,7 @@ void Write55_TypeA(string n, string ns, global::SerializationTypes.TypeA o, bool WriteEndElement(o); } - string Write50_MyEnum(global::SerializationTypes.MyEnum v) { + string Write51_MyEnum(global::SerializationTypes.MyEnum v) { string s = null; switch (v) { case global::SerializationTypes.MyEnum.@One: s = @"One"; break; @@ -3186,7 +3242,111 @@ void Write46_TypeWithGetOnlyArrayProperties(string n, string ns, global::Seriali WriteEndElement(o); } - void Write47_StructNotSerializable(string n, string ns, global::SerializationTypes.StructNotSerializable o, bool needType) { + void Write47_TypeWithArraylikeMembers(string n, string ns, global::SerializationTypes.TypeWithArraylikeMembers o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::SerializationTypes.TypeWithArraylikeMembers)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"TypeWithArraylikeMembers", @""); + { + global::System.Int32[] a = (global::System.Int32[])((global::System.Int32[])o.@IntAField); + if (a != null){ + WriteStartElement(@"IntAField", @"", null, false); + for (int ia = 0; ia < a.Length; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Int32[] a = (global::System.Int32[])((global::System.Int32[])o.@NIntAField); + if (a != null){ + WriteStartElement(@"NIntAField", @"", null, false); + for (int ia = 0; ia < a.Length; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Collections.Generic.List a = (global::System.Collections.Generic.List)((global::System.Collections.Generic.List)o.@IntLField); + if (a != null){ + WriteStartElement(@"IntLField", @"", null, false); + for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Collections.Generic.List a = (global::System.Collections.Generic.List)((global::System.Collections.Generic.List)o.@NIntLField); + if ((object)(a) == null) { + WriteNullTagLiteral(@"NIntLField", @""); + } + else { + WriteStartElement(@"NIntLField", @"", null, false); + for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Int32[] a = (global::System.Int32[])((global::System.Int32[])o.@IntAProp); + if (a != null){ + WriteStartElement(@"IntAProp", @"", null, false); + for (int ia = 0; ia < a.Length; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Int32[] a = (global::System.Int32[])((global::System.Int32[])o.@NIntAProp); + if ((object)(a) == null) { + WriteNullTagLiteral(@"NIntAProp", @""); + } + else { + WriteStartElement(@"NIntAProp", @"", null, false); + for (int ia = 0; ia < a.Length; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Collections.Generic.List a = (global::System.Collections.Generic.List)((global::System.Collections.Generic.List)o.@IntLProp); + if (a != null){ + WriteStartElement(@"IntLProp", @"", null, false); + for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + { + global::System.Collections.Generic.List a = (global::System.Collections.Generic.List)((global::System.Collections.Generic.List)o.@NIntLProp); + if (a != null){ + WriteStartElement(@"NIntLProp", @"", null, false); + for (int ia = 0; ia < ((System.Collections.ICollection)a).Count; ia++) { + WriteElementStringRaw(@"int", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)a[ia]))); + } + WriteEndElement(); + } + } + WriteEndElement(o); + } + + void Write48_StructNotSerializable(string n, string ns, global::SerializationTypes.StructNotSerializable o, bool needType) { if (!needType) { System.Type t = o.GetType(); if (t == typeof(global::SerializationTypes.StructNotSerializable)) { @@ -3201,7 +3361,7 @@ void Write47_StructNotSerializable(string n, string ns, global::SerializationTyp WriteEndElement(o); } - void Write48_TypeWithMyCollectionField(string n, string ns, global::SerializationTypes.TypeWithMyCollectionField o, bool isNullable, bool needType) { + void Write49_TypeWithMyCollectionField(string n, string ns, global::SerializationTypes.TypeWithMyCollectionField o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3232,7 +3392,7 @@ void Write48_TypeWithMyCollectionField(string n, string ns, global::Serializatio WriteEndElement(o); } - void Write49_Item(string n, string ns, global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty o, bool isNullable, bool needType) { + void Write50_Item(string n, string ns, global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3263,7 +3423,7 @@ void Write49_Item(string n, string ns, global::SerializationTypes.TypeWithReadOn WriteEndElement(o); } - void Write51_TypeWithEnumMembers(string n, string ns, global::SerializationTypes.TypeWithEnumMembers o, bool isNullable, bool needType) { + void Write52_TypeWithEnumMembers(string n, string ns, global::SerializationTypes.TypeWithEnumMembers o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3278,12 +3438,12 @@ void Write51_TypeWithEnumMembers(string n, string ns, global::SerializationTypes } WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"TypeWithEnumMembers", @""); - WriteElementString(@"F1", @"", Write50_MyEnum(((global::SerializationTypes.MyEnum)o.@F1))); - WriteElementString(@"P1", @"", Write50_MyEnum(((global::SerializationTypes.MyEnum)o.@P1))); + WriteElementString(@"F1", @"", Write51_MyEnum(((global::SerializationTypes.MyEnum)o.@F1))); + WriteElementString(@"P1", @"", Write51_MyEnum(((global::SerializationTypes.MyEnum)o.@P1))); WriteEndElement(o); } - void Write52_DCStruct(string n, string ns, global::SerializationTypes.DCStruct o, bool needType) { + void Write53_DCStruct(string n, string ns, global::SerializationTypes.DCStruct o, bool needType) { if (!needType) { System.Type t = o.GetType(); if (t == typeof(global::SerializationTypes.DCStruct)) { @@ -3298,7 +3458,7 @@ void Write52_DCStruct(string n, string ns, global::SerializationTypes.DCStruct o WriteEndElement(o); } - void Write53_DCClassWithEnumAndStruct(string n, string ns, global::SerializationTypes.DCClassWithEnumAndStruct o, bool isNullable, bool needType) { + void Write54_DCClassWithEnumAndStruct(string n, string ns, global::SerializationTypes.DCClassWithEnumAndStruct o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3313,12 +3473,12 @@ void Write53_DCClassWithEnumAndStruct(string n, string ns, global::Serialization } WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"DCClassWithEnumAndStruct", @""); - Write52_DCStruct(@"MyStruct", @"", ((global::SerializationTypes.DCStruct)o.@MyStruct), false); - WriteElementString(@"MyEnum1", @"", Write50_MyEnum(((global::SerializationTypes.MyEnum)o.@MyEnum1))); + Write53_DCStruct(@"MyStruct", @"", ((global::SerializationTypes.DCStruct)o.@MyStruct), false); + WriteElementString(@"MyEnum1", @"", Write51_MyEnum(((global::SerializationTypes.MyEnum)o.@MyEnum1))); WriteEndElement(o); } - void Write54_BuiltInTypes(string n, string ns, global::SerializationTypes.BuiltInTypes o, bool isNullable, bool needType) { + void Write55_BuiltInTypes(string n, string ns, global::SerializationTypes.BuiltInTypes o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3337,7 +3497,7 @@ void Write54_BuiltInTypes(string n, string ns, global::SerializationTypes.BuiltI WriteEndElement(o); } - void Write56_TypeB(string n, string ns, global::SerializationTypes.TypeB o, bool isNullable, bool needType) { + void Write57_TypeB(string n, string ns, global::SerializationTypes.TypeB o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3356,7 +3516,7 @@ void Write56_TypeB(string n, string ns, global::SerializationTypes.TypeB o, bool WriteEndElement(o); } - void Write57_TypeHasArrayOfASerializedAsB(string n, string ns, global::SerializationTypes.TypeHasArrayOfASerializedAsB o, bool isNullable, bool needType) { + void Write58_TypeHasArrayOfASerializedAsB(string n, string ns, global::SerializationTypes.TypeHasArrayOfASerializedAsB o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3376,7 +3536,7 @@ void Write57_TypeHasArrayOfASerializedAsB(string n, string ns, global::Serializa if (a != null){ WriteStartElement(@"Items", @"", null, false); for (int ia = 0; ia < a.Length; ia++) { - Write55_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)a[ia]), true, false); + Write56_TypeA(@"TypeA", @"", ((global::SerializationTypes.TypeA)a[ia]), true, false); } WriteEndElement(); } @@ -3384,7 +3544,7 @@ void Write57_TypeHasArrayOfASerializedAsB(string n, string ns, global::Serializa WriteEndElement(o); } - void Write58_Item(string n, string ns, global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ o, bool isNullable, bool needType) { + void Write59_Item(string n, string ns, global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3403,7 +3563,7 @@ void Write58_Item(string n, string ns, global::SerializationTypes.@__TypeNameWit WriteEndElement(o); } - void Write61_DerivedClassWithSameProperty2(string n, string ns, global::SerializationTypes.DerivedClassWithSameProperty2 o, bool isNullable, bool needType) { + void Write62_DerivedClassWithSameProperty2(string n, string ns, global::SerializationTypes.DerivedClassWithSameProperty2 o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3434,7 +3594,7 @@ void Write61_DerivedClassWithSameProperty2(string n, string ns, global::Serializ WriteEndElement(o); } - void Write60_DerivedClassWithSameProperty(string n, string ns, global::SerializationTypes.DerivedClassWithSameProperty o, bool isNullable, bool needType) { + void Write61_DerivedClassWithSameProperty(string n, string ns, global::SerializationTypes.DerivedClassWithSameProperty o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3445,7 +3605,7 @@ void Write60_DerivedClassWithSameProperty(string n, string ns, global::Serializa } else { if (t == typeof(global::SerializationTypes.DerivedClassWithSameProperty2)) { - Write61_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); + Write62_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); return; } throw CreateUnknownTypeException(o); @@ -3469,7 +3629,7 @@ void Write60_DerivedClassWithSameProperty(string n, string ns, global::Serializa WriteEndElement(o); } - void Write59_BaseClassWithSamePropertyName(string n, string ns, global::SerializationTypes.BaseClassWithSamePropertyName o, bool isNullable, bool needType) { + void Write60_BaseClassWithSamePropertyName(string n, string ns, global::SerializationTypes.BaseClassWithSamePropertyName o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3480,11 +3640,11 @@ void Write59_BaseClassWithSamePropertyName(string n, string ns, global::Serializ } else { if (t == typeof(global::SerializationTypes.DerivedClassWithSameProperty)) { - Write60_DerivedClassWithSameProperty(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty)o, isNullable, true); + Write61_DerivedClassWithSameProperty(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty)o, isNullable, true); return; } if (t == typeof(global::SerializationTypes.DerivedClassWithSameProperty2)) { - Write61_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); + Write62_DerivedClassWithSameProperty2(n, ns,(global::SerializationTypes.DerivedClassWithSameProperty2)o, isNullable, true); return; } throw CreateUnknownTypeException(o); @@ -3508,7 +3668,7 @@ void Write59_BaseClassWithSamePropertyName(string n, string ns, global::Serializ WriteEndElement(o); } - void Write62_Item(string n, string ns, global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime o, bool isNullable, bool needType) { + void Write63_Item(string n, string ns, global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3529,7 +3689,7 @@ void Write62_Item(string n, string ns, global::SerializationTypes.TypeWithDateTi WriteEndElement(o); } - void Write63_TypeWithByteArrayAsXmlText(string n, string ns, global::SerializationTypes.TypeWithByteArrayAsXmlText o, bool isNullable, bool needType) { + void Write64_TypeWithByteArrayAsXmlText(string n, string ns, global::SerializationTypes.TypeWithByteArrayAsXmlText o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3550,7 +3710,7 @@ void Write63_TypeWithByteArrayAsXmlText(string n, string ns, global::Serializati WriteEndElement(o); } - void Write64_SimpleDC(string n, string ns, global::SerializationTypes.SimpleDC o, bool isNullable, bool needType) { + void Write65_SimpleDC(string n, string ns, global::SerializationTypes.SimpleDC o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3569,7 +3729,7 @@ void Write64_SimpleDC(string n, string ns, global::SerializationTypes.SimpleDC o WriteEndElement(o); } - void Write65_Item(string n, string ns, global::SerializationTypes.TypeWithXmlTextAttributeOnArray o, bool isNullable, bool needType) { + void Write66_Item(string n, string ns, global::SerializationTypes.TypeWithXmlTextAttributeOnArray o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3597,7 +3757,7 @@ void Write65_Item(string n, string ns, global::SerializationTypes.TypeWithXmlTex WriteEndElement(o); } - void Write67_ClassImplementsInterface(string n, string ns, global::SerializationTypes.ClassImplementsInterface o, bool isNullable, bool needType) { + void Write68_ClassImplementsInterface(string n, string ns, global::SerializationTypes.ClassImplementsInterface o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3619,7 +3779,7 @@ void Write67_ClassImplementsInterface(string n, string ns, global::Serialization WriteEndElement(o); } - void Write68_SomeStruct(string n, string ns, global::SerializationTypes.SomeStruct o, bool needType) { + void Write69_SomeStruct(string n, string ns, global::SerializationTypes.SomeStruct o, bool needType) { if (!needType) { System.Type t = o.GetType(); if (t == typeof(global::SerializationTypes.SomeStruct)) { @@ -3635,7 +3795,7 @@ void Write68_SomeStruct(string n, string ns, global::SerializationTypes.SomeStru WriteEndElement(o); } - void Write69_WithStruct(string n, string ns, global::SerializationTypes.WithStruct o, bool isNullable, bool needType) { + void Write70_WithStruct(string n, string ns, global::SerializationTypes.WithStruct o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3650,11 +3810,11 @@ void Write69_WithStruct(string n, string ns, global::SerializationTypes.WithStru } WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"WithStruct", @""); - Write68_SomeStruct(@"Some", @"", ((global::SerializationTypes.SomeStruct)o.@Some), false); + Write69_SomeStruct(@"Some", @"", ((global::SerializationTypes.SomeStruct)o.@Some), false); WriteEndElement(o); } - void Write72_WithEnums(string n, string ns, global::SerializationTypes.WithEnums o, bool isNullable, bool needType) { + void Write73_WithEnums(string n, string ns, global::SerializationTypes.WithEnums o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3669,12 +3829,12 @@ void Write72_WithEnums(string n, string ns, global::SerializationTypes.WithEnums } WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"WithEnums", @""); - WriteElementString(@"Int", @"", Write70_IntEnum(((global::SerializationTypes.IntEnum)o.@Int))); - WriteElementString(@"Short", @"", Write71_ShortEnum(((global::SerializationTypes.ShortEnum)o.@Short))); + WriteElementString(@"Int", @"", Write71_IntEnum(((global::SerializationTypes.IntEnum)o.@Int))); + WriteElementString(@"Short", @"", Write72_ShortEnum(((global::SerializationTypes.ShortEnum)o.@Short))); WriteEndElement(o); } - void Write73_WithNullables(string n, string ns, global::SerializationTypes.WithNullables o, bool isNullable, bool needType) { + void Write74_WithNullables(string n, string ns, global::SerializationTypes.WithNullables o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3690,13 +3850,13 @@ void Write73_WithNullables(string n, string ns, global::SerializationTypes.WithN WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"WithNullables", @""); if (o.@Optional != null) { - WriteElementString(@"Optional", @"", Write70_IntEnum(((global::SerializationTypes.IntEnum)o.@Optional))); + WriteElementString(@"Optional", @"", Write71_IntEnum(((global::SerializationTypes.IntEnum)o.@Optional))); } else { WriteNullTagLiteral(@"Optional", @""); } if (o.@Optionull != null) { - WriteElementString(@"Optionull", @"", Write70_IntEnum(((global::SerializationTypes.IntEnum)o.@Optionull))); + WriteElementString(@"Optionull", @"", Write71_IntEnum(((global::SerializationTypes.IntEnum)o.@Optionull))); } else { WriteNullTagLiteral(@"Optionull", @""); @@ -3714,13 +3874,13 @@ void Write73_WithNullables(string n, string ns, global::SerializationTypes.WithN WriteNullTagLiteral(@"OptionullInt", @""); } if (o.@Struct1 != null) { - Write68_SomeStruct(@"Struct1", @"", ((global::SerializationTypes.SomeStruct)o.@Struct1), false); + Write69_SomeStruct(@"Struct1", @"", ((global::SerializationTypes.SomeStruct)o.@Struct1), false); } else { WriteNullTagLiteral(@"Struct1", @""); } if (o.@Struct2 != null) { - Write68_SomeStruct(@"Struct2", @"", ((global::SerializationTypes.SomeStruct)o.@Struct2), false); + Write69_SomeStruct(@"Struct2", @"", ((global::SerializationTypes.SomeStruct)o.@Struct2), false); } else { WriteNullTagLiteral(@"Struct2", @""); @@ -3728,7 +3888,7 @@ void Write73_WithNullables(string n, string ns, global::SerializationTypes.WithN WriteEndElement(o); } - void Write80_XmlSerializerAttributes(string n, string ns, global::SerializationTypes.XmlSerializerAttributes o, bool isNullable, bool needType) { + void Write81_XmlSerializerAttributes(string n, string ns, global::SerializationTypes.XmlSerializerAttributes o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3767,7 +3927,7 @@ void Write80_XmlSerializerAttributes(string n, string ns, global::SerializationT if (a != null){ WriteStartElement(@"XmlEnumProperty", @"", null, false); for (int ia = 0; ia < a.Length; ia++) { - WriteElementString(@"ItemChoiceType", @"", Write79_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)a[ia]))); + WriteElementString(@"ItemChoiceType", @"", Write80_ItemChoiceType(((global::SerializationTypes.ItemChoiceType)a[ia]))); } WriteEndElement(); } @@ -3790,7 +3950,7 @@ void Write80_XmlSerializerAttributes(string n, string ns, global::SerializationT WriteEndElement(o); } - void Write81_TypeWithAnyAttribute(string n, string ns, global::SerializationTypes.TypeWithAnyAttribute o, bool isNullable, bool needType) { + void Write82_TypeWithAnyAttribute(string n, string ns, global::SerializationTypes.TypeWithAnyAttribute o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3819,7 +3979,7 @@ void Write81_TypeWithAnyAttribute(string n, string ns, global::SerializationType WriteEndElement(o); } - void Write82_KnownTypesThroughConstructor(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructor o, bool isNullable, bool needType) { + void Write83_KnownTypesThroughConstructor(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructor o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3839,7 +3999,7 @@ void Write82_KnownTypesThroughConstructor(string n, string ns, global::Serializa WriteEndElement(o); } - void Write83_SimpleKnownTypeValue(string n, string ns, global::SerializationTypes.SimpleKnownTypeValue o, bool isNullable, bool needType) { + void Write84_SimpleKnownTypeValue(string n, string ns, global::SerializationTypes.SimpleKnownTypeValue o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3858,7 +4018,7 @@ void Write83_SimpleKnownTypeValue(string n, string ns, global::SerializationType WriteEndElement(o); } - void Write84_TypeWithPropertyNameSpecified(string n, string ns, global::SerializationTypes.TypeWithPropertyNameSpecified o, bool isNullable, bool needType) { + void Write85_TypeWithPropertyNameSpecified(string n, string ns, global::SerializationTypes.TypeWithPropertyNameSpecified o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3882,7 +4042,7 @@ void Write84_TypeWithPropertyNameSpecified(string n, string ns, global::Serializ WriteEndElement(o); } - void Write85_TypeWithXmlSchemaFormAttribute(string n, string ns, global::SerializationTypes.TypeWithXmlSchemaFormAttribute o, bool isNullable, bool needType) { + void Write86_TypeWithXmlSchemaFormAttribute(string n, string ns, global::SerializationTypes.TypeWithXmlSchemaFormAttribute o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3930,7 +4090,7 @@ void Write85_TypeWithXmlSchemaFormAttribute(string n, string ns, global::Seriali WriteEndElement(o); } - void Write86_Item(string n, string ns, global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute o, bool isNullable, bool needType) { + void Write87_Item(string n, string ns, global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3949,7 +4109,7 @@ void Write86_Item(string n, string ns, global::SerializationTypes.TypeWithTypeNa WriteEndElement(o); } - void Write88_Item(string n, string ns, global::SerializationTypes.TypeWithNonPublicDefaultConstructor o, bool isNullable, bool needType) { + void Write89_Item(string n, string ns, global::SerializationTypes.TypeWithNonPublicDefaultConstructor o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3968,7 +4128,7 @@ void Write88_Item(string n, string ns, global::SerializationTypes.TypeWithNonPub WriteEndElement(o); } - void Write89_ServerSettings(string n, string ns, global::SerializationTypes.ServerSettings o, bool isNullable, bool needType) { + void Write90_ServerSettings(string n, string ns, global::SerializationTypes.ServerSettings o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -3988,7 +4148,7 @@ void Write89_ServerSettings(string n, string ns, global::SerializationTypes.Serv WriteEndElement(o); } - void Write90_TypeWithXmlQualifiedName(string n, string ns, global::SerializationTypes.TypeWithXmlQualifiedName o, bool isNullable, bool needType) { + void Write91_TypeWithXmlQualifiedName(string n, string ns, global::SerializationTypes.TypeWithXmlQualifiedName o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4007,7 +4167,7 @@ void Write90_TypeWithXmlQualifiedName(string n, string ns, global::Serialization WriteEndElement(o); } - void Write91_TypeWith2DArrayProperty2(string n, string ns, global::SerializationTypes.TypeWith2DArrayProperty2 o, bool isNullable, bool needType) { + void Write92_TypeWith2DArrayProperty2(string n, string ns, global::SerializationTypes.TypeWith2DArrayProperty2 o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4044,7 +4204,7 @@ void Write91_TypeWith2DArrayProperty2(string n, string ns, global::Serialization WriteEndElement(o); } - void Write92_Item(string n, string ns, global::SerializationTypes.TypeWithPropertiesHavingDefaultValue o, bool isNullable, bool needType) { + void Write93_Item(string n, string ns, global::SerializationTypes.TypeWithPropertiesHavingDefaultValue o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4072,7 +4232,7 @@ void Write92_Item(string n, string ns, global::SerializationTypes.TypeWithProper WriteEndElement(o); } - void Write93_Item(string n, string ns, global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue o, bool isNullable, bool needType) { + void Write94_Item(string n, string ns, global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4088,12 +4248,12 @@ void Write93_Item(string n, string ns, global::SerializationTypes.TypeWithEnumPr WriteStartElement(n, ns, o, false, null); if (needType) WriteXsiType(@"TypeWithEnumPropertyHavingDefaultValue", @""); if (((global::SerializationTypes.IntEnum)o.@EnumProperty) != global::SerializationTypes.IntEnum.@Option1) { - WriteElementString(@"EnumProperty", @"", Write70_IntEnum(((global::SerializationTypes.IntEnum)o.@EnumProperty))); + WriteElementString(@"EnumProperty", @"", Write71_IntEnum(((global::SerializationTypes.IntEnum)o.@EnumProperty))); } WriteEndElement(o); } - void Write94_Item(string n, string ns, global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue o, bool isNullable, bool needType) { + void Write95_Item(string n, string ns, global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4110,12 +4270,12 @@ void Write94_Item(string n, string ns, global::SerializationTypes.TypeWithEnumFl if (needType) WriteXsiType(@"TypeWithEnumFlagPropertyHavingDefaultValue", @""); if (((global::SerializationTypes.EnumFlags)o.@EnumProperty) != (global::SerializationTypes.EnumFlags.@One | global::SerializationTypes.EnumFlags.@Four)) { - WriteElementString(@"EnumProperty", @"", Write66_EnumFlags(((global::SerializationTypes.EnumFlags)o.@EnumProperty))); + WriteElementString(@"EnumProperty", @"", Write67_EnumFlags(((global::SerializationTypes.EnumFlags)o.@EnumProperty))); } WriteEndElement(o); } - void Write95_TypeWithShouldSerializeMethod(string n, string ns, global::SerializationTypes.TypeWithShouldSerializeMethod o, bool isNullable, bool needType) { + void Write96_TypeWithShouldSerializeMethod(string n, string ns, global::SerializationTypes.TypeWithShouldSerializeMethod o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4136,7 +4296,7 @@ void Write95_TypeWithShouldSerializeMethod(string n, string ns, global::Serializ WriteEndElement(o); } - void Write96_Item(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties o, bool isNullable, bool needType) { + void Write97_Item(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4156,7 +4316,7 @@ void Write96_Item(string n, string ns, global::SerializationTypes.KnownTypesThro WriteEndElement(o); } - void Write97_Item(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructorWithValue o, bool isNullable, bool needType) { + void Write98_Item(string n, string ns, global::SerializationTypes.KnownTypesThroughConstructorWithValue o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4175,7 +4335,7 @@ void Write97_Item(string n, string ns, global::SerializationTypes.KnownTypesThro WriteEndElement(o); } - void Write98_Item(string n, string ns, global::SerializationTypes.TypeWithTypesHavingCustomFormatter o, bool isNullable, bool needType) { + void Write99_Item(string n, string ns, global::SerializationTypes.TypeWithTypesHavingCustomFormatter o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4202,7 +4362,7 @@ void Write98_Item(string n, string ns, global::SerializationTypes.TypeWithTypesH WriteEndElement(o); } - void Write100_Item(string n, string ns, global::SerializationTypes.TypeWithArrayPropertyHavingChoice o, bool isNullable, bool needType) { + void Write101_Item(string n, string ns, global::SerializationTypes.TypeWithArrayPropertyHavingChoice o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4245,7 +4405,92 @@ void Write100_Item(string n, string ns, global::SerializationTypes.TypeWithArray WriteEndElement(o); } - void Write101_TypeWithFieldsOrdered(string n, string ns, global::SerializationTypes.TypeWithFieldsOrdered o, bool isNullable, bool needType) { + void Write102_ComplexChoiceB(string n, string ns, global::SerializationTypes.ComplexChoiceB o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::SerializationTypes.ComplexChoiceB)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"ComplexChoiceB", @""); + WriteElementString(@"Name", @"", ((global::System.String)o.@Name)); + WriteEndElement(o); + } + + void Write103_ComplexChoiceA(string n, string ns, global::SerializationTypes.ComplexChoiceA o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::SerializationTypes.ComplexChoiceA)) { + } + else { + if (t == typeof(global::SerializationTypes.ComplexChoiceB)) { + Write102_ComplexChoiceB(n, ns,(global::SerializationTypes.ComplexChoiceB)o, isNullable, true); + return; + } + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"ComplexChoiceA", @""); + WriteElementString(@"Name", @"", ((global::System.String)o.@Name)); + WriteEndElement(o); + } + + void Write104_Item(string n, string ns, global::SerializationTypes.TypeWithPropertyHavingComplexChoice o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::SerializationTypes.TypeWithPropertyHavingComplexChoice)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(@"TypeWithPropertyHavingComplexChoice", @""); + { + global::System.Object[] a = (global::System.Object[])o.@ManyChoices; + if (a != null) { + global::SerializationTypes.MoreChoices[] c = (global::SerializationTypes.MoreChoices[])o.@ChoiceArray; + if (c == null || c.Length < a.Length) { + throw CreateInvalidChoiceIdentifierValueException(@"SerializationTypes.MoreChoices", @"ChoiceArray");} + for (int ia = 0; ia < a.Length; ia++) { + global::System.Object ai = (global::System.Object)a[ia]; + global::SerializationTypes.MoreChoices ci = (global::SerializationTypes.MoreChoices)c[ia]; + { + if (ci == SerializationTypes.MoreChoices.@Amount && ((object)(ai) != null)) { + if (((object)ai) != null && !(ai is global::System.Int32)) throw CreateMismatchChoiceException(@"System.Int32", @"ChoiceArray", @"SerializationTypes.MoreChoices.@Amount"); + WriteElementStringRaw(@"Amount", @"", System.Xml.XmlConvert.ToString((global::System.Int32)((global::System.Int32)ai))); + } + else if (ci == SerializationTypes.MoreChoices.@Item && ((object)(ai) != null)) { + if (((object)ai) != null && !(ai is global::SerializationTypes.ComplexChoiceA)) throw CreateMismatchChoiceException(@"SerializationTypes.ComplexChoiceA", @"ChoiceArray", @"SerializationTypes.MoreChoices.@Item"); + Write103_ComplexChoiceA(@"Item", @"", ((global::SerializationTypes.ComplexChoiceA)ai), false, false); + } + else if ((object)(ai) != null){ + throw CreateUnknownTypeException(ai); + } + } + } + } + } + WriteEndElement(o); + } + + void Write105_TypeWithFieldsOrdered(string n, string ns, global::SerializationTypes.TypeWithFieldsOrdered o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4267,7 +4512,7 @@ void Write101_TypeWithFieldsOrdered(string n, string ns, global::SerializationTy WriteEndElement(o); } - void Write87_Item(string n, string ns, global::SerializationTypes.TypeWithSchemaFormInXmlAttribute o, bool isNullable, bool needType) { + void Write88_Item(string n, string ns, global::SerializationTypes.TypeWithSchemaFormInXmlAttribute o, bool isNullable, bool needType) { if ((object)o == null) { if (isNullable) WriteNullTagLiteral(n, ns); return; @@ -4292,7 +4537,7 @@ protected override void InitCallbacks() { public class XmlSerializationReader1 : System.Xml.Serialization.XmlSerializationReader { - public object Read111_TypeWithXmlElementProperty() { + public object Read115_TypeWithXmlElementProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4310,7 +4555,7 @@ public object Read111_TypeWithXmlElementProperty() { return (object)o; } - public object Read112_TypeWithXmlDocumentProperty() { + public object Read116_TypeWithXmlDocumentProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4328,7 +4573,7 @@ public object Read112_TypeWithXmlDocumentProperty() { return (object)o; } - public object Read113_TypeWithBinaryProperty() { + public object Read117_TypeWithBinaryProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4346,7 +4591,7 @@ public object Read113_TypeWithBinaryProperty() { return (object)o; } - public object Read114_Item() { + public object Read118_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4364,7 +4609,7 @@ public object Read114_Item() { return (object)o; } - public object Read115_TypeWithTimeSpanProperty() { + public object Read119_TypeWithTimeSpanProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4382,7 +4627,7 @@ public object Read115_TypeWithTimeSpanProperty() { return (object)o; } - public object Read116_Item() { + public object Read120_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4400,7 +4645,7 @@ public object Read116_Item() { return (object)o; } - public object Read117_TypeWithByteProperty() { + public object Read121_TypeWithByteProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4418,7 +4663,7 @@ public object Read117_TypeWithByteProperty() { return (object)o; } - public object Read118_TypeWithXmlNodeArrayProperty() { + public object Read122_TypeWithXmlNodeArrayProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4436,7 +4681,7 @@ public object Read118_TypeWithXmlNodeArrayProperty() { return (object)o; } - public object Read119_Animal() { + public object Read123_Animal() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4454,7 +4699,7 @@ public object Read119_Animal() { return (object)o; } - public object Read120_Dog() { + public object Read124_Dog() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4472,7 +4717,7 @@ public object Read120_Dog() { return (object)o; } - public object Read121_DogBreed() { + public object Read125_DogBreed() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4492,7 +4737,7 @@ public object Read121_DogBreed() { return (object)o; } - public object Read122_Group() { + public object Read126_Group() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4510,7 +4755,7 @@ public object Read122_Group() { return (object)o; } - public object Read123_Vehicle() { + public object Read127_Vehicle() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4528,7 +4773,7 @@ public object Read123_Vehicle() { return (object)o; } - public object Read124_Employee() { + public object Read128_Employee() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4546,7 +4791,7 @@ public object Read124_Employee() { return (object)o; } - public object Read125_BaseClass() { + public object Read129_BaseClass() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4564,7 +4809,7 @@ public object Read125_BaseClass() { return (object)o; } - public object Read126_DerivedClass() { + public object Read130_DerivedClass() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4582,7 +4827,7 @@ public object Read126_DerivedClass() { return (object)o; } - public object Read127_PurchaseOrder() { + public object Read131_PurchaseOrder() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4600,7 +4845,7 @@ public object Read127_PurchaseOrder() { return (object)o; } - public object Read128_Address() { + public object Read132_Address() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4618,7 +4863,7 @@ public object Read128_Address() { return (object)o; } - public object Read129_OrderedItem() { + public object Read133_OrderedItem() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4636,7 +4881,7 @@ public object Read129_OrderedItem() { return (object)o; } - public object Read130_AliasedTestType() { + public object Read134_AliasedTestType() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4654,7 +4899,7 @@ public object Read130_AliasedTestType() { return (object)o; } - public object Read131_BaseClass1() { + public object Read135_BaseClass1() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4672,7 +4917,7 @@ public object Read131_BaseClass1() { return (object)o; } - public object Read132_DerivedClass1() { + public object Read136_DerivedClass1() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4690,7 +4935,7 @@ public object Read132_DerivedClass1() { return (object)o; } - public object Read133_ArrayOfDateTime() { + public object Read137_ArrayOfDateTime() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4740,7 +4985,7 @@ public object Read133_ArrayOfDateTime() { return (object)o; } - public object Read134_Orchestra() { + public object Read138_Orchestra() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4758,7 +5003,7 @@ public object Read134_Orchestra() { return (object)o; } - public object Read135_Instrument() { + public object Read139_Instrument() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4776,7 +5021,7 @@ public object Read135_Instrument() { return (object)o; } - public object Read136_Brass() { + public object Read140_Brass() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4794,7 +5039,7 @@ public object Read136_Brass() { return (object)o; } - public object Read137_Trumpet() { + public object Read141_Trumpet() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4812,7 +5057,7 @@ public object Read137_Trumpet() { return (object)o; } - public object Read138_Pet() { + public object Read142_Pet() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4830,7 +5075,7 @@ public object Read138_Pet() { return (object)o; } - public object Read139_DefaultValuesSetToNaN() { + public object Read143_DefaultValuesSetToNaN() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4848,7 +5093,7 @@ public object Read139_DefaultValuesSetToNaN() { return (object)o; } - public object Read140_Item() { + public object Read144_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4866,7 +5111,7 @@ public object Read140_Item() { return (object)o; } - public object Read141_Item() { + public object Read145_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4884,7 +5129,7 @@ public object Read141_Item() { return (object)o; } - public object Read142_RootElement() { + public object Read146_RootElement() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4902,7 +5147,7 @@ public object Read142_RootElement() { return (object)o; } - public object Read143_TypeWithLinkedProperty() { + public object Read147_TypeWithLinkedProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4920,7 +5165,7 @@ public object Read143_TypeWithLinkedProperty() { return (object)o; } - public object Read144_Document() { + public object Read148_Document() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4938,7 +5183,7 @@ public object Read144_Document() { return (object)o; } - public object Read145_RootClass() { + public object Read149_RootClass() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4956,7 +5201,7 @@ public object Read145_RootClass() { return (object)o; } - public object Read146_Parameter() { + public object Read150_Parameter() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4974,7 +5219,7 @@ public object Read146_Parameter() { return (object)o; } - public object Read147_XElementWrapper() { + public object Read151_XElementWrapper() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -4992,7 +5237,7 @@ public object Read147_XElementWrapper() { return (object)o; } - public object Read148_XElementStruct() { + public object Read152_XElementStruct() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5010,7 +5255,7 @@ public object Read148_XElementStruct() { return (object)o; } - public object Read149_XElementArrayWrapper() { + public object Read153_XElementArrayWrapper() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5028,7 +5273,7 @@ public object Read149_XElementArrayWrapper() { return (object)o; } - public object Read150_TypeWithDateTimeStringProperty() { + public object Read154_TypeWithDateTimeStringProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5046,7 +5291,7 @@ public object Read150_TypeWithDateTimeStringProperty() { return (object)o; } - public object Read151_SimpleType() { + public object Read155_SimpleType() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5064,7 +5309,7 @@ public object Read151_SimpleType() { return (object)o; } - public object Read152_TypeWithGetSetArrayMembers() { + public object Read156_TypeWithGetSetArrayMembers() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5082,7 +5327,7 @@ public object Read152_TypeWithGetSetArrayMembers() { return (object)o; } - public object Read153_TypeWithGetOnlyArrayProperties() { + public object Read157_TypeWithGetOnlyArrayProperties() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { @@ -5100,13 +5345,31 @@ public object Read153_TypeWithGetOnlyArrayProperties() { return (object)o; } - public object Read154_StructNotSerializable() { + public object Read158_TypeWithArraylikeMembers() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id48_TypeWithArraylikeMembers && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read48_TypeWithArraylikeMembers(true, true); + break; + } + throw CreateUnknownNodeException(); + } while (false); + } + else { + UnknownNode(null, @":TypeWithArraylikeMembers"); + } + return (object)o; + } + + public object Read159_StructNotSerializable() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id48_StructNotSerializable && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read48_StructNotSerializable(true); + if (((object) Reader.LocalName == (object)id49_StructNotSerializable && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read49_StructNotSerializable(true); break; } throw CreateUnknownNodeException(); @@ -5118,13 +5381,13 @@ public object Read154_StructNotSerializable() { return (object)o; } - public object Read155_TypeWithMyCollectionField() { + public object Read160_TypeWithMyCollectionField() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id49_TypeWithMyCollectionField && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read49_TypeWithMyCollectionField(true, true); + if (((object) Reader.LocalName == (object)id50_TypeWithMyCollectionField && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read50_TypeWithMyCollectionField(true, true); break; } throw CreateUnknownNodeException(); @@ -5136,13 +5399,13 @@ public object Read155_TypeWithMyCollectionField() { return (object)o; } - public object Read156_Item() { + public object Read161_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id50_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read50_Item(true, true); + if (((object) Reader.LocalName == (object)id51_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read51_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5154,12 +5417,12 @@ public object Read156_Item() { return (object)o; } - public object Read157_ArrayOfAnyType() { + public object Read162_ArrayOfAnyType() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id51_ArrayOfAnyType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id52_ArrayOfAnyType && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o) == null) o = new global::SerializationTypes.MyList(); global::SerializationTypes.MyList a_0_0 = (global::SerializationTypes.MyList)o; @@ -5172,7 +5435,7 @@ public object Read157_ArrayOfAnyType() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id52_anyType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id53_anyType && (object) Reader.NamespaceURI == (object)id2_Item)) { if ((object)(a_0_0) == null) Reader.Skip(); else a_0_0.Add(Read1_Object(true, true)); break; } @@ -5202,14 +5465,14 @@ public object Read157_ArrayOfAnyType() { return (object)o; } - public object Read158_MyEnum() { + public object Read163_MyEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id53_MyEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id54_MyEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read51_MyEnum(Reader.ReadElementString()); + o = Read52_MyEnum(Reader.ReadElementString()); } break; } @@ -5222,13 +5485,13 @@ public object Read158_MyEnum() { return (object)o; } - public object Read159_TypeWithEnumMembers() { + public object Read164_TypeWithEnumMembers() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id54_TypeWithEnumMembers && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read52_TypeWithEnumMembers(true, true); + if (((object) Reader.LocalName == (object)id55_TypeWithEnumMembers && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read53_TypeWithEnumMembers(true, true); break; } throw CreateUnknownNodeException(); @@ -5240,13 +5503,13 @@ public object Read159_TypeWithEnumMembers() { return (object)o; } - public object Read160_DCStruct() { + public object Read165_DCStruct() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id55_DCStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read53_DCStruct(true); + if (((object) Reader.LocalName == (object)id56_DCStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read54_DCStruct(true); break; } throw CreateUnknownNodeException(); @@ -5258,13 +5521,13 @@ public object Read160_DCStruct() { return (object)o; } - public object Read161_DCClassWithEnumAndStruct() { + public object Read166_DCClassWithEnumAndStruct() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id56_DCClassWithEnumAndStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read54_DCClassWithEnumAndStruct(true, true); + if (((object) Reader.LocalName == (object)id57_DCClassWithEnumAndStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read55_DCClassWithEnumAndStruct(true, true); break; } throw CreateUnknownNodeException(); @@ -5276,13 +5539,13 @@ public object Read161_DCClassWithEnumAndStruct() { return (object)o; } - public object Read162_BuiltInTypes() { + public object Read167_BuiltInTypes() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id57_BuiltInTypes && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read55_BuiltInTypes(true, true); + if (((object) Reader.LocalName == (object)id58_BuiltInTypes && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read56_BuiltInTypes(true, true); break; } throw CreateUnknownNodeException(); @@ -5294,13 +5557,13 @@ public object Read162_BuiltInTypes() { return (object)o; } - public object Read163_TypeA() { + public object Read168_TypeA() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id58_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read56_TypeA(true, true); + if (((object) Reader.LocalName == (object)id59_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read57_TypeA(true, true); break; } throw CreateUnknownNodeException(); @@ -5312,13 +5575,13 @@ public object Read163_TypeA() { return (object)o; } - public object Read164_TypeB() { + public object Read169_TypeB() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id59_TypeB && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read57_TypeB(true, true); + if (((object) Reader.LocalName == (object)id60_TypeB && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read58_TypeB(true, true); break; } throw CreateUnknownNodeException(); @@ -5330,13 +5593,13 @@ public object Read164_TypeB() { return (object)o; } - public object Read165_TypeHasArrayOfASerializedAsB() { + public object Read170_TypeHasArrayOfASerializedAsB() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id60_TypeHasArrayOfASerializedAsB && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read58_TypeHasArrayOfASerializedAsB(true, true); + if (((object) Reader.LocalName == (object)id61_TypeHasArrayOfASerializedAsB && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read59_TypeHasArrayOfASerializedAsB(true, true); break; } throw CreateUnknownNodeException(); @@ -5348,13 +5611,13 @@ public object Read165_TypeHasArrayOfASerializedAsB() { return (object)o; } - public object Read166_Item() { + public object Read171_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id61_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read59_Item(true, true); + if (((object) Reader.LocalName == (object)id62_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read60_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5366,13 +5629,13 @@ public object Read166_Item() { return (object)o; } - public object Read167_BaseClassWithSamePropertyName() { + public object Read172_BaseClassWithSamePropertyName() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id62_BaseClassWithSamePropertyName && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read60_BaseClassWithSamePropertyName(true, true); + if (((object) Reader.LocalName == (object)id63_BaseClassWithSamePropertyName && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read61_BaseClassWithSamePropertyName(true, true); break; } throw CreateUnknownNodeException(); @@ -5384,13 +5647,13 @@ public object Read167_BaseClassWithSamePropertyName() { return (object)o; } - public object Read168_DerivedClassWithSameProperty() { + public object Read173_DerivedClassWithSameProperty() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id63_DerivedClassWithSameProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read61_DerivedClassWithSameProperty(true, true); + if (((object) Reader.LocalName == (object)id64_DerivedClassWithSameProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read62_DerivedClassWithSameProperty(true, true); break; } throw CreateUnknownNodeException(); @@ -5402,13 +5665,13 @@ public object Read168_DerivedClassWithSameProperty() { return (object)o; } - public object Read169_DerivedClassWithSameProperty2() { + public object Read174_DerivedClassWithSameProperty2() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id64_DerivedClassWithSameProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read62_DerivedClassWithSameProperty2(true, true); + if (((object) Reader.LocalName == (object)id65_DerivedClassWithSameProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read63_DerivedClassWithSameProperty2(true, true); break; } throw CreateUnknownNodeException(); @@ -5420,13 +5683,13 @@ public object Read169_DerivedClassWithSameProperty2() { return (object)o; } - public object Read170_Item() { + public object Read175_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id65_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read63_Item(true, true); + if (((object) Reader.LocalName == (object)id66_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read64_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5438,13 +5701,13 @@ public object Read170_Item() { return (object)o; } - public object Read171_TypeWithByteArrayAsXmlText() { + public object Read176_TypeWithByteArrayAsXmlText() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id66_TypeWithByteArrayAsXmlText && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read64_TypeWithByteArrayAsXmlText(true, true); + if (((object) Reader.LocalName == (object)id67_TypeWithByteArrayAsXmlText && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read65_TypeWithByteArrayAsXmlText(true, true); break; } throw CreateUnknownNodeException(); @@ -5456,13 +5719,13 @@ public object Read171_TypeWithByteArrayAsXmlText() { return (object)o; } - public object Read172_SimpleDC() { + public object Read177_SimpleDC() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id67_SimpleDC && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read65_SimpleDC(true, true); + if (((object) Reader.LocalName == (object)id68_SimpleDC && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read66_SimpleDC(true, true); break; } throw CreateUnknownNodeException(); @@ -5474,13 +5737,13 @@ public object Read172_SimpleDC() { return (object)o; } - public object Read173_Item() { + public object Read178_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id68_Item && (object) Reader.NamespaceURI == (object)id69_Item)) { - o = Read66_Item(false, true); + if (((object) Reader.LocalName == (object)id69_Item && (object) Reader.NamespaceURI == (object)id70_Item)) { + o = Read67_Item(false, true); break; } throw CreateUnknownNodeException(); @@ -5492,14 +5755,14 @@ public object Read173_Item() { return (object)o; } - public object Read174_EnumFlags() { + public object Read179_EnumFlags() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id70_EnumFlags && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id71_EnumFlags && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read67_EnumFlags(Reader.ReadElementString()); + o = Read68_EnumFlags(Reader.ReadElementString()); } break; } @@ -5512,13 +5775,13 @@ public object Read174_EnumFlags() { return (object)o; } - public object Read175_ClassImplementsInterface() { + public object Read180_ClassImplementsInterface() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id71_ClassImplementsInterface && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read68_ClassImplementsInterface(true, true); + if (((object) Reader.LocalName == (object)id72_ClassImplementsInterface && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read69_ClassImplementsInterface(true, true); break; } throw CreateUnknownNodeException(); @@ -5530,13 +5793,13 @@ public object Read175_ClassImplementsInterface() { return (object)o; } - public object Read176_WithStruct() { + public object Read181_WithStruct() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id72_WithStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read70_WithStruct(true, true); + if (((object) Reader.LocalName == (object)id73_WithStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read71_WithStruct(true, true); break; } throw CreateUnknownNodeException(); @@ -5548,13 +5811,13 @@ public object Read176_WithStruct() { return (object)o; } - public object Read177_SomeStruct() { + public object Read182_SomeStruct() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id73_SomeStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read69_SomeStruct(true); + if (((object) Reader.LocalName == (object)id74_SomeStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read70_SomeStruct(true); break; } throw CreateUnknownNodeException(); @@ -5566,13 +5829,13 @@ public object Read177_SomeStruct() { return (object)o; } - public object Read178_WithEnums() { + public object Read183_WithEnums() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id74_WithEnums && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read73_WithEnums(true, true); + if (((object) Reader.LocalName == (object)id75_WithEnums && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read74_WithEnums(true, true); break; } throw CreateUnknownNodeException(); @@ -5584,13 +5847,13 @@ public object Read178_WithEnums() { return (object)o; } - public object Read179_WithNullables() { + public object Read184_WithNullables() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id75_WithNullables && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read77_WithNullables(true, true); + if (((object) Reader.LocalName == (object)id76_WithNullables && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read78_WithNullables(true, true); break; } throw CreateUnknownNodeException(); @@ -5602,14 +5865,14 @@ public object Read179_WithNullables() { return (object)o; } - public object Read180_ByteEnum() { + public object Read185_ByteEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id76_ByteEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id77_ByteEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read78_ByteEnum(Reader.ReadElementString()); + o = Read79_ByteEnum(Reader.ReadElementString()); } break; } @@ -5622,14 +5885,14 @@ public object Read180_ByteEnum() { return (object)o; } - public object Read181_SByteEnum() { + public object Read186_SByteEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id77_SByteEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id78_SByteEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read79_SByteEnum(Reader.ReadElementString()); + o = Read80_SByteEnum(Reader.ReadElementString()); } break; } @@ -5642,14 +5905,14 @@ public object Read181_SByteEnum() { return (object)o; } - public object Read182_ShortEnum() { + public object Read187_ShortEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id78_ShortEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id79_ShortEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read72_ShortEnum(Reader.ReadElementString()); + o = Read73_ShortEnum(Reader.ReadElementString()); } break; } @@ -5662,14 +5925,14 @@ public object Read182_ShortEnum() { return (object)o; } - public object Read183_IntEnum() { + public object Read188_IntEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id79_IntEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id80_IntEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read71_IntEnum(Reader.ReadElementString()); + o = Read72_IntEnum(Reader.ReadElementString()); } break; } @@ -5682,14 +5945,14 @@ public object Read183_IntEnum() { return (object)o; } - public object Read184_UIntEnum() { + public object Read189_UIntEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id80_UIntEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id81_UIntEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read80_UIntEnum(Reader.ReadElementString()); + o = Read81_UIntEnum(Reader.ReadElementString()); } break; } @@ -5702,14 +5965,14 @@ public object Read184_UIntEnum() { return (object)o; } - public object Read185_LongEnum() { + public object Read190_LongEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id81_LongEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id82_LongEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read81_LongEnum(Reader.ReadElementString()); + o = Read82_LongEnum(Reader.ReadElementString()); } break; } @@ -5722,14 +5985,14 @@ public object Read185_LongEnum() { return (object)o; } - public object Read186_ULongEnum() { + public object Read191_ULongEnum() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id82_ULongEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id83_ULongEnum && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read82_ULongEnum(Reader.ReadElementString()); + o = Read83_ULongEnum(Reader.ReadElementString()); } break; } @@ -5742,13 +6005,13 @@ public object Read186_ULongEnum() { return (object)o; } - public object Read187_AttributeTesting() { + public object Read192_AttributeTesting() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id83_AttributeTesting && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read84_XmlSerializerAttributes(false, true); + if (((object) Reader.LocalName == (object)id84_AttributeTesting && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read85_XmlSerializerAttributes(false, true); break; } throw CreateUnknownNodeException(); @@ -5760,14 +6023,14 @@ public object Read187_AttributeTesting() { return (object)o; } - public object Read188_ItemChoiceType() { + public object Read193_ItemChoiceType() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id84_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id85_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o = Read83_ItemChoiceType(Reader.ReadElementString()); + o = Read84_ItemChoiceType(Reader.ReadElementString()); } break; } @@ -5780,13 +6043,13 @@ public object Read188_ItemChoiceType() { return (object)o; } - public object Read189_TypeWithAnyAttribute() { + public object Read194_TypeWithAnyAttribute() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id85_TypeWithAnyAttribute && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read85_TypeWithAnyAttribute(true, true); + if (((object) Reader.LocalName == (object)id86_TypeWithAnyAttribute && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read86_TypeWithAnyAttribute(true, true); break; } throw CreateUnknownNodeException(); @@ -5798,13 +6061,13 @@ public object Read189_TypeWithAnyAttribute() { return (object)o; } - public object Read190_KnownTypesThroughConstructor() { + public object Read195_KnownTypesThroughConstructor() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id86_KnownTypesThroughConstructor && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read86_KnownTypesThroughConstructor(true, true); + if (((object) Reader.LocalName == (object)id87_KnownTypesThroughConstructor && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read87_KnownTypesThroughConstructor(true, true); break; } throw CreateUnknownNodeException(); @@ -5816,13 +6079,13 @@ public object Read190_KnownTypesThroughConstructor() { return (object)o; } - public object Read191_SimpleKnownTypeValue() { + public object Read196_SimpleKnownTypeValue() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id87_SimpleKnownTypeValue && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read87_SimpleKnownTypeValue(true, true); + if (((object) Reader.LocalName == (object)id88_SimpleKnownTypeValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read88_SimpleKnownTypeValue(true, true); break; } throw CreateUnknownNodeException(); @@ -5834,12 +6097,12 @@ public object Read191_SimpleKnownTypeValue() { return (object)o; } - public object Read192_Item() { + public object Read197_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id88_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id89_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { o = (global::SerializationTypes.ClassImplementingIXmlSerialiable)ReadSerializable(( System.Xml.Serialization.IXmlSerializable)new global::SerializationTypes.ClassImplementingIXmlSerialiable()); break; } @@ -5852,13 +6115,13 @@ public object Read192_Item() { return (object)o; } - public object Read193_TypeWithPropertyNameSpecified() { + public object Read198_TypeWithPropertyNameSpecified() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id89_TypeWithPropertyNameSpecified && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read88_TypeWithPropertyNameSpecified(true, true); + if (((object) Reader.LocalName == (object)id90_TypeWithPropertyNameSpecified && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read89_TypeWithPropertyNameSpecified(true, true); break; } throw CreateUnknownNodeException(); @@ -5870,13 +6133,13 @@ public object Read193_TypeWithPropertyNameSpecified() { return (object)o; } - public object Read194_TypeWithXmlSchemaFormAttribute() { + public object Read199_TypeWithXmlSchemaFormAttribute() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id90_TypeWithXmlSchemaFormAttribute && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read89_TypeWithXmlSchemaFormAttribute(true, true); + if (((object) Reader.LocalName == (object)id91_TypeWithXmlSchemaFormAttribute && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read90_TypeWithXmlSchemaFormAttribute(true, true); break; } throw CreateUnknownNodeException(); @@ -5888,13 +6151,13 @@ public object Read194_TypeWithXmlSchemaFormAttribute() { return (object)o; } - public object Read195_MyXmlType() { + public object Read200_MyXmlType() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id91_MyXmlType && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read90_Item(true, true); + if (((object) Reader.LocalName == (object)id92_MyXmlType && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read91_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5906,13 +6169,13 @@ public object Read195_MyXmlType() { return (object)o; } - public object Read196_Item() { + public object Read201_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id92_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read91_Item(true, true); + if (((object) Reader.LocalName == (object)id93_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read92_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5924,13 +6187,13 @@ public object Read196_Item() { return (object)o; } - public object Read197_Item() { + public object Read202_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id93_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read92_Item(true, true); + if (((object) Reader.LocalName == (object)id94_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read93_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -5942,13 +6205,13 @@ public object Read197_Item() { return (object)o; } - public object Read198_ServerSettings() { + public object Read203_ServerSettings() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id94_ServerSettings && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read93_ServerSettings(true, true); + if (((object) Reader.LocalName == (object)id95_ServerSettings && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read94_ServerSettings(true, true); break; } throw CreateUnknownNodeException(); @@ -5960,13 +6223,13 @@ public object Read198_ServerSettings() { return (object)o; } - public object Read199_TypeWithXmlQualifiedName() { + public object Read204_TypeWithXmlQualifiedName() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id95_TypeWithXmlQualifiedName && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read94_TypeWithXmlQualifiedName(true, true); + if (((object) Reader.LocalName == (object)id96_TypeWithXmlQualifiedName && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read95_TypeWithXmlQualifiedName(true, true); break; } throw CreateUnknownNodeException(); @@ -5978,13 +6241,13 @@ public object Read199_TypeWithXmlQualifiedName() { return (object)o; } - public object Read200_TypeWith2DArrayProperty2() { + public object Read205_TypeWith2DArrayProperty2() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id96_TypeWith2DArrayProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read95_TypeWith2DArrayProperty2(true, true); + if (((object) Reader.LocalName == (object)id97_TypeWith2DArrayProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read96_TypeWith2DArrayProperty2(true, true); break; } throw CreateUnknownNodeException(); @@ -5996,13 +6259,13 @@ public object Read200_TypeWith2DArrayProperty2() { return (object)o; } - public object Read201_Item() { + public object Read206_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id97_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read96_Item(true, true); + if (((object) Reader.LocalName == (object)id98_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read97_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6014,13 +6277,13 @@ public object Read201_Item() { return (object)o; } - public object Read202_Item() { + public object Read207_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id98_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read97_Item(true, true); + if (((object) Reader.LocalName == (object)id99_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read98_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6032,13 +6295,13 @@ public object Read202_Item() { return (object)o; } - public object Read203_Item() { + public object Read208_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id99_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read98_Item(true, true); + if (((object) Reader.LocalName == (object)id100_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read99_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6050,13 +6313,13 @@ public object Read203_Item() { return (object)o; } - public object Read204_TypeWithShouldSerializeMethod() { + public object Read209_TypeWithShouldSerializeMethod() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id100_TypeWithShouldSerializeMethod && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read99_TypeWithShouldSerializeMethod(true, true); + if (((object) Reader.LocalName == (object)id101_TypeWithShouldSerializeMethod && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read100_TypeWithShouldSerializeMethod(true, true); break; } throw CreateUnknownNodeException(); @@ -6068,13 +6331,13 @@ public object Read204_TypeWithShouldSerializeMethod() { return (object)o; } - public object Read205_Item() { + public object Read210_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id101_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read100_Item(true, true); + if (((object) Reader.LocalName == (object)id102_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read101_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6086,13 +6349,13 @@ public object Read205_Item() { return (object)o; } - public object Read206_Item() { + public object Read211_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id102_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read101_Item(true, true); + if (((object) Reader.LocalName == (object)id103_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read102_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6104,13 +6367,13 @@ public object Read206_Item() { return (object)o; } - public object Read207_Item() { + public object Read212_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id103_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read102_Item(true, true); + if (((object) Reader.LocalName == (object)id104_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read103_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6122,13 +6385,13 @@ public object Read207_Item() { return (object)o; } - public object Read208_Item() { + public object Read213_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id104_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read104_Item(true, true); + if (((object) Reader.LocalName == (object)id105_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read105_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6140,15 +6403,33 @@ public object Read208_Item() { return (object)o; } - public object Read209_MoreChoices() { + public object Read214_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id105_MoreChoices && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o = Read103_MoreChoices(Reader.ReadElementString()); - } + if (((object) Reader.LocalName == (object)id106_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read108_Item(true, true); + break; + } + throw CreateUnknownNodeException(); + } while (false); + } + else { + UnknownNode(null, @":TypeWithPropertyHavingComplexChoice"); + } + return (object)o; + } + + public object Read215_MoreChoices() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id107_MoreChoices && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o = Read104_MoreChoices(Reader.ReadElementString()); + } break; } throw CreateUnknownNodeException(); @@ -6160,13 +6441,49 @@ public object Read209_MoreChoices() { return (object)o; } - public object Read210_TypeWithFieldsOrdered() { + public object Read216_ComplexChoiceA() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id108_ComplexChoiceA && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read107_ComplexChoiceA(true, true); + break; + } + throw CreateUnknownNodeException(); + } while (false); + } + else { + UnknownNode(null, @":ComplexChoiceA"); + } + return (object)o; + } + + public object Read217_ComplexChoiceB() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id109_ComplexChoiceB && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read106_ComplexChoiceB(true, true); + break; + } + throw CreateUnknownNodeException(); + } while (false); + } + else { + UnknownNode(null, @":ComplexChoiceB"); + } + return (object)o; + } + + public object Read218_TypeWithFieldsOrdered() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id106_TypeWithFieldsOrdered && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read105_TypeWithFieldsOrdered(true, true); + if (((object) Reader.LocalName == (object)id110_TypeWithFieldsOrdered && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read109_TypeWithFieldsOrdered(true, true); break; } throw CreateUnknownNodeException(); @@ -6178,13 +6495,13 @@ public object Read210_TypeWithFieldsOrdered() { return (object)o; } - public object Read211_Item() { + public object Read219_Item() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id107_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read106_Item(true, true); + if (((object) Reader.LocalName == (object)id111_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read110_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6196,13 +6513,13 @@ public object Read211_Item() { return (object)o; } - public object Read212_Root() { + public object Read220_Root() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id108_Root && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read109_Item(true, true); + if (((object) Reader.LocalName == (object)id112_Root && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read113_Item(true, true); break; } throw CreateUnknownNodeException(); @@ -6214,13 +6531,13 @@ public object Read212_Root() { return (object)o; } - public object Read213_TypeClashB() { + public object Read221_TypeClashB() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id109_TypeClashB && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read108_TypeNameClash(true, true); + if (((object) Reader.LocalName == (object)id113_TypeClashB && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read112_TypeNameClash(true, true); break; } throw CreateUnknownNodeException(); @@ -6232,13 +6549,13 @@ public object Read213_TypeClashB() { return (object)o; } - public object Read214_TypeClashA() { + public object Read222_TypeClashA() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id110_TypeClashA && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read107_TypeNameClash(true, true); + if (((object) Reader.LocalName == (object)id114_TypeClashA && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read111_TypeNameClash(true, true); break; } throw CreateUnknownNodeException(); @@ -6250,13 +6567,13 @@ public object Read214_TypeClashA() { return (object)o; } - public object Read215_Person() { + public object Read223_Person() { object o = null; Reader.MoveToContent(); if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id111_Person && (object) Reader.NamespaceURI == (object)id2_Item)) { - o = Read110_Person(true, true); + if (((object) Reader.LocalName == (object)id115_Person && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read114_Person(true, true); break; } throw CreateUnknownNodeException(); @@ -6268,12 +6585,12 @@ public object Read215_Person() { return (object)o; } - global::Outer.Person Read110_Person(bool isNullable, bool checkType) { + global::Outer.Person Read114_Person(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id111_Person && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id115_Person && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -6298,21 +6615,21 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id112_FirstName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id116_FirstName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@FirstName = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id113_MiddleName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id117_MiddleName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@MiddleName = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id114_LastName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id118_LastName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@LastName = Reader.ReadElementString(); } @@ -6331,12 +6648,12 @@ public object Read215_Person() { return o; } - global::SerializationTypes.TypeNameClashA.TypeNameClash Read107_TypeNameClash(bool isNullable, bool checkType) { + global::SerializationTypes.TypeNameClashA.TypeNameClash Read111_TypeNameClash(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id110_TypeClashA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id114_TypeClashA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -6361,7 +6678,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -6380,12 +6697,12 @@ public object Read215_Person() { return o; } - global::SerializationTypes.TypeNameClashB.TypeNameClash Read108_TypeNameClash(bool isNullable, bool checkType) { + global::SerializationTypes.TypeNameClashB.TypeNameClash Read112_TypeNameClash(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id109_TypeClashB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id113_TypeClashB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -6410,7 +6727,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -6429,12 +6746,12 @@ public object Read215_Person() { return o; } - global::SerializationTypes.NamespaceTypeNameClashContainer Read109_Item(bool isNullable, bool checkType) { + global::SerializationTypes.NamespaceTypeNameClashContainer Read113_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id116_ContainerType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id120_ContainerType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -6465,12 +6782,12 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id117_A && (object) Reader.NamespaceURI == (object)id2_Item)) { - a_0 = (global::SerializationTypes.TypeNameClashA.TypeNameClash[])EnsureArrayIndex(a_0, ca_0, typeof(global::SerializationTypes.TypeNameClashA.TypeNameClash));a_0[ca_0++] = Read107_TypeNameClash(false, true); + if (((object) Reader.LocalName == (object)id121_A && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_0 = (global::SerializationTypes.TypeNameClashA.TypeNameClash[])EnsureArrayIndex(a_0, ca_0, typeof(global::SerializationTypes.TypeNameClashA.TypeNameClash));a_0[ca_0++] = Read111_TypeNameClash(false, true); break; } - if (((object) Reader.LocalName == (object)id118_B && (object) Reader.NamespaceURI == (object)id2_Item)) { - a_1 = (global::SerializationTypes.TypeNameClashB.TypeNameClash[])EnsureArrayIndex(a_1, ca_1, typeof(global::SerializationTypes.TypeNameClashB.TypeNameClash));a_1[ca_1++] = Read108_TypeNameClash(false, true); + if (((object) Reader.LocalName == (object)id122_B && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_1 = (global::SerializationTypes.TypeNameClashB.TypeNameClash[])EnsureArrayIndex(a_1, ca_1, typeof(global::SerializationTypes.TypeNameClashB.TypeNameClash));a_1[ca_1++] = Read112_TypeNameClash(false, true); break; } UnknownNode((object)o, @":A, :B"); @@ -6487,12 +6804,12 @@ public object Read215_Person() { return o; } - global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName Read106_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName Read110_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id107_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id111_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -6517,12 +6834,12 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Value1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id123_Value1 && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Value1 = Read1_Object(false, true); paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id120_Value2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id124_Value2 && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Value2 = Read1_Object(false, true); paramsRead[1] = true; break; @@ -6552,102 +6869,110 @@ public object Read215_Person() { return ReadTypedPrimitive(new System.Xml.XmlQualifiedName("anyType", "http://www.w3.org/2001/XMLSchema")); } else { - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id111_Person && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read110_Person(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id116_ContainerType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read109_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id109_TypeClashB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read108_TypeNameClash(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id110_TypeClashA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read107_TypeNameClash(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id107_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read106_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id106_TypeWithFieldsOrdered && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read105_TypeWithFieldsOrdered(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id115_Person && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read114_Person(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id120_ContainerType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read113_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id113_TypeClashB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read112_TypeNameClash(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id114_TypeClashA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read111_TypeNameClash(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id111_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read110_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id110_TypeWithFieldsOrdered && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read109_TypeWithFieldsOrdered(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id106_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read108_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id108_ComplexChoiceA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read107_ComplexChoiceA(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id109_ComplexChoiceB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read106_ComplexChoiceB(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id105_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read105_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id104_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read104_Item(isNullable, false); + return Read103_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id103_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read102_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id102_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read101_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id101_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read100_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id100_TypeWithShouldSerializeMethod && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read99_TypeWithShouldSerializeMethod(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id101_TypeWithShouldSerializeMethod && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read100_TypeWithShouldSerializeMethod(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id100_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read99_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id99_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read98_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id98_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read97_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id97_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read96_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id96_TypeWith2DArrayProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read95_TypeWith2DArrayProperty2(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id95_TypeWithXmlQualifiedName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read94_TypeWithXmlQualifiedName(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id94_ServerSettings && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read93_ServerSettings(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id93_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read92_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id91_MyXmlType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read90_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id90_TypeWithXmlSchemaFormAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read89_TypeWithXmlSchemaFormAttribute(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id89_TypeWithPropertyNameSpecified && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read88_TypeWithPropertyNameSpecified(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id87_SimpleKnownTypeValue && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read87_SimpleKnownTypeValue(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id86_KnownTypesThroughConstructor && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read86_KnownTypesThroughConstructor(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id85_TypeWithAnyAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read85_TypeWithAnyAttribute(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id121_XmlSerializerAttributes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read84_XmlSerializerAttributes(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id75_WithNullables && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read77_WithNullables(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id74_WithEnums && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read73_WithEnums(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id72_WithStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read70_WithStruct(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id73_SomeStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read69_SomeStruct(false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id71_ClassImplementsInterface && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read68_ClassImplementsInterface(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id68_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id69_Item)) - return Read66_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id67_SimpleDC && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read65_SimpleDC(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id66_TypeWithByteArrayAsXmlText && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read64_TypeWithByteArrayAsXmlText(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read63_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id62_BaseClassWithSamePropertyName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read60_BaseClassWithSamePropertyName(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id63_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read61_DerivedClassWithSameProperty(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read62_DerivedClassWithSameProperty2(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id61_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read59_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id60_TypeHasArrayOfASerializedAsB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read58_TypeHasArrayOfASerializedAsB(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id59_TypeB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read57_TypeB(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id58_TypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read56_TypeA(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id57_BuiltInTypes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read55_BuiltInTypes(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id56_DCClassWithEnumAndStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read54_DCClassWithEnumAndStruct(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id55_DCStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read53_DCStruct(false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id54_TypeWithEnumMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read52_TypeWithEnumMembers(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id50_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read50_Item(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id49_TypeWithMyCollectionField && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read49_TypeWithMyCollectionField(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id48_StructNotSerializable && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read48_StructNotSerializable(false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id97_TypeWith2DArrayProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read96_TypeWith2DArrayProperty2(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id96_TypeWithXmlQualifiedName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read95_TypeWithXmlQualifiedName(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id95_ServerSettings && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read94_ServerSettings(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id94_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read93_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id92_MyXmlType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read91_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id91_TypeWithXmlSchemaFormAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read90_TypeWithXmlSchemaFormAttribute(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id90_TypeWithPropertyNameSpecified && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read89_TypeWithPropertyNameSpecified(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id88_SimpleKnownTypeValue && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read88_SimpleKnownTypeValue(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id87_KnownTypesThroughConstructor && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read87_KnownTypesThroughConstructor(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id86_TypeWithAnyAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read86_TypeWithAnyAttribute(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id125_XmlSerializerAttributes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read85_XmlSerializerAttributes(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id76_WithNullables && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read78_WithNullables(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id75_WithEnums && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read74_WithEnums(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id73_WithStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read71_WithStruct(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id74_SomeStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read70_SomeStruct(false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id72_ClassImplementsInterface && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read69_ClassImplementsInterface(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id69_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id70_Item)) + return Read67_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id68_SimpleDC && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read66_SimpleDC(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id67_TypeWithByteArrayAsXmlText && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read65_TypeWithByteArrayAsXmlText(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id66_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read64_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id63_BaseClassWithSamePropertyName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read61_BaseClassWithSamePropertyName(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read62_DerivedClassWithSameProperty(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read63_DerivedClassWithSameProperty2(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id62_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read60_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id61_TypeHasArrayOfASerializedAsB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read59_TypeHasArrayOfASerializedAsB(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id60_TypeB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read58_TypeB(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id59_TypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read57_TypeA(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id58_BuiltInTypes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read56_BuiltInTypes(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id57_DCClassWithEnumAndStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read55_DCClassWithEnumAndStruct(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id56_DCStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read54_DCStruct(false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id55_TypeWithEnumMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read53_TypeWithEnumMembers(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id51_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read51_Item(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id50_TypeWithMyCollectionField && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read50_TypeWithMyCollectionField(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id49_StructNotSerializable && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read49_StructNotSerializable(false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id48_TypeWithArraylikeMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read48_TypeWithArraylikeMembers(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id47_TypeWithGetOnlyArrayProperties && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read47_TypeWithGetOnlyArrayProperties(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id46_TypeWithGetSetArrayMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) @@ -6666,13 +6991,13 @@ public object Read215_Person() { return Read40_RootClass(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id40_Parameter && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read39_Parameter(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id122_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id126_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read38_ParameterOfString(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id123_MsgDocumentType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id38_httpexamplecom)) + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id127_MsgDocumentType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id38_httpexamplecom)) return Read37_MsgDocumentType(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id36_TypeWithLinkedProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read36_TypeWithLinkedProperty(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id124_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id128_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read35_Item(isNullable, false); if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id34_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read34_Item(isNullable, false); @@ -6742,7 +7067,7 @@ public object Read215_Person() { ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id125_ArrayOfOrderedItem && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id19_httpwwwcontoso1com)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id129_ArrayOfOrderedItem && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id19_httpwwwcontoso1com)) { global::OrderedItem[] a = null; if (!ReadNull()) { global::OrderedItem[] z_0_0 = null; @@ -6774,7 +7099,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id126_ArrayOfInt && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id130_ArrayOfInt && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -6788,7 +7113,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id127_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { { z_0_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); } @@ -6807,7 +7132,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id128_ArrayOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id132_ArrayOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -6821,7 +7146,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { z_0_0.Add(null); } @@ -6843,7 +7168,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id130_ArrayOfDouble && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id134_ArrayOfDouble && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -6857,7 +7182,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id131_double && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id135_double && (object) Reader.NamespaceURI == (object)id2_Item)) { { z_0_0.Add(System.Xml.XmlConvert.ToDouble(Reader.ReadElementString())); } @@ -6909,7 +7234,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id132_ArrayOfInstrument && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id136_ArrayOfInstrument && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::Instrument[] a = null; if (!ReadNull()) { global::Instrument[] z_0_0 = null; @@ -6941,7 +7266,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id133_ArrayOfTypeWithLinkedProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id137_ArrayOfTypeWithLinkedProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -6972,7 +7297,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id134_ArrayOfParameter && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id138_ArrayOfParameter && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -7003,7 +7328,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id135_ArrayOfXElement && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id139_ArrayOfXElement && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Xml.Linq.XElement[] a = null; if (!ReadNull()) { global::System.Xml.Linq.XElement[] z_0_0 = null; @@ -7017,7 +7342,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id136_XElement && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id140_XElement && (object) Reader.NamespaceURI == (object)id2_Item)) { z_0_0 = (global::System.Xml.Linq.XElement[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::System.Xml.Linq.XElement));z_0_0[cz_0_0++] = (global::System.Xml.Linq.XElement)ReadSerializable(( System.Xml.Serialization.IXmlSerializable)new global::System.Xml.Linq.XElement("default"), true ); break; @@ -7036,7 +7361,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id137_ArrayOfSimpleType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id141_ArrayOfSimpleType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::SerializationTypes.SimpleType[] a = null; if (!ReadNull()) { global::SerializationTypes.SimpleType[] z_0_0 = null; @@ -7068,7 +7393,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id51_ArrayOfAnyType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id52_ArrayOfAnyType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::SerializationTypes.MyList a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::SerializationTypes.MyList(); @@ -7082,7 +7407,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id52_anyType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id53_anyType && (object) Reader.NamespaceURI == (object)id2_Item)) { if ((object)(z_0_0) == null) Reader.Skip(); else z_0_0.Add(Read1_Object(true, true)); break; } @@ -7099,13 +7424,13 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id53_MyEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id54_MyEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read51_MyEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read52_MyEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id138_ArrayOfTypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id142_ArrayOfTypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::SerializationTypes.TypeA[] a = null; if (!ReadNull()) { global::SerializationTypes.TypeA[] z_0_0 = null; @@ -7119,8 +7444,8 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id58_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { - z_0_0 = (global::SerializationTypes.TypeA[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::SerializationTypes.TypeA));z_0_0[cz_0_0++] = Read56_TypeA(true, true); + if (((object) Reader.LocalName == (object)id59_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { + z_0_0 = (global::SerializationTypes.TypeA[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::SerializationTypes.TypeA));z_0_0[cz_0_0++] = Read57_TypeA(true, true); break; } UnknownNode(null, @":TypeA"); @@ -7137,61 +7462,61 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id70_EnumFlags && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id71_EnumFlags && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read67_EnumFlags(CollapseWhitespace(Reader.ReadString())); + object e = Read68_EnumFlags(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id79_IntEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id80_IntEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read71_IntEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read72_IntEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id78_ShortEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id79_ShortEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read72_ShortEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read73_ShortEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id76_ByteEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id77_ByteEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read78_ByteEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read79_ByteEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id77_SByteEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id78_SByteEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read79_SByteEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read80_SByteEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id80_UIntEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id81_UIntEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read80_UIntEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read81_UIntEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id81_LongEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id82_LongEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read81_LongEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read82_LongEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id82_ULongEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id83_ULongEnum && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read82_ULongEnum(CollapseWhitespace(Reader.ReadString())); + object e = Read83_ULongEnum(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id84_ItemChoiceType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id85_ItemChoiceType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read83_ItemChoiceType(CollapseWhitespace(Reader.ReadString())); + object e = Read84_ItemChoiceType(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id139_ArrayOfItemChoiceType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id143_ArrayOfItemChoiceType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::SerializationTypes.ItemChoiceType[] a = null; if (!ReadNull()) { global::SerializationTypes.ItemChoiceType[] z_0_0 = null; @@ -7205,9 +7530,9 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id84_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id85_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { { - z_0_0 = (global::SerializationTypes.ItemChoiceType[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::SerializationTypes.ItemChoiceType));z_0_0[cz_0_0++] = Read83_ItemChoiceType(Reader.ReadElementString()); + z_0_0 = (global::SerializationTypes.ItemChoiceType[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::SerializationTypes.ItemChoiceType));z_0_0[cz_0_0++] = Read84_ItemChoiceType(Reader.ReadElementString()); } break; } @@ -7225,7 +7550,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id128_ArrayOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id140_httpmynamespace)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id132_ArrayOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id144_httpmynamespace)) { global::System.Object[] a = null; if (!ReadNull()) { global::System.Object[] z_0_0 = null; @@ -7239,7 +7564,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id140_httpmynamespace)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id144_httpmynamespace)) { if (ReadNull()) { z_0_0 = (global::System.Object[])EnsureArrayIndex(z_0_0, cz_0_0, typeof(global::System.Object));z_0_0[cz_0_0++] = null; } @@ -7262,7 +7587,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id141_ArrayOfString1 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id145_ArrayOfString1 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -7276,7 +7601,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id142_NoneParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id146_NoneParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { { z_0_0.Add(Reader.ReadElementString()); } @@ -7295,7 +7620,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id143_ArrayOfBoolean && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id147_ArrayOfBoolean && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::System.Collections.Generic.List a = null; if (!ReadNull()) { if ((object)(a) == null) a = new global::System.Collections.Generic.List(); @@ -7309,7 +7634,7 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id144_QualifiedParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id148_QualifiedParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { { z_0_0.Add(System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString())); } @@ -7328,7 +7653,7 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id145_ArrayOfArrayOfSimpleType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id149_ArrayOfArrayOfSimpleType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { global::SerializationTypes.SimpleType[][] a = null; if (!ReadNull()) { global::SerializationTypes.SimpleType[][] z_0_0 = null; @@ -7387,9 +7712,9 @@ public object Read215_Person() { } return a; } - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id105_MoreChoices && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id107_MoreChoices && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { Reader.ReadStartElement(); - object e = Read103_MoreChoices(CollapseWhitespace(Reader.ReadString())); + object e = Read104_MoreChoices(CollapseWhitespace(Reader.ReadString())); ReadEndElement(); return e; } @@ -7425,7 +7750,7 @@ public object Read215_Person() { return o; } - global::SerializationTypes.MoreChoices Read103_MoreChoices(string s) { + global::SerializationTypes.MoreChoices Read104_MoreChoices(string s) { switch (s) { case @"None": return global::SerializationTypes.MoreChoices.@None; case @"Item": return global::SerializationTypes.MoreChoices.@Item; @@ -7464,14 +7789,14 @@ public object Read215_Person() { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id146_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id150_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@P1 = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id147_P2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id151_P2 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@P2 = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -7490,7 +7815,7 @@ public object Read215_Person() { return o; } - global::SerializationTypes.ItemChoiceType Read83_ItemChoiceType(string s) { + global::SerializationTypes.ItemChoiceType Read84_ItemChoiceType(string s) { switch (s) { case @"None": return global::SerializationTypes.ItemChoiceType.@None; case @"Word": return global::SerializationTypes.ItemChoiceType.@Word; @@ -7500,7 +7825,7 @@ public object Read215_Person() { } } - global::SerializationTypes.ULongEnum Read82_ULongEnum(string s) { + global::SerializationTypes.ULongEnum Read83_ULongEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.ULongEnum.@Option0; case @"Option1": return global::SerializationTypes.ULongEnum.@Option1; @@ -7509,7 +7834,7 @@ public object Read215_Person() { } } - global::SerializationTypes.LongEnum Read81_LongEnum(string s) { + global::SerializationTypes.LongEnum Read82_LongEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.LongEnum.@Option0; case @"Option1": return global::SerializationTypes.LongEnum.@Option1; @@ -7518,7 +7843,7 @@ public object Read215_Person() { } } - global::SerializationTypes.UIntEnum Read80_UIntEnum(string s) { + global::SerializationTypes.UIntEnum Read81_UIntEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.UIntEnum.@Option0; case @"Option1": return global::SerializationTypes.UIntEnum.@Option1; @@ -7527,7 +7852,7 @@ public object Read215_Person() { } } - global::SerializationTypes.SByteEnum Read79_SByteEnum(string s) { + global::SerializationTypes.SByteEnum Read80_SByteEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.SByteEnum.@Option0; case @"Option1": return global::SerializationTypes.SByteEnum.@Option1; @@ -7536,7 +7861,7 @@ public object Read215_Person() { } } - global::SerializationTypes.ByteEnum Read78_ByteEnum(string s) { + global::SerializationTypes.ByteEnum Read79_ByteEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.ByteEnum.@Option0; case @"Option1": return global::SerializationTypes.ByteEnum.@Option1; @@ -7545,7 +7870,7 @@ public object Read215_Person() { } } - global::SerializationTypes.ShortEnum Read72_ShortEnum(string s) { + global::SerializationTypes.ShortEnum Read73_ShortEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.ShortEnum.@Option0; case @"Option1": return global::SerializationTypes.ShortEnum.@Option1; @@ -7554,7 +7879,7 @@ public object Read215_Person() { } } - global::SerializationTypes.IntEnum Read71_IntEnum(string s) { + global::SerializationTypes.IntEnum Read72_IntEnum(string s) { switch (s) { case @"Option0": return global::SerializationTypes.IntEnum.@Option0; case @"Option1": return global::SerializationTypes.IntEnum.@Option1; @@ -7579,16 +7904,16 @@ internal System.Collections.Hashtable EnumFlagsValues { } } - global::SerializationTypes.EnumFlags Read67_EnumFlags(string s) { + global::SerializationTypes.EnumFlags Read68_EnumFlags(string s) { return (global::SerializationTypes.EnumFlags)ToEnum(s, EnumFlagsValues, @"global::SerializationTypes.EnumFlags"); } - global::SerializationTypes.TypeA Read56_TypeA(bool isNullable, bool checkType) { + global::SerializationTypes.TypeA Read57_TypeA(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id58_TypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id59_TypeA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -7613,7 +7938,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -7632,7 +7957,7 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.MyEnum Read51_MyEnum(string s) { + global::SerializationTypes.MyEnum Read52_MyEnum(string s) { switch (s) { case @"One": return global::SerializationTypes.MyEnum.@One; case @"Two": return global::SerializationTypes.MyEnum.@Two; @@ -7649,7 +7974,7 @@ internal System.Collections.Hashtable EnumFlagsValues { if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id40_Parameter && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id122_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id126_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) return Read38_ParameterOfString(isNullable, false); throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } @@ -7659,7 +7984,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::Parameter(); System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Name = Reader.Value; paramsRead[0] = true; } @@ -7692,7 +8017,7 @@ internal System.Collections.Hashtable EnumFlagsValues { bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id122_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id126_ParameterOfString && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -7703,7 +8028,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::Parameter(); System.Span paramsRead = stackalloc bool[2]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Name = Reader.Value; paramsRead[0] = true; } @@ -7721,7 +8046,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Value = Reader.ReadElementString(); } @@ -7772,12 +8097,12 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id149_Child && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id153_Child && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Child = Read36_TypeWithLinkedProperty(false, true); paramsRead[0] = true; break; } - if (((object) Reader.LocalName == (object)id150_Children && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id154_Children && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@Children) == null) o.@Children = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_1_0 = (global::System.Collections.Generic.List)o.@Children; @@ -7853,7 +8178,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -7902,21 +8227,21 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id151_IsValved && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id155_IsValved && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IsValved = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString()); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id152_Modulation && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id156_Modulation && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Modulation = ToChar(Reader.ReadElementString()); } @@ -7967,14 +8292,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id151_IsValved && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id155_IsValved && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IsValved = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString()); } @@ -8023,35 +8348,35 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id153_ItemName && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id157_ItemName && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@ItemName = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id154_Description && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id158_Description && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@Description = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id155_UnitPrice && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id159_UnitPrice && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@UnitPrice = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id156_Quantity && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id160_Quantity && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@Quantity = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id157_LineTotal && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id161_LineTotal && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@LineTotal = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } @@ -8199,14 +8524,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id158_BinaryHexContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id162_BinaryHexContent && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@BinaryHexContent = ToByteArrayHex(false); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id159_Base64Content && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id163_Base64Content && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Base64Content = ToByteArrayBase64(false); } @@ -8255,7 +8580,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id160_DTO && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id164_DTO && (object) Reader.NamespaceURI == (object)id2_Item)) { { if (Reader.IsEmptyElement) { Reader.Skip(); @@ -8268,7 +8593,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id161_DTO2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id165_DTO2 && (object) Reader.NamespaceURI == (object)id2_Item)) { { if (Reader.IsEmptyElement) { Reader.Skip(); @@ -8281,7 +8606,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id162_DefaultDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id166_DefaultDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -8297,12 +8622,12 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id163_NullableDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id167_NullableDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@NullableDTO = Read5_NullableOfDateTimeOffset(true); paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id164_NullableDefaultDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id168_NullableDefaultDTO && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@NullableDTOWithDefault = Read5_NullableOfDateTimeOffset(true); paramsRead[4] = true; break; @@ -8365,7 +8690,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id165_TimeSpanProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id169_TimeSpanProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { if (Reader.IsEmptyElement) { Reader.Skip(); @@ -8420,7 +8745,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id165_TimeSpanProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id169_TimeSpanProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -8436,7 +8761,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id166_TimeSpanProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id170_TimeSpanProperty2 && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -8494,7 +8819,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id167_ByteProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id171_ByteProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@ByteProperty = System.Xml.XmlConvert.ToByte(Reader.ReadElementString()); } @@ -8594,21 +8919,21 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id168_Age && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id172_Age && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Age = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id169_Breed && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id173_Breed && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Breed = Read12_DogBreed(Reader.ReadElementString()); } @@ -8659,14 +8984,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id168_Age && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id172_Age && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Age = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -8715,7 +9040,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id170_LicenseNumber && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id174_LicenseNumber && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@LicenseNumber = Reader.ReadElementString(); } @@ -8764,14 +9089,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id171_GroupName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id175_GroupName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@GroupName = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id172_GroupVehicle && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id176_GroupVehicle && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@GroupVehicle = Read14_Vehicle(false, true); paramsRead[1] = true; break; @@ -8818,7 +9143,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id173_EmployeeName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id177_EmployeeName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@EmployeeName = Reader.ReadElementString(); } @@ -8867,14 +9192,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Value = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id174_value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id178_value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@value = Reader.ReadElementString(); } @@ -8925,14 +9250,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Value = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id174_value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id178_value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@value = Reader.ReadElementString(); } @@ -8967,7 +9292,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::Address(); System.Span paramsRead = stackalloc bool[5]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Name = Reader.Value; paramsRead[0] = true; } @@ -8985,28 +9310,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id175_Line1 && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id179_Line1 && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@Line1 = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id176_City && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id180_City && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@City = Reader.ReadElementString(); } paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id177_State && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id181_State && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@State = Reader.ReadElementString(); } paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id178_Zip && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id182_Zip && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@Zip = Reader.ReadElementString(); } @@ -9057,19 +9382,19 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id179_ShipTo && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id183_ShipTo && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { o.@ShipTo = Read19_Address(false, true); paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id180_OrderDate && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id184_OrderDate && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@OrderDate = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (((object) Reader.LocalName == (object)id181_Items && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (((object) Reader.LocalName == (object)id185_Items && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { if (!ReadNull()) { global::OrderedItem[] a_2_0 = null; int ca_2_0 = 0; @@ -9100,21 +9425,21 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id182_SubTotal && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id186_SubTotal && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@SubTotal = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id183_ShipCost && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id187_ShipCost && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@ShipCost = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } paramsRead[4] = true; break; } - if (!paramsRead[5] && ((object) Reader.LocalName == (object)id184_TotalCost && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { + if (!paramsRead[5] && ((object) Reader.LocalName == (object)id188_TotalCost && (object) Reader.NamespaceURI == (object)id19_httpwwwcontoso1com)) { { o.@TotalCost = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } @@ -9149,7 +9474,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::Address(); System.Span paramsRead = stackalloc bool[5]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Name = Reader.Value; paramsRead[0] = true; } @@ -9167,28 +9492,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id175_Line1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id179_Line1 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Line1 = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id176_City && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id180_City && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@City = Reader.ReadElementString(); } paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id177_State && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id181_State && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@State = Reader.ReadElementString(); } paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id178_Zip && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id182_Zip && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Zip = Reader.ReadElementString(); } @@ -9237,35 +9562,35 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id153_ItemName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id157_ItemName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@ItemName = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id154_Description && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id158_Description && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Description = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id155_UnitPrice && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id159_UnitPrice && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@UnitPrice = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id156_Quantity && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id160_Quantity && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Quantity = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id157_LineTotal && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id161_LineTotal && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@LineTotal = System.Xml.XmlConvert.ToDecimal(Reader.ReadElementString()); } @@ -9314,7 +9639,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id185_X && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id189_X && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@Aliased) == null) o.@Aliased = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List)o.@Aliased; @@ -9327,7 +9652,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id127_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); } @@ -9347,7 +9672,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id186_Y && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id190_Y && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@Aliased) == null) o.@Aliased = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List)o.@Aliased; @@ -9360,7 +9685,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { a_0_0.Add(null); } @@ -9383,7 +9708,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id187_Z && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id191_Z && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@Aliased) == null) o.@Aliased = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List)o.@Aliased; @@ -9396,7 +9721,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id131_double && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id135_double && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0_0.Add(System.Xml.XmlConvert.ToDouble(Reader.ReadElementString())); } @@ -9460,7 +9785,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id188_Prop && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id192_Prop && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0.Add(ToDateTime(Reader.ReadElementString())); } @@ -9512,7 +9837,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id188_Prop && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id192_Prop && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0.Add(ToDateTime(Reader.ReadElementString())); } @@ -9562,7 +9887,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id189_Instruments && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id193_Instruments && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::Instrument[] a_0_0 = null; int ca_0_0 = 0; @@ -9642,7 +9967,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id190_Comment2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id194_Comment2 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Comment2 = Reader.ReadElementString(); } @@ -9691,7 +10016,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id191_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id195_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9701,7 +10026,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id192_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id196_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9711,7 +10036,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id193_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id197_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9721,7 +10046,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id194_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id198_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9773,7 +10098,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id191_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id195_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9783,7 +10108,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id192_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id196_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9793,7 +10118,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id193_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id197_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9803,7 +10128,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id194_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id198_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9855,7 +10180,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id191_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id195_DoubleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9865,7 +10190,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id192_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id196_SingleField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9875,7 +10200,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id193_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id197_DoubleProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9885,7 +10210,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id194_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id198_FloatProp && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -9912,7 +10237,7 @@ internal System.Collections.Hashtable EnumFlagsValues { bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id124_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id128_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -9923,7 +10248,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::TypeWithMismatchBetweenAttributeAndPropertyType(); System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id195_IntValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id199_IntValue && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@IntValue = System.Xml.XmlConvert.ToInt32(Reader.Value); paramsRead[0] = true; } @@ -9956,7 +10281,7 @@ internal System.Collections.Hashtable EnumFlagsValues { bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id123_MsgDocumentType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id38_httpexamplecom)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id127_MsgDocumentType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id38_httpexamplecom)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -9969,11 +10294,11 @@ internal System.Collections.Hashtable EnumFlagsValues { int ca_1 = 0; System.Span paramsRead = stackalloc bool[2]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id196_id && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id200_id && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Id = CollapseWhitespace(Reader.Value); paramsRead[0] = true; } - else if (((object) Reader.LocalName == (object)id197_refs && (object) Reader.NamespaceURI == (object)id2_Item)) { + else if (((object) Reader.LocalName == (object)id201_refs && (object) Reader.NamespaceURI == (object)id2_Item)) { string listValues = Reader.Value; string[] vals = listValues.Split(null); for (int i = 0; i < vals.Length; i++) { @@ -10038,7 +10363,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id198_Parameters && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id202_Parameters && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@Parameters) == null) o.@Parameters = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List)o.@Parameters; @@ -10110,7 +10435,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@Value = (global::System.Xml.Linq.XElement)ReadSerializable(( System.Xml.Serialization.IXmlSerializable)new global::System.Xml.Linq.XElement("default"), true ); paramsRead[0] = true; @@ -10164,7 +10489,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id199_xelement && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id203_xelement && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@xelement = (global::System.Xml.Linq.XElement)ReadSerializable(( System.Xml.Serialization.IXmlSerializable)new global::System.Xml.Linq.XElement("default"), true ); paramsRead[0] = true; @@ -10214,7 +10539,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id200_xelements && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id204_xelements && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::System.Xml.Linq.XElement[] a_0_0 = null; int ca_0_0 = 0; @@ -10227,7 +10552,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id136_XElement && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id140_XElement && (object) Reader.NamespaceURI == (object)id2_Item)) { a_0_0 = (global::System.Xml.Linq.XElement[])EnsureArrayIndex(a_0_0, ca_0_0, typeof(global::System.Xml.Linq.XElement));a_0_0[ca_0_0++] = (global::System.Xml.Linq.XElement)ReadSerializable(( System.Xml.Serialization.IXmlSerializable)new global::System.Xml.Linq.XElement("default"), true ); break; @@ -10288,14 +10613,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id201_DateTimeString && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id205_DateTimeString && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DateTimeString = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id202_CurrentDateTime && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id206_CurrentDateTime && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@CurrentDateTime = ToDateTime(Reader.ReadElementString()); } @@ -10352,7 +10677,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id203_F1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id207_F1 && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::SerializationTypes.SimpleType[] a_0_0 = null; int ca_0_0 = 0; @@ -10383,7 +10708,7 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (((object) Reader.LocalName == (object)id204_F2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id208_F2 && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::System.Int32[] a_1_0 = null; int ca_1_0 = 0; @@ -10396,7 +10721,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id127_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_1_0 = (global::System.Int32[])EnsureArrayIndex(a_1_0, ca_1_0, typeof(global::System.Int32));a_1_0[ca_1_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -10416,7 +10741,7 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (((object) Reader.LocalName == (object)id146_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id150_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::SerializationTypes.SimpleType[] a_2_0 = null; int ca_2_0 = 0; @@ -10447,7 +10772,7 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (((object) Reader.LocalName == (object)id147_P2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id151_P2 && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::System.Int32[] a_3_0 = null; int ca_3_0 = 0; @@ -10460,7 +10785,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id127_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_3_0 = (global::System.Int32[])EnsureArrayIndex(a_3_0, ca_3_0, typeof(global::System.Int32));a_3_0[ca_3_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -10532,78 +10857,37 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.StructNotSerializable Read48_StructNotSerializable(bool checkType) { - System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; - bool isNull = false; - if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id48_StructNotSerializable && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { - } - else { - throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); - } - } - global::SerializationTypes.StructNotSerializable o; - try { - o = (global::SerializationTypes.StructNotSerializable)System.Activator.CreateInstance(typeof(global::SerializationTypes.StructNotSerializable), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.CreateInstance | System.Reflection.BindingFlags.NonPublic, null, new object[0], null); - } - catch (System.MissingMethodException) { - throw CreateInaccessibleConstructorException(@"global::SerializationTypes.StructNotSerializable"); - } - catch (System.Security.SecurityException) { - throw CreateCtorHasSecurityException(@"global::SerializationTypes.StructNotSerializable"); - } - System.Span paramsRead = stackalloc bool[1]; - while (Reader.MoveToNextAttribute()) { - if (!IsXmlnsAttribute(Reader.Name)) { - UnknownNode((object)o); - } - } - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip(); - return o; - } - Reader.ReadStartElement(); - Reader.MoveToContent(); - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id174_value && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@value = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); - } - paramsRead[0] = true; - break; - } - UnknownNode((object)o, @":value"); - } while (false); - } - else { - UnknownNode((object)o, @":value"); - } - Reader.MoveToContent(); - } - ReadEndElement(); - return o; - } - - global::SerializationTypes.TypeWithMyCollectionField Read49_TypeWithMyCollectionField(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithArraylikeMembers Read48_TypeWithArraylikeMembers(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id49_TypeWithMyCollectionField && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id48_TypeWithArraylikeMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) return null; - global::SerializationTypes.TypeWithMyCollectionField o; - o = new global::SerializationTypes.TypeWithMyCollectionField(); - if ((object)(o.@Collection) == null) o.@Collection = new global::SerializationTypes.MyCollection(); - global::SerializationTypes.MyCollection a_0 = (global::SerializationTypes.MyCollection)o.@Collection; - System.Span paramsRead = stackalloc bool[1]; + global::SerializationTypes.TypeWithArraylikeMembers o; + o = new global::SerializationTypes.TypeWithArraylikeMembers(); + global::System.Int32[] a_0 = null; + int ca_0 = 0; + global::System.Int32[] a_1 = null; + int ca_1 = 0; + if ((object)(o.@IntLField) == null) o.@IntLField = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_2 = (global::System.Collections.Generic.List)o.@IntLField; + if ((object)(o.@NIntLField) == null) o.@NIntLField = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_3 = (global::System.Collections.Generic.List)o.@NIntLField; + global::System.Int32[] a_4 = null; + int ca_4 = 0; + global::System.Int32[] a_5 = null; + int ca_5 = 0; + if ((object)(o.@IntLProp) == null) o.@IntLProp = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_6 = (global::System.Collections.Generic.List)o.@IntLProp; + if ((object)(o.@NIntLProp) == null) o.@NIntLProp = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_7 = (global::System.Collections.Generic.List)o.@NIntLProp; + System.Span paramsRead = stackalloc bool[8]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); @@ -10619,10 +10903,10 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id205_Collection && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id209_IntAField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { - if ((object)(o.@Collection) == null) o.@Collection = new global::SerializationTypes.MyCollection(); - global::SerializationTypes.MyCollection a_0_0 = (global::SerializationTypes.MyCollection)o.@Collection; + global::System.Int32[] a_0_0 = null; + int ca_0_0 = 0; if ((Reader.IsEmptyElement)) { Reader.Skip(); } @@ -10632,75 +10916,31 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { - if (ReadNull()) { - a_0_0.Add(null); - } - else { - a_0_0.Add(Reader.ReadElementString()); + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_0_0 = (global::System.Int32[])EnsureArrayIndex(a_0_0, ca_0_0, typeof(global::System.Int32));a_0_0[ca_0_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } break; } - UnknownNode(null, @":string"); + UnknownNode(null, @":int"); } while (false); } else { - UnknownNode(null, @":string"); + UnknownNode(null, @":int"); } Reader.MoveToContent(); } ReadEndElement(); } + o.@IntAField = (global::System.Int32[])ShrinkArray(a_0_0, ca_0_0, typeof(global::System.Int32), false); } break; } - UnknownNode((object)o, @":Collection"); - } while (false); - } - else { - UnknownNode((object)o, @":Collection"); - } - Reader.MoveToContent(); - } - ReadEndElement(); - return o; - } - - global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty Read50_Item(bool isNullable, bool checkType) { - System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; - bool isNull = false; - if (isNullable) isNull = ReadNull(); - if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id50_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { - } - else { - throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); - } - } - if (isNull) return null; - global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty o; - o = new global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty(); - global::SerializationTypes.MyCollection a_0 = (global::SerializationTypes.MyCollection)o.@Collection; - System.Span paramsRead = stackalloc bool[1]; - while (Reader.MoveToNextAttribute()) { - if (!IsXmlnsAttribute(Reader.Name)) { - UnknownNode((object)o); - } - } - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip(); - return o; - } - Reader.ReadStartElement(); - Reader.MoveToContent(); - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - do { - if (((object) Reader.LocalName == (object)id205_Collection && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id210_NIntAField && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { - global::SerializationTypes.MyCollection a_0_0 = (global::SerializationTypes.MyCollection)o.@Collection; - if (((object)(a_0_0) == null) || (Reader.IsEmptyElement)) { + global::System.Int32[] a_1_0 = null; + int ca_1_0 = 0; + if ((Reader.IsEmptyElement)) { Reader.Skip(); } else { @@ -10709,101 +10949,513 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { - if (ReadNull()) { - a_0_0.Add(null); - } - else { - a_0_0.Add(Reader.ReadElementString()); + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_1_0 = (global::System.Int32[])EnsureArrayIndex(a_1_0, ca_1_0, typeof(global::System.Int32));a_1_0[ca_1_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } break; } - UnknownNode(null, @":string"); + UnknownNode(null, @":int"); } while (false); } else { - UnknownNode(null, @":string"); + UnknownNode(null, @":int"); } Reader.MoveToContent(); } ReadEndElement(); } + o.@NIntAField = (global::System.Int32[])ShrinkArray(a_1_0, ca_1_0, typeof(global::System.Int32), false); } break; } - UnknownNode((object)o, @":Collection"); - } while (false); - } - else { - UnknownNode((object)o, @":Collection"); - } - Reader.MoveToContent(); - } - ReadEndElement(); - return o; - } - - global::SerializationTypes.TypeWithEnumMembers Read52_TypeWithEnumMembers(bool isNullable, bool checkType) { - System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; - bool isNull = false; - if (isNullable) isNull = ReadNull(); - if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id54_TypeWithEnumMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { - } - else { - throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); - } - } - if (isNull) return null; - global::SerializationTypes.TypeWithEnumMembers o; - o = new global::SerializationTypes.TypeWithEnumMembers(); - System.Span paramsRead = stackalloc bool[2]; - while (Reader.MoveToNextAttribute()) { - if (!IsXmlnsAttribute(Reader.Name)) { - UnknownNode((object)o); - } - } - Reader.MoveToElement(); - if (Reader.IsEmptyElement) { - Reader.Skip(); - return o; - } - Reader.ReadStartElement(); - Reader.MoveToContent(); - while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { - if (Reader.NodeType == System.Xml.XmlNodeType.Element) { - do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id203_F1 && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@F1 = Read51_MyEnum(Reader.ReadElementString()); - } - paramsRead[0] = true; - break; - } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id146_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@P1 = Read51_MyEnum(Reader.ReadElementString()); + if (((object) Reader.LocalName == (object)id211_IntLField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + if ((object)(o.@IntLField) == null) o.@IntLField = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_2_0 = (global::System.Collections.Generic.List)o.@IntLField; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_2_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } } - paramsRead[1] = true; break; } - UnknownNode((object)o, @":F1, :P1"); - } while (false); - } - else { - UnknownNode((object)o, @":F1, :P1"); - } - Reader.MoveToContent(); - } - ReadEndElement(); + if (((object) Reader.LocalName == (object)id212_NIntLField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + if ((object)(o.@NIntLField) == null) o.@NIntLField = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List)o.@NIntLField; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_3_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + } + else { + if ((object)(o.@NIntLField) == null) o.@NIntLField = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List)o.@NIntLField; + } + break; + } + if (((object) Reader.LocalName == (object)id213_IntAProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + global::System.Int32[] a_4_0 = null; + int ca_4_0 = 0; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_4_0 = (global::System.Int32[])EnsureArrayIndex(a_4_0, ca_4_0, typeof(global::System.Int32));a_4_0[ca_4_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + o.@IntAProp = (global::System.Int32[])ShrinkArray(a_4_0, ca_4_0, typeof(global::System.Int32), false); + } + break; + } + if (((object) Reader.LocalName == (object)id214_NIntAProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + global::System.Int32[] a_5_0 = null; + int ca_5_0 = 0; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_5_0 = (global::System.Int32[])EnsureArrayIndex(a_5_0, ca_5_0, typeof(global::System.Int32));a_5_0[ca_5_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + o.@NIntAProp = (global::System.Int32[])ShrinkArray(a_5_0, ca_5_0, typeof(global::System.Int32), false); + } + else { + global::System.Int32[] a_5_0 = null; + int ca_5_0 = 0; + o.@NIntAProp = (global::System.Int32[])ShrinkArray(a_5_0, ca_5_0, typeof(global::System.Int32), true); + } + break; + } + if (((object) Reader.LocalName == (object)id215_IntLProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + if ((object)(o.@IntLProp) == null) o.@IntLProp = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_6_0 = (global::System.Collections.Generic.List)o.@IntLProp; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_6_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + } + break; + } + if (((object) Reader.LocalName == (object)id216_NIntLProp && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + if ((object)(o.@NIntLProp) == null) o.@NIntLProp = new global::System.Collections.Generic.List(); + global::System.Collections.Generic.List a_7_0 = (global::System.Collections.Generic.List)o.@NIntLProp; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_7_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); + } + break; + } + UnknownNode(null, @":int"); + } while (false); + } + else { + UnknownNode(null, @":int"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + } + break; + } + UnknownNode((object)o, @":IntAField, :NIntAField, :IntLField, :NIntLField, :IntAProp, :NIntAProp, :IntLProp, :NIntLProp"); + } while (false); + } + else { + UnknownNode((object)o, @":IntAField, :NIntAField, :IntLField, :NIntLField, :IntAProp, :NIntAProp, :IntLProp, :NIntLProp"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.StructNotSerializable Read49_StructNotSerializable(bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id49_StructNotSerializable && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + global::SerializationTypes.StructNotSerializable o; + try { + o = (global::SerializationTypes.StructNotSerializable)System.Activator.CreateInstance(typeof(global::SerializationTypes.StructNotSerializable), System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.CreateInstance | System.Reflection.BindingFlags.NonPublic, null, new object[0], null); + } + catch (System.MissingMethodException) { + throw CreateInaccessibleConstructorException(@"global::SerializationTypes.StructNotSerializable"); + } + catch (System.Security.SecurityException) { + throw CreateCtorHasSecurityException(@"global::SerializationTypes.StructNotSerializable"); + } + System.Span paramsRead = stackalloc bool[1]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id178_value && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@value = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); + } + paramsRead[0] = true; + break; + } + UnknownNode((object)o, @":value"); + } while (false); + } + else { + UnknownNode((object)o, @":value"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.TypeWithMyCollectionField Read50_TypeWithMyCollectionField(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id50_TypeWithMyCollectionField && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.TypeWithMyCollectionField o; + o = new global::SerializationTypes.TypeWithMyCollectionField(); + if ((object)(o.@Collection) == null) o.@Collection = new global::SerializationTypes.MyCollection(); + global::SerializationTypes.MyCollection a_0 = (global::SerializationTypes.MyCollection)o.@Collection; + System.Span paramsRead = stackalloc bool[1]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id217_Collection && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + if ((object)(o.@Collection) == null) o.@Collection = new global::SerializationTypes.MyCollection(); + global::SerializationTypes.MyCollection a_0_0 = (global::SerializationTypes.MyCollection)o.@Collection; + if ((Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (ReadNull()) { + a_0_0.Add(null); + } + else { + a_0_0.Add(Reader.ReadElementString()); + } + break; + } + UnknownNode(null, @":string"); + } while (false); + } + else { + UnknownNode(null, @":string"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + } + break; + } + UnknownNode((object)o, @":Collection"); + } while (false); + } + else { + UnknownNode((object)o, @":Collection"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty Read51_Item(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id51_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty o; + o = new global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty(); + global::SerializationTypes.MyCollection a_0 = (global::SerializationTypes.MyCollection)o.@Collection; + System.Span paramsRead = stackalloc bool[1]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id217_Collection && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!ReadNull()) { + global::SerializationTypes.MyCollection a_0_0 = (global::SerializationTypes.MyCollection)o.@Collection; + if (((object)(a_0_0) == null) || (Reader.IsEmptyElement)) { + Reader.Skip(); + } + else { + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (ReadNull()) { + a_0_0.Add(null); + } + else { + a_0_0.Add(Reader.ReadElementString()); + } + break; + } + UnknownNode(null, @":string"); + } while (false); + } + else { + UnknownNode(null, @":string"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + } + } + break; + } + UnknownNode((object)o, @":Collection"); + } while (false); + } + else { + UnknownNode((object)o, @":Collection"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.TypeWithEnumMembers Read53_TypeWithEnumMembers(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id55_TypeWithEnumMembers && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.TypeWithEnumMembers o; + o = new global::SerializationTypes.TypeWithEnumMembers(); + System.Span paramsRead = stackalloc bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id207_F1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@F1 = Read52_MyEnum(Reader.ReadElementString()); + } + paramsRead[0] = true; + break; + } + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id150_P1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@P1 = Read52_MyEnum(Reader.ReadElementString()); + } + paramsRead[1] = true; + break; + } + UnknownNode((object)o, @":F1, :P1"); + } while (false); + } + else { + UnknownNode((object)o, @":F1, :P1"); + } + Reader.MoveToContent(); + } + ReadEndElement(); return o; } - global::SerializationTypes.DCStruct Read53_DCStruct(bool checkType) { + global::SerializationTypes.DCStruct Read54_DCStruct(bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id55_DCStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id56_DCStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -10835,7 +11487,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id206_Data && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id218_Data && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Data = Reader.ReadElementString(); } @@ -10854,12 +11506,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.DCClassWithEnumAndStruct Read54_DCClassWithEnumAndStruct(bool isNullable, bool checkType) { + global::SerializationTypes.DCClassWithEnumAndStruct Read55_DCClassWithEnumAndStruct(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id56_DCClassWithEnumAndStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id57_DCClassWithEnumAndStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -10884,14 +11536,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id207_MyStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@MyStruct = Read53_DCStruct(true); + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id219_MyStruct && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@MyStruct = Read54_DCStruct(true); paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id208_MyEnum1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id220_MyEnum1 && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o.@MyEnum1 = Read51_MyEnum(Reader.ReadElementString()); + o.@MyEnum1 = Read52_MyEnum(Reader.ReadElementString()); } paramsRead[1] = true; break; @@ -10908,12 +11560,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.BuiltInTypes Read55_BuiltInTypes(bool isNullable, bool checkType) { + global::SerializationTypes.BuiltInTypes Read56_BuiltInTypes(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id57_BuiltInTypes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id58_BuiltInTypes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -10938,7 +11590,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id209_ByteArray && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id221_ByteArray && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@ByteArray = ToByteArrayBase64(false); } @@ -10957,12 +11609,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeB Read57_TypeB(bool isNullable, bool checkType) { + global::SerializationTypes.TypeB Read58_TypeB(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id59_TypeB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id60_TypeB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -10987,7 +11639,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -11006,12 +11658,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeHasArrayOfASerializedAsB Read58_TypeHasArrayOfASerializedAsB(bool isNullable, bool checkType) { + global::SerializationTypes.TypeHasArrayOfASerializedAsB Read59_TypeHasArrayOfASerializedAsB(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id60_TypeHasArrayOfASerializedAsB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id61_TypeHasArrayOfASerializedAsB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11038,7 +11690,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id181_Items && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id185_Items && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::SerializationTypes.TypeA[] a_0_0 = null; int ca_0_0 = 0; @@ -11051,8 +11703,8 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id58_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { - a_0_0 = (global::SerializationTypes.TypeA[])EnsureArrayIndex(a_0_0, ca_0_0, typeof(global::SerializationTypes.TypeA));a_0_0[ca_0_0++] = Read56_TypeA(true, true); + if (((object) Reader.LocalName == (object)id59_TypeA && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_0_0 = (global::SerializationTypes.TypeA[])EnsureArrayIndex(a_0_0, ca_0_0, typeof(global::SerializationTypes.TypeA));a_0_0[ca_0_0++] = Read57_TypeA(true, true); break; } UnknownNode(null, @":TypeA"); @@ -11081,12 +11733,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ Read59_Item(bool isNullable, bool checkType) { + global::SerializationTypes.@__TypeNameWithSpecialCharacters漢ñ Read60_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id61_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id62_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11111,7 +11763,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id210_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id222_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@PropertyNameWithSpecialCharacters漢ñ = Reader.ReadElementString(); } @@ -11130,12 +11782,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.DerivedClassWithSameProperty2 Read62_DerivedClassWithSameProperty2(bool isNullable, bool checkType) { + global::SerializationTypes.DerivedClassWithSameProperty2 Read63_DerivedClassWithSameProperty2(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11162,28 +11814,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id211_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id223_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringProperty = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id212_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id224_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IntProperty = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id213_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id225_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DateTimeProperty = ToDateTime(Reader.ReadElementString()); } paramsRead[2] = true; break; } - if (((object) Reader.LocalName == (object)id214_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id226_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@ListProperty) == null) o.@ListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List)o.@ListProperty; @@ -11196,7 +11848,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { a_3_0.Add(null); } @@ -11230,16 +11882,16 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.DerivedClassWithSameProperty Read61_DerivedClassWithSameProperty(bool isNullable, bool checkType) { + global::SerializationTypes.DerivedClassWithSameProperty Read62_DerivedClassWithSameProperty(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id63_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read62_DerivedClassWithSameProperty2(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read63_DerivedClassWithSameProperty2(isNullable, false); throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } @@ -11264,28 +11916,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id211_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id223_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringProperty = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id212_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id224_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IntProperty = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id213_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id225_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DateTimeProperty = ToDateTime(Reader.ReadElementString()); } paramsRead[2] = true; break; } - if (((object) Reader.LocalName == (object)id214_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id226_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@ListProperty) == null) o.@ListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List)o.@ListProperty; @@ -11298,7 +11950,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { a_3_0.Add(null); } @@ -11332,18 +11984,18 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.BaseClassWithSamePropertyName Read60_BaseClassWithSamePropertyName(bool isNullable, bool checkType) { + global::SerializationTypes.BaseClassWithSamePropertyName Read61_BaseClassWithSamePropertyName(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id62_BaseClassWithSamePropertyName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id63_BaseClassWithSamePropertyName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id63_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read61_DerivedClassWithSameProperty(isNullable, false); - if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) - return Read62_DerivedClassWithSameProperty2(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id64_DerivedClassWithSameProperty && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read62_DerivedClassWithSameProperty(isNullable, false); + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_DerivedClassWithSameProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read63_DerivedClassWithSameProperty2(isNullable, false); throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } @@ -11368,28 +12020,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id211_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id223_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringProperty = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id212_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id224_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IntProperty = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id213_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id225_DateTimeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DateTimeProperty = ToDateTime(Reader.ReadElementString()); } paramsRead[2] = true; break; } - if (((object) Reader.LocalName == (object)id214_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id226_ListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@ListProperty) == null) o.@ListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List)o.@ListProperty; @@ -11402,7 +12054,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id2_Item)) { if (ReadNull()) { a_3_0.Add(null); } @@ -11436,12 +12088,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime Read63_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithDateTimePropertyAsXmlTime Read64_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id65_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id66_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11483,12 +12135,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithByteArrayAsXmlText Read64_TypeWithByteArrayAsXmlText(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithByteArrayAsXmlText Read65_TypeWithByteArrayAsXmlText(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id66_TypeWithByteArrayAsXmlText && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id67_TypeWithByteArrayAsXmlText && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11530,12 +12182,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.SimpleDC Read65_SimpleDC(bool isNullable, bool checkType) { + global::SerializationTypes.SimpleDC Read66_SimpleDC(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id67_SimpleDC && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id68_SimpleDC && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11560,7 +12212,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id206_Data && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id218_Data && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Data = Reader.ReadElementString(); } @@ -11579,12 +12231,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithXmlTextAttributeOnArray Read66_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithXmlTextAttributeOnArray Read67_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id68_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id69_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id69_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id70_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11630,12 +12282,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.ClassImplementsInterface Read68_ClassImplementsInterface(bool isNullable, bool checkType) { + global::SerializationTypes.ClassImplementsInterface Read69_ClassImplementsInterface(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id71_ClassImplementsInterface && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id72_ClassImplementsInterface && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11660,28 +12312,28 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id215_ClassID && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id227_ClassID && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@ClassID = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id216_DisplayName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id228_DisplayName && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DisplayName = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id217_Id && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id229_Id && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Id = Reader.ReadElementString(); } paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id218_IsLoaded && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id230_IsLoaded && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IsLoaded = System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString()); } @@ -11700,11 +12352,11 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.SomeStruct Read69_SomeStruct(bool checkType) { + global::SerializationTypes.SomeStruct Read70_SomeStruct(bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id73_SomeStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id74_SomeStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11736,14 +12388,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id117_A && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id121_A && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@A = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id118_B && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id122_B && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@B = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -11762,12 +12414,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.WithStruct Read70_WithStruct(bool isNullable, bool checkType) { + global::SerializationTypes.WithStruct Read71_WithStruct(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id72_WithStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id73_WithStruct && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11792,8 +12444,8 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id219_Some && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Some = Read69_SomeStruct(true); + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id231_Some && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Some = Read70_SomeStruct(true); paramsRead[0] = true; break; } @@ -11809,12 +12461,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.WithEnums Read73_WithEnums(bool isNullable, bool checkType) { + global::SerializationTypes.WithEnums Read74_WithEnums(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id74_WithEnums && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id75_WithEnums && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11839,16 +12491,16 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id220_Int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id232_Int && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o.@Int = Read71_IntEnum(Reader.ReadElementString()); + o.@Int = Read72_IntEnum(Reader.ReadElementString()); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id221_Short && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id233_Short && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o.@Short = Read72_ShortEnum(Reader.ReadElementString()); + o.@Short = Read73_ShortEnum(Reader.ReadElementString()); } paramsRead[1] = true; break; @@ -11865,12 +12517,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.WithNullables Read77_WithNullables(bool isNullable, bool checkType) { + global::SerializationTypes.WithNullables Read78_WithNullables(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id75_WithNullables && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id76_WithNullables && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11895,33 +12547,33 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id222_Optional && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Optional = Read74_NullableOfIntEnum(true); + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id234_Optional && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Optional = Read75_NullableOfIntEnum(true); paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id223_Optionull && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Optionull = Read74_NullableOfIntEnum(true); + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id235_Optionull && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Optionull = Read75_NullableOfIntEnum(true); paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id224_OptionalInt && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@OptionalInt = Read75_NullableOfInt32(true); + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id236_OptionalInt && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@OptionalInt = Read76_NullableOfInt32(true); paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id225_OptionullInt && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@OptionullInt = Read75_NullableOfInt32(true); + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id237_OptionullInt && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@OptionullInt = Read76_NullableOfInt32(true); paramsRead[3] = true; break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id226_Struct1 && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Struct1 = Read76_NullableOfSomeStruct(true); + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id238_Struct1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Struct1 = Read77_NullableOfSomeStruct(true); paramsRead[4] = true; break; } - if (!paramsRead[5] && ((object) Reader.LocalName == (object)id227_Struct2 && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Struct2 = Read76_NullableOfSomeStruct(true); + if (!paramsRead[5] && ((object) Reader.LocalName == (object)id239_Struct2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Struct2 = Read77_NullableOfSomeStruct(true); paramsRead[5] = true; break; } @@ -11937,15 +12589,15 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::System.Nullable Read76_NullableOfSomeStruct(bool checkType) { + global::System.Nullable Read77_NullableOfSomeStruct(bool checkType) { global::System.Nullable o = default(global::System.Nullable); if (ReadNull()) return o; - o = Read69_SomeStruct(true); + o = Read70_SomeStruct(true); return o; } - global::System.Nullable Read75_NullableOfInt32(bool checkType) { + global::System.Nullable Read76_NullableOfInt32(bool checkType) { global::System.Nullable o = default(global::System.Nullable); if (ReadNull()) return o; @@ -11955,22 +12607,22 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::System.Nullable Read74_NullableOfIntEnum(bool checkType) { + global::System.Nullable Read75_NullableOfIntEnum(bool checkType) { global::System.Nullable o = default(global::System.Nullable); if (ReadNull()) return o; { - o = Read71_IntEnum(Reader.ReadElementString()); + o = Read72_IntEnum(Reader.ReadElementString()); } return o; } - global::SerializationTypes.XmlSerializerAttributes Read84_XmlSerializerAttributes(bool isNullable, bool checkType) { + global::SerializationTypes.XmlSerializerAttributes Read85_XmlSerializerAttributes(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id121_XmlSerializerAttributes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id125_XmlSerializerAttributes && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -11985,7 +12637,7 @@ internal System.Collections.Hashtable EnumFlagsValues { int ca_7 = 0; System.Span paramsRead = stackalloc bool[8]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[6] && ((object) Reader.LocalName == (object)id228_XmlAttributeName && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[6] && ((object) Reader.LocalName == (object)id240_XmlAttributeName && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@XmlAttributeProperty = System.Xml.XmlConvert.ToInt32(Reader.Value); paramsRead[6] = true; } @@ -12004,7 +12656,7 @@ internal System.Collections.Hashtable EnumFlagsValues { string tmp = null; if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id229_Word && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id241_Word && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@MyChoice = Reader.ReadElementString(); } @@ -12012,7 +12664,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id230_Number && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id242_Number && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@MyChoice = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -12020,7 +12672,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id231_DecimalNumber && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id243_DecimalNumber && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@MyChoice = System.Xml.XmlConvert.ToDouble(Reader.ReadElementString()); } @@ -12028,12 +12680,12 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id232_XmlIncludeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id244_XmlIncludeProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@XmlIncludeProperty = Read1_Object(false, true); paramsRead[1] = true; break; } - if (((object) Reader.LocalName == (object)id233_XmlEnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id245_XmlEnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::SerializationTypes.ItemChoiceType[] a_2_0 = null; int ca_2_0 = 0; @@ -12046,9 +12698,9 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id84_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id85_ItemChoiceType && (object) Reader.NamespaceURI == (object)id2_Item)) { { - a_2_0 = (global::SerializationTypes.ItemChoiceType[])EnsureArrayIndex(a_2_0, ca_2_0, typeof(global::SerializationTypes.ItemChoiceType));a_2_0[ca_2_0++] = Read83_ItemChoiceType(Reader.ReadElementString()); + a_2_0 = (global::SerializationTypes.ItemChoiceType[])EnsureArrayIndex(a_2_0, ca_2_0, typeof(global::SerializationTypes.ItemChoiceType));a_2_0[ca_2_0++] = Read84_ItemChoiceType(Reader.ReadElementString()); } break; } @@ -12066,21 +12718,21 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id234_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id246_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@XmlNamespaceDeclarationsProperty = Reader.ReadElementString(); } paramsRead[4] = true; break; } - if (!paramsRead[5] && ((object) Reader.LocalName == (object)id235_XmlElementPropertyNode && (object) Reader.NamespaceURI == (object)id236_httpelement)) { + if (!paramsRead[5] && ((object) Reader.LocalName == (object)id247_XmlElementPropertyNode && (object) Reader.NamespaceURI == (object)id248_httpelement)) { { o.@XmlElementProperty = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } paramsRead[5] = true; break; } - if (((object) Reader.LocalName == (object)id237_CustomXmlArrayProperty && (object) Reader.NamespaceURI == (object)id140_httpmynamespace)) { + if (((object) Reader.LocalName == (object)id249_CustomXmlArrayProperty && (object) Reader.NamespaceURI == (object)id144_httpmynamespace)) { if (!ReadNull()) { global::System.Object[] a_7_0 = null; int ca_7_0 = 0; @@ -12093,7 +12745,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id129_string && (object) Reader.NamespaceURI == (object)id140_httpmynamespace)) { + if (((object) Reader.LocalName == (object)id133_string && (object) Reader.NamespaceURI == (object)id144_httpmynamespace)) { if (ReadNull()) { a_7_0 = (global::System.Object[])EnsureArrayIndex(a_7_0, ca_7_0, typeof(global::System.Object));a_7_0[ca_7_0++] = null; } @@ -12135,12 +12787,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithAnyAttribute Read85_TypeWithAnyAttribute(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithAnyAttribute Read86_TypeWithAnyAttribute(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id85_TypeWithAnyAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id86_TypeWithAnyAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12153,7 +12805,7 @@ internal System.Collections.Hashtable EnumFlagsValues { int ca_2 = 0; System.Span paramsRead = stackalloc bool[3]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id212_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id224_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@IntProperty = System.Xml.XmlConvert.ToInt32(Reader.Value); paramsRead[1] = true; } @@ -12175,7 +12827,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -12195,12 +12847,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.KnownTypesThroughConstructor Read86_KnownTypesThroughConstructor(bool isNullable, bool checkType) { + global::SerializationTypes.KnownTypesThroughConstructor Read87_KnownTypesThroughConstructor(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id86_KnownTypesThroughConstructor && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id87_KnownTypesThroughConstructor && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12225,12 +12877,12 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id238_EnumValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id250_EnumValue && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@EnumValue = Read1_Object(false, true); paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id239_SimpleTypeValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id251_SimpleTypeValue && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@SimpleTypeValue = Read1_Object(false, true); paramsRead[1] = true; break; @@ -12247,12 +12899,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.SimpleKnownTypeValue Read87_SimpleKnownTypeValue(bool isNullable, bool checkType) { + global::SerializationTypes.SimpleKnownTypeValue Read88_SimpleKnownTypeValue(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id87_SimpleKnownTypeValue && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id88_SimpleKnownTypeValue && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12277,7 +12929,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id240_StrProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id252_StrProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StrProperty = Reader.ReadElementString(); } @@ -12296,12 +12948,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithPropertyNameSpecified Read88_TypeWithPropertyNameSpecified(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithPropertyNameSpecified Read89_TypeWithPropertyNameSpecified(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id89_TypeWithPropertyNameSpecified && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id90_TypeWithPropertyNameSpecified && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12326,7 +12978,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id241_MyField && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id253_MyField && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@MyFieldSpecified = true; { o.@MyField = Reader.ReadElementString(); @@ -12334,7 +12986,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id242_MyFieldIgnored && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id254_MyFieldIgnored && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@MyFieldIgnoredSpecified = true; { o.@MyFieldIgnored = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); @@ -12354,12 +13006,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithXmlSchemaFormAttribute Read89_TypeWithXmlSchemaFormAttribute(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithXmlSchemaFormAttribute Read90_TypeWithXmlSchemaFormAttribute(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id90_TypeWithXmlSchemaFormAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id91_TypeWithXmlSchemaFormAttribute && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12390,7 +13042,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id243_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id255_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@UnqualifiedSchemaFormListProperty) == null) o.@UnqualifiedSchemaFormListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List)o.@UnqualifiedSchemaFormListProperty; @@ -12403,7 +13055,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id127_int && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id131_int && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0_0.Add(System.Xml.XmlConvert.ToInt32(Reader.ReadElementString())); } @@ -12422,7 +13074,7 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (((object) Reader.LocalName == (object)id244_NoneSchemaFormListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id256_NoneSchemaFormListProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@NoneSchemaFormListProperty) == null) o.@NoneSchemaFormListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_1_0 = (global::System.Collections.Generic.List)o.@NoneSchemaFormListProperty; @@ -12435,7 +13087,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id142_NoneParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id146_NoneParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_1_0.Add(Reader.ReadElementString()); } @@ -12454,7 +13106,7 @@ internal System.Collections.Hashtable EnumFlagsValues { } break; } - if (((object) Reader.LocalName == (object)id245_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id257_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { if ((object)(o.@QualifiedSchemaFormListProperty) == null) o.@QualifiedSchemaFormListProperty = new global::System.Collections.Generic.List(); global::System.Collections.Generic.List a_2_0 = (global::System.Collections.Generic.List)o.@QualifiedSchemaFormListProperty; @@ -12467,7 +13119,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id144_QualifiedParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id148_QualifiedParameter && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_2_0.Add(System.Xml.XmlConvert.ToBoolean(Reader.ReadElementString())); } @@ -12498,12 +13150,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute Read90_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute Read91_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id91_MyXmlType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id92_MyXmlType && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12514,7 +13166,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::SerializationTypes.TypeWithTypeNameInXmlTypeAttribute(); System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id246_XmlAttributeForm && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id258_XmlAttributeForm && (object) Reader.NamespaceURI == (object)id2_Item)) { o.@XmlAttributeForm = Reader.Value; paramsRead[0] = true; } @@ -12542,12 +13194,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithNonPublicDefaultConstructor Read92_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithNonPublicDefaultConstructor Read93_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id93_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id94_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12580,7 +13232,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id115_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Name = Reader.ReadElementString(); } @@ -12599,12 +13251,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.ServerSettings Read93_ServerSettings(bool isNullable, bool checkType) { + global::SerializationTypes.ServerSettings Read94_ServerSettings(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id94_ServerSettings && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id95_ServerSettings && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12629,14 +13281,14 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id247_DS2Root && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id259_DS2Root && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@DS2Root = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id248_MetricConfigUrl && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id260_MetricConfigUrl && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@MetricConfigUrl = Reader.ReadElementString(); } @@ -12655,12 +13307,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithXmlQualifiedName Read94_TypeWithXmlQualifiedName(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithXmlQualifiedName Read95_TypeWithXmlQualifiedName(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id95_TypeWithXmlQualifiedName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id96_TypeWithXmlQualifiedName && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12685,7 +13337,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Value = ReadElementQualifiedName(); } @@ -12704,12 +13356,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWith2DArrayProperty2 Read95_TypeWith2DArrayProperty2(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWith2DArrayProperty2 Read96_TypeWith2DArrayProperty2(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id96_TypeWith2DArrayProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id97_TypeWith2DArrayProperty2 && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12736,7 +13388,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id249_TwoDArrayOfSimpleType && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id261_TwoDArrayOfSimpleType && (object) Reader.NamespaceURI == (object)id2_Item)) { if (!ReadNull()) { global::SerializationTypes.SimpleType[][] a_0_0 = null; int ca_0_0 = 0; @@ -12806,12 +13458,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithPropertiesHavingDefaultValue Read96_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithPropertiesHavingDefaultValue Read97_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id97_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id98_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12836,21 +13488,21 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id250_EmptyStringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id262_EmptyStringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@EmptyStringProperty = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id211_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id223_StringProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringProperty = Reader.ReadElementString(); } paramsRead[1] = true; break; } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id212_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id224_IntProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -12860,7 +13512,7 @@ internal System.Collections.Hashtable EnumFlagsValues { paramsRead[2] = true; break; } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id251_CharProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id263_CharProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } @@ -12882,12 +13534,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue Read97_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithEnumPropertyHavingDefaultValue Read98_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id98_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id99_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12912,12 +13564,12 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id252_EnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id264_EnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } else { - o.@EnumProperty = Read71_IntEnum(Reader.ReadElementString()); + o.@EnumProperty = Read72_IntEnum(Reader.ReadElementString()); } paramsRead[0] = true; break; @@ -12934,12 +13586,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue Read98_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue Read99_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id99_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id100_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -12964,12 +13616,12 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id252_EnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id264_EnumProperty && (object) Reader.NamespaceURI == (object)id2_Item)) { if (Reader.IsEmptyElement) { Reader.Skip(); } else { - o.@EnumProperty = Read67_EnumFlags(Reader.ReadElementString()); + o.@EnumProperty = Read68_EnumFlags(Reader.ReadElementString()); } paramsRead[0] = true; break; @@ -12986,12 +13638,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithShouldSerializeMethod Read99_TypeWithShouldSerializeMethod(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithShouldSerializeMethod Read100_TypeWithShouldSerializeMethod(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id100_TypeWithShouldSerializeMethod && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id101_TypeWithShouldSerializeMethod && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -13016,7 +13668,7 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id253_Foo && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id265_Foo && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@Foo = Reader.ReadElementString(); } @@ -13035,21 +13687,229 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties Read100_Item(bool isNullable, bool checkType) { + global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties Read101_Item(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id102_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties o; + o = new global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties(); + System.Span paramsRead = stackalloc bool[2]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id266_StringArrayValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@StringArrayValue = Read1_Object(false, true); + paramsRead[0] = true; + break; + } + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id267_IntArrayValue && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@IntArrayValue = Read1_Object(false, true); + paramsRead[1] = true; + break; + } + UnknownNode((object)o, @":StringArrayValue, :IntArrayValue"); + } while (false); + } + else { + UnknownNode((object)o, @":StringArrayValue, :IntArrayValue"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.KnownTypesThroughConstructorWithValue Read102_Item(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id103_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.KnownTypesThroughConstructorWithValue o; + o = new global::SerializationTypes.KnownTypesThroughConstructorWithValue(); + System.Span paramsRead = stackalloc bool[1]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id152_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { + o.@Value = Read1_Object(false, true); + paramsRead[0] = true; + break; + } + UnknownNode((object)o, @":Value"); + } while (false); + } + else { + UnknownNode((object)o, @":Value"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.TypeWithTypesHavingCustomFormatter Read103_Item(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id104_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else { + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + } + if (isNull) return null; + global::SerializationTypes.TypeWithTypesHavingCustomFormatter o; + o = new global::SerializationTypes.TypeWithTypesHavingCustomFormatter(); + System.Span paramsRead = stackalloc bool[9]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + do { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id268_DateTimeContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@DateTimeContent = ToDateTime(Reader.ReadElementString()); + } + paramsRead[0] = true; + break; + } + if (!paramsRead[1] && ((object) Reader.LocalName == (object)id269_QNameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@QNameContent = ReadElementQualifiedName(); + } + paramsRead[1] = true; + break; + } + if (!paramsRead[2] && ((object) Reader.LocalName == (object)id270_DateContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@DateContent = ToDate(Reader.ReadElementString()); + } + paramsRead[2] = true; + break; + } + if (!paramsRead[3] && ((object) Reader.LocalName == (object)id271_NameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@NameContent = ToXmlName(Reader.ReadElementString()); + } + paramsRead[3] = true; + break; + } + if (!paramsRead[4] && ((object) Reader.LocalName == (object)id272_NCNameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@NCNameContent = ToXmlNCName(Reader.ReadElementString()); + } + paramsRead[4] = true; + break; + } + if (!paramsRead[5] && ((object) Reader.LocalName == (object)id273_NMTOKENContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@NMTOKENContent = ToXmlNmToken(Reader.ReadElementString()); + } + paramsRead[5] = true; + break; + } + if (!paramsRead[6] && ((object) Reader.LocalName == (object)id274_NMTOKENSContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@NMTOKENSContent = ToXmlNmTokens(Reader.ReadElementString()); + } + paramsRead[6] = true; + break; + } + if (!paramsRead[7] && ((object) Reader.LocalName == (object)id275_Base64BinaryContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@Base64BinaryContent = ToByteArrayBase64(false); + } + paramsRead[7] = true; + break; + } + if (!paramsRead[8] && ((object) Reader.LocalName == (object)id276_HexBinaryContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@HexBinaryContent = ToByteArrayHex(false); + } + paramsRead[8] = true; + break; + } + UnknownNode((object)o, @":DateTimeContent, :QNameContent, :DateContent, :NameContent, :NCNameContent, :NMTOKENContent, :NMTOKENSContent, :Base64BinaryContent, :HexBinaryContent"); + } while (false); + } + else { + UnknownNode((object)o, @":DateTimeContent, :QNameContent, :DateContent, :NameContent, :NCNameContent, :NMTOKENContent, :NMTOKENSContent, :Base64BinaryContent, :HexBinaryContent"); + } + Reader.MoveToContent(); + } + ReadEndElement(); + return o; + } + + global::SerializationTypes.TypeWithArrayPropertyHavingChoice Read105_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id101_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id105_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) return null; - global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties o; - o = new global::SerializationTypes.KnownTypesThroughConstructorWithArrayProperties(); - System.Span paramsRead = stackalloc bool[2]; + global::SerializationTypes.TypeWithArrayPropertyHavingChoice o; + o = new global::SerializationTypes.TypeWithArrayPropertyHavingChoice(); + global::System.Object[] a_0 = null; + int ca_0 = 0; + global::SerializationTypes.MoreChoices[] choice_a_0 = null; + int cchoice_a_0 = 0; + System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); @@ -13058,6 +13918,8 @@ internal System.Collections.Hashtable EnumFlagsValues { Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip(); + o.@ManyChoices = (global::System.Object[])ShrinkArray(a_0, ca_0, typeof(global::System.Object), true); + o.@ChoiceArray = (global::SerializationTypes.MoreChoices[])ShrinkArray(choice_a_0, cchoice_a_0, typeof(global::SerializationTypes.MoreChoices), true); return o; } Reader.ReadStartElement(); @@ -13065,42 +13927,48 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id254_StringArrayValue && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@StringArrayValue = Read1_Object(false, true); - paramsRead[0] = true; + if (((object) Reader.LocalName == (object)id277_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_0 = (global::System.Object[])EnsureArrayIndex(a_0, ca_0, typeof(global::System.Object));a_0[ca_0++] = Reader.ReadElementString(); + } + choice_a_0 = (global::SerializationTypes.MoreChoices[])EnsureArrayIndex(choice_a_0, cchoice_a_0, typeof(global::SerializationTypes.MoreChoices));choice_a_0[cchoice_a_0++] = global::SerializationTypes.MoreChoices.@Item; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id255_IntArrayValue && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@IntArrayValue = Read1_Object(false, true); - paramsRead[1] = true; + if (((object) Reader.LocalName == (object)id278_Amount && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + a_0 = (global::System.Object[])EnsureArrayIndex(a_0, ca_0, typeof(global::System.Object));a_0[ca_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); + } + choice_a_0 = (global::SerializationTypes.MoreChoices[])EnsureArrayIndex(choice_a_0, cchoice_a_0, typeof(global::SerializationTypes.MoreChoices));choice_a_0[cchoice_a_0++] = global::SerializationTypes.MoreChoices.@Amount; break; } - UnknownNode((object)o, @":StringArrayValue, :IntArrayValue"); + UnknownNode((object)o, @":Item, :Amount"); } while (false); } else { - UnknownNode((object)o, @":StringArrayValue, :IntArrayValue"); + UnknownNode((object)o, @":Item, :Amount"); } Reader.MoveToContent(); } + o.@ManyChoices = (global::System.Object[])ShrinkArray(a_0, ca_0, typeof(global::System.Object), true); + o.@ChoiceArray = (global::SerializationTypes.MoreChoices[])ShrinkArray(choice_a_0, cchoice_a_0, typeof(global::SerializationTypes.MoreChoices), true); ReadEndElement(); return o; } - global::SerializationTypes.KnownTypesThroughConstructorWithValue Read101_Item(bool isNullable, bool checkType) { + global::SerializationTypes.ComplexChoiceB Read106_ComplexChoiceB(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id102_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id109_ComplexChoiceB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) return null; - global::SerializationTypes.KnownTypesThroughConstructorWithValue o; - o = new global::SerializationTypes.KnownTypesThroughConstructorWithValue(); + global::SerializationTypes.ComplexChoiceB o; + o = new global::SerializationTypes.ComplexChoiceB(); System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { @@ -13117,16 +13985,18 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id148_Value && (object) Reader.NamespaceURI == (object)id2_Item)) { - o.@Value = Read1_Object(false, true); + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@Name = Reader.ReadElementString(); + } paramsRead[0] = true; break; } - UnknownNode((object)o, @":Value"); + UnknownNode((object)o, @":Name"); } while (false); } else { - UnknownNode((object)o, @":Value"); + UnknownNode((object)o, @":Name"); } Reader.MoveToContent(); } @@ -13134,21 +14004,23 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithTypesHavingCustomFormatter Read102_Item(bool isNullable, bool checkType) { + global::SerializationTypes.ComplexChoiceA Read107_ComplexChoiceA(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id103_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id108_ComplexChoiceA && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { + if (((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id109_ComplexChoiceB && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) + return Read106_ComplexChoiceB(isNullable, false); throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) return null; - global::SerializationTypes.TypeWithTypesHavingCustomFormatter o; - o = new global::SerializationTypes.TypeWithTypesHavingCustomFormatter(); - System.Span paramsRead = stackalloc bool[9]; + global::SerializationTypes.ComplexChoiceA o; + o = new global::SerializationTypes.ComplexChoiceA(); + System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { if (!IsXmlnsAttribute(Reader.Name)) { UnknownNode((object)o); @@ -13164,74 +14036,18 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id256_DateTimeContent && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id119_Name && (object) Reader.NamespaceURI == (object)id2_Item)) { { - o.@DateTimeContent = ToDateTime(Reader.ReadElementString()); + o.@Name = Reader.ReadElementString(); } paramsRead[0] = true; break; } - if (!paramsRead[1] && ((object) Reader.LocalName == (object)id257_QNameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@QNameContent = ReadElementQualifiedName(); - } - paramsRead[1] = true; - break; - } - if (!paramsRead[2] && ((object) Reader.LocalName == (object)id258_DateContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@DateContent = ToDate(Reader.ReadElementString()); - } - paramsRead[2] = true; - break; - } - if (!paramsRead[3] && ((object) Reader.LocalName == (object)id259_NameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@NameContent = ToXmlName(Reader.ReadElementString()); - } - paramsRead[3] = true; - break; - } - if (!paramsRead[4] && ((object) Reader.LocalName == (object)id260_NCNameContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@NCNameContent = ToXmlNCName(Reader.ReadElementString()); - } - paramsRead[4] = true; - break; - } - if (!paramsRead[5] && ((object) Reader.LocalName == (object)id261_NMTOKENContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@NMTOKENContent = ToXmlNmToken(Reader.ReadElementString()); - } - paramsRead[5] = true; - break; - } - if (!paramsRead[6] && ((object) Reader.LocalName == (object)id262_NMTOKENSContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@NMTOKENSContent = ToXmlNmTokens(Reader.ReadElementString()); - } - paramsRead[6] = true; - break; - } - if (!paramsRead[7] && ((object) Reader.LocalName == (object)id263_Base64BinaryContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@Base64BinaryContent = ToByteArrayBase64(false); - } - paramsRead[7] = true; - break; - } - if (!paramsRead[8] && ((object) Reader.LocalName == (object)id264_HexBinaryContent && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - o.@HexBinaryContent = ToByteArrayHex(false); - } - paramsRead[8] = true; - break; - } - UnknownNode((object)o, @":DateTimeContent, :QNameContent, :DateContent, :NameContent, :NCNameContent, :NMTOKENContent, :NMTOKENSContent, :Base64BinaryContent, :HexBinaryContent"); + UnknownNode((object)o, @":Name"); } while (false); } else { - UnknownNode((object)o, @":DateTimeContent, :QNameContent, :DateContent, :NameContent, :NCNameContent, :NMTOKENContent, :NMTOKENSContent, :Base64BinaryContent, :HexBinaryContent"); + UnknownNode((object)o, @":Name"); } Reader.MoveToContent(); } @@ -13239,20 +14055,20 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithArrayPropertyHavingChoice Read104_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithPropertyHavingComplexChoice Read108_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id104_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id106_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); } } if (isNull) return null; - global::SerializationTypes.TypeWithArrayPropertyHavingChoice o; - o = new global::SerializationTypes.TypeWithArrayPropertyHavingChoice(); + global::SerializationTypes.TypeWithPropertyHavingComplexChoice o; + o = new global::SerializationTypes.TypeWithPropertyHavingComplexChoice(); global::System.Object[] a_0 = null; int ca_0 = 0; global::SerializationTypes.MoreChoices[] choice_a_0 = null; @@ -13275,14 +14091,12 @@ internal System.Collections.Hashtable EnumFlagsValues { while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { do { - if (((object) Reader.LocalName == (object)id265_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { - { - a_0 = (global::System.Object[])EnsureArrayIndex(a_0, ca_0, typeof(global::System.Object));a_0[ca_0++] = Reader.ReadElementString(); - } + if (((object) Reader.LocalName == (object)id277_Item && (object) Reader.NamespaceURI == (object)id2_Item)) { + a_0 = (global::System.Object[])EnsureArrayIndex(a_0, ca_0, typeof(global::System.Object));a_0[ca_0++] = Read107_ComplexChoiceA(false, true); choice_a_0 = (global::SerializationTypes.MoreChoices[])EnsureArrayIndex(choice_a_0, cchoice_a_0, typeof(global::SerializationTypes.MoreChoices));choice_a_0[cchoice_a_0++] = global::SerializationTypes.MoreChoices.@Item; break; } - if (((object) Reader.LocalName == (object)id266_Amount && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id278_Amount && (object) Reader.NamespaceURI == (object)id2_Item)) { { a_0 = (global::System.Object[])EnsureArrayIndex(a_0, ca_0, typeof(global::System.Object));a_0[ca_0++] = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -13303,12 +14117,12 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithFieldsOrdered Read105_TypeWithFieldsOrdered(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithFieldsOrdered Read109_TypeWithFieldsOrdered(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); if (checkType) { - if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id106_TypeWithFieldsOrdered && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id110_TypeWithFieldsOrdered && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { } else { throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); @@ -13335,7 +14149,7 @@ internal System.Collections.Hashtable EnumFlagsValues { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { switch (state) { case 0: - if (((object) Reader.LocalName == (object)id267_IntField1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id279_IntField1 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IntField1 = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -13343,7 +14157,7 @@ internal System.Collections.Hashtable EnumFlagsValues { state = 1; break; case 1: - if (((object) Reader.LocalName == (object)id268_IntField2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id280_IntField2 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@IntField2 = System.Xml.XmlConvert.ToInt32(Reader.ReadElementString()); } @@ -13351,7 +14165,7 @@ internal System.Collections.Hashtable EnumFlagsValues { state = 2; break; case 2: - if (((object) Reader.LocalName == (object)id269_StringField2 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id281_StringField2 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringField2 = Reader.ReadElementString(); } @@ -13359,7 +14173,7 @@ internal System.Collections.Hashtable EnumFlagsValues { state = 3; break; case 3: - if (((object) Reader.LocalName == (object)id270_StringField1 && (object) Reader.NamespaceURI == (object)id2_Item)) { + if (((object) Reader.LocalName == (object)id282_StringField1 && (object) Reader.NamespaceURI == (object)id2_Item)) { { o.@StringField1 = Reader.ReadElementString(); } @@ -13380,7 +14194,7 @@ internal System.Collections.Hashtable EnumFlagsValues { return o; } - global::SerializationTypes.TypeWithSchemaFormInXmlAttribute Read91_Item(bool isNullable, bool checkType) { + global::SerializationTypes.TypeWithSchemaFormInXmlAttribute Read92_Item(bool isNullable, bool checkType) { System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; bool isNull = false; if (isNullable) isNull = ReadNull(); @@ -13396,7 +14210,7 @@ internal System.Collections.Hashtable EnumFlagsValues { o = new global::SerializationTypes.TypeWithSchemaFormInXmlAttribute(); System.Span paramsRead = stackalloc bool[1]; while (Reader.MoveToNextAttribute()) { - if (!paramsRead[0] && ((object) Reader.LocalName == (object)id271_TestProperty && (object) Reader.NamespaceURI == (object)id272_httptestcom)) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id283_TestProperty && (object) Reader.NamespaceURI == (object)id284_httptestcom)) { o.@TestProperty = Reader.Value; paramsRead[0] = true; } @@ -13427,552 +14241,576 @@ internal System.Collections.Hashtable EnumFlagsValues { protected override void InitCallbacks() { } - string id168_Age; - string id201_DateTimeString; - string id194_FloatProp; - string id33_Item; - string id214_ListProperty; - string id216_DisplayName; - string id118_B; - string id53_MyEnum; - string id263_Base64BinaryContent; - string id68_Item; - string id196_id; - string id161_DTO2; - string id234_Item; - string id260_NCNameContent; - string id55_DCStruct; - string id10_Animal; - string id165_TimeSpanProperty; - string id186_Y; - string id228_XmlAttributeName; - string id250_EmptyStringProperty; - string id79_IntEnum; - string id187_Z; - string id117_A; - string id212_IntProperty; - string id231_DecimalNumber; - string id66_TypeWithByteArrayAsXmlText; - string id235_XmlElementPropertyNode; - string id210_Item; + string id211_IntLField; + string id230_IsLoaded; + string id39_RootClass; + string id235_Optionull; + string id119_Name; + string id245_XmlEnumProperty; + string id263_CharProperty; + string id188_TotalCost; + string id262_EmptyStringProperty; + string id156_Modulation; + string id104_Item; + string id76_WithNullables; + string id123_Value1; + string id179_Line1; + string id228_DisplayName; + string id163_Base64Content; + string id208_F2; + string id149_ArrayOfArrayOfSimpleType; + string id171_ByteProperty; + string id203_xelement; + string id111_Item; + string id72_ClassImplementsInterface; + string id103_Item; + string id105_Item; + string id9_TypeWithXmlNodeArrayProperty; + string id234_Optional; + string id180_City; + string id128_Item; + string id250_EnumValue; + string id169_TimeSpanProperty; + string id268_DateTimeContent; + string id229_Id; + string id267_IntArrayValue; + string id151_P2; + string id73_WithStruct; + string id190_Y; + string id15_Employee; + string id265_Foo; + string id68_SimpleDC; + string id197_DoubleProp; + string id167_NullableDTO; + string id71_EnumFlags; + string id84_AttributeTesting; + string id11_Dog; + string id212_NIntLField; + string id74_SomeStruct; + string id140_XElement; + string id213_IntAProp; + string id278_Amount; + string id261_TwoDArrayOfSimpleType; + string id67_TypeWithByteArrayAsXmlText; + string id225_DateTimeProperty; + string id181_State; + string id232_Int; + string id122_B; + string id2_Item; + string id17_DerivedClass; + string id252_StrProperty; + string id196_SingleField; + string id281_StringField2; + string id247_XmlElementPropertyNode; string id43_XElementArrayWrapper; - string id129_string; - string id252_EnumProperty; + string id260_MetricConfigUrl; + string id47_TypeWithGetOnlyArrayProperties; + string id95_ServerSettings; + string id88_SimpleKnownTypeValue; + string id284_httptestcom; + string id60_TypeB; + string id107_MoreChoices; + string id25_ArrayOfDateTime; + string id133_string; + string id200_id; + string id273_NMTOKENContent; + string id86_TypeWithAnyAttribute; + string id216_NIntLProp; + string id162_BinaryHexContent; + string id58_BuiltInTypes; + string id131_int; + string id283_TestProperty; + string id62_Item; string id31_Pet; - string id128_ArrayOfString; - string id18_PurchaseOrder; - string id271_TestProperty; - string id241_MyField; - string id170_LicenseNumber; - string id78_ShortEnum; - string id211_StringProperty; - string id243_Item; - string id207_MyStruct; - string id21_OrderedItem; - string id208_MyEnum1; - string id160_DTO; - string id169_Breed; - string id35_RootElement; - string id265_Item; - string id142_NoneParameter; - string id141_ArrayOfString1; - string id215_ClassID; - string id100_TypeWithShouldSerializeMethod; - string id26_dateTime; + string id90_TypeWithPropertyNameSpecified; + string id1_TypeWithXmlElementProperty; + string id127_MsgDocumentType; + string id130_ArrayOfInt; + string id182_Zip; + string id175_GroupName; + string id204_xelements; + string id187_ShipCost; + string id173_Breed; + string id33_Item; + string id242_Number; + string id96_TypeWithXmlQualifiedName; + string id231_Some; string id6_TypeWithTimeSpanProperty; - string id162_DefaultDTO; - string id114_LastName; - string id105_MoreChoices; - string id206_Data; - string id172_GroupVehicle; - string id192_SingleField; - string id87_SimpleKnownTypeValue; - string id97_Item; - string id232_XmlIncludeProperty; - string id99_Item; - string id74_WithEnums; - string id264_HexBinaryContent; - string id37_Document; + string id113_TypeClashB; + string id59_TypeA; + string id274_NMTOKENSContent; + string id91_TypeWithXmlSchemaFormAttribute; + string id56_DCStruct; + string id178_value; + string id100_Item; + string id238_Struct1; + string id27_Orchestra; + string id155_IsValved; + string id8_TypeWithByteProperty; + string id239_Struct2; + string id83_ULongEnum; + string id53_anyType; + string id176_GroupVehicle; + string id195_DoubleField; + string id264_EnumProperty; + string id120_ContainerType; + string id144_httpmynamespace; + string id157_ItemName; + string id244_XmlIncludeProperty; + string id209_IntAField; + string id142_ArrayOfTypeA; + string id150_P1; + string id40_Parameter; + string id202_Parameters; + string id48_TypeWithArraylikeMembers; + string id77_ByteEnum; + string id14_Vehicle; string id42_XElementStruct; - string id113_MiddleName; + string id271_NameContent; + string id16_BaseClass; + string id226_ListProperty; + string id82_LongEnum; + string id272_NCNameContent; + string id138_ArrayOfParameter; + string id153_Child; + string id26_dateTime; + string id257_Item; + string id21_OrderedItem; + string id134_ArrayOfDouble; + string id75_WithEnums; + string id102_Item; + string id240_XmlAttributeName; + string id222_Item; + string id55_TypeWithEnumMembers; + string id20_Address; + string id277_Item; + string id112_Root; + string id147_ArrayOfBoolean; + string id165_DTO2; string id41_XElementWrapper; + string id227_ClassID; + string id248_httpelement; + string id236_OptionalInt; + string id186_SubTotal; + string id246_Item; + string id270_DateContent; + string id218_Data; + string id3_TypeWithXmlDocumentProperty; + string id87_KnownTypesThroughConstructor; + string id141_ArrayOfSimpleType; + string id137_ArrayOfTypeWithLinkedProperty; + string id101_TypeWithShouldSerializeMethod; + string id201_refs; + string id161_LineTotal; + string id215_IntLProp; + string id109_ComplexChoiceB; + string id10_Animal; + string id280_IntField2; + string id174_LicenseNumber; + string id93_Item; + string id66_Item; + string id164_DTO; string id44_TypeWithDateTimeStringProperty; - string id226_Struct1; - string id183_ShipCost; - string id145_ArrayOfArrayOfSimpleType; + string id35_RootElement; + string id223_StringProperty; + string id170_TimeSpanProperty2; string id22_AliasedTestType; - string id32_DefaultValuesSetToNaN; - string id167_ByteProperty; - string id151_IsValved; - string id34_Item; - string id209_ByteArray; - string id152_Modulation; - string id111_Person; - string id188_Prop; - string id29_Brass; - string id25_ArrayOfDateTime; - string id184_TotalCost; - string id268_IntField2; - string id204_F2; - string id15_Employee; - string id195_IntValue; - string id147_P2; + string id206_CurrentDateTime; + string id210_NIntAField; + string id132_ArrayOfString; + string id154_Children; + string id126_ParameterOfString; + string id184_OrderDate; + string id205_DateTimeString; + string id269_QNameContent; + string id237_OptionullInt; + string id241_Word; + string id168_NullableDefaultDTO; + string id172_Age; + string id19_httpwwwcontoso1com; + string id220_MyEnum1; + string id18_PurchaseOrder; + string id199_IntValue; + string id159_UnitPrice; + string id92_MyXmlType; string id36_TypeWithLinkedProperty; - string id136_XElement; - string id199_xelement; - string id50_Item; - string id236_httpelement; - string id112_FirstName; - string id58_TypeA; - string id85_TypeWithAnyAttribute; - string id153_ItemName; - string id48_StructNotSerializable; - string id116_ContainerType; - string id227_Struct2; - string id163_NullableDTO; - string id110_TypeClashA; - string id11_Dog; - string id8_TypeWithByteProperty; - string id127_int; - string id185_X; - string id139_ArrayOfItemChoiceType; - string id137_ArrayOfSimpleType; - string id23_BaseClass1; - string id123_MsgDocumentType; - string id173_EmployeeName; - string id150_Children; - string id131_double; - string id119_Value1; - string id38_httpexamplecom; - string id12_DogBreed; - string id175_Line1; - string id115_Name; - string id166_TimeSpanProperty2; - string id91_MyXmlType; - string id248_MetricConfigUrl; - string id5_Item; - string id217_Id; + string id253_MyField; string id98_Item; - string id126_ArrayOfInt; - string id237_CustomXmlArrayProperty; - string id242_MyFieldIgnored; - string id213_DateTimeProperty; - string id77_SByteEnum; - string id102_Item; - string id156_Quantity; - string id164_NullableDefaultDTO; - string id17_DerivedClass; - string id262_NMTOKENSContent; - string id82_ULongEnum; - string id223_Optionull; - string id54_TypeWithEnumMembers; - string id178_Zip; - string id224_OptionalInt; - string id272_httptestcom; - string id190_Comment2; - string id83_AttributeTesting; - string id30_Trumpet; - string id47_TypeWithGetOnlyArrayProperties; - string id65_Item; - string id51_ArrayOfAnyType; - string id255_IntArrayValue; - string id222_Optional; - string id28_Instrument; - string id253_Foo; - string id13_Group; + string id69_Item; + string id148_QualifiedParameter; + string id145_ArrayOfString1; + string id4_TypeWithBinaryProperty; + string id251_SimpleTypeValue; string id24_DerivedClass1; - string id81_LongEnum; - string id94_ServerSettings; - string id62_BaseClassWithSamePropertyName; - string id146_P1; - string id133_ArrayOfTypeWithLinkedProperty; - string id230_Number; - string id239_SimpleTypeValue; - string id89_TypeWithPropertyNameSpecified; - string id269_StringField2; - string id159_Base64Content; - string id122_ParameterOfString; - string id155_UnitPrice; - string id233_XmlEnumProperty; - string id134_ArrayOfParameter; - string id174_value; - string id246_XmlAttributeForm; - string id198_Parameters; - string id130_ArrayOfDouble; - string id193_DoubleProp; - string id101_Item; - string id219_Some; - string id138_ArrayOfTypeA; - string id59_TypeB; - string id2_Item; - string id45_SimpleType; - string id181_Items; - string id154_Description; - string id240_StrProperty; - string id106_TypeWithFieldsOrdered; - string id256_DateTimeContent; - string id63_DerivedClassWithSameProperty; - string id261_NMTOKENContent; + string id97_TypeWith2DArrayProperty2; + string id30_Trumpet; + string id63_BaseClassWithSamePropertyName; + string id217_Collection; + string id224_IntProperty; + string id185_Items; + string id183_ShipTo; + string id193_Instruments; + string id275_Base64BinaryContent; + string id80_IntEnum; + string id12_DogBreed; string id7_Item; - string id86_KnownTypesThroughConstructor; - string id247_DS2Root; - string id1_TypeWithXmlElementProperty; - string id225_OptionullInt; - string id177_State; - string id67_SimpleDC; - string id14_Vehicle; - string id84_ItemChoiceType; - string id60_TypeHasArrayOfASerializedAsB; - string id49_TypeWithMyCollectionField; - string id176_City; - string id52_anyType; - string id75_WithNullables; - string id27_Orchestra; - string id251_CharProperty; - string id197_refs; - string id19_httpwwwcontoso1com; - string id218_IsLoaded; - string id40_Parameter; - string id238_EnumValue; - string id148_Value; - string id73_SomeStruct; - string id92_Item; - string id88_Item; - string id135_ArrayOfXElement; - string id244_NoneSchemaFormListProperty; - string id71_ClassImplementsInterface; - string id109_TypeClashB; - string id140_httpmynamespace; - string id96_TypeWith2DArrayProperty2; - string id143_ArrayOfBoolean; - string id103_Item; - string id245_Item; - string id267_IntField1; - string id90_TypeWithXmlSchemaFormAttribute; - string id76_ByteEnum; - string id93_Item; - string id202_CurrentDateTime; - string id200_xelements; - string id189_Instruments; - string id171_GroupName; - string id80_UIntEnum; - string id16_BaseClass; - string id72_WithStruct; - string id205_Collection; - string id95_TypeWithXmlQualifiedName; - string id257_QNameContent; - string id179_ShipTo; - string id132_ArrayOfInstrument; - string id57_BuiltInTypes; - string id61_Item; - string id158_BinaryHexContent; - string id104_Item; - string id124_Item; - string id249_TwoDArrayOfSimpleType; - string id191_DoubleField; + string id136_ArrayOfInstrument; + string id135_double; + string id50_TypeWithMyCollectionField; + string id124_Value2; + string id110_TypeWithFieldsOrdered; + string id146_NoneParameter; + string id37_Document; + string id254_MyFieldIgnored; + string id279_IntField1; + string id249_CustomXmlArrayProperty; + string id54_MyEnum; + string id207_F1; + string id143_ArrayOfItemChoiceType; + string id108_ComplexChoiceA; + string id94_Item; + string id121_A; + string id5_Item; + string id256_NoneSchemaFormListProperty; + string id166_DefaultDTO; + string id65_DerivedClassWithSameProperty2; + string id34_Item; + string id32_DefaultValuesSetToNaN; + string id219_MyStruct; + string id23_BaseClass1; string id46_TypeWithGetSetArrayMembers; - string id4_TypeWithBinaryProperty; - string id221_Short; - string id144_QualifiedParameter; - string id149_Child; - string id203_F1; - string id69_Item; - string id229_Word; - string id3_TypeWithXmlDocumentProperty; - string id20_Address; - string id120_Value2; - string id121_XmlSerializerAttributes; - string id180_OrderDate; - string id70_EnumFlags; - string id266_Amount; - string id9_TypeWithXmlNodeArrayProperty; - string id259_NameContent; - string id220_Int; - string id64_DerivedClassWithSameProperty2; - string id125_ArrayOfOrderedItem; - string id157_LineTotal; - string id254_StringArrayValue; - string id107_Item; - string id56_DCClassWithEnumAndStruct; - string id270_StringField1; - string id182_SubTotal; - string id108_Root; - string id39_RootClass; - string id258_DateContent; + string id266_StringArrayValue; + string id160_Quantity; + string id78_SByteEnum; + string id45_SimpleType; + string id258_XmlAttributeForm; + string id118_LastName; + string id282_StringField1; + string id49_StructNotSerializable; + string id52_ArrayOfAnyType; + string id152_Value; + string id28_Instrument; + string id29_Brass; + string id117_MiddleName; + string id276_HexBinaryContent; + string id194_Comment2; + string id70_Item; + string id89_Item; + string id116_FirstName; + string id192_Prop; + string id139_ArrayOfXElement; + string id79_ShortEnum; + string id85_ItemChoiceType; + string id106_Item; + string id61_TypeHasArrayOfASerializedAsB; + string id255_Item; + string id51_Item; + string id99_Item; + string id114_TypeClashA; + string id259_DS2Root; + string id115_Person; + string id13_Group; + string id81_UIntEnum; + string id38_httpexamplecom; + string id177_EmployeeName; + string id129_ArrayOfOrderedItem; + string id221_ByteArray; + string id214_NIntAProp; + string id233_Short; + string id189_X; + string id243_DecimalNumber; + string id191_Z; + string id158_Description; + string id198_FloatProp; + string id64_DerivedClassWithSameProperty; + string id57_DCClassWithEnumAndStruct; + string id125_XmlSerializerAttributes; protected override void InitIDs() { - id168_Age = Reader.NameTable.Add(@"Age"); - id201_DateTimeString = Reader.NameTable.Add(@"DateTimeString"); - id194_FloatProp = Reader.NameTable.Add(@"FloatProp"); - id33_Item = Reader.NameTable.Add(@"DefaultValuesSetToPositiveInfinity"); - id214_ListProperty = Reader.NameTable.Add(@"ListProperty"); - id216_DisplayName = Reader.NameTable.Add(@"DisplayName"); - id118_B = Reader.NameTable.Add(@"B"); - id53_MyEnum = Reader.NameTable.Add(@"MyEnum"); - id263_Base64BinaryContent = Reader.NameTable.Add(@"Base64BinaryContent"); - id68_Item = Reader.NameTable.Add(@"TypeWithXmlTextAttributeOnArray"); - id196_id = Reader.NameTable.Add(@"id"); - id161_DTO2 = Reader.NameTable.Add(@"DTO2"); - id234_Item = Reader.NameTable.Add(@"XmlNamespaceDeclarationsProperty"); - id260_NCNameContent = Reader.NameTable.Add(@"NCNameContent"); - id55_DCStruct = Reader.NameTable.Add(@"DCStruct"); - id10_Animal = Reader.NameTable.Add(@"Animal"); - id165_TimeSpanProperty = Reader.NameTable.Add(@"TimeSpanProperty"); - id186_Y = Reader.NameTable.Add(@"Y"); - id228_XmlAttributeName = Reader.NameTable.Add(@"XmlAttributeName"); - id250_EmptyStringProperty = Reader.NameTable.Add(@"EmptyStringProperty"); - id79_IntEnum = Reader.NameTable.Add(@"IntEnum"); - id187_Z = Reader.NameTable.Add(@"Z"); - id117_A = Reader.NameTable.Add(@"A"); - id212_IntProperty = Reader.NameTable.Add(@"IntProperty"); - id231_DecimalNumber = Reader.NameTable.Add(@"DecimalNumber"); - id66_TypeWithByteArrayAsXmlText = Reader.NameTable.Add(@"TypeWithByteArrayAsXmlText"); - id235_XmlElementPropertyNode = Reader.NameTable.Add(@"XmlElementPropertyNode"); - id210_Item = Reader.NameTable.Add(@"PropertyNameWithSpecialCharacters漢ñ"); + id211_IntLField = Reader.NameTable.Add(@"IntLField"); + id230_IsLoaded = Reader.NameTable.Add(@"IsLoaded"); + id39_RootClass = Reader.NameTable.Add(@"RootClass"); + id235_Optionull = Reader.NameTable.Add(@"Optionull"); + id119_Name = Reader.NameTable.Add(@"Name"); + id245_XmlEnumProperty = Reader.NameTable.Add(@"XmlEnumProperty"); + id263_CharProperty = Reader.NameTable.Add(@"CharProperty"); + id188_TotalCost = Reader.NameTable.Add(@"TotalCost"); + id262_EmptyStringProperty = Reader.NameTable.Add(@"EmptyStringProperty"); + id156_Modulation = Reader.NameTable.Add(@"Modulation"); + id104_Item = Reader.NameTable.Add(@"TypeWithTypesHavingCustomFormatter"); + id76_WithNullables = Reader.NameTable.Add(@"WithNullables"); + id123_Value1 = Reader.NameTable.Add(@"Value1"); + id179_Line1 = Reader.NameTable.Add(@"Line1"); + id228_DisplayName = Reader.NameTable.Add(@"DisplayName"); + id163_Base64Content = Reader.NameTable.Add(@"Base64Content"); + id208_F2 = Reader.NameTable.Add(@"F2"); + id149_ArrayOfArrayOfSimpleType = Reader.NameTable.Add(@"ArrayOfArrayOfSimpleType"); + id171_ByteProperty = Reader.NameTable.Add(@"ByteProperty"); + id203_xelement = Reader.NameTable.Add(@"xelement"); + id111_Item = Reader.NameTable.Add(@"TypeWithKnownTypesOfCollectionsWithConflictingXmlName"); + id72_ClassImplementsInterface = Reader.NameTable.Add(@"ClassImplementsInterface"); + id103_Item = Reader.NameTable.Add(@"KnownTypesThroughConstructorWithValue"); + id105_Item = Reader.NameTable.Add(@"TypeWithArrayPropertyHavingChoice"); + id9_TypeWithXmlNodeArrayProperty = Reader.NameTable.Add(@"TypeWithXmlNodeArrayProperty"); + id234_Optional = Reader.NameTable.Add(@"Optional"); + id180_City = Reader.NameTable.Add(@"City"); + id128_Item = Reader.NameTable.Add(@"TypeWithMismatchBetweenAttributeAndPropertyType"); + id250_EnumValue = Reader.NameTable.Add(@"EnumValue"); + id169_TimeSpanProperty = Reader.NameTable.Add(@"TimeSpanProperty"); + id268_DateTimeContent = Reader.NameTable.Add(@"DateTimeContent"); + id229_Id = Reader.NameTable.Add(@"Id"); + id267_IntArrayValue = Reader.NameTable.Add(@"IntArrayValue"); + id151_P2 = Reader.NameTable.Add(@"P2"); + id73_WithStruct = Reader.NameTable.Add(@"WithStruct"); + id190_Y = Reader.NameTable.Add(@"Y"); + id15_Employee = Reader.NameTable.Add(@"Employee"); + id265_Foo = Reader.NameTable.Add(@"Foo"); + id68_SimpleDC = Reader.NameTable.Add(@"SimpleDC"); + id197_DoubleProp = Reader.NameTable.Add(@"DoubleProp"); + id167_NullableDTO = Reader.NameTable.Add(@"NullableDTO"); + id71_EnumFlags = Reader.NameTable.Add(@"EnumFlags"); + id84_AttributeTesting = Reader.NameTable.Add(@"AttributeTesting"); + id11_Dog = Reader.NameTable.Add(@"Dog"); + id212_NIntLField = Reader.NameTable.Add(@"NIntLField"); + id74_SomeStruct = Reader.NameTable.Add(@"SomeStruct"); + id140_XElement = Reader.NameTable.Add(@"XElement"); + id213_IntAProp = Reader.NameTable.Add(@"IntAProp"); + id278_Amount = Reader.NameTable.Add(@"Amount"); + id261_TwoDArrayOfSimpleType = Reader.NameTable.Add(@"TwoDArrayOfSimpleType"); + id67_TypeWithByteArrayAsXmlText = Reader.NameTable.Add(@"TypeWithByteArrayAsXmlText"); + id225_DateTimeProperty = Reader.NameTable.Add(@"DateTimeProperty"); + id181_State = Reader.NameTable.Add(@"State"); + id232_Int = Reader.NameTable.Add(@"Int"); + id122_B = Reader.NameTable.Add(@"B"); + id2_Item = Reader.NameTable.Add(@""); + id17_DerivedClass = Reader.NameTable.Add(@"DerivedClass"); + id252_StrProperty = Reader.NameTable.Add(@"StrProperty"); + id196_SingleField = Reader.NameTable.Add(@"SingleField"); + id281_StringField2 = Reader.NameTable.Add(@"StringField2"); + id247_XmlElementPropertyNode = Reader.NameTable.Add(@"XmlElementPropertyNode"); id43_XElementArrayWrapper = Reader.NameTable.Add(@"XElementArrayWrapper"); - id129_string = Reader.NameTable.Add(@"string"); - id252_EnumProperty = Reader.NameTable.Add(@"EnumProperty"); + id260_MetricConfigUrl = Reader.NameTable.Add(@"MetricConfigUrl"); + id47_TypeWithGetOnlyArrayProperties = Reader.NameTable.Add(@"TypeWithGetOnlyArrayProperties"); + id95_ServerSettings = Reader.NameTable.Add(@"ServerSettings"); + id88_SimpleKnownTypeValue = Reader.NameTable.Add(@"SimpleKnownTypeValue"); + id284_httptestcom = Reader.NameTable.Add(@"http://test.com"); + id60_TypeB = Reader.NameTable.Add(@"TypeB"); + id107_MoreChoices = Reader.NameTable.Add(@"MoreChoices"); + id25_ArrayOfDateTime = Reader.NameTable.Add(@"ArrayOfDateTime"); + id133_string = Reader.NameTable.Add(@"string"); + id200_id = Reader.NameTable.Add(@"id"); + id273_NMTOKENContent = Reader.NameTable.Add(@"NMTOKENContent"); + id86_TypeWithAnyAttribute = Reader.NameTable.Add(@"TypeWithAnyAttribute"); + id216_NIntLProp = Reader.NameTable.Add(@"NIntLProp"); + id162_BinaryHexContent = Reader.NameTable.Add(@"BinaryHexContent"); + id58_BuiltInTypes = Reader.NameTable.Add(@"BuiltInTypes"); + id131_int = Reader.NameTable.Add(@"int"); + id283_TestProperty = Reader.NameTable.Add(@"TestProperty"); + id62_Item = Reader.NameTable.Add(@"__TypeNameWithSpecialCharacters漢ñ"); id31_Pet = Reader.NameTable.Add(@"Pet"); - id128_ArrayOfString = Reader.NameTable.Add(@"ArrayOfString"); - id18_PurchaseOrder = Reader.NameTable.Add(@"PurchaseOrder"); - id271_TestProperty = Reader.NameTable.Add(@"TestProperty"); - id241_MyField = Reader.NameTable.Add(@"MyField"); - id170_LicenseNumber = Reader.NameTable.Add(@"LicenseNumber"); - id78_ShortEnum = Reader.NameTable.Add(@"ShortEnum"); - id211_StringProperty = Reader.NameTable.Add(@"StringProperty"); - id243_Item = Reader.NameTable.Add(@"UnqualifiedSchemaFormListProperty"); - id207_MyStruct = Reader.NameTable.Add(@"MyStruct"); - id21_OrderedItem = Reader.NameTable.Add(@"OrderedItem"); - id208_MyEnum1 = Reader.NameTable.Add(@"MyEnum1"); - id160_DTO = Reader.NameTable.Add(@"DTO"); - id169_Breed = Reader.NameTable.Add(@"Breed"); - id35_RootElement = Reader.NameTable.Add(@"RootElement"); - id265_Item = Reader.NameTable.Add(@"Item"); - id142_NoneParameter = Reader.NameTable.Add(@"NoneParameter"); - id141_ArrayOfString1 = Reader.NameTable.Add(@"ArrayOfString1"); - id215_ClassID = Reader.NameTable.Add(@"ClassID"); - id100_TypeWithShouldSerializeMethod = Reader.NameTable.Add(@"TypeWithShouldSerializeMethod"); - id26_dateTime = Reader.NameTable.Add(@"dateTime"); + id90_TypeWithPropertyNameSpecified = Reader.NameTable.Add(@"TypeWithPropertyNameSpecified"); + id1_TypeWithXmlElementProperty = Reader.NameTable.Add(@"TypeWithXmlElementProperty"); + id127_MsgDocumentType = Reader.NameTable.Add(@"MsgDocumentType"); + id130_ArrayOfInt = Reader.NameTable.Add(@"ArrayOfInt"); + id182_Zip = Reader.NameTable.Add(@"Zip"); + id175_GroupName = Reader.NameTable.Add(@"GroupName"); + id204_xelements = Reader.NameTable.Add(@"xelements"); + id187_ShipCost = Reader.NameTable.Add(@"ShipCost"); + id173_Breed = Reader.NameTable.Add(@"Breed"); + id33_Item = Reader.NameTable.Add(@"DefaultValuesSetToPositiveInfinity"); + id242_Number = Reader.NameTable.Add(@"Number"); + id96_TypeWithXmlQualifiedName = Reader.NameTable.Add(@"TypeWithXmlQualifiedName"); + id231_Some = Reader.NameTable.Add(@"Some"); id6_TypeWithTimeSpanProperty = Reader.NameTable.Add(@"TypeWithTimeSpanProperty"); - id162_DefaultDTO = Reader.NameTable.Add(@"DefaultDTO"); - id114_LastName = Reader.NameTable.Add(@"LastName"); - id105_MoreChoices = Reader.NameTable.Add(@"MoreChoices"); - id206_Data = Reader.NameTable.Add(@"Data"); - id172_GroupVehicle = Reader.NameTable.Add(@"GroupVehicle"); - id192_SingleField = Reader.NameTable.Add(@"SingleField"); - id87_SimpleKnownTypeValue = Reader.NameTable.Add(@"SimpleKnownTypeValue"); - id97_Item = Reader.NameTable.Add(@"TypeWithPropertiesHavingDefaultValue"); - id232_XmlIncludeProperty = Reader.NameTable.Add(@"XmlIncludeProperty"); - id99_Item = Reader.NameTable.Add(@"TypeWithEnumFlagPropertyHavingDefaultValue"); - id74_WithEnums = Reader.NameTable.Add(@"WithEnums"); - id264_HexBinaryContent = Reader.NameTable.Add(@"HexBinaryContent"); - id37_Document = Reader.NameTable.Add(@"Document"); + id113_TypeClashB = Reader.NameTable.Add(@"TypeClashB"); + id59_TypeA = Reader.NameTable.Add(@"TypeA"); + id274_NMTOKENSContent = Reader.NameTable.Add(@"NMTOKENSContent"); + id91_TypeWithXmlSchemaFormAttribute = Reader.NameTable.Add(@"TypeWithXmlSchemaFormAttribute"); + id56_DCStruct = Reader.NameTable.Add(@"DCStruct"); + id178_value = Reader.NameTable.Add(@"value"); + id100_Item = Reader.NameTable.Add(@"TypeWithEnumFlagPropertyHavingDefaultValue"); + id238_Struct1 = Reader.NameTable.Add(@"Struct1"); + id27_Orchestra = Reader.NameTable.Add(@"Orchestra"); + id155_IsValved = Reader.NameTable.Add(@"IsValved"); + id8_TypeWithByteProperty = Reader.NameTable.Add(@"TypeWithByteProperty"); + id239_Struct2 = Reader.NameTable.Add(@"Struct2"); + id83_ULongEnum = Reader.NameTable.Add(@"ULongEnum"); + id53_anyType = Reader.NameTable.Add(@"anyType"); + id176_GroupVehicle = Reader.NameTable.Add(@"GroupVehicle"); + id195_DoubleField = Reader.NameTable.Add(@"DoubleField"); + id264_EnumProperty = Reader.NameTable.Add(@"EnumProperty"); + id120_ContainerType = Reader.NameTable.Add(@"ContainerType"); + id144_httpmynamespace = Reader.NameTable.Add(@"http://mynamespace"); + id157_ItemName = Reader.NameTable.Add(@"ItemName"); + id244_XmlIncludeProperty = Reader.NameTable.Add(@"XmlIncludeProperty"); + id209_IntAField = Reader.NameTable.Add(@"IntAField"); + id142_ArrayOfTypeA = Reader.NameTable.Add(@"ArrayOfTypeA"); + id150_P1 = Reader.NameTable.Add(@"P1"); + id40_Parameter = Reader.NameTable.Add(@"Parameter"); + id202_Parameters = Reader.NameTable.Add(@"Parameters"); + id48_TypeWithArraylikeMembers = Reader.NameTable.Add(@"TypeWithArraylikeMembers"); + id77_ByteEnum = Reader.NameTable.Add(@"ByteEnum"); + id14_Vehicle = Reader.NameTable.Add(@"Vehicle"); id42_XElementStruct = Reader.NameTable.Add(@"XElementStruct"); - id113_MiddleName = Reader.NameTable.Add(@"MiddleName"); + id271_NameContent = Reader.NameTable.Add(@"NameContent"); + id16_BaseClass = Reader.NameTable.Add(@"BaseClass"); + id226_ListProperty = Reader.NameTable.Add(@"ListProperty"); + id82_LongEnum = Reader.NameTable.Add(@"LongEnum"); + id272_NCNameContent = Reader.NameTable.Add(@"NCNameContent"); + id138_ArrayOfParameter = Reader.NameTable.Add(@"ArrayOfParameter"); + id153_Child = Reader.NameTable.Add(@"Child"); + id26_dateTime = Reader.NameTable.Add(@"dateTime"); + id257_Item = Reader.NameTable.Add(@"QualifiedSchemaFormListProperty"); + id21_OrderedItem = Reader.NameTable.Add(@"OrderedItem"); + id134_ArrayOfDouble = Reader.NameTable.Add(@"ArrayOfDouble"); + id75_WithEnums = Reader.NameTable.Add(@"WithEnums"); + id102_Item = Reader.NameTable.Add(@"KnownTypesThroughConstructorWithArrayProperties"); + id240_XmlAttributeName = Reader.NameTable.Add(@"XmlAttributeName"); + id222_Item = Reader.NameTable.Add(@"PropertyNameWithSpecialCharacters漢ñ"); + id55_TypeWithEnumMembers = Reader.NameTable.Add(@"TypeWithEnumMembers"); + id20_Address = Reader.NameTable.Add(@"Address"); + id277_Item = Reader.NameTable.Add(@"Item"); + id112_Root = Reader.NameTable.Add(@"Root"); + id147_ArrayOfBoolean = Reader.NameTable.Add(@"ArrayOfBoolean"); + id165_DTO2 = Reader.NameTable.Add(@"DTO2"); id41_XElementWrapper = Reader.NameTable.Add(@"XElementWrapper"); + id227_ClassID = Reader.NameTable.Add(@"ClassID"); + id248_httpelement = Reader.NameTable.Add(@"http://element"); + id236_OptionalInt = Reader.NameTable.Add(@"OptionalInt"); + id186_SubTotal = Reader.NameTable.Add(@"SubTotal"); + id246_Item = Reader.NameTable.Add(@"XmlNamespaceDeclarationsProperty"); + id270_DateContent = Reader.NameTable.Add(@"DateContent"); + id218_Data = Reader.NameTable.Add(@"Data"); + id3_TypeWithXmlDocumentProperty = Reader.NameTable.Add(@"TypeWithXmlDocumentProperty"); + id87_KnownTypesThroughConstructor = Reader.NameTable.Add(@"KnownTypesThroughConstructor"); + id141_ArrayOfSimpleType = Reader.NameTable.Add(@"ArrayOfSimpleType"); + id137_ArrayOfTypeWithLinkedProperty = Reader.NameTable.Add(@"ArrayOfTypeWithLinkedProperty"); + id101_TypeWithShouldSerializeMethod = Reader.NameTable.Add(@"TypeWithShouldSerializeMethod"); + id201_refs = Reader.NameTable.Add(@"refs"); + id161_LineTotal = Reader.NameTable.Add(@"LineTotal"); + id215_IntLProp = Reader.NameTable.Add(@"IntLProp"); + id109_ComplexChoiceB = Reader.NameTable.Add(@"ComplexChoiceB"); + id10_Animal = Reader.NameTable.Add(@"Animal"); + id280_IntField2 = Reader.NameTable.Add(@"IntField2"); + id174_LicenseNumber = Reader.NameTable.Add(@"LicenseNumber"); + id93_Item = Reader.NameTable.Add(@"TypeWithSchemaFormInXmlAttribute"); + id66_Item = Reader.NameTable.Add(@"TypeWithDateTimePropertyAsXmlTime"); + id164_DTO = Reader.NameTable.Add(@"DTO"); id44_TypeWithDateTimeStringProperty = Reader.NameTable.Add(@"TypeWithDateTimeStringProperty"); - id226_Struct1 = Reader.NameTable.Add(@"Struct1"); - id183_ShipCost = Reader.NameTable.Add(@"ShipCost"); - id145_ArrayOfArrayOfSimpleType = Reader.NameTable.Add(@"ArrayOfArrayOfSimpleType"); + id35_RootElement = Reader.NameTable.Add(@"RootElement"); + id223_StringProperty = Reader.NameTable.Add(@"StringProperty"); + id170_TimeSpanProperty2 = Reader.NameTable.Add(@"TimeSpanProperty2"); id22_AliasedTestType = Reader.NameTable.Add(@"AliasedTestType"); - id32_DefaultValuesSetToNaN = Reader.NameTable.Add(@"DefaultValuesSetToNaN"); - id167_ByteProperty = Reader.NameTable.Add(@"ByteProperty"); - id151_IsValved = Reader.NameTable.Add(@"IsValved"); - id34_Item = Reader.NameTable.Add(@"DefaultValuesSetToNegativeInfinity"); - id209_ByteArray = Reader.NameTable.Add(@"ByteArray"); - id152_Modulation = Reader.NameTable.Add(@"Modulation"); - id111_Person = Reader.NameTable.Add(@"Person"); - id188_Prop = Reader.NameTable.Add(@"Prop"); - id29_Brass = Reader.NameTable.Add(@"Brass"); - id25_ArrayOfDateTime = Reader.NameTable.Add(@"ArrayOfDateTime"); - id184_TotalCost = Reader.NameTable.Add(@"TotalCost"); - id268_IntField2 = Reader.NameTable.Add(@"IntField2"); - id204_F2 = Reader.NameTable.Add(@"F2"); - id15_Employee = Reader.NameTable.Add(@"Employee"); - id195_IntValue = Reader.NameTable.Add(@"IntValue"); - id147_P2 = Reader.NameTable.Add(@"P2"); + id206_CurrentDateTime = Reader.NameTable.Add(@"CurrentDateTime"); + id210_NIntAField = Reader.NameTable.Add(@"NIntAField"); + id132_ArrayOfString = Reader.NameTable.Add(@"ArrayOfString"); + id154_Children = Reader.NameTable.Add(@"Children"); + id126_ParameterOfString = Reader.NameTable.Add(@"ParameterOfString"); + id184_OrderDate = Reader.NameTable.Add(@"OrderDate"); + id205_DateTimeString = Reader.NameTable.Add(@"DateTimeString"); + id269_QNameContent = Reader.NameTable.Add(@"QNameContent"); + id237_OptionullInt = Reader.NameTable.Add(@"OptionullInt"); + id241_Word = Reader.NameTable.Add(@"Word"); + id168_NullableDefaultDTO = Reader.NameTable.Add(@"NullableDefaultDTO"); + id172_Age = Reader.NameTable.Add(@"Age"); + id19_httpwwwcontoso1com = Reader.NameTable.Add(@"http://www.contoso1.com"); + id220_MyEnum1 = Reader.NameTable.Add(@"MyEnum1"); + id18_PurchaseOrder = Reader.NameTable.Add(@"PurchaseOrder"); + id199_IntValue = Reader.NameTable.Add(@"IntValue"); + id159_UnitPrice = Reader.NameTable.Add(@"UnitPrice"); + id92_MyXmlType = Reader.NameTable.Add(@"MyXmlType"); id36_TypeWithLinkedProperty = Reader.NameTable.Add(@"TypeWithLinkedProperty"); - id136_XElement = Reader.NameTable.Add(@"XElement"); - id199_xelement = Reader.NameTable.Add(@"xelement"); - id50_Item = Reader.NameTable.Add(@"TypeWithReadOnlyMyCollectionProperty"); - id236_httpelement = Reader.NameTable.Add(@"http://element"); - id112_FirstName = Reader.NameTable.Add(@"FirstName"); - id58_TypeA = Reader.NameTable.Add(@"TypeA"); - id85_TypeWithAnyAttribute = Reader.NameTable.Add(@"TypeWithAnyAttribute"); - id153_ItemName = Reader.NameTable.Add(@"ItemName"); - id48_StructNotSerializable = Reader.NameTable.Add(@"StructNotSerializable"); - id116_ContainerType = Reader.NameTable.Add(@"ContainerType"); - id227_Struct2 = Reader.NameTable.Add(@"Struct2"); - id163_NullableDTO = Reader.NameTable.Add(@"NullableDTO"); - id110_TypeClashA = Reader.NameTable.Add(@"TypeClashA"); - id11_Dog = Reader.NameTable.Add(@"Dog"); - id8_TypeWithByteProperty = Reader.NameTable.Add(@"TypeWithByteProperty"); - id127_int = Reader.NameTable.Add(@"int"); - id185_X = Reader.NameTable.Add(@"X"); - id139_ArrayOfItemChoiceType = Reader.NameTable.Add(@"ArrayOfItemChoiceType"); - id137_ArrayOfSimpleType = Reader.NameTable.Add(@"ArrayOfSimpleType"); - id23_BaseClass1 = Reader.NameTable.Add(@"BaseClass1"); - id123_MsgDocumentType = Reader.NameTable.Add(@"MsgDocumentType"); - id173_EmployeeName = Reader.NameTable.Add(@"EmployeeName"); - id150_Children = Reader.NameTable.Add(@"Children"); - id131_double = Reader.NameTable.Add(@"double"); - id119_Value1 = Reader.NameTable.Add(@"Value1"); - id38_httpexamplecom = Reader.NameTable.Add(@"http://example.com"); - id12_DogBreed = Reader.NameTable.Add(@"DogBreed"); - id175_Line1 = Reader.NameTable.Add(@"Line1"); - id115_Name = Reader.NameTable.Add(@"Name"); - id166_TimeSpanProperty2 = Reader.NameTable.Add(@"TimeSpanProperty2"); - id91_MyXmlType = Reader.NameTable.Add(@"MyXmlType"); - id248_MetricConfigUrl = Reader.NameTable.Add(@"MetricConfigUrl"); - id5_Item = Reader.NameTable.Add(@"TypeWithDateTimeOffsetProperties"); - id217_Id = Reader.NameTable.Add(@"Id"); - id98_Item = Reader.NameTable.Add(@"TypeWithEnumPropertyHavingDefaultValue"); - id126_ArrayOfInt = Reader.NameTable.Add(@"ArrayOfInt"); - id237_CustomXmlArrayProperty = Reader.NameTable.Add(@"CustomXmlArrayProperty"); - id242_MyFieldIgnored = Reader.NameTable.Add(@"MyFieldIgnored"); - id213_DateTimeProperty = Reader.NameTable.Add(@"DateTimeProperty"); - id77_SByteEnum = Reader.NameTable.Add(@"SByteEnum"); - id102_Item = Reader.NameTable.Add(@"KnownTypesThroughConstructorWithValue"); - id156_Quantity = Reader.NameTable.Add(@"Quantity"); - id164_NullableDefaultDTO = Reader.NameTable.Add(@"NullableDefaultDTO"); - id17_DerivedClass = Reader.NameTable.Add(@"DerivedClass"); - id262_NMTOKENSContent = Reader.NameTable.Add(@"NMTOKENSContent"); - id82_ULongEnum = Reader.NameTable.Add(@"ULongEnum"); - id223_Optionull = Reader.NameTable.Add(@"Optionull"); - id54_TypeWithEnumMembers = Reader.NameTable.Add(@"TypeWithEnumMembers"); - id178_Zip = Reader.NameTable.Add(@"Zip"); - id224_OptionalInt = Reader.NameTable.Add(@"OptionalInt"); - id272_httptestcom = Reader.NameTable.Add(@"http://test.com"); - id190_Comment2 = Reader.NameTable.Add(@"Comment2"); - id83_AttributeTesting = Reader.NameTable.Add(@"AttributeTesting"); - id30_Trumpet = Reader.NameTable.Add(@"Trumpet"); - id47_TypeWithGetOnlyArrayProperties = Reader.NameTable.Add(@"TypeWithGetOnlyArrayProperties"); - id65_Item = Reader.NameTable.Add(@"TypeWithDateTimePropertyAsXmlTime"); - id51_ArrayOfAnyType = Reader.NameTable.Add(@"ArrayOfAnyType"); - id255_IntArrayValue = Reader.NameTable.Add(@"IntArrayValue"); - id222_Optional = Reader.NameTable.Add(@"Optional"); - id28_Instrument = Reader.NameTable.Add(@"Instrument"); - id253_Foo = Reader.NameTable.Add(@"Foo"); - id13_Group = Reader.NameTable.Add(@"Group"); + id253_MyField = Reader.NameTable.Add(@"MyField"); + id98_Item = Reader.NameTable.Add(@"TypeWithPropertiesHavingDefaultValue"); + id69_Item = Reader.NameTable.Add(@"TypeWithXmlTextAttributeOnArray"); + id148_QualifiedParameter = Reader.NameTable.Add(@"QualifiedParameter"); + id145_ArrayOfString1 = Reader.NameTable.Add(@"ArrayOfString1"); + id4_TypeWithBinaryProperty = Reader.NameTable.Add(@"TypeWithBinaryProperty"); + id251_SimpleTypeValue = Reader.NameTable.Add(@"SimpleTypeValue"); id24_DerivedClass1 = Reader.NameTable.Add(@"DerivedClass1"); - id81_LongEnum = Reader.NameTable.Add(@"LongEnum"); - id94_ServerSettings = Reader.NameTable.Add(@"ServerSettings"); - id62_BaseClassWithSamePropertyName = Reader.NameTable.Add(@"BaseClassWithSamePropertyName"); - id146_P1 = Reader.NameTable.Add(@"P1"); - id133_ArrayOfTypeWithLinkedProperty = Reader.NameTable.Add(@"ArrayOfTypeWithLinkedProperty"); - id230_Number = Reader.NameTable.Add(@"Number"); - id239_SimpleTypeValue = Reader.NameTable.Add(@"SimpleTypeValue"); - id89_TypeWithPropertyNameSpecified = Reader.NameTable.Add(@"TypeWithPropertyNameSpecified"); - id269_StringField2 = Reader.NameTable.Add(@"StringField2"); - id159_Base64Content = Reader.NameTable.Add(@"Base64Content"); - id122_ParameterOfString = Reader.NameTable.Add(@"ParameterOfString"); - id155_UnitPrice = Reader.NameTable.Add(@"UnitPrice"); - id233_XmlEnumProperty = Reader.NameTable.Add(@"XmlEnumProperty"); - id134_ArrayOfParameter = Reader.NameTable.Add(@"ArrayOfParameter"); - id174_value = Reader.NameTable.Add(@"value"); - id246_XmlAttributeForm = Reader.NameTable.Add(@"XmlAttributeForm"); - id198_Parameters = Reader.NameTable.Add(@"Parameters"); - id130_ArrayOfDouble = Reader.NameTable.Add(@"ArrayOfDouble"); - id193_DoubleProp = Reader.NameTable.Add(@"DoubleProp"); - id101_Item = Reader.NameTable.Add(@"KnownTypesThroughConstructorWithArrayProperties"); - id219_Some = Reader.NameTable.Add(@"Some"); - id138_ArrayOfTypeA = Reader.NameTable.Add(@"ArrayOfTypeA"); - id59_TypeB = Reader.NameTable.Add(@"TypeB"); - id2_Item = Reader.NameTable.Add(@""); - id45_SimpleType = Reader.NameTable.Add(@"SimpleType"); - id181_Items = Reader.NameTable.Add(@"Items"); - id154_Description = Reader.NameTable.Add(@"Description"); - id240_StrProperty = Reader.NameTable.Add(@"StrProperty"); - id106_TypeWithFieldsOrdered = Reader.NameTable.Add(@"TypeWithFieldsOrdered"); - id256_DateTimeContent = Reader.NameTable.Add(@"DateTimeContent"); - id63_DerivedClassWithSameProperty = Reader.NameTable.Add(@"DerivedClassWithSameProperty"); - id261_NMTOKENContent = Reader.NameTable.Add(@"NMTOKENContent"); + id97_TypeWith2DArrayProperty2 = Reader.NameTable.Add(@"TypeWith2DArrayProperty2"); + id30_Trumpet = Reader.NameTable.Add(@"Trumpet"); + id63_BaseClassWithSamePropertyName = Reader.NameTable.Add(@"BaseClassWithSamePropertyName"); + id217_Collection = Reader.NameTable.Add(@"Collection"); + id224_IntProperty = Reader.NameTable.Add(@"IntProperty"); + id185_Items = Reader.NameTable.Add(@"Items"); + id183_ShipTo = Reader.NameTable.Add(@"ShipTo"); + id193_Instruments = Reader.NameTable.Add(@"Instruments"); + id275_Base64BinaryContent = Reader.NameTable.Add(@"Base64BinaryContent"); + id80_IntEnum = Reader.NameTable.Add(@"IntEnum"); + id12_DogBreed = Reader.NameTable.Add(@"DogBreed"); id7_Item = Reader.NameTable.Add(@"TypeWithDefaultTimeSpanProperty"); - id86_KnownTypesThroughConstructor = Reader.NameTable.Add(@"KnownTypesThroughConstructor"); - id247_DS2Root = Reader.NameTable.Add(@"DS2Root"); - id1_TypeWithXmlElementProperty = Reader.NameTable.Add(@"TypeWithXmlElementProperty"); - id225_OptionullInt = Reader.NameTable.Add(@"OptionullInt"); - id177_State = Reader.NameTable.Add(@"State"); - id67_SimpleDC = Reader.NameTable.Add(@"SimpleDC"); - id14_Vehicle = Reader.NameTable.Add(@"Vehicle"); - id84_ItemChoiceType = Reader.NameTable.Add(@"ItemChoiceType"); - id60_TypeHasArrayOfASerializedAsB = Reader.NameTable.Add(@"TypeHasArrayOfASerializedAsB"); - id49_TypeWithMyCollectionField = Reader.NameTable.Add(@"TypeWithMyCollectionField"); - id176_City = Reader.NameTable.Add(@"City"); - id52_anyType = Reader.NameTable.Add(@"anyType"); - id75_WithNullables = Reader.NameTable.Add(@"WithNullables"); - id27_Orchestra = Reader.NameTable.Add(@"Orchestra"); - id251_CharProperty = Reader.NameTable.Add(@"CharProperty"); - id197_refs = Reader.NameTable.Add(@"refs"); - id19_httpwwwcontoso1com = Reader.NameTable.Add(@"http://www.contoso1.com"); - id218_IsLoaded = Reader.NameTable.Add(@"IsLoaded"); - id40_Parameter = Reader.NameTable.Add(@"Parameter"); - id238_EnumValue = Reader.NameTable.Add(@"EnumValue"); - id148_Value = Reader.NameTable.Add(@"Value"); - id73_SomeStruct = Reader.NameTable.Add(@"SomeStruct"); - id92_Item = Reader.NameTable.Add(@"TypeWithSchemaFormInXmlAttribute"); - id88_Item = Reader.NameTable.Add(@"ClassImplementingIXmlSerialiable"); - id135_ArrayOfXElement = Reader.NameTable.Add(@"ArrayOfXElement"); - id244_NoneSchemaFormListProperty = Reader.NameTable.Add(@"NoneSchemaFormListProperty"); - id71_ClassImplementsInterface = Reader.NameTable.Add(@"ClassImplementsInterface"); - id109_TypeClashB = Reader.NameTable.Add(@"TypeClashB"); - id140_httpmynamespace = Reader.NameTable.Add(@"http://mynamespace"); - id96_TypeWith2DArrayProperty2 = Reader.NameTable.Add(@"TypeWith2DArrayProperty2"); - id143_ArrayOfBoolean = Reader.NameTable.Add(@"ArrayOfBoolean"); - id103_Item = Reader.NameTable.Add(@"TypeWithTypesHavingCustomFormatter"); - id245_Item = Reader.NameTable.Add(@"QualifiedSchemaFormListProperty"); - id267_IntField1 = Reader.NameTable.Add(@"IntField1"); - id90_TypeWithXmlSchemaFormAttribute = Reader.NameTable.Add(@"TypeWithXmlSchemaFormAttribute"); - id76_ByteEnum = Reader.NameTable.Add(@"ByteEnum"); - id93_Item = Reader.NameTable.Add(@"TypeWithNonPublicDefaultConstructor"); - id202_CurrentDateTime = Reader.NameTable.Add(@"CurrentDateTime"); - id200_xelements = Reader.NameTable.Add(@"xelements"); - id189_Instruments = Reader.NameTable.Add(@"Instruments"); - id171_GroupName = Reader.NameTable.Add(@"GroupName"); - id80_UIntEnum = Reader.NameTable.Add(@"UIntEnum"); - id16_BaseClass = Reader.NameTable.Add(@"BaseClass"); - id72_WithStruct = Reader.NameTable.Add(@"WithStruct"); - id205_Collection = Reader.NameTable.Add(@"Collection"); - id95_TypeWithXmlQualifiedName = Reader.NameTable.Add(@"TypeWithXmlQualifiedName"); - id257_QNameContent = Reader.NameTable.Add(@"QNameContent"); - id179_ShipTo = Reader.NameTable.Add(@"ShipTo"); - id132_ArrayOfInstrument = Reader.NameTable.Add(@"ArrayOfInstrument"); - id57_BuiltInTypes = Reader.NameTable.Add(@"BuiltInTypes"); - id61_Item = Reader.NameTable.Add(@"__TypeNameWithSpecialCharacters漢ñ"); - id158_BinaryHexContent = Reader.NameTable.Add(@"BinaryHexContent"); - id104_Item = Reader.NameTable.Add(@"TypeWithArrayPropertyHavingChoice"); - id124_Item = Reader.NameTable.Add(@"TypeWithMismatchBetweenAttributeAndPropertyType"); - id249_TwoDArrayOfSimpleType = Reader.NameTable.Add(@"TwoDArrayOfSimpleType"); - id191_DoubleField = Reader.NameTable.Add(@"DoubleField"); - id46_TypeWithGetSetArrayMembers = Reader.NameTable.Add(@"TypeWithGetSetArrayMembers"); - id4_TypeWithBinaryProperty = Reader.NameTable.Add(@"TypeWithBinaryProperty"); - id221_Short = Reader.NameTable.Add(@"Short"); - id144_QualifiedParameter = Reader.NameTable.Add(@"QualifiedParameter"); - id149_Child = Reader.NameTable.Add(@"Child"); - id203_F1 = Reader.NameTable.Add(@"F1"); - id69_Item = Reader.NameTable.Add(@"http://schemas.xmlsoap.org/ws/2005/04/discovery"); - id229_Word = Reader.NameTable.Add(@"Word"); - id3_TypeWithXmlDocumentProperty = Reader.NameTable.Add(@"TypeWithXmlDocumentProperty"); - id20_Address = Reader.NameTable.Add(@"Address"); - id120_Value2 = Reader.NameTable.Add(@"Value2"); - id121_XmlSerializerAttributes = Reader.NameTable.Add(@"XmlSerializerAttributes"); - id180_OrderDate = Reader.NameTable.Add(@"OrderDate"); - id70_EnumFlags = Reader.NameTable.Add(@"EnumFlags"); - id266_Amount = Reader.NameTable.Add(@"Amount"); - id9_TypeWithXmlNodeArrayProperty = Reader.NameTable.Add(@"TypeWithXmlNodeArrayProperty"); - id259_NameContent = Reader.NameTable.Add(@"NameContent"); - id220_Int = Reader.NameTable.Add(@"Int"); - id64_DerivedClassWithSameProperty2 = Reader.NameTable.Add(@"DerivedClassWithSameProperty2"); - id125_ArrayOfOrderedItem = Reader.NameTable.Add(@"ArrayOfOrderedItem"); - id157_LineTotal = Reader.NameTable.Add(@"LineTotal"); - id254_StringArrayValue = Reader.NameTable.Add(@"StringArrayValue"); - id107_Item = Reader.NameTable.Add(@"TypeWithKnownTypesOfCollectionsWithConflictingXmlName"); - id56_DCClassWithEnumAndStruct = Reader.NameTable.Add(@"DCClassWithEnumAndStruct"); - id270_StringField1 = Reader.NameTable.Add(@"StringField1"); - id182_SubTotal = Reader.NameTable.Add(@"SubTotal"); - id108_Root = Reader.NameTable.Add(@"Root"); - id39_RootClass = Reader.NameTable.Add(@"RootClass"); - id258_DateContent = Reader.NameTable.Add(@"DateContent"); + id136_ArrayOfInstrument = Reader.NameTable.Add(@"ArrayOfInstrument"); + id135_double = Reader.NameTable.Add(@"double"); + id50_TypeWithMyCollectionField = Reader.NameTable.Add(@"TypeWithMyCollectionField"); + id124_Value2 = Reader.NameTable.Add(@"Value2"); + id110_TypeWithFieldsOrdered = Reader.NameTable.Add(@"TypeWithFieldsOrdered"); + id146_NoneParameter = Reader.NameTable.Add(@"NoneParameter"); + id37_Document = Reader.NameTable.Add(@"Document"); + id254_MyFieldIgnored = Reader.NameTable.Add(@"MyFieldIgnored"); + id279_IntField1 = Reader.NameTable.Add(@"IntField1"); + id249_CustomXmlArrayProperty = Reader.NameTable.Add(@"CustomXmlArrayProperty"); + id54_MyEnum = Reader.NameTable.Add(@"MyEnum"); + id207_F1 = Reader.NameTable.Add(@"F1"); + id143_ArrayOfItemChoiceType = Reader.NameTable.Add(@"ArrayOfItemChoiceType"); + id108_ComplexChoiceA = Reader.NameTable.Add(@"ComplexChoiceA"); + id94_Item = Reader.NameTable.Add(@"TypeWithNonPublicDefaultConstructor"); + id121_A = Reader.NameTable.Add(@"A"); + id5_Item = Reader.NameTable.Add(@"TypeWithDateTimeOffsetProperties"); + id256_NoneSchemaFormListProperty = Reader.NameTable.Add(@"NoneSchemaFormListProperty"); + id166_DefaultDTO = Reader.NameTable.Add(@"DefaultDTO"); + id65_DerivedClassWithSameProperty2 = Reader.NameTable.Add(@"DerivedClassWithSameProperty2"); + id34_Item = Reader.NameTable.Add(@"DefaultValuesSetToNegativeInfinity"); + id32_DefaultValuesSetToNaN = Reader.NameTable.Add(@"DefaultValuesSetToNaN"); + id219_MyStruct = Reader.NameTable.Add(@"MyStruct"); + id23_BaseClass1 = Reader.NameTable.Add(@"BaseClass1"); + id46_TypeWithGetSetArrayMembers = Reader.NameTable.Add(@"TypeWithGetSetArrayMembers"); + id266_StringArrayValue = Reader.NameTable.Add(@"StringArrayValue"); + id160_Quantity = Reader.NameTable.Add(@"Quantity"); + id78_SByteEnum = Reader.NameTable.Add(@"SByteEnum"); + id45_SimpleType = Reader.NameTable.Add(@"SimpleType"); + id258_XmlAttributeForm = Reader.NameTable.Add(@"XmlAttributeForm"); + id118_LastName = Reader.NameTable.Add(@"LastName"); + id282_StringField1 = Reader.NameTable.Add(@"StringField1"); + id49_StructNotSerializable = Reader.NameTable.Add(@"StructNotSerializable"); + id52_ArrayOfAnyType = Reader.NameTable.Add(@"ArrayOfAnyType"); + id152_Value = Reader.NameTable.Add(@"Value"); + id28_Instrument = Reader.NameTable.Add(@"Instrument"); + id29_Brass = Reader.NameTable.Add(@"Brass"); + id117_MiddleName = Reader.NameTable.Add(@"MiddleName"); + id276_HexBinaryContent = Reader.NameTable.Add(@"HexBinaryContent"); + id194_Comment2 = Reader.NameTable.Add(@"Comment2"); + id70_Item = Reader.NameTable.Add(@"http://schemas.xmlsoap.org/ws/2005/04/discovery"); + id89_Item = Reader.NameTable.Add(@"ClassImplementingIXmlSerialiable"); + id116_FirstName = Reader.NameTable.Add(@"FirstName"); + id192_Prop = Reader.NameTable.Add(@"Prop"); + id139_ArrayOfXElement = Reader.NameTable.Add(@"ArrayOfXElement"); + id79_ShortEnum = Reader.NameTable.Add(@"ShortEnum"); + id85_ItemChoiceType = Reader.NameTable.Add(@"ItemChoiceType"); + id106_Item = Reader.NameTable.Add(@"TypeWithPropertyHavingComplexChoice"); + id61_TypeHasArrayOfASerializedAsB = Reader.NameTable.Add(@"TypeHasArrayOfASerializedAsB"); + id255_Item = Reader.NameTable.Add(@"UnqualifiedSchemaFormListProperty"); + id51_Item = Reader.NameTable.Add(@"TypeWithReadOnlyMyCollectionProperty"); + id99_Item = Reader.NameTable.Add(@"TypeWithEnumPropertyHavingDefaultValue"); + id114_TypeClashA = Reader.NameTable.Add(@"TypeClashA"); + id259_DS2Root = Reader.NameTable.Add(@"DS2Root"); + id115_Person = Reader.NameTable.Add(@"Person"); + id13_Group = Reader.NameTable.Add(@"Group"); + id81_UIntEnum = Reader.NameTable.Add(@"UIntEnum"); + id38_httpexamplecom = Reader.NameTable.Add(@"http://example.com"); + id177_EmployeeName = Reader.NameTable.Add(@"EmployeeName"); + id129_ArrayOfOrderedItem = Reader.NameTable.Add(@"ArrayOfOrderedItem"); + id221_ByteArray = Reader.NameTable.Add(@"ByteArray"); + id214_NIntAProp = Reader.NameTable.Add(@"NIntAProp"); + id233_Short = Reader.NameTable.Add(@"Short"); + id189_X = Reader.NameTable.Add(@"X"); + id243_DecimalNumber = Reader.NameTable.Add(@"DecimalNumber"); + id191_Z = Reader.NameTable.Add(@"Z"); + id158_Description = Reader.NameTable.Add(@"Description"); + id198_FloatProp = Reader.NameTable.Add(@"FloatProp"); + id64_DerivedClassWithSameProperty = Reader.NameTable.Add(@"DerivedClassWithSameProperty"); + id57_DCClassWithEnumAndStruct = Reader.NameTable.Add(@"DCClassWithEnumAndStruct"); + id125_XmlSerializerAttributes = Reader.NameTable.Add(@"XmlSerializerAttributes"); } } @@ -13992,11 +14830,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write107_TypeWithXmlElementProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write111_TypeWithXmlElementProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read111_TypeWithXmlElementProperty(); + return ((XmlSerializationReader1)reader).Read115_TypeWithXmlElementProperty(); } } @@ -14007,11 +14845,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write108_TypeWithXmlDocumentProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write112_TypeWithXmlDocumentProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read112_TypeWithXmlDocumentProperty(); + return ((XmlSerializationReader1)reader).Read116_TypeWithXmlDocumentProperty(); } } @@ -14022,11 +14860,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write109_TypeWithBinaryProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write113_TypeWithBinaryProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read113_TypeWithBinaryProperty(); + return ((XmlSerializationReader1)reader).Read117_TypeWithBinaryProperty(); } } @@ -14037,11 +14875,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write110_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write114_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read114_Item(); + return ((XmlSerializationReader1)reader).Read118_Item(); } } @@ -14052,11 +14890,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write111_TypeWithTimeSpanProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write115_TypeWithTimeSpanProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read115_TypeWithTimeSpanProperty(); + return ((XmlSerializationReader1)reader).Read119_TypeWithTimeSpanProperty(); } } @@ -14067,11 +14905,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write112_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write116_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read116_Item(); + return ((XmlSerializationReader1)reader).Read120_Item(); } } @@ -14082,11 +14920,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write113_TypeWithByteProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write117_TypeWithByteProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read117_TypeWithByteProperty(); + return ((XmlSerializationReader1)reader).Read121_TypeWithByteProperty(); } } @@ -14097,11 +14935,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write114_TypeWithXmlNodeArrayProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write118_TypeWithXmlNodeArrayProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read118_TypeWithXmlNodeArrayProperty(); + return ((XmlSerializationReader1)reader).Read122_TypeWithXmlNodeArrayProperty(); } } @@ -14112,11 +14950,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write115_Animal(objectToSerialize); + ((XmlSerializationWriter1)writer).Write119_Animal(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read119_Animal(); + return ((XmlSerializationReader1)reader).Read123_Animal(); } } @@ -14127,11 +14965,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write116_Dog(objectToSerialize); + ((XmlSerializationWriter1)writer).Write120_Dog(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read120_Dog(); + return ((XmlSerializationReader1)reader).Read124_Dog(); } } @@ -14142,11 +14980,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write117_DogBreed(objectToSerialize); + ((XmlSerializationWriter1)writer).Write121_DogBreed(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read121_DogBreed(); + return ((XmlSerializationReader1)reader).Read125_DogBreed(); } } @@ -14157,11 +14995,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write118_Group(objectToSerialize); + ((XmlSerializationWriter1)writer).Write122_Group(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read122_Group(); + return ((XmlSerializationReader1)reader).Read126_Group(); } } @@ -14172,11 +15010,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write119_Vehicle(objectToSerialize); + ((XmlSerializationWriter1)writer).Write123_Vehicle(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read123_Vehicle(); + return ((XmlSerializationReader1)reader).Read127_Vehicle(); } } @@ -14187,11 +15025,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write120_Employee(objectToSerialize); + ((XmlSerializationWriter1)writer).Write124_Employee(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read124_Employee(); + return ((XmlSerializationReader1)reader).Read128_Employee(); } } @@ -14202,11 +15040,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write121_BaseClass(objectToSerialize); + ((XmlSerializationWriter1)writer).Write125_BaseClass(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read125_BaseClass(); + return ((XmlSerializationReader1)reader).Read129_BaseClass(); } } @@ -14217,11 +15055,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write122_DerivedClass(objectToSerialize); + ((XmlSerializationWriter1)writer).Write126_DerivedClass(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read126_DerivedClass(); + return ((XmlSerializationReader1)reader).Read130_DerivedClass(); } } @@ -14232,11 +15070,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write123_PurchaseOrder(objectToSerialize); + ((XmlSerializationWriter1)writer).Write127_PurchaseOrder(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read127_PurchaseOrder(); + return ((XmlSerializationReader1)reader).Read131_PurchaseOrder(); } } @@ -14247,11 +15085,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write124_Address(objectToSerialize); + ((XmlSerializationWriter1)writer).Write128_Address(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read128_Address(); + return ((XmlSerializationReader1)reader).Read132_Address(); } } @@ -14262,11 +15100,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write125_OrderedItem(objectToSerialize); + ((XmlSerializationWriter1)writer).Write129_OrderedItem(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read129_OrderedItem(); + return ((XmlSerializationReader1)reader).Read133_OrderedItem(); } } @@ -14277,11 +15115,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write126_AliasedTestType(objectToSerialize); + ((XmlSerializationWriter1)writer).Write130_AliasedTestType(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read130_AliasedTestType(); + return ((XmlSerializationReader1)reader).Read134_AliasedTestType(); } } @@ -14292,11 +15130,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write127_BaseClass1(objectToSerialize); + ((XmlSerializationWriter1)writer).Write131_BaseClass1(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read131_BaseClass1(); + return ((XmlSerializationReader1)reader).Read135_BaseClass1(); } } @@ -14307,11 +15145,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write128_DerivedClass1(objectToSerialize); + ((XmlSerializationWriter1)writer).Write132_DerivedClass1(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read132_DerivedClass1(); + return ((XmlSerializationReader1)reader).Read136_DerivedClass1(); } } @@ -14322,11 +15160,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write129_ArrayOfDateTime(objectToSerialize); + ((XmlSerializationWriter1)writer).Write133_ArrayOfDateTime(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read133_ArrayOfDateTime(); + return ((XmlSerializationReader1)reader).Read137_ArrayOfDateTime(); } } @@ -14337,11 +15175,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write130_Orchestra(objectToSerialize); + ((XmlSerializationWriter1)writer).Write134_Orchestra(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read134_Orchestra(); + return ((XmlSerializationReader1)reader).Read138_Orchestra(); } } @@ -14352,11 +15190,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write131_Instrument(objectToSerialize); + ((XmlSerializationWriter1)writer).Write135_Instrument(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read135_Instrument(); + return ((XmlSerializationReader1)reader).Read139_Instrument(); } } @@ -14367,11 +15205,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write132_Brass(objectToSerialize); + ((XmlSerializationWriter1)writer).Write136_Brass(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read136_Brass(); + return ((XmlSerializationReader1)reader).Read140_Brass(); } } @@ -14382,11 +15220,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write133_Trumpet(objectToSerialize); + ((XmlSerializationWriter1)writer).Write137_Trumpet(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read137_Trumpet(); + return ((XmlSerializationReader1)reader).Read141_Trumpet(); } } @@ -14397,11 +15235,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write134_Pet(objectToSerialize); + ((XmlSerializationWriter1)writer).Write138_Pet(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read138_Pet(); + return ((XmlSerializationReader1)reader).Read142_Pet(); } } @@ -14412,11 +15250,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write135_DefaultValuesSetToNaN(objectToSerialize); + ((XmlSerializationWriter1)writer).Write139_DefaultValuesSetToNaN(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read139_DefaultValuesSetToNaN(); + return ((XmlSerializationReader1)reader).Read143_DefaultValuesSetToNaN(); } } @@ -14427,11 +15265,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write136_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write140_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read140_Item(); + return ((XmlSerializationReader1)reader).Read144_Item(); } } @@ -14442,11 +15280,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write137_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write141_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read141_Item(); + return ((XmlSerializationReader1)reader).Read145_Item(); } } @@ -14457,11 +15295,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write138_RootElement(objectToSerialize); + ((XmlSerializationWriter1)writer).Write142_RootElement(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read142_RootElement(); + return ((XmlSerializationReader1)reader).Read146_RootElement(); } } @@ -14472,11 +15310,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write139_TypeWithLinkedProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write143_TypeWithLinkedProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read143_TypeWithLinkedProperty(); + return ((XmlSerializationReader1)reader).Read147_TypeWithLinkedProperty(); } } @@ -14487,11 +15325,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write140_Document(objectToSerialize); + ((XmlSerializationWriter1)writer).Write144_Document(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read144_Document(); + return ((XmlSerializationReader1)reader).Read148_Document(); } } @@ -14502,11 +15340,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write141_RootClass(objectToSerialize); + ((XmlSerializationWriter1)writer).Write145_RootClass(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read145_RootClass(); + return ((XmlSerializationReader1)reader).Read149_RootClass(); } } @@ -14517,11 +15355,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write142_Parameter(objectToSerialize); + ((XmlSerializationWriter1)writer).Write146_Parameter(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read146_Parameter(); + return ((XmlSerializationReader1)reader).Read150_Parameter(); } } @@ -14532,11 +15370,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write143_XElementWrapper(objectToSerialize); + ((XmlSerializationWriter1)writer).Write147_XElementWrapper(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read147_XElementWrapper(); + return ((XmlSerializationReader1)reader).Read151_XElementWrapper(); } } @@ -14547,11 +15385,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write144_XElementStruct(objectToSerialize); + ((XmlSerializationWriter1)writer).Write148_XElementStruct(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read148_XElementStruct(); + return ((XmlSerializationReader1)reader).Read152_XElementStruct(); } } @@ -14562,11 +15400,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write145_XElementArrayWrapper(objectToSerialize); + ((XmlSerializationWriter1)writer).Write149_XElementArrayWrapper(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read149_XElementArrayWrapper(); + return ((XmlSerializationReader1)reader).Read153_XElementArrayWrapper(); } } @@ -14577,11 +15415,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write146_TypeWithDateTimeStringProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write150_TypeWithDateTimeStringProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read150_TypeWithDateTimeStringProperty(); + return ((XmlSerializationReader1)reader).Read154_TypeWithDateTimeStringProperty(); } } @@ -14592,11 +15430,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write147_SimpleType(objectToSerialize); + ((XmlSerializationWriter1)writer).Write151_SimpleType(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read151_SimpleType(); + return ((XmlSerializationReader1)reader).Read155_SimpleType(); } } @@ -14607,11 +15445,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write148_TypeWithGetSetArrayMembers(objectToSerialize); + ((XmlSerializationWriter1)writer).Write152_TypeWithGetSetArrayMembers(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read152_TypeWithGetSetArrayMembers(); + return ((XmlSerializationReader1)reader).Read156_TypeWithGetSetArrayMembers(); } } @@ -14622,11 +15460,26 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write149_TypeWithGetOnlyArrayProperties(objectToSerialize); + ((XmlSerializationWriter1)writer).Write153_TypeWithGetOnlyArrayProperties(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read157_TypeWithGetOnlyArrayProperties(); + } + } + + public sealed class TypeWithArraylikeMembersSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"TypeWithArraylikeMembers", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write154_TypeWithArraylikeMembers(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read153_TypeWithGetOnlyArrayProperties(); + return ((XmlSerializationReader1)reader).Read158_TypeWithArraylikeMembers(); } } @@ -14637,11 +15490,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write150_StructNotSerializable(objectToSerialize); + ((XmlSerializationWriter1)writer).Write155_StructNotSerializable(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read154_StructNotSerializable(); + return ((XmlSerializationReader1)reader).Read159_StructNotSerializable(); } } @@ -14652,11 +15505,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write151_TypeWithMyCollectionField(objectToSerialize); + ((XmlSerializationWriter1)writer).Write156_TypeWithMyCollectionField(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read155_TypeWithMyCollectionField(); + return ((XmlSerializationReader1)reader).Read160_TypeWithMyCollectionField(); } } @@ -14667,11 +15520,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write152_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write157_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read156_Item(); + return ((XmlSerializationReader1)reader).Read161_Item(); } } @@ -14682,11 +15535,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write153_ArrayOfAnyType(objectToSerialize); + ((XmlSerializationWriter1)writer).Write158_ArrayOfAnyType(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read157_ArrayOfAnyType(); + return ((XmlSerializationReader1)reader).Read162_ArrayOfAnyType(); } } @@ -14697,11 +15550,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write154_MyEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write159_MyEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read158_MyEnum(); + return ((XmlSerializationReader1)reader).Read163_MyEnum(); } } @@ -14712,11 +15565,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write155_TypeWithEnumMembers(objectToSerialize); + ((XmlSerializationWriter1)writer).Write160_TypeWithEnumMembers(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read159_TypeWithEnumMembers(); + return ((XmlSerializationReader1)reader).Read164_TypeWithEnumMembers(); } } @@ -14727,11 +15580,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write156_DCStruct(objectToSerialize); + ((XmlSerializationWriter1)writer).Write161_DCStruct(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read160_DCStruct(); + return ((XmlSerializationReader1)reader).Read165_DCStruct(); } } @@ -14742,11 +15595,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write157_DCClassWithEnumAndStruct(objectToSerialize); + ((XmlSerializationWriter1)writer).Write162_DCClassWithEnumAndStruct(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read161_DCClassWithEnumAndStruct(); + return ((XmlSerializationReader1)reader).Read166_DCClassWithEnumAndStruct(); } } @@ -14757,11 +15610,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write158_BuiltInTypes(objectToSerialize); + ((XmlSerializationWriter1)writer).Write163_BuiltInTypes(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read162_BuiltInTypes(); + return ((XmlSerializationReader1)reader).Read167_BuiltInTypes(); } } @@ -14772,11 +15625,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write159_TypeA(objectToSerialize); + ((XmlSerializationWriter1)writer).Write164_TypeA(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read163_TypeA(); + return ((XmlSerializationReader1)reader).Read168_TypeA(); } } @@ -14787,11 +15640,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write160_TypeB(objectToSerialize); + ((XmlSerializationWriter1)writer).Write165_TypeB(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read164_TypeB(); + return ((XmlSerializationReader1)reader).Read169_TypeB(); } } @@ -14802,11 +15655,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write161_TypeHasArrayOfASerializedAsB(objectToSerialize); + ((XmlSerializationWriter1)writer).Write166_TypeHasArrayOfASerializedAsB(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read165_TypeHasArrayOfASerializedAsB(); + return ((XmlSerializationReader1)reader).Read170_TypeHasArrayOfASerializedAsB(); } } @@ -14817,11 +15670,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write162_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write167_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read166_Item(); + return ((XmlSerializationReader1)reader).Read171_Item(); } } @@ -14832,11 +15685,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write163_BaseClassWithSamePropertyName(objectToSerialize); + ((XmlSerializationWriter1)writer).Write168_BaseClassWithSamePropertyName(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read167_BaseClassWithSamePropertyName(); + return ((XmlSerializationReader1)reader).Read172_BaseClassWithSamePropertyName(); } } @@ -14847,11 +15700,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write164_DerivedClassWithSameProperty(objectToSerialize); + ((XmlSerializationWriter1)writer).Write169_DerivedClassWithSameProperty(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read168_DerivedClassWithSameProperty(); + return ((XmlSerializationReader1)reader).Read173_DerivedClassWithSameProperty(); } } @@ -14862,11 +15715,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write165_DerivedClassWithSameProperty2(objectToSerialize); + ((XmlSerializationWriter1)writer).Write170_DerivedClassWithSameProperty2(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read169_DerivedClassWithSameProperty2(); + return ((XmlSerializationReader1)reader).Read174_DerivedClassWithSameProperty2(); } } @@ -14877,11 +15730,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write166_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write171_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read170_Item(); + return ((XmlSerializationReader1)reader).Read175_Item(); } } @@ -14892,11 +15745,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write167_TypeWithByteArrayAsXmlText(objectToSerialize); + ((XmlSerializationWriter1)writer).Write172_TypeWithByteArrayAsXmlText(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read171_TypeWithByteArrayAsXmlText(); + return ((XmlSerializationReader1)reader).Read176_TypeWithByteArrayAsXmlText(); } } @@ -14907,11 +15760,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write168_SimpleDC(objectToSerialize); + ((XmlSerializationWriter1)writer).Write173_SimpleDC(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read172_SimpleDC(); + return ((XmlSerializationReader1)reader).Read177_SimpleDC(); } } @@ -14922,11 +15775,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write169_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write174_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read173_Item(); + return ((XmlSerializationReader1)reader).Read178_Item(); } } @@ -14937,11 +15790,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write170_EnumFlags(objectToSerialize); + ((XmlSerializationWriter1)writer).Write175_EnumFlags(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read174_EnumFlags(); + return ((XmlSerializationReader1)reader).Read179_EnumFlags(); } } @@ -14952,11 +15805,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write171_ClassImplementsInterface(objectToSerialize); + ((XmlSerializationWriter1)writer).Write176_ClassImplementsInterface(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read175_ClassImplementsInterface(); + return ((XmlSerializationReader1)reader).Read180_ClassImplementsInterface(); } } @@ -14967,11 +15820,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write172_WithStruct(objectToSerialize); + ((XmlSerializationWriter1)writer).Write177_WithStruct(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read176_WithStruct(); + return ((XmlSerializationReader1)reader).Read181_WithStruct(); } } @@ -14982,11 +15835,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write173_SomeStruct(objectToSerialize); + ((XmlSerializationWriter1)writer).Write178_SomeStruct(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read177_SomeStruct(); + return ((XmlSerializationReader1)reader).Read182_SomeStruct(); } } @@ -14997,11 +15850,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write174_WithEnums(objectToSerialize); + ((XmlSerializationWriter1)writer).Write179_WithEnums(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read178_WithEnums(); + return ((XmlSerializationReader1)reader).Read183_WithEnums(); } } @@ -15012,11 +15865,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write175_WithNullables(objectToSerialize); + ((XmlSerializationWriter1)writer).Write180_WithNullables(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read179_WithNullables(); + return ((XmlSerializationReader1)reader).Read184_WithNullables(); } } @@ -15027,11 +15880,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write176_ByteEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write181_ByteEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read180_ByteEnum(); + return ((XmlSerializationReader1)reader).Read185_ByteEnum(); } } @@ -15042,11 +15895,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write177_SByteEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write182_SByteEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read181_SByteEnum(); + return ((XmlSerializationReader1)reader).Read186_SByteEnum(); } } @@ -15057,11 +15910,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write178_ShortEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write183_ShortEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read182_ShortEnum(); + return ((XmlSerializationReader1)reader).Read187_ShortEnum(); } } @@ -15072,11 +15925,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write179_IntEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write184_IntEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read183_IntEnum(); + return ((XmlSerializationReader1)reader).Read188_IntEnum(); } } @@ -15087,11 +15940,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write180_UIntEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write185_UIntEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read184_UIntEnum(); + return ((XmlSerializationReader1)reader).Read189_UIntEnum(); } } @@ -15102,11 +15955,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write181_LongEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write186_LongEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read185_LongEnum(); + return ((XmlSerializationReader1)reader).Read190_LongEnum(); } } @@ -15117,11 +15970,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write182_ULongEnum(objectToSerialize); + ((XmlSerializationWriter1)writer).Write187_ULongEnum(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read186_ULongEnum(); + return ((XmlSerializationReader1)reader).Read191_ULongEnum(); } } @@ -15132,11 +15985,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write183_AttributeTesting(objectToSerialize); + ((XmlSerializationWriter1)writer).Write188_AttributeTesting(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read187_AttributeTesting(); + return ((XmlSerializationReader1)reader).Read192_AttributeTesting(); } } @@ -15147,11 +16000,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write184_ItemChoiceType(objectToSerialize); + ((XmlSerializationWriter1)writer).Write189_ItemChoiceType(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read188_ItemChoiceType(); + return ((XmlSerializationReader1)reader).Read193_ItemChoiceType(); } } @@ -15162,11 +16015,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write185_TypeWithAnyAttribute(objectToSerialize); + ((XmlSerializationWriter1)writer).Write190_TypeWithAnyAttribute(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read189_TypeWithAnyAttribute(); + return ((XmlSerializationReader1)reader).Read194_TypeWithAnyAttribute(); } } @@ -15177,11 +16030,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write186_KnownTypesThroughConstructor(objectToSerialize); + ((XmlSerializationWriter1)writer).Write191_KnownTypesThroughConstructor(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read190_KnownTypesThroughConstructor(); + return ((XmlSerializationReader1)reader).Read195_KnownTypesThroughConstructor(); } } @@ -15192,11 +16045,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write187_SimpleKnownTypeValue(objectToSerialize); + ((XmlSerializationWriter1)writer).Write192_SimpleKnownTypeValue(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read191_SimpleKnownTypeValue(); + return ((XmlSerializationReader1)reader).Read196_SimpleKnownTypeValue(); } } @@ -15207,11 +16060,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write188_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write193_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read192_Item(); + return ((XmlSerializationReader1)reader).Read197_Item(); } } @@ -15222,11 +16075,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write189_TypeWithPropertyNameSpecified(objectToSerialize); + ((XmlSerializationWriter1)writer).Write194_TypeWithPropertyNameSpecified(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read193_TypeWithPropertyNameSpecified(); + return ((XmlSerializationReader1)reader).Read198_TypeWithPropertyNameSpecified(); } } @@ -15237,11 +16090,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write190_TypeWithXmlSchemaFormAttribute(objectToSerialize); + ((XmlSerializationWriter1)writer).Write195_TypeWithXmlSchemaFormAttribute(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read194_TypeWithXmlSchemaFormAttribute(); + return ((XmlSerializationReader1)reader).Read199_TypeWithXmlSchemaFormAttribute(); } } @@ -15252,11 +16105,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write191_MyXmlType(objectToSerialize); + ((XmlSerializationWriter1)writer).Write196_MyXmlType(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read195_MyXmlType(); + return ((XmlSerializationReader1)reader).Read200_MyXmlType(); } } @@ -15267,11 +16120,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write192_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write197_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read196_Item(); + return ((XmlSerializationReader1)reader).Read201_Item(); } } @@ -15282,11 +16135,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write193_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write198_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read197_Item(); + return ((XmlSerializationReader1)reader).Read202_Item(); } } @@ -15297,11 +16150,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write194_ServerSettings(objectToSerialize); + ((XmlSerializationWriter1)writer).Write199_ServerSettings(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read198_ServerSettings(); + return ((XmlSerializationReader1)reader).Read203_ServerSettings(); } } @@ -15312,11 +16165,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write195_TypeWithXmlQualifiedName(objectToSerialize); + ((XmlSerializationWriter1)writer).Write200_TypeWithXmlQualifiedName(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read199_TypeWithXmlQualifiedName(); + return ((XmlSerializationReader1)reader).Read204_TypeWithXmlQualifiedName(); } } @@ -15327,11 +16180,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write196_TypeWith2DArrayProperty2(objectToSerialize); + ((XmlSerializationWriter1)writer).Write201_TypeWith2DArrayProperty2(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read200_TypeWith2DArrayProperty2(); + return ((XmlSerializationReader1)reader).Read205_TypeWith2DArrayProperty2(); } } @@ -15342,11 +16195,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write197_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write202_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read201_Item(); + return ((XmlSerializationReader1)reader).Read206_Item(); } } @@ -15357,11 +16210,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write198_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write203_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read202_Item(); + return ((XmlSerializationReader1)reader).Read207_Item(); } } @@ -15372,11 +16225,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write199_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write204_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read203_Item(); + return ((XmlSerializationReader1)reader).Read208_Item(); } } @@ -15387,11 +16240,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write200_TypeWithShouldSerializeMethod(objectToSerialize); + ((XmlSerializationWriter1)writer).Write205_TypeWithShouldSerializeMethod(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read204_TypeWithShouldSerializeMethod(); + return ((XmlSerializationReader1)reader).Read209_TypeWithShouldSerializeMethod(); } } @@ -15402,11 +16255,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write201_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write206_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read205_Item(); + return ((XmlSerializationReader1)reader).Read210_Item(); } } @@ -15417,11 +16270,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write202_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write207_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read206_Item(); + return ((XmlSerializationReader1)reader).Read211_Item(); } } @@ -15432,11 +16285,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write203_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write208_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read207_Item(); + return ((XmlSerializationReader1)reader).Read212_Item(); } } @@ -15447,11 +16300,26 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write204_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write209_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read208_Item(); + return ((XmlSerializationReader1)reader).Read213_Item(); + } + } + + public sealed class TypeWithPropertyHavingComplexChoiceSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"TypeWithPropertyHavingComplexChoice", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write210_Item(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read214_Item(); } } @@ -15462,11 +16330,41 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write205_MoreChoices(objectToSerialize); + ((XmlSerializationWriter1)writer).Write211_MoreChoices(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read215_MoreChoices(); + } + } + + public sealed class ComplexChoiceASerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"ComplexChoiceA", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write212_ComplexChoiceA(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((XmlSerializationReader1)reader).Read216_ComplexChoiceA(); + } + } + + public sealed class ComplexChoiceBSerializer : XmlSerializer1 { + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"ComplexChoiceB", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((XmlSerializationWriter1)writer).Write213_ComplexChoiceB(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read209_MoreChoices(); + return ((XmlSerializationReader1)reader).Read217_ComplexChoiceB(); } } @@ -15477,11 +16375,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write206_TypeWithFieldsOrdered(objectToSerialize); + ((XmlSerializationWriter1)writer).Write214_TypeWithFieldsOrdered(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read210_TypeWithFieldsOrdered(); + return ((XmlSerializationReader1)reader).Read218_TypeWithFieldsOrdered(); } } @@ -15492,11 +16390,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write207_Item(objectToSerialize); + ((XmlSerializationWriter1)writer).Write215_Item(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read211_Item(); + return ((XmlSerializationReader1)reader).Read219_Item(); } } @@ -15507,11 +16405,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write208_Root(objectToSerialize); + ((XmlSerializationWriter1)writer).Write216_Root(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read212_Root(); + return ((XmlSerializationReader1)reader).Read220_Root(); } } @@ -15522,11 +16420,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write209_TypeClashB(objectToSerialize); + ((XmlSerializationWriter1)writer).Write217_TypeClashB(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read213_TypeClashB(); + return ((XmlSerializationReader1)reader).Read221_TypeClashB(); } } @@ -15537,11 +16435,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write210_TypeClashA(objectToSerialize); + ((XmlSerializationWriter1)writer).Write218_TypeClashA(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read214_TypeClashA(); + return ((XmlSerializationReader1)reader).Read222_TypeClashA(); } } @@ -15552,11 +16450,11 @@ public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { } protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { - ((XmlSerializationWriter1)writer).Write211_Person(objectToSerialize); + ((XmlSerializationWriter1)writer).Write219_Person(objectToSerialize); } protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { - return ((XmlSerializationReader1)reader).Read215_Person(); + return ((XmlSerializationReader1)reader).Read223_Person(); } } @@ -15568,111 +16466,115 @@ public override System.Collections.Hashtable ReadMethods { get { if (readMethods == null) { System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); - _tmp[@"TypeWithXmlElementProperty::"] = @"Read111_TypeWithXmlElementProperty"; - _tmp[@"TypeWithXmlDocumentProperty::"] = @"Read112_TypeWithXmlDocumentProperty"; - _tmp[@"TypeWithBinaryProperty::"] = @"Read113_TypeWithBinaryProperty"; - _tmp[@"TypeWithDateTimeOffsetProperties::"] = @"Read114_Item"; - _tmp[@"TypeWithTimeSpanProperty::"] = @"Read115_TypeWithTimeSpanProperty"; - _tmp[@"TypeWithDefaultTimeSpanProperty::"] = @"Read116_Item"; - _tmp[@"TypeWithByteProperty::"] = @"Read117_TypeWithByteProperty"; - _tmp[@"TypeWithXmlNodeArrayProperty:::True:"] = @"Read118_TypeWithXmlNodeArrayProperty"; - _tmp[@"Animal::"] = @"Read119_Animal"; - _tmp[@"Dog::"] = @"Read120_Dog"; - _tmp[@"DogBreed::"] = @"Read121_DogBreed"; - _tmp[@"Group::"] = @"Read122_Group"; - _tmp[@"Vehicle::"] = @"Read123_Vehicle"; - _tmp[@"Employee::"] = @"Read124_Employee"; - _tmp[@"BaseClass::"] = @"Read125_BaseClass"; - _tmp[@"DerivedClass::"] = @"Read126_DerivedClass"; - _tmp[@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:"] = @"Read127_PurchaseOrder"; - _tmp[@"Address::"] = @"Read128_Address"; - _tmp[@"OrderedItem::"] = @"Read129_OrderedItem"; - _tmp[@"AliasedTestType::"] = @"Read130_AliasedTestType"; - _tmp[@"BaseClass1::"] = @"Read131_BaseClass1"; - _tmp[@"DerivedClass1::"] = @"Read132_DerivedClass1"; - _tmp[@"MyCollection1::"] = @"Read133_ArrayOfDateTime"; - _tmp[@"Orchestra::"] = @"Read134_Orchestra"; - _tmp[@"Instrument::"] = @"Read135_Instrument"; - _tmp[@"Brass::"] = @"Read136_Brass"; - _tmp[@"Trumpet::"] = @"Read137_Trumpet"; - _tmp[@"Pet::"] = @"Read138_Pet"; - _tmp[@"DefaultValuesSetToNaN::"] = @"Read139_DefaultValuesSetToNaN"; - _tmp[@"DefaultValuesSetToPositiveInfinity::"] = @"Read140_Item"; - _tmp[@"DefaultValuesSetToNegativeInfinity::"] = @"Read141_Item"; - _tmp[@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:"] = @"Read142_RootElement"; - _tmp[@"TypeWithLinkedProperty::"] = @"Read143_TypeWithLinkedProperty"; - _tmp[@"MsgDocumentType:http://example.com:Document:True:"] = @"Read144_Document"; - _tmp[@"RootClass::"] = @"Read145_RootClass"; - _tmp[@"Parameter::"] = @"Read146_Parameter"; - _tmp[@"XElementWrapper::"] = @"Read147_XElementWrapper"; - _tmp[@"XElementStruct::"] = @"Read148_XElementStruct"; - _tmp[@"XElementArrayWrapper::"] = @"Read149_XElementArrayWrapper"; - _tmp[@"SerializationTypes.TypeWithDateTimeStringProperty::"] = @"Read150_TypeWithDateTimeStringProperty"; - _tmp[@"SerializationTypes.SimpleType::"] = @"Read151_SimpleType"; - _tmp[@"SerializationTypes.TypeWithGetSetArrayMembers::"] = @"Read152_TypeWithGetSetArrayMembers"; - _tmp[@"SerializationTypes.TypeWithGetOnlyArrayProperties::"] = @"Read153_TypeWithGetOnlyArrayProperties"; - _tmp[@"SerializationTypes.StructNotSerializable::"] = @"Read154_StructNotSerializable"; - _tmp[@"SerializationTypes.TypeWithMyCollectionField::"] = @"Read155_TypeWithMyCollectionField"; - _tmp[@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::"] = @"Read156_Item"; - _tmp[@"SerializationTypes.MyList::"] = @"Read157_ArrayOfAnyType"; - _tmp[@"SerializationTypes.MyEnum::"] = @"Read158_MyEnum"; - _tmp[@"SerializationTypes.TypeWithEnumMembers::"] = @"Read159_TypeWithEnumMembers"; - _tmp[@"SerializationTypes.DCStruct::"] = @"Read160_DCStruct"; - _tmp[@"SerializationTypes.DCClassWithEnumAndStruct::"] = @"Read161_DCClassWithEnumAndStruct"; - _tmp[@"SerializationTypes.BuiltInTypes::"] = @"Read162_BuiltInTypes"; - _tmp[@"SerializationTypes.TypeA::"] = @"Read163_TypeA"; - _tmp[@"SerializationTypes.TypeB::"] = @"Read164_TypeB"; - _tmp[@"SerializationTypes.TypeHasArrayOfASerializedAsB::"] = @"Read165_TypeHasArrayOfASerializedAsB"; - _tmp[@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::"] = @"Read166_Item"; - _tmp[@"SerializationTypes.BaseClassWithSamePropertyName::"] = @"Read167_BaseClassWithSamePropertyName"; - _tmp[@"SerializationTypes.DerivedClassWithSameProperty::"] = @"Read168_DerivedClassWithSameProperty"; - _tmp[@"SerializationTypes.DerivedClassWithSameProperty2::"] = @"Read169_DerivedClassWithSameProperty2"; - _tmp[@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::"] = @"Read170_Item"; - _tmp[@"SerializationTypes.TypeWithByteArrayAsXmlText::"] = @"Read171_TypeWithByteArrayAsXmlText"; - _tmp[@"SerializationTypes.SimpleDC::"] = @"Read172_SimpleDC"; - _tmp[@"SerializationTypes.TypeWithXmlTextAttributeOnArray:http://schemas.xmlsoap.org/ws/2005/04/discovery::False:"] = @"Read173_Item"; - _tmp[@"SerializationTypes.EnumFlags::"] = @"Read174_EnumFlags"; - _tmp[@"SerializationTypes.ClassImplementsInterface::"] = @"Read175_ClassImplementsInterface"; - _tmp[@"SerializationTypes.WithStruct::"] = @"Read176_WithStruct"; - _tmp[@"SerializationTypes.SomeStruct::"] = @"Read177_SomeStruct"; - _tmp[@"SerializationTypes.WithEnums::"] = @"Read178_WithEnums"; - _tmp[@"SerializationTypes.WithNullables::"] = @"Read179_WithNullables"; - _tmp[@"SerializationTypes.ByteEnum::"] = @"Read180_ByteEnum"; - _tmp[@"SerializationTypes.SByteEnum::"] = @"Read181_SByteEnum"; - _tmp[@"SerializationTypes.ShortEnum::"] = @"Read182_ShortEnum"; - _tmp[@"SerializationTypes.IntEnum::"] = @"Read183_IntEnum"; - _tmp[@"SerializationTypes.UIntEnum::"] = @"Read184_UIntEnum"; - _tmp[@"SerializationTypes.LongEnum::"] = @"Read185_LongEnum"; - _tmp[@"SerializationTypes.ULongEnum::"] = @"Read186_ULongEnum"; - _tmp[@"SerializationTypes.XmlSerializerAttributes::AttributeTesting:False:"] = @"Read187_AttributeTesting"; - _tmp[@"SerializationTypes.ItemChoiceType::"] = @"Read188_ItemChoiceType"; - _tmp[@"SerializationTypes.TypeWithAnyAttribute::"] = @"Read189_TypeWithAnyAttribute"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructor::"] = @"Read190_KnownTypesThroughConstructor"; - _tmp[@"SerializationTypes.SimpleKnownTypeValue::"] = @"Read191_SimpleKnownTypeValue"; - _tmp[@"SerializationTypes.ClassImplementingIXmlSerialiable::"] = @"Read192_Item"; - _tmp[@"SerializationTypes.TypeWithPropertyNameSpecified::"] = @"Read193_TypeWithPropertyNameSpecified"; - _tmp[@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:"] = @"Read194_TypeWithXmlSchemaFormAttribute"; - _tmp[@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::"] = @"Read195_MyXmlType"; - _tmp[@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::"] = @"Read196_Item"; - _tmp[@"SerializationTypes.TypeWithNonPublicDefaultConstructor::"] = @"Read197_Item"; - _tmp[@"SerializationTypes.ServerSettings::"] = @"Read198_ServerSettings"; - _tmp[@"SerializationTypes.TypeWithXmlQualifiedName::"] = @"Read199_TypeWithXmlQualifiedName"; - _tmp[@"SerializationTypes.TypeWith2DArrayProperty2::"] = @"Read200_TypeWith2DArrayProperty2"; - _tmp[@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::"] = @"Read201_Item"; - _tmp[@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::"] = @"Read202_Item"; - _tmp[@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::"] = @"Read203_Item"; - _tmp[@"SerializationTypes.TypeWithShouldSerializeMethod::"] = @"Read204_TypeWithShouldSerializeMethod"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::"] = @"Read205_Item"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithValue::"] = @"Read206_Item"; - _tmp[@"SerializationTypes.TypeWithTypesHavingCustomFormatter::"] = @"Read207_Item"; - _tmp[@"SerializationTypes.TypeWithArrayPropertyHavingChoice::"] = @"Read208_Item"; - _tmp[@"SerializationTypes.MoreChoices::"] = @"Read209_MoreChoices"; - _tmp[@"SerializationTypes.TypeWithFieldsOrdered::"] = @"Read210_TypeWithFieldsOrdered"; - _tmp[@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::"] = @"Read211_Item"; - _tmp[@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:"] = @"Read212_Root"; - _tmp[@"SerializationTypes.TypeNameClashB.TypeNameClash::"] = @"Read213_TypeClashB"; - _tmp[@"SerializationTypes.TypeNameClashA.TypeNameClash::"] = @"Read214_TypeClashA"; - _tmp[@"Outer+Person::"] = @"Read215_Person"; + _tmp[@"TypeWithXmlElementProperty::"] = @"Read115_TypeWithXmlElementProperty"; + _tmp[@"TypeWithXmlDocumentProperty::"] = @"Read116_TypeWithXmlDocumentProperty"; + _tmp[@"TypeWithBinaryProperty::"] = @"Read117_TypeWithBinaryProperty"; + _tmp[@"TypeWithDateTimeOffsetProperties::"] = @"Read118_Item"; + _tmp[@"TypeWithTimeSpanProperty::"] = @"Read119_TypeWithTimeSpanProperty"; + _tmp[@"TypeWithDefaultTimeSpanProperty::"] = @"Read120_Item"; + _tmp[@"TypeWithByteProperty::"] = @"Read121_TypeWithByteProperty"; + _tmp[@"TypeWithXmlNodeArrayProperty:::True:"] = @"Read122_TypeWithXmlNodeArrayProperty"; + _tmp[@"Animal::"] = @"Read123_Animal"; + _tmp[@"Dog::"] = @"Read124_Dog"; + _tmp[@"DogBreed::"] = @"Read125_DogBreed"; + _tmp[@"Group::"] = @"Read126_Group"; + _tmp[@"Vehicle::"] = @"Read127_Vehicle"; + _tmp[@"Employee::"] = @"Read128_Employee"; + _tmp[@"BaseClass::"] = @"Read129_BaseClass"; + _tmp[@"DerivedClass::"] = @"Read130_DerivedClass"; + _tmp[@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:"] = @"Read131_PurchaseOrder"; + _tmp[@"Address::"] = @"Read132_Address"; + _tmp[@"OrderedItem::"] = @"Read133_OrderedItem"; + _tmp[@"AliasedTestType::"] = @"Read134_AliasedTestType"; + _tmp[@"BaseClass1::"] = @"Read135_BaseClass1"; + _tmp[@"DerivedClass1::"] = @"Read136_DerivedClass1"; + _tmp[@"MyCollection1::"] = @"Read137_ArrayOfDateTime"; + _tmp[@"Orchestra::"] = @"Read138_Orchestra"; + _tmp[@"Instrument::"] = @"Read139_Instrument"; + _tmp[@"Brass::"] = @"Read140_Brass"; + _tmp[@"Trumpet::"] = @"Read141_Trumpet"; + _tmp[@"Pet::"] = @"Read142_Pet"; + _tmp[@"DefaultValuesSetToNaN::"] = @"Read143_DefaultValuesSetToNaN"; + _tmp[@"DefaultValuesSetToPositiveInfinity::"] = @"Read144_Item"; + _tmp[@"DefaultValuesSetToNegativeInfinity::"] = @"Read145_Item"; + _tmp[@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:"] = @"Read146_RootElement"; + _tmp[@"TypeWithLinkedProperty::"] = @"Read147_TypeWithLinkedProperty"; + _tmp[@"MsgDocumentType:http://example.com:Document:True:"] = @"Read148_Document"; + _tmp[@"RootClass::"] = @"Read149_RootClass"; + _tmp[@"Parameter::"] = @"Read150_Parameter"; + _tmp[@"XElementWrapper::"] = @"Read151_XElementWrapper"; + _tmp[@"XElementStruct::"] = @"Read152_XElementStruct"; + _tmp[@"XElementArrayWrapper::"] = @"Read153_XElementArrayWrapper"; + _tmp[@"SerializationTypes.TypeWithDateTimeStringProperty::"] = @"Read154_TypeWithDateTimeStringProperty"; + _tmp[@"SerializationTypes.SimpleType::"] = @"Read155_SimpleType"; + _tmp[@"SerializationTypes.TypeWithGetSetArrayMembers::"] = @"Read156_TypeWithGetSetArrayMembers"; + _tmp[@"SerializationTypes.TypeWithGetOnlyArrayProperties::"] = @"Read157_TypeWithGetOnlyArrayProperties"; + _tmp[@"SerializationTypes.TypeWithArraylikeMembers::"] = @"Read158_TypeWithArraylikeMembers"; + _tmp[@"SerializationTypes.StructNotSerializable::"] = @"Read159_StructNotSerializable"; + _tmp[@"SerializationTypes.TypeWithMyCollectionField::"] = @"Read160_TypeWithMyCollectionField"; + _tmp[@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::"] = @"Read161_Item"; + _tmp[@"SerializationTypes.MyList::"] = @"Read162_ArrayOfAnyType"; + _tmp[@"SerializationTypes.MyEnum::"] = @"Read163_MyEnum"; + _tmp[@"SerializationTypes.TypeWithEnumMembers::"] = @"Read164_TypeWithEnumMembers"; + _tmp[@"SerializationTypes.DCStruct::"] = @"Read165_DCStruct"; + _tmp[@"SerializationTypes.DCClassWithEnumAndStruct::"] = @"Read166_DCClassWithEnumAndStruct"; + _tmp[@"SerializationTypes.BuiltInTypes::"] = @"Read167_BuiltInTypes"; + _tmp[@"SerializationTypes.TypeA::"] = @"Read168_TypeA"; + _tmp[@"SerializationTypes.TypeB::"] = @"Read169_TypeB"; + _tmp[@"SerializationTypes.TypeHasArrayOfASerializedAsB::"] = @"Read170_TypeHasArrayOfASerializedAsB"; + _tmp[@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::"] = @"Read171_Item"; + _tmp[@"SerializationTypes.BaseClassWithSamePropertyName::"] = @"Read172_BaseClassWithSamePropertyName"; + _tmp[@"SerializationTypes.DerivedClassWithSameProperty::"] = @"Read173_DerivedClassWithSameProperty"; + _tmp[@"SerializationTypes.DerivedClassWithSameProperty2::"] = @"Read174_DerivedClassWithSameProperty2"; + _tmp[@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::"] = @"Read175_Item"; + _tmp[@"SerializationTypes.TypeWithByteArrayAsXmlText::"] = @"Read176_TypeWithByteArrayAsXmlText"; + _tmp[@"SerializationTypes.SimpleDC::"] = @"Read177_SimpleDC"; + _tmp[@"SerializationTypes.TypeWithXmlTextAttributeOnArray:http://schemas.xmlsoap.org/ws/2005/04/discovery::False:"] = @"Read178_Item"; + _tmp[@"SerializationTypes.EnumFlags::"] = @"Read179_EnumFlags"; + _tmp[@"SerializationTypes.ClassImplementsInterface::"] = @"Read180_ClassImplementsInterface"; + _tmp[@"SerializationTypes.WithStruct::"] = @"Read181_WithStruct"; + _tmp[@"SerializationTypes.SomeStruct::"] = @"Read182_SomeStruct"; + _tmp[@"SerializationTypes.WithEnums::"] = @"Read183_WithEnums"; + _tmp[@"SerializationTypes.WithNullables::"] = @"Read184_WithNullables"; + _tmp[@"SerializationTypes.ByteEnum::"] = @"Read185_ByteEnum"; + _tmp[@"SerializationTypes.SByteEnum::"] = @"Read186_SByteEnum"; + _tmp[@"SerializationTypes.ShortEnum::"] = @"Read187_ShortEnum"; + _tmp[@"SerializationTypes.IntEnum::"] = @"Read188_IntEnum"; + _tmp[@"SerializationTypes.UIntEnum::"] = @"Read189_UIntEnum"; + _tmp[@"SerializationTypes.LongEnum::"] = @"Read190_LongEnum"; + _tmp[@"SerializationTypes.ULongEnum::"] = @"Read191_ULongEnum"; + _tmp[@"SerializationTypes.XmlSerializerAttributes::AttributeTesting:False:"] = @"Read192_AttributeTesting"; + _tmp[@"SerializationTypes.ItemChoiceType::"] = @"Read193_ItemChoiceType"; + _tmp[@"SerializationTypes.TypeWithAnyAttribute::"] = @"Read194_TypeWithAnyAttribute"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructor::"] = @"Read195_KnownTypesThroughConstructor"; + _tmp[@"SerializationTypes.SimpleKnownTypeValue::"] = @"Read196_SimpleKnownTypeValue"; + _tmp[@"SerializationTypes.ClassImplementingIXmlSerialiable::"] = @"Read197_Item"; + _tmp[@"SerializationTypes.TypeWithPropertyNameSpecified::"] = @"Read198_TypeWithPropertyNameSpecified"; + _tmp[@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:"] = @"Read199_TypeWithXmlSchemaFormAttribute"; + _tmp[@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::"] = @"Read200_MyXmlType"; + _tmp[@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::"] = @"Read201_Item"; + _tmp[@"SerializationTypes.TypeWithNonPublicDefaultConstructor::"] = @"Read202_Item"; + _tmp[@"SerializationTypes.ServerSettings::"] = @"Read203_ServerSettings"; + _tmp[@"SerializationTypes.TypeWithXmlQualifiedName::"] = @"Read204_TypeWithXmlQualifiedName"; + _tmp[@"SerializationTypes.TypeWith2DArrayProperty2::"] = @"Read205_TypeWith2DArrayProperty2"; + _tmp[@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::"] = @"Read206_Item"; + _tmp[@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::"] = @"Read207_Item"; + _tmp[@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::"] = @"Read208_Item"; + _tmp[@"SerializationTypes.TypeWithShouldSerializeMethod::"] = @"Read209_TypeWithShouldSerializeMethod"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::"] = @"Read210_Item"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithValue::"] = @"Read211_Item"; + _tmp[@"SerializationTypes.TypeWithTypesHavingCustomFormatter::"] = @"Read212_Item"; + _tmp[@"SerializationTypes.TypeWithArrayPropertyHavingChoice::"] = @"Read213_Item"; + _tmp[@"SerializationTypes.TypeWithPropertyHavingComplexChoice::"] = @"Read214_Item"; + _tmp[@"SerializationTypes.MoreChoices::"] = @"Read215_MoreChoices"; + _tmp[@"SerializationTypes.ComplexChoiceA::"] = @"Read216_ComplexChoiceA"; + _tmp[@"SerializationTypes.ComplexChoiceB::"] = @"Read217_ComplexChoiceB"; + _tmp[@"SerializationTypes.TypeWithFieldsOrdered::"] = @"Read218_TypeWithFieldsOrdered"; + _tmp[@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::"] = @"Read219_Item"; + _tmp[@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:"] = @"Read220_Root"; + _tmp[@"SerializationTypes.TypeNameClashB.TypeNameClash::"] = @"Read221_TypeClashB"; + _tmp[@"SerializationTypes.TypeNameClashA.TypeNameClash::"] = @"Read222_TypeClashA"; + _tmp[@"Outer+Person::"] = @"Read223_Person"; if (readMethods == null) readMethods = _tmp; } return readMethods; @@ -15683,111 +16585,115 @@ public override System.Collections.Hashtable WriteMethods { get { if (writeMethods == null) { System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); - _tmp[@"TypeWithXmlElementProperty::"] = @"Write107_TypeWithXmlElementProperty"; - _tmp[@"TypeWithXmlDocumentProperty::"] = @"Write108_TypeWithXmlDocumentProperty"; - _tmp[@"TypeWithBinaryProperty::"] = @"Write109_TypeWithBinaryProperty"; - _tmp[@"TypeWithDateTimeOffsetProperties::"] = @"Write110_Item"; - _tmp[@"TypeWithTimeSpanProperty::"] = @"Write111_TypeWithTimeSpanProperty"; - _tmp[@"TypeWithDefaultTimeSpanProperty::"] = @"Write112_Item"; - _tmp[@"TypeWithByteProperty::"] = @"Write113_TypeWithByteProperty"; - _tmp[@"TypeWithXmlNodeArrayProperty:::True:"] = @"Write114_TypeWithXmlNodeArrayProperty"; - _tmp[@"Animal::"] = @"Write115_Animal"; - _tmp[@"Dog::"] = @"Write116_Dog"; - _tmp[@"DogBreed::"] = @"Write117_DogBreed"; - _tmp[@"Group::"] = @"Write118_Group"; - _tmp[@"Vehicle::"] = @"Write119_Vehicle"; - _tmp[@"Employee::"] = @"Write120_Employee"; - _tmp[@"BaseClass::"] = @"Write121_BaseClass"; - _tmp[@"DerivedClass::"] = @"Write122_DerivedClass"; - _tmp[@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:"] = @"Write123_PurchaseOrder"; - _tmp[@"Address::"] = @"Write124_Address"; - _tmp[@"OrderedItem::"] = @"Write125_OrderedItem"; - _tmp[@"AliasedTestType::"] = @"Write126_AliasedTestType"; - _tmp[@"BaseClass1::"] = @"Write127_BaseClass1"; - _tmp[@"DerivedClass1::"] = @"Write128_DerivedClass1"; - _tmp[@"MyCollection1::"] = @"Write129_ArrayOfDateTime"; - _tmp[@"Orchestra::"] = @"Write130_Orchestra"; - _tmp[@"Instrument::"] = @"Write131_Instrument"; - _tmp[@"Brass::"] = @"Write132_Brass"; - _tmp[@"Trumpet::"] = @"Write133_Trumpet"; - _tmp[@"Pet::"] = @"Write134_Pet"; - _tmp[@"DefaultValuesSetToNaN::"] = @"Write135_DefaultValuesSetToNaN"; - _tmp[@"DefaultValuesSetToPositiveInfinity::"] = @"Write136_Item"; - _tmp[@"DefaultValuesSetToNegativeInfinity::"] = @"Write137_Item"; - _tmp[@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:"] = @"Write138_RootElement"; - _tmp[@"TypeWithLinkedProperty::"] = @"Write139_TypeWithLinkedProperty"; - _tmp[@"MsgDocumentType:http://example.com:Document:True:"] = @"Write140_Document"; - _tmp[@"RootClass::"] = @"Write141_RootClass"; - _tmp[@"Parameter::"] = @"Write142_Parameter"; - _tmp[@"XElementWrapper::"] = @"Write143_XElementWrapper"; - _tmp[@"XElementStruct::"] = @"Write144_XElementStruct"; - _tmp[@"XElementArrayWrapper::"] = @"Write145_XElementArrayWrapper"; - _tmp[@"SerializationTypes.TypeWithDateTimeStringProperty::"] = @"Write146_TypeWithDateTimeStringProperty"; - _tmp[@"SerializationTypes.SimpleType::"] = @"Write147_SimpleType"; - _tmp[@"SerializationTypes.TypeWithGetSetArrayMembers::"] = @"Write148_TypeWithGetSetArrayMembers"; - _tmp[@"SerializationTypes.TypeWithGetOnlyArrayProperties::"] = @"Write149_TypeWithGetOnlyArrayProperties"; - _tmp[@"SerializationTypes.StructNotSerializable::"] = @"Write150_StructNotSerializable"; - _tmp[@"SerializationTypes.TypeWithMyCollectionField::"] = @"Write151_TypeWithMyCollectionField"; - _tmp[@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::"] = @"Write152_Item"; - _tmp[@"SerializationTypes.MyList::"] = @"Write153_ArrayOfAnyType"; - _tmp[@"SerializationTypes.MyEnum::"] = @"Write154_MyEnum"; - _tmp[@"SerializationTypes.TypeWithEnumMembers::"] = @"Write155_TypeWithEnumMembers"; - _tmp[@"SerializationTypes.DCStruct::"] = @"Write156_DCStruct"; - _tmp[@"SerializationTypes.DCClassWithEnumAndStruct::"] = @"Write157_DCClassWithEnumAndStruct"; - _tmp[@"SerializationTypes.BuiltInTypes::"] = @"Write158_BuiltInTypes"; - _tmp[@"SerializationTypes.TypeA::"] = @"Write159_TypeA"; - _tmp[@"SerializationTypes.TypeB::"] = @"Write160_TypeB"; - _tmp[@"SerializationTypes.TypeHasArrayOfASerializedAsB::"] = @"Write161_TypeHasArrayOfASerializedAsB"; - _tmp[@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::"] = @"Write162_Item"; - _tmp[@"SerializationTypes.BaseClassWithSamePropertyName::"] = @"Write163_BaseClassWithSamePropertyName"; - _tmp[@"SerializationTypes.DerivedClassWithSameProperty::"] = @"Write164_DerivedClassWithSameProperty"; - _tmp[@"SerializationTypes.DerivedClassWithSameProperty2::"] = @"Write165_DerivedClassWithSameProperty2"; - _tmp[@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::"] = @"Write166_Item"; - _tmp[@"SerializationTypes.TypeWithByteArrayAsXmlText::"] = @"Write167_TypeWithByteArrayAsXmlText"; - _tmp[@"SerializationTypes.SimpleDC::"] = @"Write168_SimpleDC"; - _tmp[@"SerializationTypes.TypeWithXmlTextAttributeOnArray:http://schemas.xmlsoap.org/ws/2005/04/discovery::False:"] = @"Write169_Item"; - _tmp[@"SerializationTypes.EnumFlags::"] = @"Write170_EnumFlags"; - _tmp[@"SerializationTypes.ClassImplementsInterface::"] = @"Write171_ClassImplementsInterface"; - _tmp[@"SerializationTypes.WithStruct::"] = @"Write172_WithStruct"; - _tmp[@"SerializationTypes.SomeStruct::"] = @"Write173_SomeStruct"; - _tmp[@"SerializationTypes.WithEnums::"] = @"Write174_WithEnums"; - _tmp[@"SerializationTypes.WithNullables::"] = @"Write175_WithNullables"; - _tmp[@"SerializationTypes.ByteEnum::"] = @"Write176_ByteEnum"; - _tmp[@"SerializationTypes.SByteEnum::"] = @"Write177_SByteEnum"; - _tmp[@"SerializationTypes.ShortEnum::"] = @"Write178_ShortEnum"; - _tmp[@"SerializationTypes.IntEnum::"] = @"Write179_IntEnum"; - _tmp[@"SerializationTypes.UIntEnum::"] = @"Write180_UIntEnum"; - _tmp[@"SerializationTypes.LongEnum::"] = @"Write181_LongEnum"; - _tmp[@"SerializationTypes.ULongEnum::"] = @"Write182_ULongEnum"; - _tmp[@"SerializationTypes.XmlSerializerAttributes::AttributeTesting:False:"] = @"Write183_AttributeTesting"; - _tmp[@"SerializationTypes.ItemChoiceType::"] = @"Write184_ItemChoiceType"; - _tmp[@"SerializationTypes.TypeWithAnyAttribute::"] = @"Write185_TypeWithAnyAttribute"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructor::"] = @"Write186_KnownTypesThroughConstructor"; - _tmp[@"SerializationTypes.SimpleKnownTypeValue::"] = @"Write187_SimpleKnownTypeValue"; - _tmp[@"SerializationTypes.ClassImplementingIXmlSerialiable::"] = @"Write188_Item"; - _tmp[@"SerializationTypes.TypeWithPropertyNameSpecified::"] = @"Write189_TypeWithPropertyNameSpecified"; - _tmp[@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:"] = @"Write190_TypeWithXmlSchemaFormAttribute"; - _tmp[@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::"] = @"Write191_MyXmlType"; - _tmp[@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::"] = @"Write192_Item"; - _tmp[@"SerializationTypes.TypeWithNonPublicDefaultConstructor::"] = @"Write193_Item"; - _tmp[@"SerializationTypes.ServerSettings::"] = @"Write194_ServerSettings"; - _tmp[@"SerializationTypes.TypeWithXmlQualifiedName::"] = @"Write195_TypeWithXmlQualifiedName"; - _tmp[@"SerializationTypes.TypeWith2DArrayProperty2::"] = @"Write196_TypeWith2DArrayProperty2"; - _tmp[@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::"] = @"Write197_Item"; - _tmp[@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::"] = @"Write198_Item"; - _tmp[@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::"] = @"Write199_Item"; - _tmp[@"SerializationTypes.TypeWithShouldSerializeMethod::"] = @"Write200_TypeWithShouldSerializeMethod"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::"] = @"Write201_Item"; - _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithValue::"] = @"Write202_Item"; - _tmp[@"SerializationTypes.TypeWithTypesHavingCustomFormatter::"] = @"Write203_Item"; - _tmp[@"SerializationTypes.TypeWithArrayPropertyHavingChoice::"] = @"Write204_Item"; - _tmp[@"SerializationTypes.MoreChoices::"] = @"Write205_MoreChoices"; - _tmp[@"SerializationTypes.TypeWithFieldsOrdered::"] = @"Write206_TypeWithFieldsOrdered"; - _tmp[@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::"] = @"Write207_Item"; - _tmp[@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:"] = @"Write208_Root"; - _tmp[@"SerializationTypes.TypeNameClashB.TypeNameClash::"] = @"Write209_TypeClashB"; - _tmp[@"SerializationTypes.TypeNameClashA.TypeNameClash::"] = @"Write210_TypeClashA"; - _tmp[@"Outer+Person::"] = @"Write211_Person"; + _tmp[@"TypeWithXmlElementProperty::"] = @"Write111_TypeWithXmlElementProperty"; + _tmp[@"TypeWithXmlDocumentProperty::"] = @"Write112_TypeWithXmlDocumentProperty"; + _tmp[@"TypeWithBinaryProperty::"] = @"Write113_TypeWithBinaryProperty"; + _tmp[@"TypeWithDateTimeOffsetProperties::"] = @"Write114_Item"; + _tmp[@"TypeWithTimeSpanProperty::"] = @"Write115_TypeWithTimeSpanProperty"; + _tmp[@"TypeWithDefaultTimeSpanProperty::"] = @"Write116_Item"; + _tmp[@"TypeWithByteProperty::"] = @"Write117_TypeWithByteProperty"; + _tmp[@"TypeWithXmlNodeArrayProperty:::True:"] = @"Write118_TypeWithXmlNodeArrayProperty"; + _tmp[@"Animal::"] = @"Write119_Animal"; + _tmp[@"Dog::"] = @"Write120_Dog"; + _tmp[@"DogBreed::"] = @"Write121_DogBreed"; + _tmp[@"Group::"] = @"Write122_Group"; + _tmp[@"Vehicle::"] = @"Write123_Vehicle"; + _tmp[@"Employee::"] = @"Write124_Employee"; + _tmp[@"BaseClass::"] = @"Write125_BaseClass"; + _tmp[@"DerivedClass::"] = @"Write126_DerivedClass"; + _tmp[@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:"] = @"Write127_PurchaseOrder"; + _tmp[@"Address::"] = @"Write128_Address"; + _tmp[@"OrderedItem::"] = @"Write129_OrderedItem"; + _tmp[@"AliasedTestType::"] = @"Write130_AliasedTestType"; + _tmp[@"BaseClass1::"] = @"Write131_BaseClass1"; + _tmp[@"DerivedClass1::"] = @"Write132_DerivedClass1"; + _tmp[@"MyCollection1::"] = @"Write133_ArrayOfDateTime"; + _tmp[@"Orchestra::"] = @"Write134_Orchestra"; + _tmp[@"Instrument::"] = @"Write135_Instrument"; + _tmp[@"Brass::"] = @"Write136_Brass"; + _tmp[@"Trumpet::"] = @"Write137_Trumpet"; + _tmp[@"Pet::"] = @"Write138_Pet"; + _tmp[@"DefaultValuesSetToNaN::"] = @"Write139_DefaultValuesSetToNaN"; + _tmp[@"DefaultValuesSetToPositiveInfinity::"] = @"Write140_Item"; + _tmp[@"DefaultValuesSetToNegativeInfinity::"] = @"Write141_Item"; + _tmp[@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:"] = @"Write142_RootElement"; + _tmp[@"TypeWithLinkedProperty::"] = @"Write143_TypeWithLinkedProperty"; + _tmp[@"MsgDocumentType:http://example.com:Document:True:"] = @"Write144_Document"; + _tmp[@"RootClass::"] = @"Write145_RootClass"; + _tmp[@"Parameter::"] = @"Write146_Parameter"; + _tmp[@"XElementWrapper::"] = @"Write147_XElementWrapper"; + _tmp[@"XElementStruct::"] = @"Write148_XElementStruct"; + _tmp[@"XElementArrayWrapper::"] = @"Write149_XElementArrayWrapper"; + _tmp[@"SerializationTypes.TypeWithDateTimeStringProperty::"] = @"Write150_TypeWithDateTimeStringProperty"; + _tmp[@"SerializationTypes.SimpleType::"] = @"Write151_SimpleType"; + _tmp[@"SerializationTypes.TypeWithGetSetArrayMembers::"] = @"Write152_TypeWithGetSetArrayMembers"; + _tmp[@"SerializationTypes.TypeWithGetOnlyArrayProperties::"] = @"Write153_TypeWithGetOnlyArrayProperties"; + _tmp[@"SerializationTypes.TypeWithArraylikeMembers::"] = @"Write154_TypeWithArraylikeMembers"; + _tmp[@"SerializationTypes.StructNotSerializable::"] = @"Write155_StructNotSerializable"; + _tmp[@"SerializationTypes.TypeWithMyCollectionField::"] = @"Write156_TypeWithMyCollectionField"; + _tmp[@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::"] = @"Write157_Item"; + _tmp[@"SerializationTypes.MyList::"] = @"Write158_ArrayOfAnyType"; + _tmp[@"SerializationTypes.MyEnum::"] = @"Write159_MyEnum"; + _tmp[@"SerializationTypes.TypeWithEnumMembers::"] = @"Write160_TypeWithEnumMembers"; + _tmp[@"SerializationTypes.DCStruct::"] = @"Write161_DCStruct"; + _tmp[@"SerializationTypes.DCClassWithEnumAndStruct::"] = @"Write162_DCClassWithEnumAndStruct"; + _tmp[@"SerializationTypes.BuiltInTypes::"] = @"Write163_BuiltInTypes"; + _tmp[@"SerializationTypes.TypeA::"] = @"Write164_TypeA"; + _tmp[@"SerializationTypes.TypeB::"] = @"Write165_TypeB"; + _tmp[@"SerializationTypes.TypeHasArrayOfASerializedAsB::"] = @"Write166_TypeHasArrayOfASerializedAsB"; + _tmp[@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::"] = @"Write167_Item"; + _tmp[@"SerializationTypes.BaseClassWithSamePropertyName::"] = @"Write168_BaseClassWithSamePropertyName"; + _tmp[@"SerializationTypes.DerivedClassWithSameProperty::"] = @"Write169_DerivedClassWithSameProperty"; + _tmp[@"SerializationTypes.DerivedClassWithSameProperty2::"] = @"Write170_DerivedClassWithSameProperty2"; + _tmp[@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::"] = @"Write171_Item"; + _tmp[@"SerializationTypes.TypeWithByteArrayAsXmlText::"] = @"Write172_TypeWithByteArrayAsXmlText"; + _tmp[@"SerializationTypes.SimpleDC::"] = @"Write173_SimpleDC"; + _tmp[@"SerializationTypes.TypeWithXmlTextAttributeOnArray:http://schemas.xmlsoap.org/ws/2005/04/discovery::False:"] = @"Write174_Item"; + _tmp[@"SerializationTypes.EnumFlags::"] = @"Write175_EnumFlags"; + _tmp[@"SerializationTypes.ClassImplementsInterface::"] = @"Write176_ClassImplementsInterface"; + _tmp[@"SerializationTypes.WithStruct::"] = @"Write177_WithStruct"; + _tmp[@"SerializationTypes.SomeStruct::"] = @"Write178_SomeStruct"; + _tmp[@"SerializationTypes.WithEnums::"] = @"Write179_WithEnums"; + _tmp[@"SerializationTypes.WithNullables::"] = @"Write180_WithNullables"; + _tmp[@"SerializationTypes.ByteEnum::"] = @"Write181_ByteEnum"; + _tmp[@"SerializationTypes.SByteEnum::"] = @"Write182_SByteEnum"; + _tmp[@"SerializationTypes.ShortEnum::"] = @"Write183_ShortEnum"; + _tmp[@"SerializationTypes.IntEnum::"] = @"Write184_IntEnum"; + _tmp[@"SerializationTypes.UIntEnum::"] = @"Write185_UIntEnum"; + _tmp[@"SerializationTypes.LongEnum::"] = @"Write186_LongEnum"; + _tmp[@"SerializationTypes.ULongEnum::"] = @"Write187_ULongEnum"; + _tmp[@"SerializationTypes.XmlSerializerAttributes::AttributeTesting:False:"] = @"Write188_AttributeTesting"; + _tmp[@"SerializationTypes.ItemChoiceType::"] = @"Write189_ItemChoiceType"; + _tmp[@"SerializationTypes.TypeWithAnyAttribute::"] = @"Write190_TypeWithAnyAttribute"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructor::"] = @"Write191_KnownTypesThroughConstructor"; + _tmp[@"SerializationTypes.SimpleKnownTypeValue::"] = @"Write192_SimpleKnownTypeValue"; + _tmp[@"SerializationTypes.ClassImplementingIXmlSerialiable::"] = @"Write193_Item"; + _tmp[@"SerializationTypes.TypeWithPropertyNameSpecified::"] = @"Write194_TypeWithPropertyNameSpecified"; + _tmp[@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:"] = @"Write195_TypeWithXmlSchemaFormAttribute"; + _tmp[@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::"] = @"Write196_MyXmlType"; + _tmp[@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::"] = @"Write197_Item"; + _tmp[@"SerializationTypes.TypeWithNonPublicDefaultConstructor::"] = @"Write198_Item"; + _tmp[@"SerializationTypes.ServerSettings::"] = @"Write199_ServerSettings"; + _tmp[@"SerializationTypes.TypeWithXmlQualifiedName::"] = @"Write200_TypeWithXmlQualifiedName"; + _tmp[@"SerializationTypes.TypeWith2DArrayProperty2::"] = @"Write201_TypeWith2DArrayProperty2"; + _tmp[@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::"] = @"Write202_Item"; + _tmp[@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::"] = @"Write203_Item"; + _tmp[@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::"] = @"Write204_Item"; + _tmp[@"SerializationTypes.TypeWithShouldSerializeMethod::"] = @"Write205_TypeWithShouldSerializeMethod"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::"] = @"Write206_Item"; + _tmp[@"SerializationTypes.KnownTypesThroughConstructorWithValue::"] = @"Write207_Item"; + _tmp[@"SerializationTypes.TypeWithTypesHavingCustomFormatter::"] = @"Write208_Item"; + _tmp[@"SerializationTypes.TypeWithArrayPropertyHavingChoice::"] = @"Write209_Item"; + _tmp[@"SerializationTypes.TypeWithPropertyHavingComplexChoice::"] = @"Write210_Item"; + _tmp[@"SerializationTypes.MoreChoices::"] = @"Write211_MoreChoices"; + _tmp[@"SerializationTypes.ComplexChoiceA::"] = @"Write212_ComplexChoiceA"; + _tmp[@"SerializationTypes.ComplexChoiceB::"] = @"Write213_ComplexChoiceB"; + _tmp[@"SerializationTypes.TypeWithFieldsOrdered::"] = @"Write214_TypeWithFieldsOrdered"; + _tmp[@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::"] = @"Write215_Item"; + _tmp[@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:"] = @"Write216_Root"; + _tmp[@"SerializationTypes.TypeNameClashB.TypeNameClash::"] = @"Write217_TypeClashB"; + _tmp[@"SerializationTypes.TypeNameClashA.TypeNameClash::"] = @"Write218_TypeClashA"; + _tmp[@"Outer+Person::"] = @"Write219_Person"; if (writeMethods == null) writeMethods = _tmp; } return writeMethods; @@ -15798,111 +16704,115 @@ public override System.Collections.Hashtable TypedSerializers { get { if (typedSerializers == null) { System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp.Add(@"SerializationTypes.TypeWithArraylikeMembers::", new TypeWithArraylikeMembersSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithGetSetArrayMembers::", new TypeWithGetSetArrayMembersSerializer()); + _tmp.Add(@"SerializationTypes.MyList::", new MyListSerializer()); + _tmp.Add(@"SerializationTypes.StructNotSerializable::", new StructNotSerializableSerializer()); + _tmp.Add(@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:", new PurchaseOrderSerializer()); + _tmp.Add(@"SerializationTypes.SimpleDC::", new SimpleDCSerializer()); + _tmp.Add(@"SerializationTypes.SimpleKnownTypeValue::", new SimpleKnownTypeValueSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithAnyAttribute::", new TypeWithAnyAttributeSerializer()); + _tmp.Add(@"TypeWithXmlElementProperty::", new TypeWithXmlElementPropertySerializer()); + _tmp.Add(@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::", new TypeWithEnumPropertyHavingDefaultValueSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithByteArrayAsXmlText::", new TypeWithByteArrayAsXmlTextSerializer()); _tmp.Add(@"XElementArrayWrapper::", new XElementArrayWrapperSerializer()); - _tmp.Add(@"TypeWithDefaultTimeSpanProperty::", new TypeWithDefaultTimeSpanPropertySerializer()); - _tmp.Add(@"SerializationTypes.ClassImplementsInterface::", new ClassImplementsInterfaceSerializer()); - _tmp.Add(@"MsgDocumentType:http://example.com:Document:True:", new MsgDocumentTypeSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::", new TypeWithTypeNameInXmlTypeAttributeSerializer()); + _tmp.Add(@"Dog::", new DogSerializer()); _tmp.Add(@"SerializationTypes.TypeWithEnumMembers::", new TypeWithEnumMembersSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::", new TypeWithDateTimePropertyAsXmlTimeSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::", new TypeWithKnownTypesOfCollectionsWithConflictingXmlNameSerializer()); - _tmp.Add(@"Vehicle::", new VehicleSerializer()); _tmp.Add(@"TypeWithByteProperty::", new TypeWithBytePropertySerializer()); - _tmp.Add(@"SerializationTypes.ItemChoiceType::", new ItemChoiceTypeSerializer()); - _tmp.Add(@"SerializationTypes.ServerSettings::", new ServerSettingsSerializer()); - _tmp.Add(@"Address::", new AddressSerializer()); _tmp.Add(@"DerivedClass::", new DerivedClassSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithMyCollectionField::", new TypeWithMyCollectionFieldSerializer()); - _tmp.Add(@"Brass::", new BrassSerializer()); - _tmp.Add(@"SerializationTypes.ClassImplementingIXmlSerialiable::", new ClassImplementingIXmlSerialiableSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithNonPublicDefaultConstructor::", new TypeWithNonPublicDefaultConstructorSerializer()); - _tmp.Add(@"SerializationTypes.WithEnums::", new WithEnumsSerializer()); - _tmp.Add(@"SerializationTypes.MoreChoices::", new MoreChoicesSerializer()); - _tmp.Add(@"AliasedTestType::", new AliasedTestTypeSerializer()); - _tmp.Add(@"TypeWithXmlElementProperty::", new TypeWithXmlElementPropertySerializer()); - _tmp.Add(@"SerializationTypes.TypeWith2DArrayProperty2::", new TypeWith2DArrayProperty2Serializer()); + _tmp.Add(@"TypeWithXmlDocumentProperty::", new TypeWithXmlDocumentPropertySerializer()); + _tmp.Add(@"SerializationTypes.WithNullables::", new WithNullablesSerializer()); + _tmp.Add(@"DefaultValuesSetToNegativeInfinity::", new DefaultValuesSetToNegativeInfinitySerializer()); + _tmp.Add(@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:", new NamespaceTypeNameClashContainerSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithArrayPropertyHavingChoice::", new TypeWithArrayPropertyHavingChoiceSerializer()); _tmp.Add(@"SerializationTypes.XmlSerializerAttributes::AttributeTesting:False:", new XmlSerializerAttributesSerializer()); - _tmp.Add(@"SerializationTypes.ULongEnum::", new ULongEnumSerializer()); - _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::", new KnownTypesThroughConstructorWithArrayPropertiesSerializer()); - _tmp.Add(@"Pet::", new PetSerializer()); - _tmp.Add(@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:", new TypeWithMismatchBetweenAttributeAndPropertyTypeSerializer()); - _tmp.Add(@"Instrument::", new InstrumentSerializer()); - _tmp.Add(@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::", new __TypeNameWithSpecialCharacters漢ñSerializer()); - _tmp.Add(@"Outer+Person::", new PersonSerializer()); - _tmp.Add(@"TypeWithBinaryProperty::", new TypeWithBinaryPropertySerializer()); - _tmp.Add(@"SerializationTypes.TypeWithPropertyNameSpecified::", new TypeWithPropertyNameSpecifiedSerializer()); - _tmp.Add(@"SerializationTypes.SimpleKnownTypeValue::", new SimpleKnownTypeValueSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithXmlQualifiedName::", new TypeWithXmlQualifiedNameSerializer()); - _tmp.Add(@"TypeWithDateTimeOffsetProperties::", new TypeWithDateTimeOffsetPropertiesSerializer()); - _tmp.Add(@"MyCollection1::", new MyCollection1Serializer()); - _tmp.Add(@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::", new TypeWithSchemaFormInXmlAttributeSerializer()); - _tmp.Add(@"DefaultValuesSetToPositiveInfinity::", new DefaultValuesSetToPositiveInfinitySerializer()); - _tmp.Add(@"TypeWithTimeSpanProperty::", new TypeWithTimeSpanPropertySerializer()); - _tmp.Add(@"DerivedClass1::", new DerivedClass1Serializer()); - _tmp.Add(@"SerializationTypes.UIntEnum::", new UIntEnumSerializer()); - _tmp.Add(@"BaseClass::", new BaseClassSerializer()); - _tmp.Add(@"PurchaseOrder:http://www.contoso1.com:PurchaseOrder:False:", new PurchaseOrderSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::", new TypeWithReadOnlyMyCollectionPropertySerializer()); + _tmp.Add(@"SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName::", new TypeWithKnownTypesOfCollectionsWithConflictingXmlNameSerializer()); _tmp.Add(@"SerializationTypes.TypeA::", new TypeASerializer()); - _tmp.Add(@"Trumpet::", new TrumpetSerializer()); - _tmp.Add(@"SerializationTypes.BaseClassWithSamePropertyName::", new BaseClassWithSamePropertyNameSerializer()); - _tmp.Add(@"BaseClass1::", new BaseClass1Serializer()); - _tmp.Add(@"SerializationTypes.ShortEnum::", new ShortEnumSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithTypeNameInXmlTypeAttribute::", new TypeWithTypeNameInXmlTypeAttributeSerializer()); - _tmp.Add(@"SerializationTypes.WithStruct::", new WithStructSerializer()); - _tmp.Add(@"Group::", new GroupSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithGetSetArrayMembers::", new TypeWithGetSetArrayMembersSerializer()); + _tmp.Add(@"SerializationTypes.DCStruct::", new DCStructSerializer()); _tmp.Add(@"Animal::", new AnimalSerializer()); - _tmp.Add(@"OrderedItem::", new OrderedItemSerializer()); - _tmp.Add(@"SerializationTypes.IntEnum::", new IntEnumSerializer()); + _tmp.Add(@"BaseClass1::", new BaseClass1Serializer()); + _tmp.Add(@"SerializationTypes.TypeWithXmlQualifiedName::", new TypeWithXmlQualifiedNameSerializer()); + _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructorWithValue::", new KnownTypesThroughConstructorWithValueSerializer()); + _tmp.Add(@"SerializationTypes.LongEnum::", new LongEnumSerializer()); + _tmp.Add(@"TypeWithXmlNodeArrayProperty:::True:", new TypeWithXmlNodeArrayPropertySerializer()); + _tmp.Add(@"SerializationTypes.ComplexChoiceA::", new ComplexChoiceASerializer()); + _tmp.Add(@"SerializationTypes.EnumFlags::", new EnumFlagsSerializer()); + _tmp.Add(@"SerializationTypes.UIntEnum::", new UIntEnumSerializer()); + _tmp.Add(@"SerializationTypes.TypeHasArrayOfASerializedAsB::", new TypeHasArrayOfASerializedAsBSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithDateTimePropertyAsXmlTime::", new TypeWithDateTimePropertyAsXmlTimeSerializer()); + _tmp.Add(@"DogBreed::", new DogBreedSerializer()); + _tmp.Add(@"SerializationTypes.ByteEnum::", new ByteEnumSerializer()); _tmp.Add(@"TypeWithLinkedProperty::", new TypeWithLinkedPropertySerializer()); - _tmp.Add(@"SerializationTypes.TypeWithByteArrayAsXmlText::", new TypeWithByteArrayAsXmlTextSerializer()); - _tmp.Add(@"SerializationTypes.TypeNameClashA.TypeNameClash::", new TypeNameClashSerializer1()); - _tmp.Add(@"TypeWithXmlDocumentProperty::", new TypeWithXmlDocumentPropertySerializer()); - _tmp.Add(@"Employee::", new EmployeeSerializer()); + _tmp.Add(@"SerializationTypes.ClassImplementingIXmlSerialiable::", new ClassImplementingIXmlSerialiableSerializer()); + _tmp.Add(@"SerializationTypes.IntEnum::", new IntEnumSerializer()); + _tmp.Add(@"Instrument::", new InstrumentSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithNonPublicDefaultConstructor::", new TypeWithNonPublicDefaultConstructorSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithTypesHavingCustomFormatter::", new TypeWithTypesHavingCustomFormatterSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithMyCollectionField::", new TypeWithMyCollectionFieldSerializer()); + _tmp.Add(@"Address::", new AddressSerializer()); + _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructor::", new KnownTypesThroughConstructorSerializer()); + _tmp.Add(@"SerializationTypes.ServerSettings::", new ServerSettingsSerializer()); _tmp.Add(@"SerializationTypes.TypeWithDateTimeStringProperty::", new TypeWithDateTimeStringPropertySerializer()); + _tmp.Add(@"Vehicle::", new VehicleSerializer()); + _tmp.Add(@"TypeWithTimeSpanProperty::", new TypeWithTimeSpanPropertySerializer()); + _tmp.Add(@"SerializationTypes.ItemChoiceType::", new ItemChoiceTypeSerializer()); + _tmp.Add(@"SerializationTypes.DerivedClassWithSameProperty2::", new DerivedClassWithSameProperty2Serializer()); + _tmp.Add(@"Outer+Person::", new PersonSerializer()); + _tmp.Add(@"MyCollection1::", new MyCollection1Serializer()); + _tmp.Add(@"SerializationTypes.MoreChoices::", new MoreChoicesSerializer()); + _tmp.Add(@"AliasedTestType::", new AliasedTestTypeSerializer()); + _tmp.Add(@"Orchestra::", new OrchestraSerializer()); + _tmp.Add(@"SerializationTypes.ShortEnum::", new ShortEnumSerializer()); + _tmp.Add(@"Trumpet::", new TrumpetSerializer()); _tmp.Add(@"XElementStruct::", new XElementStructSerializer()); - _tmp.Add(@"SerializationTypes.SomeStruct::", new SomeStructSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithAnyAttribute::", new TypeWithAnyAttributeSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:", new TypeWithXmlSchemaFormAttributeSerializer()); - _tmp.Add(@"SerializationTypes.TypeB::", new TypeBSerializer()); - _tmp.Add(@"SerializationTypes.SimpleType::", new SimpleTypeSerializer()); - _tmp.Add(@"SerializationTypes.MyList::", new MyListSerializer()); - _tmp.Add(@"SerializationTypes.SimpleDC::", new SimpleDCSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithTypesHavingCustomFormatter::", new TypeWithTypesHavingCustomFormatterSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::", new TypeWithEnumFlagPropertyHavingDefaultValueSerializer()); + _tmp.Add(@"SerializationTypes.ComplexChoiceB::", new ComplexChoiceBSerializer()); + _tmp.Add(@"MsgDocumentType:http://example.com:Document:True:", new MsgDocumentTypeSerializer()); _tmp.Add(@"SerializationTypes.MyEnum::", new MyEnumSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithGetOnlyArrayProperties::", new TypeWithGetOnlyArrayPropertiesSerializer()); - _tmp.Add(@"SerializationTypes.StructNotSerializable::", new StructNotSerializableSerializer()); - _tmp.Add(@"SerializationTypes.NamespaceTypeNameClashContainer::Root:True:", new NamespaceTypeNameClashContainerSerializer()); - _tmp.Add(@"SerializationTypes.BuiltInTypes::", new BuiltInTypesSerializer()); + _tmp.Add(@"OrderedItem::", new OrderedItemSerializer()); + _tmp.Add(@"TypeWithBinaryProperty::", new TypeWithBinaryPropertySerializer()); + _tmp.Add(@"TypeWithDefaultTimeSpanProperty::", new TypeWithDefaultTimeSpanPropertySerializer()); + _tmp.Add(@"Brass::", new BrassSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::", new TypeWithPropertiesHavingDefaultValueSerializer()); _tmp.Add(@"RootClass::", new RootClassSerializer()); + _tmp.Add(@"DerivedClass1::", new DerivedClass1Serializer()); + _tmp.Add(@"SerializationTypes.TypeWithShouldSerializeMethod::", new TypeWithShouldSerializeMethodSerializer()); + _tmp.Add(@"SerializationTypes.DCClassWithEnumAndStruct::", new DCClassWithEnumAndStructSerializer()); _tmp.Add(@"SerializationTypes.SByteEnum::", new SByteEnumSerializer()); + _tmp.Add(@"Pet::", new PetSerializer()); + _tmp.Add(@"SerializationTypes.ULongEnum::", new ULongEnumSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithXmlSchemaFormAttribute:::True:", new TypeWithXmlSchemaFormAttributeSerializer()); + _tmp.Add(@"BaseClass::", new BaseClassSerializer()); + _tmp.Add(@"TypeWithMismatchBetweenAttributeAndPropertyType::RootElement:True:", new TypeWithMismatchBetweenAttributeAndPropertyTypeSerializer()); + _tmp.Add(@"Parameter::", new ParameterSerializer()); + _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructorWithArrayProperties::", new KnownTypesThroughConstructorWithArrayPropertiesSerializer()); + _tmp.Add(@"SerializationTypes.TypeNameClashA.TypeNameClash::", new TypeNameClashSerializer1()); + _tmp.Add(@"SerializationTypes.BuiltInTypes::", new BuiltInTypesSerializer()); + _tmp.Add(@"TypeWithDateTimeOffsetProperties::", new TypeWithDateTimeOffsetPropertiesSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithPropertyHavingComplexChoice::", new TypeWithPropertyHavingComplexChoiceSerializer()); + _tmp.Add(@"SerializationTypes.DerivedClassWithSameProperty::", new DerivedClassWithSamePropertySerializer()); + _tmp.Add(@"SerializationTypes.TypeWithGetOnlyArrayProperties::", new TypeWithGetOnlyArrayPropertiesSerializer()); + _tmp.Add(@"SerializationTypes.WithEnums::", new WithEnumsSerializer()); + _tmp.Add(@"SerializationTypes.__TypeNameWithSpecialCharacters漢ñ::", new __TypeNameWithSpecialCharacters漢ñSerializer()); + _tmp.Add(@"SerializationTypes.SimpleType::", new SimpleTypeSerializer()); + _tmp.Add(@"SerializationTypes.TypeWith2DArrayProperty2::", new TypeWith2DArrayProperty2Serializer()); + _tmp.Add(@"SerializationTypes.WithStruct::", new WithStructSerializer()); + _tmp.Add(@"DefaultValuesSetToPositiveInfinity::", new DefaultValuesSetToPositiveInfinitySerializer()); _tmp.Add(@"XElementWrapper::", new XElementWrapperSerializer()); - _tmp.Add(@"SerializationTypes.DCStruct::", new DCStructSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithPropertyNameSpecified::", new TypeWithPropertyNameSpecifiedSerializer()); + _tmp.Add(@"SerializationTypes.TypeB::", new TypeBSerializer()); + _tmp.Add(@"DefaultValuesSetToNaN::", new DefaultValuesSetToNaNSerializer()); + _tmp.Add(@"Employee::", new EmployeeSerializer()); + _tmp.Add(@"SerializationTypes.SomeStruct::", new SomeStructSerializer()); _tmp.Add(@"SerializationTypes.TypeWithXmlTextAttributeOnArray:http://schemas.xmlsoap.org/ws/2005/04/discovery::False:", new TypeWithXmlTextAttributeOnArraySerializer()); - _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructor::", new KnownTypesThroughConstructorSerializer()); - _tmp.Add(@"SerializationTypes.DerivedClassWithSameProperty::", new DerivedClassWithSamePropertySerializer()); - _tmp.Add(@"SerializationTypes.DCClassWithEnumAndStruct::", new DCClassWithEnumAndStructSerializer()); - _tmp.Add(@"DogBreed::", new DogBreedSerializer()); - _tmp.Add(@"SerializationTypes.DerivedClassWithSameProperty2::", new DerivedClassWithSameProperty2Serializer()); _tmp.Add(@"SerializationTypes.TypeWithFieldsOrdered::", new TypeWithFieldsOrderedSerializer()); - _tmp.Add(@"DefaultValuesSetToNegativeInfinity::", new DefaultValuesSetToNegativeInfinitySerializer()); - _tmp.Add(@"Dog::", new DogSerializer()); - _tmp.Add(@"TypeWithXmlNodeArrayProperty:::True:", new TypeWithXmlNodeArrayPropertySerializer()); - _tmp.Add(@"SerializationTypes.TypeWithEnumPropertyHavingDefaultValue::", new TypeWithEnumPropertyHavingDefaultValueSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithEnumFlagPropertyHavingDefaultValue::", new TypeWithEnumFlagPropertyHavingDefaultValueSerializer()); - _tmp.Add(@"SerializationTypes.WithNullables::", new WithNullablesSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithSchemaFormInXmlAttribute::", new TypeWithSchemaFormInXmlAttributeSerializer()); + _tmp.Add(@"SerializationTypes.ClassImplementsInterface::", new ClassImplementsInterfaceSerializer()); _tmp.Add(@"SerializationTypes.TypeNameClashB.TypeNameClash::", new TypeNameClashSerializer()); - _tmp.Add(@"SerializationTypes.ByteEnum::", new ByteEnumSerializer()); - _tmp.Add(@"DefaultValuesSetToNaN::", new DefaultValuesSetToNaNSerializer()); - _tmp.Add(@"Orchestra::", new OrchestraSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithArrayPropertyHavingChoice::", new TypeWithArrayPropertyHavingChoiceSerializer()); - _tmp.Add(@"Parameter::", new ParameterSerializer()); - _tmp.Add(@"SerializationTypes.EnumFlags::", new EnumFlagsSerializer()); - _tmp.Add(@"SerializationTypes.KnownTypesThroughConstructorWithValue::", new KnownTypesThroughConstructorWithValueSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithPropertiesHavingDefaultValue::", new TypeWithPropertiesHavingDefaultValueSerializer()); - _tmp.Add(@"SerializationTypes.LongEnum::", new LongEnumSerializer()); - _tmp.Add(@"SerializationTypes.TypeWithShouldSerializeMethod::", new TypeWithShouldSerializeMethodSerializer()); - _tmp.Add(@"SerializationTypes.TypeHasArrayOfASerializedAsB::", new TypeHasArrayOfASerializedAsBSerializer()); + _tmp.Add(@"SerializationTypes.TypeWithReadOnlyMyCollectionProperty::", new TypeWithReadOnlyMyCollectionPropertySerializer()); + _tmp.Add(@"SerializationTypes.BaseClassWithSamePropertyName::", new BaseClassWithSamePropertyNameSerializer()); + _tmp.Add(@"Group::", new GroupSerializer()); if (typedSerializers == null) typedSerializers = _tmp; } return typedSerializers; @@ -15952,6 +16862,7 @@ public override System.Boolean CanSerialize(System.Type type) { if (type == typeof(global::SerializationTypes.SimpleType)) return true; if (type == typeof(global::SerializationTypes.TypeWithGetSetArrayMembers)) return true; if (type == typeof(global::SerializationTypes.TypeWithGetOnlyArrayProperties)) return true; + if (type == typeof(global::SerializationTypes.TypeWithArraylikeMembers)) return true; if (type == typeof(global::SerializationTypes.StructNotSerializable)) return true; if (type == typeof(global::SerializationTypes.TypeWithMyCollectionField)) return true; if (type == typeof(global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)) return true; @@ -16007,7 +16918,10 @@ public override System.Boolean CanSerialize(System.Type type) { if (type == typeof(global::SerializationTypes.KnownTypesThroughConstructorWithValue)) return true; if (type == typeof(global::SerializationTypes.TypeWithTypesHavingCustomFormatter)) return true; if (type == typeof(global::SerializationTypes.TypeWithArrayPropertyHavingChoice)) return true; + if (type == typeof(global::SerializationTypes.TypeWithPropertyHavingComplexChoice)) return true; if (type == typeof(global::SerializationTypes.MoreChoices)) return true; + if (type == typeof(global::SerializationTypes.ComplexChoiceA)) return true; + if (type == typeof(global::SerializationTypes.ComplexChoiceB)) return true; if (type == typeof(global::SerializationTypes.TypeWithFieldsOrdered)) return true; if (type == typeof(global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)) return true; if (type == typeof(global::SerializationTypes.NamespaceTypeNameClashContainer)) return true; @@ -16060,6 +16974,7 @@ public override System.Xml.Serialization.XmlSerializer GetSerializer(System.Type if (type == typeof(global::SerializationTypes.SimpleType)) return new SimpleTypeSerializer(); if (type == typeof(global::SerializationTypes.TypeWithGetSetArrayMembers)) return new TypeWithGetSetArrayMembersSerializer(); if (type == typeof(global::SerializationTypes.TypeWithGetOnlyArrayProperties)) return new TypeWithGetOnlyArrayPropertiesSerializer(); + if (type == typeof(global::SerializationTypes.TypeWithArraylikeMembers)) return new TypeWithArraylikeMembersSerializer(); if (type == typeof(global::SerializationTypes.StructNotSerializable)) return new StructNotSerializableSerializer(); if (type == typeof(global::SerializationTypes.TypeWithMyCollectionField)) return new TypeWithMyCollectionFieldSerializer(); if (type == typeof(global::SerializationTypes.TypeWithReadOnlyMyCollectionProperty)) return new TypeWithReadOnlyMyCollectionPropertySerializer(); @@ -16115,7 +17030,10 @@ public override System.Xml.Serialization.XmlSerializer GetSerializer(System.Type if (type == typeof(global::SerializationTypes.KnownTypesThroughConstructorWithValue)) return new KnownTypesThroughConstructorWithValueSerializer(); if (type == typeof(global::SerializationTypes.TypeWithTypesHavingCustomFormatter)) return new TypeWithTypesHavingCustomFormatterSerializer(); if (type == typeof(global::SerializationTypes.TypeWithArrayPropertyHavingChoice)) return new TypeWithArrayPropertyHavingChoiceSerializer(); + if (type == typeof(global::SerializationTypes.TypeWithPropertyHavingComplexChoice)) return new TypeWithPropertyHavingComplexChoiceSerializer(); if (type == typeof(global::SerializationTypes.MoreChoices)) return new MoreChoicesSerializer(); + if (type == typeof(global::SerializationTypes.ComplexChoiceA)) return new ComplexChoiceASerializer(); + if (type == typeof(global::SerializationTypes.ComplexChoiceB)) return new ComplexChoiceBSerializer(); if (type == typeof(global::SerializationTypes.TypeWithFieldsOrdered)) return new TypeWithFieldsOrderedSerializer(); if (type == typeof(global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName)) return new TypeWithKnownTypesOfCollectionsWithConflictingXmlNameSerializer(); if (type == typeof(global::SerializationTypes.NamespaceTypeNameClashContainer)) return new NamespaceTypeNameClashContainerSerializer(); diff --git a/src/libraries/System.Data.Odbc/tests/CommandBuilderTests.cs b/src/libraries/System.Data.Odbc/tests/CommandBuilderTests.cs index 5b3c38bf894059..48f7dd90506e93 100644 --- a/src/libraries/System.Data.Odbc/tests/CommandBuilderTests.cs +++ b/src/libraries/System.Data.Odbc/tests/CommandBuilderTests.cs @@ -7,6 +7,7 @@ namespace System.Data.Odbc.Tests { public class CommandBuilderTests : IntegrationTestBase { + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void QuoteIdentifier_UseConnection() { @@ -36,6 +37,7 @@ public void QuoteIdentifier_UseConnection() Assert.Throws(() => commandBuilder.UnquoteIdentifier("Test")); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void QuoteIdentifier_CustomPrefixSuffix() { diff --git a/src/libraries/System.Data.Odbc/tests/ConnectionTests.cs b/src/libraries/System.Data.Odbc/tests/ConnectionTests.cs index 24c42a5bc72401..a468a0f0e2a39d 100644 --- a/src/libraries/System.Data.Odbc/tests/ConnectionTests.cs +++ b/src/libraries/System.Data.Odbc/tests/ConnectionTests.cs @@ -9,6 +9,7 @@ namespace System.Data.Odbc.Tests { public class ConnectionTests : IntegrationTestBase { + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] // Bug #96278 fixed only on .NET, not on .NET Framework [ConditionalFact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] diff --git a/src/libraries/System.Data.Odbc/tests/DependencyCheckTest.cs b/src/libraries/System.Data.Odbc/tests/DependencyCheckTest.cs index d2eee47618689f..2937d2a15c6232 100644 --- a/src/libraries/System.Data.Odbc/tests/DependencyCheckTest.cs +++ b/src/libraries/System.Data.Odbc/tests/DependencyCheckTest.cs @@ -8,6 +8,7 @@ namespace System.Data.Odbc.Tests public class DependencyCheckTest { [ConditionalFact(Helpers.OdbcNotAvailable)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] public void OdbcConnection_OpenWhenOdbcNotInstalled_ThrowsException() { if (PlatformDetection.IsWindowsServerCore && !Environment.Is64BitProcess) diff --git a/src/libraries/System.Data.Odbc/tests/ReaderTests.cs b/src/libraries/System.Data.Odbc/tests/ReaderTests.cs index 79ea6ffa93c485..1010e02870f5d8 100644 --- a/src/libraries/System.Data.Odbc/tests/ReaderTests.cs +++ b/src/libraries/System.Data.Odbc/tests/ReaderTests.cs @@ -8,6 +8,7 @@ namespace System.Data.Odbc.Tests { public class ReaderTests : IntegrationTestBase { + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void EmptyReader() { @@ -42,6 +43,7 @@ public void EmptyReader() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void GetValues() { @@ -75,6 +77,7 @@ public void GetValues() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void GetValueFailsWithBigIntWithBackwardsCompatibility() { @@ -110,6 +113,7 @@ public void GetValueFailsWithBigIntWithBackwardsCompatibility() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void GetDataTypeName() { @@ -136,6 +140,7 @@ public void GetDataTypeName() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void GetFieldTypeIsNotSupportedInSqlite() { @@ -167,6 +172,7 @@ public void GetFieldTypeIsNotSupportedInSqlite() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void IsDbNullIsNotSupportedInSqlite() { @@ -198,6 +204,7 @@ public void IsDbNullIsNotSupportedInSqlite() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void InvalidRowIndex() { @@ -230,6 +237,7 @@ public void InvalidRowIndex() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void InvalidRowName() { diff --git a/src/libraries/System.Data.Odbc/tests/SmokeTest.cs b/src/libraries/System.Data.Odbc/tests/SmokeTest.cs index f508673fbde2f5..2733b0a0aa620e 100644 --- a/src/libraries/System.Data.Odbc/tests/SmokeTest.cs +++ b/src/libraries/System.Data.Odbc/tests/SmokeTest.cs @@ -7,6 +7,7 @@ namespace System.Data.Odbc.Tests { public class SmokeTest : IntegrationTestBase { + [ActiveIssue("https://github.com/dotnet/runtime/issues/116482", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] [ConditionalFact] public void CreateInsertSelectTest() { diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj index 2316c532efb58b..f110b765c8adcd 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System.Diagnostics.DiagnosticSource.csproj @@ -25,7 +25,7 @@ System.Diagnostics.DiagnosticSource - + diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivitySource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivitySource.cs index ebaddab4ec80cc..f82e54e65d5b5e 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivitySource.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivitySource.cs @@ -407,105 +407,94 @@ internal void NotifyActivityAddException(Activity activity, Exception exception, } } - // SynchronizedList is a helper collection which ensure thread safety on the collection - // and allow enumerating the collection items and execute some action on the enumerated item and can detect any change in the collection - // during the enumeration which force restarting the enumeration again. - // Caution: We can have the action executed on the same item more than once which is ok in our scenarios. + // This class uses a copy-on-write design to ensure thread safety all operations are thread safe. + // However, it is possible for read-only operations to see stale versions of the item while a change + // is occurring. internal sealed class SynchronizedList { - private readonly List _list; - private uint _version; - - public SynchronizedList() => _list = new List(); + private readonly object _writeLock; + // This array must not be mutated directly. To mutate, obtain the lock, copy the array and then replace it with the new array. + private T[] _volatileArray; + public SynchronizedList() + { + _volatileArray = []; + _writeLock = new(); + } public void Add(T item) { - lock (_list) + lock (_writeLock) { - _list.Add(item); - _version++; + T[] newArray = new T[_volatileArray.Length + 1]; + + Array.Copy(_volatileArray, newArray, _volatileArray.Length);// copy existing items + newArray[_volatileArray.Length] = item;// copy new item + + _volatileArray = newArray; } } public bool AddIfNotExist(T item) { - lock (_list) + lock (_writeLock) { - if (!_list.Contains(item)) + int index = Array.IndexOf(_volatileArray, item); + + if (index >= 0) { - _list.Add(item); - _version++; - return true; + return false; } - return false; + + T[] newArray = new T[_volatileArray.Length + 1]; + + Array.Copy(_volatileArray, newArray, _volatileArray.Length);// copy existing items + newArray[_volatileArray.Length] = item;// copy new item + + _volatileArray = newArray; + + return true; } } public bool Remove(T item) { - lock (_list) + lock (_writeLock) { - if (_list.Remove(item)) + int index = Array.IndexOf(_volatileArray, item); + + if (index < 0) { - _version++; - return true; + return false; } - return false; + + T[] newArray = new T[_volatileArray.Length - 1]; + + Array.Copy(_volatileArray, newArray, index);// copy existing items before index + + Array.Copy( + _volatileArray, index + 1, // position after the index, skipping it + newArray, index, _volatileArray.Length - index - 1// remaining items accounting for removed item + ); + + _volatileArray = newArray; + return true; } } - public int Count => _list.Count; + public int Count => _volatileArray.Length; public void EnumWithFunc(ActivitySource.Function func, ref ActivityCreationOptions data, ref ActivitySamplingResult samplingResult, ref ActivityCreationOptions dataWithContext) { - uint version = _version; - int index = 0; - - while (index < _list.Count) + foreach (T item in _volatileArray) { - T item; - lock (_list) - { - if (version != _version) - { - version = _version; - index = 0; - continue; - } - - item = _list[index]; - index++; - } - - // Important to call the func outside the lock. - // This is the whole point we are having this wrapper class. func(item, ref data, ref samplingResult, ref dataWithContext); } } public void EnumWithAction(Action action, object arg) { - uint version = _version; - int index = 0; - - while (index < _list.Count) + foreach (T item in _volatileArray) { - T item; - lock (_list) - { - if (version != _version) - { - version = _version; - index = 0; - continue; - } - - item = _list[index]; - index++; - } - - // Important to call the action outside the lock. - // This is the whole point we are having this wrapper class. action(item, arg); } } @@ -517,27 +506,8 @@ public void EnumWithExceptionNotification(Activity activity, Exception exception return; } - uint version = _version; - int index = 0; - - while (index < _list.Count) + foreach (T item in _volatileArray) { - T item; - lock (_list) - { - if (version != _version) - { - version = _version; - index = 0; - continue; - } - - item = _list[index]; - index++; - } - - // Important to notify outside the lock. - // This is the whole point we are having this wrapper class. (item as ActivityListener)!.ExceptionRecorder?.Invoke(activity, exception, ref tags); } } diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs index 0c23059c17ae88..ecfe219e072843 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/HttpHandlerDiagnosticListenerTests.cs @@ -145,6 +145,7 @@ public async Task TestBasicReceiveAndResponseEvents() } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/112792")] [OuterLoop] [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public void TestW3CHeaders() @@ -194,6 +195,7 @@ public void TestW3CHeadersTraceStateAndCorrelationContext() { using (var eventRecords = new EventObserverAndRecorder()) { + Activity.DefaultIdFormat = ActivityIdFormat.W3C; var parent = new Activity("w3c activity"); parent.SetParentId(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom()); parent.TraceStateString = "some=state"; diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs index e1a28506696ccf..fb844377ea4c64 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/AD/ADStoreCtx.cs @@ -2405,6 +2405,9 @@ protected enum StoreCapabilityMap // Must be called inside of lock(domainInfoLock) protected virtual void LoadDomainInfo() { + const int LdapDefaultPort = 389; + const int LdapsDefaultPort = 636; + GlobalDebug.WriteLineIf(GlobalDebug.Info, "ADStoreCtx", "LoadComputerInfo"); Debug.Assert(this.ctxBase != null); @@ -2418,12 +2421,22 @@ protected virtual void LoadDomainInfo() this.dnsHostName = ADUtils.GetServerName(this.ctxBase); // Pull the requested port number - Uri ldapUri = new Uri(this.ctxBase.Path); - int port = ldapUri.Port != -1 ? ldapUri.Port : (ldapUri.Scheme.ToUpperInvariant() == "LDAPS" ? 636 : 389); + int port = LdapDefaultPort; + if (Uri.TryCreate(ctxBase.Path, UriKind.Absolute, out Uri ldapUri)) + { + if (ldapUri.Port != -1) + { + port = ldapUri.Port; + } + else if (string.Equals(ldapUri.Scheme, "LDAPS", StringComparison.OrdinalIgnoreCase)) + { + port = LdapsDefaultPort; + } + } string dnsDomainName = ""; - using (DirectoryEntry rootDse = new DirectoryEntry("LDAP://" + this.dnsHostName + ":" + port + "/rootDse", "", "", AuthenticationTypes.Anonymous)) + using (DirectoryEntry rootDse = new DirectoryEntry($"LDAP://{this.dnsHostName}:{port}/rootDse", "", "", AuthenticationTypes.Anonymous)) { this.defaultNamingContext = (string)rootDse.Properties["defaultNamingContext"][0]; this.contextBasePartitionDN = this.defaultNamingContext; diff --git a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs index 32262da81be3e2..49ff2a1891cee0 100644 --- a/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs +++ b/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs @@ -382,6 +382,10 @@ public partial class LdapSessionOptions internal LdapSessionOptions() { } public bool AutoReconnect { get { throw null; } set { } } public string DomainName { get { throw null; } set { } } +#if NET + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] + public string TrustedCertificatesDirectory { get { throw null; } set { } } +#endif public string HostName { get { throw null; } set { } } public bool HostReachable { get { throw null; } } public System.DirectoryServices.Protocols.LocatorFlags LocatorFlag { get { throw null; } set { } } @@ -402,6 +406,10 @@ internal LdapSessionOptions() { } public bool Signing { get { throw null; } set { } } public System.DirectoryServices.Protocols.SecurityPackageContextConnectionInformation SslInformation { get { throw null; } } public int SspiFlag { get { throw null; } set { } } +#if NET + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("windows")] + public void StartNewTlsSessionContext() { } +#endif public bool TcpKeepAlive { get { throw null; } set { } } public System.DirectoryServices.Protocols.VerifyServerCertificateCallback VerifyServerCertificate { get { throw null; } set { } } public void FastConcurrentBind() { } diff --git a/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml b/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml new file mode 100644 index 00000000000000..2647f901c1a47e --- /dev/null +++ b/src/libraries/System.DirectoryServices.Protocols/src/CompatibilitySuppressions.xml @@ -0,0 +1,67 @@ + + + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/net8.0/System.DirectoryServices.Protocols.dll + lib/net8.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/net9.0/System.DirectoryServices.Protocols.dll + lib/net9.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/net9.0/System.DirectoryServices.Protocols.dll + lib/net9.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/net9.0/System.DirectoryServices.Protocols.dll + lib/net9.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.get_TrustedCertificatesDirectory + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.set_TrustedCertificatesDirectory(System.String) + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + + CP0002 + M:System.DirectoryServices.Protocols.LdapSessionOptions.StartNewTlsSessionContext + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + lib/netstandard2.0/System.DirectoryServices.Protocols.dll + true + + \ No newline at end of file diff --git a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx index b63f103619fbdb..1f6c9734a7384c 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx +++ b/src/libraries/System.DirectoryServices.Protocols/src/Resources/Strings.resx @@ -426,4 +426,7 @@ Only ReferralChasingOptions.None and ReferralChasingOptions.All are supported on Linux. + + The directory '{0}' does not exist. + \ No newline at end of file diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs index 1125bfd568d385..facdfc6a484bb9 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs @@ -955,13 +955,13 @@ private unsafe Interop.BOOL ProcessClientCertificate(IntPtr ldapHandle, IntPtr C private void Connect() { - //Ccurrently ldap does not accept more than one certificate. + // Currently ldap does not accept more than one certificate. if (ClientCertificates.Count > 1) { throw new InvalidOperationException(SR.InvalidClientCertificates); } - // Set the certificate callback routine here if user adds the certifcate to the certificate collection. + // Set the certificate callback routine here if user adds the certificate to the certificate collection. if (ClientCertificates.Count != 0) { int certError = LdapPal.SetClientCertOption(_ldapHandle, LdapOption.LDAP_OPT_CLIENT_CERTIFICATE, _clientCertificateRoutine); diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs index e1cfffebb531fc..5059c40499d5c6 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; +using System.IO; +using System.Runtime.Versioning; namespace System.DirectoryServices.Protocols { @@ -11,6 +13,34 @@ public partial class LdapSessionOptions private bool _secureSocketLayer; + /// + /// Specifies the path of the directory containing CA certificates in the PEM format. + /// Multiple directories may be specified by separating with a semi-colon. + /// + /// + /// The certificate files are looked up by the CA subject name hash value where that hash can be + /// obtained by using, for example, openssl x509 -hash -noout -in CA.crt. + /// It is a common practice to have the certificate file be a symbolic link to the actual certificate file + /// which can be done by using openssl rehash . or c_rehash . in the directory + /// containing the certificate files. + /// + /// The directory not exist. + [UnsupportedOSPlatform("windows")] + public string TrustedCertificatesDirectory + { + get => GetStringValueHelper(LdapOption.LDAP_OPT_X_TLS_CACERTDIR, releasePtr: true); + + set + { + if (!Directory.Exists(value)) + { + throw new DirectoryNotFoundException(SR.Format(SR.DirectoryNotFound, value)); + } + + SetStringOptionHelper(LdapOption.LDAP_OPT_X_TLS_CACERTDIR, value); + } + } + public bool SecureSocketLayer { get @@ -52,6 +82,16 @@ public ReferralChasingOptions ReferralChasing } } + /// + /// Create a new TLS library context. + /// Calling this is necessary after setting TLS-based options, such as TrustedCertificatesDirectory. + /// + [UnsupportedOSPlatform("windows")] + public void StartNewTlsSessionContext() + { + SetIntValueHelper(LdapOption.LDAP_OPT_X_TLS_NEWCTX, 0); + } + private bool GetBoolValueHelper(LdapOption option) { if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); @@ -71,5 +111,14 @@ private void SetBoolValueHelper(LdapOption option, bool value) ErrorChecking.CheckAndSetLdapError(error); } + + private void SetStringOptionHelper(LdapOption option, string value) + { + if (_connection._disposed) throw new ObjectDisposedException(GetType().Name); + + int error = LdapPal.SetStringOption(_connection._ldapHandle, option, value); + + ErrorChecking.CheckAndSetLdapError(error); + } } } diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs index 813005c5ecb72b..cc73449104adf4 100644 --- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs +++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs @@ -10,6 +10,13 @@ public partial class LdapSessionOptions { private static void PALCertFreeCRLContext(IntPtr certPtr) => Interop.Ldap.CertFreeCRLContext(certPtr); + [UnsupportedOSPlatform("windows")] + public string TrustedCertificatesDirectory + { + get => throw new PlatformNotSupportedException(); + set => throw new PlatformNotSupportedException(); + } + public bool SecureSocketLayer { get @@ -24,6 +31,9 @@ public bool SecureSocketLayer } } + [UnsupportedOSPlatform("windows")] + public void StartNewTlsSessionContext() => throw new PlatformNotSupportedException(); + public int ProtocolVersion { get => GetIntValueHelper(LdapOption.LDAP_OPT_VERSION); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs index 00433bae9875c2..05dda66bbda001 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs @@ -2,12 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; -using System.Diagnostics; using System.DirectoryServices.Tests; using System.Globalization; +using System.IO; using System.Net; -using System.Text; -using System.Threading; using Xunit; namespace System.DirectoryServices.Protocols.Tests @@ -16,6 +14,7 @@ public partial class DirectoryServicesProtocolsTests { internal static bool LdapConfigurationExists => LdapConfiguration.Configuration != null; internal static bool IsActiveDirectoryServer => LdapConfigurationExists && LdapConfiguration.Configuration.IsActiveDirectoryServer; + internal static bool UseTls => LdapConfigurationExists && LdapConfiguration.Configuration.UseTls; internal static bool IsServerSideSortSupported => LdapConfigurationExists && LdapConfiguration.Configuration.SupportsServerSideSort; @@ -706,6 +705,64 @@ public void TestMultipleServerBind() connection.Timeout = new TimeSpan(0, 3, 0); } +#if NET + [ConditionalFact(nameof(UseTls))] + [PlatformSpecific(TestPlatforms.Linux)] + public void StartNewTlsSessionContext() + { + using (var connection = GetConnection(bind: false)) + { + // We use "." as the directory since it must be a valid directory for StartNewTlsSessionContext() + Bind() to be successful even + // though there are no client certificates in ".". + connection.SessionOptions.TrustedCertificatesDirectory = "."; + + // For a real-world scenario, we would call 'StartTransportLayerSecurity(null)' here which would do the TLS handshake including + // providing the client certificate to the server and validating the server certificate. However, this requires additional + // setup that we don't have including trusting the server certificate and by specifying "demand" in the setup of the server + // via 'LDAP_TLS_VERIFY_CLIENT=demand' to force the TLS handshake to occur. + + connection.SessionOptions.StartNewTlsSessionContext(); + connection.Bind(); + + SearchRequest searchRequest = new (LdapConfiguration.Configuration.SearchDn, "(objectClass=*)", SearchScope.Subtree); + _ = (SearchResponse)connection.SendRequest(searchRequest); + } + } + + [ConditionalFact(nameof(UseTls))] + [PlatformSpecific(TestPlatforms.Linux)] + public void StartNewTlsSessionContext_ThrowsLdapException() + { + using (var connection = GetConnection(bind: false)) + { + // Create a new session context without setting TrustedCertificatesDirectory. + connection.SessionOptions.StartNewTlsSessionContext(); + Assert.Throws(() => connection.Bind()); + } + } + + [ConditionalFact(nameof(LdapConfigurationExists))] + [PlatformSpecific(TestPlatforms.Linux)] + public void TrustedCertificatesDirectory_ThrowsDirectoryNotFoundException() + { + using (var connection = GetConnection(bind: false)) + { + Assert.Throws(() => connection.SessionOptions.TrustedCertificatesDirectory = "nonexistent"); + } + } + + [ConditionalFact(nameof(LdapConfigurationExists))] + [PlatformSpecific(TestPlatforms.Windows)] + public void StartNewTlsSessionContext_ThrowsPlatformNotSupportedException() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Throws(() => options.StartNewTlsSessionContext()); + } + } +#endif + private void DeleteAttribute(LdapConnection connection, string entryDn, string attributeName) { string dn = entryDn + "," + LdapConfiguration.Configuration.SearchDn; @@ -786,24 +843,24 @@ private SearchResultEntry SearchUser(LdapConnection connection, string rootDn, s return null; } - private LdapConnection GetConnection(string server) + private static LdapConnection GetConnection(string server) { LdapDirectoryIdentifier directoryIdentifier = new LdapDirectoryIdentifier(server, fullyQualifiedDnsHostName: true, connectionless: false); return GetConnection(directoryIdentifier); } - private LdapConnection GetConnection() + private static LdapConnection GetConnection(bool bind = true) { LdapDirectoryIdentifier directoryIdentifier = string.IsNullOrEmpty(LdapConfiguration.Configuration.Port) ? new LdapDirectoryIdentifier(LdapConfiguration.Configuration.ServerName, fullyQualifiedDnsHostName: true, connectionless: false) : new LdapDirectoryIdentifier(LdapConfiguration.Configuration.ServerName, int.Parse(LdapConfiguration.Configuration.Port, NumberStyles.None, CultureInfo.InvariantCulture), fullyQualifiedDnsHostName: true, connectionless: false); - return GetConnection(directoryIdentifier); + return GetConnection(directoryIdentifier, bind); } - private static LdapConnection GetConnection(LdapDirectoryIdentifier directoryIdentifier) + private static LdapConnection GetConnection(LdapDirectoryIdentifier directoryIdentifier, bool bind = true) { NetworkCredential credential = new NetworkCredential(LdapConfiguration.Configuration.UserName, LdapConfiguration.Configuration.Password); @@ -816,7 +873,11 @@ private static LdapConnection GetConnection(LdapDirectoryIdentifier directoryIde // to LDAP v2, which we do not support, and will return LDAP_PROTOCOL_ERROR connection.SessionOptions.ProtocolVersion = 3; connection.SessionOptions.SecureSocketLayer = LdapConfiguration.Configuration.UseTls; - connection.Bind(); + + if (bind) + { + connection.Bind(); + } connection.Timeout = new TimeSpan(0, 3, 0); return connection; diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs index 5f6a737834ac23..2a8ab23a16d421 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapSessionOptionsTests.cs @@ -7,6 +7,8 @@ namespace System.DirectoryServices.Protocols.Tests { + // To enable these tests locally for Mono, comment out this line in DirectoryServicesTestHelpers.cs: + // [assembly: ActiveIssue("https://github.com/dotnet/runtime/issues/35912", TestRuntimes.Mono)] [ConditionalClass(typeof(DirectoryServicesTestHelpers), nameof(DirectoryServicesTestHelpers.IsWindowsOrLibLdapIsInstalled))] public class LdapSessionOptionsTests { @@ -27,6 +29,7 @@ public void ReferralChasing_Set_GetReturnsExpected_On_Windows(ReferralChasingOpt } [Theory] + [ActiveIssue("https://github.com/dotnet/runtime/issues/112146")] [PlatformSpecific(TestPlatforms.Linux)] [InlineData(ReferralChasingOptions.None)] [InlineData(ReferralChasingOptions.All)] @@ -756,5 +759,32 @@ public void StopTransportLayerSecurity_Disposed_ThrowsObjectDisposedException() Assert.Throws(() => connection.SessionOptions.StopTransportLayerSecurity()); } + +#if NET + [Fact] + [PlatformSpecific(TestPlatforms.Linux)] + public void CertificateDirectoryProperty() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Null(options.TrustedCertificatesDirectory); + + options.TrustedCertificatesDirectory = "."; + Assert.Equal(".", options.TrustedCertificatesDirectory); + } + } + + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] + public void CertificateDirectoryProperty_ThrowsPlatformNotSupportedException() + { + using (var connection = new LdapConnection("server")) + { + LdapSessionOptions options = connection.SessionOptions; + Assert.Throws(() => options.TrustedCertificatesDirectory = "CertificateDirectory"); + } + } +#endif } } diff --git a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Sequence.cs b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Sequence.cs index f66ffcb85ad1a6..7b26e725de3e85 100644 --- a/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Sequence.cs +++ b/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.Sequence.cs @@ -75,7 +75,7 @@ public static void ReadSequence( if (length.HasValue) { - if (length.Value + headerLength > source.Length) + if (length.Value > source.Length - headerLength) { throw GetValidityException(LengthValidity.LengthExceedsInput); } diff --git a/src/libraries/System.Formats.Asn1/tests/Decoder/ReadEncodedValueTests.cs b/src/libraries/System.Formats.Asn1/tests/Decoder/ReadEncodedValueTests.cs new file mode 100644 index 00000000000000..82f8afc382771e --- /dev/null +++ b/src/libraries/System.Formats.Asn1/tests/Decoder/ReadEncodedValueTests.cs @@ -0,0 +1,237 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Test.Cryptography; +using Xunit; + +namespace System.Formats.Asn1.Tests.Decoder +{ + public sealed class ReadEncodedValueTests + { + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_Primitive(AsnEncodingRules ruleSet) + { + // OCTET STRING (6 content bytes) + // NULL + ReadOnlySpan data = + [ + 0x04, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x05, 0x00, + ]; + + ExpectSuccess(data, ruleSet, Asn1Tag.PrimitiveOctetString, 2, 6); + } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_Indefinite(AsnEncodingRules ruleSet) + { + // CONSTRUCTED OCTET STRING (indefinite) + // OCTET STRING (1 byte) + // OCTET STRING (5 bytes) + // END OF CONTENTS + // NULL + ReadOnlySpan data = + [ + 0x24, 0x80, + 0x04, 0x01, 0x01, + 0x04, 0x05, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x00, 0x00, + 0x05, 0x00, + ]; + + // BER: Indefinite length encoding is OK, no requirements on the contents. + // CER: Indefinite length encoding is required for CONSTRUCTED, the contents are invalid for OCTET STRING, + // but (Try)ReadEncodedValue doesn't pay attention to that. + // DER: Indefinite length encoding is never permitted. + + if (ruleSet == AsnEncodingRules.DER) + { + ExpectFailure(data, ruleSet); + } + else + { + ExpectSuccess(data, ruleSet, Asn1Tag.ConstructedOctetString, 2, 10, indefiniteLength: true); + } + } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_DefiniteConstructed(AsnEncodingRules ruleSet) + { + // CONSTRUCTED OCTET STRING (11 bytes) + // OCTET STRING (1 byte) + // OCTET STRING (5 bytes) + // NULL + ReadOnlySpan data = + [ + 0x24, 0x0A, + 0x04, 0x01, 0x01, + 0x04, 0x05, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x05, 0x00, + ]; + + // BER: Indefinite length encoding is OK, no requirements on the contents. + // CER: Indefinite length encoding is required for CONSTRUCTED, so fail. + // DER: CONSTRUCTED OCTET STRING is not permitted, but ReadEncodedValue doesn't check for that, + // since the length is in minimal representation, the read is successful + + if (ruleSet == AsnEncodingRules.CER) + { + ExpectFailure(data, ruleSet); + } + else + { + ExpectSuccess(data, ruleSet, Asn1Tag.ConstructedOctetString, 2, 10); + } + } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_OutOfBoundsLength(AsnEncodingRules ruleSet) + { + // SEQUENCE (3 bytes), but only one byte remains. + ReadOnlySpan data = [0x30, 0x03, 0x00]; + + ExpectFailure(data, ruleSet); + } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_LargeOutOfBoundsLength(AsnEncodingRules ruleSet) + { + // SEQUENCE (int.MaxValue bytes), but no bytes remain. + ReadOnlySpan data = [0x30, 0x84, 0x7F, 0xFF, 0xFF, 0xFF]; + + ExpectFailure(data, ruleSet); + } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ReadEncodedValue_ExtremelyLargeLength(AsnEncodingRules ruleSet) + { + if (!Environment.Is64BitProcess) + { + return; + } + + // OCTET STRING ((int.MaxValue - 6) bytes), span will be inflated to make it look valid. + byte[] data = "04847FFFFFF9".HexToByteArray(); + + unsafe + { + fixed (byte* ptr = data) + { + // Verify that the length can be interpreted this large, but that it doesn't read that far. + ReadOnlySpan span = new ReadOnlySpan(ptr, int.MaxValue); + ExpectSuccess(span, ruleSet, Asn1Tag.PrimitiveOctetString, 6, int.MaxValue - 6); + } + } + } + + private static void ExpectSuccess( + ReadOnlySpan data, + AsnEncodingRules ruleSet, + Asn1Tag expectedTag, + int expectedContentOffset, + int expectedContentLength, + bool indefiniteLength = false) + { + Asn1Tag tag; + int contentOffset; + int contentLength; + int bytesConsumed; + + bool read = AsnDecoder.TryReadEncodedValue( + data, + ruleSet, + out tag, + out contentOffset, + out contentLength, + out bytesConsumed); + + Assert.True(read, "AsnDecoder.TryReadEncodedValue unexpectedly returned false"); + Assert.Equal(expectedTag, tag); + Assert.Equal(expectedContentOffset, contentOffset); + Assert.Equal(expectedContentLength, contentLength); + + int expectedBytesConsumed = expectedContentOffset + expectedContentLength + (indefiniteLength ? 2 : 0); + Assert.Equal(expectedBytesConsumed, bytesConsumed); + + contentOffset = contentLength = bytesConsumed = default; + + tag = AsnDecoder.ReadEncodedValue( + data, + ruleSet, + out contentOffset, + out contentLength, + out bytesConsumed); + + Assert.Equal(expectedTag, tag); + Assert.Equal(expectedContentOffset, contentOffset); + Assert.Equal(expectedContentLength, contentLength); + Assert.Equal(expectedBytesConsumed, bytesConsumed); + } + + private static void ExpectFailure(ReadOnlySpan data, AsnEncodingRules ruleSet) + { + Asn1Tag tag; + int contentOffset; + int contentLength; + int bytesConsumed; + + bool read = AsnDecoder.TryReadEncodedValue( + data, + ruleSet, + out tag, + out contentOffset, + out contentLength, + out bytesConsumed); + + Assert.False(read, "AsnDecoder.TryReadEncodedValue unexpectedly returned true"); + Assert.Equal(default, tag); + Assert.Equal(default, contentOffset); + Assert.Equal(default, contentLength); + Assert.Equal(default, bytesConsumed); + + int seed = Environment.CurrentManagedThreadId; + Asn1Tag seedTag = new Asn1Tag(TagClass.Private, seed, (seed & 1) == 0); + tag = seedTag; + contentOffset = contentLength = bytesConsumed = seed; + + try + { + tag = AsnDecoder.ReadEncodedValue( + data, + ruleSet, + out contentOffset, + out contentLength, + out bytesConsumed); + + Assert.Fail("ReadEncodedValue should have thrown AsnContentException"); + } + catch (AsnContentException e) + { + Assert.IsType(e); + } + + Assert.Equal(seedTag, tag); + Assert.Equal(seed, contentOffset); + Assert.Equal(seed, contentLength); + Assert.Equal(seed, bytesConsumed); + } + } +} diff --git a/src/libraries/System.Formats.Asn1/tests/Reader/ReadSequence.cs b/src/libraries/System.Formats.Asn1/tests/Reader/ReadSequence.cs index c1f5e620625efb..058b01216299eb 100644 --- a/src/libraries/System.Formats.Asn1/tests/Reader/ReadSequence.cs +++ b/src/libraries/System.Formats.Asn1/tests/Reader/ReadSequence.cs @@ -405,5 +405,33 @@ public static void ReadSequenceOf_PreservesOptions(AsnEncodingRules ruleSet) outer.ThrowIfNotEmpty(); initial.ThrowIfNotEmpty(); } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ExtremelyLargeContentLength(AsnEncodingRules ruleSet) + { + int start = Environment.CurrentManagedThreadId; + int contentOffset = start; + int contentLength = start; + int bytesConsumed = start; + + ReadOnlySpan input = [0x30, 0x84, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x00]; + + try + { + AsnDecoder.ReadSequence(input, ruleSet, out contentOffset, out contentLength, out bytesConsumed); + Assert.Fail("ReadSequence should have thrown AsnContentException"); + } + catch (AsnContentException e) + { + Assert.IsType(e); + } + + Assert.Equal(start, contentOffset); + Assert.Equal(start, contentLength); + Assert.Equal(start, bytesConsumed); + } } } diff --git a/src/libraries/System.Formats.Asn1/tests/Reader/ReadSetOf.cs b/src/libraries/System.Formats.Asn1/tests/Reader/ReadSetOf.cs index f5b38dc0e16b62..90058b9f487a4f 100644 --- a/src/libraries/System.Formats.Asn1/tests/Reader/ReadSetOf.cs +++ b/src/libraries/System.Formats.Asn1/tests/Reader/ReadSetOf.cs @@ -390,5 +390,33 @@ public static void ReadSetOf_PreservesOptions(AsnEncodingRules ruleSet) outer.ThrowIfNotEmpty(); initial.ThrowIfNotEmpty(); } + + [Theory] + [InlineData(AsnEncodingRules.BER)] + [InlineData(AsnEncodingRules.CER)] + [InlineData(AsnEncodingRules.DER)] + public static void ExtremelyLargeContentLength(AsnEncodingRules ruleSet) + { + int start = Environment.CurrentManagedThreadId; + int contentOffset = start; + int contentLength = start; + int bytesConsumed = start; + + ReadOnlySpan input = [0x31, 0x84, 0x7F, 0xFF, 0xFF, 0xFF, 0x00, 0x00]; + + try + { + AsnDecoder.ReadSetOf(input, ruleSet, out contentOffset, out contentLength, out bytesConsumed); + Assert.Fail("ReadSetOf should have thrown AsnContentException"); + } + catch (AsnContentException e) + { + Assert.IsType(e); + } + + Assert.Equal(start, contentOffset); + Assert.Equal(start, contentLength); + Assert.Equal(start, bytesConsumed); + } } } diff --git a/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj b/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj index 68bdc72edf895f..3626af0c77d1a5 100644 --- a/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj +++ b/src/libraries/System.Formats.Asn1/tests/System.Formats.Asn1.Tests.csproj @@ -5,6 +5,7 @@ + diff --git a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberTypeInfo.cs b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberTypeInfo.cs index 84c1073b0ef67a..c46d13f443e119 100644 --- a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberTypeInfo.cs +++ b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberTypeInfo.cs @@ -91,8 +91,10 @@ internal static MemberTypeInfo Decode(BinaryReader reader, int count, PayloadOpt const AllowedRecordTypes SystemClass = Classes | AllowedRecordTypes.SystemClassWithMembersAndTypes // All primitive types can be stored by using one of the interfaces they implement. // Example: `new IEnumerable[1] { "hello" }` or `new IComparable[1] { int.MaxValue }`. - | AllowedRecordTypes.BinaryObjectString | AllowedRecordTypes.MemberPrimitiveTyped; - const AllowedRecordTypes NonSystemClass = Classes | AllowedRecordTypes.ClassWithMembersAndTypes; + | AllowedRecordTypes.BinaryObjectString | AllowedRecordTypes.MemberPrimitiveTyped + // System.Nullable is a special case of SystemClassWithMembersAndTypes + | AllowedRecordTypes.ClassWithMembersAndTypes; + const AllowedRecordTypes NonSystemClass = Classes | AllowedRecordTypes.ClassWithMembersAndTypes; return binaryType switch { diff --git a/src/libraries/System.Formats.Nrbf/tests/ArraySinglePrimitiveRecordTests.cs b/src/libraries/System.Formats.Nrbf/tests/ArraySinglePrimitiveRecordTests.cs index 7ef801808e4e95..9f714c9dddac15 100644 --- a/src/libraries/System.Formats.Nrbf/tests/ArraySinglePrimitiveRecordTests.cs +++ b/src/libraries/System.Formats.Nrbf/tests/ArraySinglePrimitiveRecordTests.cs @@ -20,7 +20,7 @@ public NonSeekableStream(byte[] buffer) : base(buffer) { } public static IEnumerable GetCanReadArrayOfAnySizeArgs() { - foreach (int size in new[] { 1, 127, 128, 512_001, 512_001 }) + foreach (int size in new[] { 1, 127, 128, 20_001 }) { yield return new object[] { size, true }; yield return new object[] { size, false }; diff --git a/src/libraries/System.Formats.Nrbf/tests/EdgeCaseTests.cs b/src/libraries/System.Formats.Nrbf/tests/EdgeCaseTests.cs index f091d47ded8c5f..1d14993a0890c3 100644 --- a/src/libraries/System.Formats.Nrbf/tests/EdgeCaseTests.cs +++ b/src/libraries/System.Formats.Nrbf/tests/EdgeCaseTests.cs @@ -144,4 +144,48 @@ public void CanReadAllKindsOfDateTimes_DateTimeIsMemberOfTheRootRecord(DateTime Assert.Equal(input.Ticks, classRecord.GetDateTime(nameof(ClassWithDateTime.Value)).Ticks); Assert.Equal(input.Kind, classRecord.GetDateTime(nameof(ClassWithDateTime.Value)).Kind); } + + [Fact] + public void CanReadUserClassStoredAsSystemClass() + { + // For the following data, BinaryFormatter serializes the ClassWithNullableStructField class + // as a record with a single field called "NullableField" with BinaryType.SystemClass (!!!) + // and TypeName being System.Nullable`1[[SampleStruct, $AssemblyName]]. + // It most likely does so, because it's System.Nullable<$NonSystemStruct>. + // But later it serializes the SampleStruct as a ClassWithMembersAndTypes record, + // not SystemClassWithMembersAndTypes. + // It does so, only when the payload contains at least one class with the nullable field being null. + + using MemoryStream stream = Serialize( + new ClassWithNullableStructField[] + { + new ClassWithNullableStructField() { NullableField = null }, // having a null here is crucial for the test + new ClassWithNullableStructField() { NullableField = new ClassWithNullableStructField.SampleStruct() { Value = 42 } } + } + ); + + SZArrayRecord arrayRecord = (SZArrayRecord)NrbfDecoder.Decode(stream); + SerializationRecord[] records = arrayRecord.GetArray(); + Assert.Equal(2, arrayRecord.Length); + Assert.All(records, record => Assert.True(record.TypeNameMatches(typeof(ClassWithNullableStructField)))); + Assert.Null(((ClassRecord)records[0]).GetClassRecord(nameof(ClassWithNullableStructField.NullableField))); + + ClassRecord? notNullRecord = ((ClassRecord)records[1]).GetClassRecord(nameof(ClassWithNullableStructField.NullableField)); + Assert.NotNull(notNullRecord); + Assert.Equal(42, notNullRecord.GetInt32(nameof(ClassWithNullableStructField.SampleStruct.Value))); + } + + [Serializable] + public class ClassWithNullableStructField + { +#pragma warning disable IDE0001 // Simplify names + public System.Nullable NullableField; +#pragma warning restore IDE0001 + + [Serializable] + public struct SampleStruct + { + public int Value; + } + } } diff --git a/src/libraries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs b/src/libraries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs index ed0e72a6f53304..f2b9e37f31a909 100644 --- a/src/libraries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs +++ b/src/libraries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/RemoveTests.cs @@ -8,6 +8,7 @@ namespace System.IO.IsolatedStorage public class RemoveTests : IsoStorageTest { [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114403", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst))] public void RemoveUserStoreForApplication() { TestHelper.WipeStores(); @@ -23,6 +24,7 @@ public void RemoveUserStoreForApplication() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114403", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst))] public void RemoveUserStoreForAssembly() { TestHelper.WipeStores(); @@ -38,6 +40,7 @@ public void RemoveUserStoreForAssembly() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114403", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst))] public void RemoveUserStoreForDomain() { TestHelper.WipeStores(); @@ -54,7 +57,9 @@ public void RemoveUserStoreForDomain() } } - [Theory, MemberData(nameof(ValidStores))] + [Theory] + [MemberData(nameof(ValidStores))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114403", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst))] public void RemoveStoreWithContent(PresetScopes scope) { TestHelper.WipeStores(); diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs index 6747758c7b5330..3b78641a006839 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; using System.Runtime.CompilerServices; using Microsoft.DotNet.XUnitExtensions; using Xunit; @@ -56,24 +57,33 @@ public void InvalidArguments() } } + public static IEnumerable AccessLevelCombinationsData() + { + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Write }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadExecute }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWriteExecute }; + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.CopyOnWrite }; + // https://github.com/dotnet/runtime/issues/114403 + if (PlatformDetection.IsNotMacCatalyst) + { + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.ReadExecute }; + } + yield return new object[] { MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Write }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.ReadWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite }; + } + [ConditionalTheory] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Write)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWrite)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadExecute)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWriteExecute)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.ReadExecute)] - [InlineData(MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Write)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.ReadWrite)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite)] + [MemberData(nameof(AccessLevelCombinationsData))] public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, MemoryMappedFileAccess viewAccess) { const int Capacity = 4096; diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs index f279b8c33f98f7..cd1af097e216f4 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; using System.Runtime.CompilerServices; using Microsoft.DotNet.XUnitExtensions; using Xunit; @@ -56,24 +57,33 @@ public void InvalidArguments() } } + public static IEnumerable AccessLevelCombinationsData() + { + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Write }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadExecute }; + yield return new object[] { MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWriteExecute }; + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.CopyOnWrite }; + // https://github.com/dotnet/runtime/issues/114403 + if (PlatformDetection.IsNotMacCatalyst) + { + yield return new object[] { MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.ReadExecute }; + } + yield return new object[] { MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Write }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.ReadWrite }; + yield return new object[] { MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite }; + yield return new object[] { MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read }; + yield return new object[] { MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite }; + } + [ConditionalTheory] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.Write)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWrite)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadExecute)] - [InlineData(MemoryMappedFileAccess.ReadWriteExecute, MemoryMappedFileAccess.ReadWriteExecute)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadExecute, MemoryMappedFileAccess.ReadExecute)] - [InlineData(MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.CopyOnWrite, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.Write)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.ReadWrite)] - [InlineData(MemoryMappedFileAccess.ReadWrite, MemoryMappedFileAccess.CopyOnWrite)] - [InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.Read)] - [InlineData(MemoryMappedFileAccess.Read, MemoryMappedFileAccess.CopyOnWrite)] + [MemberData(nameof(AccessLevelCombinationsData))] public void ValidAccessLevelCombinations(MemoryMappedFileAccess mapAccess, MemoryMappedFileAccess viewAccess) { const int Capacity = 4096; diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs index 4f6db79a54bf5d..7a0b6dc8e37055 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs @@ -139,10 +139,7 @@ internal override void DisposeCore(bool disposing) if (disposing) { - if (State != PipeState.Closed) - { - _internalTokenSource.Cancel(); - } + _internalTokenSource.Cancel(); } } diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs index c0f066da805214..b986a7342538ba 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs @@ -62,7 +62,11 @@ internal override void TryToReuse(PipeValueTaskSource source) { if (Interlocked.CompareExchange(ref _reusableConnectionValueTaskSource, connectionSource, null) is not null) { - source._preallocatedOverlapped.Dispose(); + source.Dispose(); + } + else if (State == PipeState.Closed) + { + Interlocked.Exchange(ref _reusableConnectionValueTaskSource, null)?.Dispose(); } } } diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs index 453fe1153bd4be..ddff733119a7a8 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs @@ -255,9 +255,25 @@ internal virtual void TryToReuse(PipeValueTaskSource source) if (source is ReadWriteValueTaskSource readWriteSource) { ref ReadWriteValueTaskSource? field = ref readWriteSource._isWrite ? ref _reusableWriteValueTaskSource : ref _reusableReadValueTaskSource; + + // Try to return the instance. If there's already something in the field, then there had been concurrent + // operations and someone else already returned their instance, so just dispose of this one (the "pool" has + // a size of 1). If there's not something there and we're successful in storing our instance, the 99% case is + // this is normal operation, there wasn't a concurrent operation, and we just successfully returned the rented + // instance. However, it could also be because the stream has been disposed, in which case the disposal process + // would have nulled out the field, and since this instance wasn't present when disposal happened, it won't have + // been disposed. Further, disposal won't happen again, so just leaving the instance there will result in its + // resources being leaked. Instead, _after_ returning the instance we then check whether the stream is now + // disposed, and if it is, we then try to re-rent the instance and dispose of it. It's fine if the disposal happens + // after we've stored the instance back and before we check the stream's state, as then this code will be racing + // with disposal and only one of the two will succeed in exchanging out the instance. if (Interlocked.CompareExchange(ref field, readWriteSource, null) is not null) { - source._preallocatedOverlapped.Dispose(); + source.Dispose(); + } + else if (State == PipeState.Closed) + { + Interlocked.Exchange(ref field, null)?.Dispose(); } } } diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs index a52b3cac99bc1b..d1fdf314344a50 100644 --- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs +++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs @@ -144,6 +144,11 @@ public override Task FlushAsync(CancellationToken cancellationToken) protected override void Dispose(bool disposing) { + // Mark the pipe as closed before calling DisposeCore. That way, other threads that might + // be synchronizing on shared resources disposed of in DisposeCore will be guaranteed to + // see the closed state after that synchronization. + _state = PipeState.Closed; + try { // Nothing will be done differently based on whether we are @@ -159,8 +164,6 @@ protected override void Dispose(bool disposing) { base.Dispose(disposing); } - - _state = PipeState.Closed; } // ********************** Public Properties *********************** // diff --git a/src/libraries/System.Linq/src/System/Linq/SkipTake.SpeedOpt.cs b/src/libraries/System.Linq/src/System/Linq/SkipTake.SpeedOpt.cs index 5cb53aa2997e06..ef043f9f6755e7 100644 --- a/src/libraries/System.Linq/src/System/Linq/SkipTake.SpeedOpt.cs +++ b/src/libraries/System.Linq/src/System/Linq/SkipTake.SpeedOpt.cs @@ -430,9 +430,12 @@ public override Iterator Take(int count) { if (_source is Iterator iterator && iterator.GetCount(onlyIfCheap: true) is int count && - count >= _minIndexInclusive) + count > _minIndexInclusive) { - return !HasLimit ? + // If there's no upper bound, or if there are fewer items in the list + // than the upper bound allows, just return the last element of the list. + // Otherwise, get the element at the upper bound. + return (uint)count <= (uint)_maxIndexInclusive ? iterator.TryGetLast(out found) : iterator.TryGetElementAt(_maxIndexInclusive, out found); } diff --git a/src/libraries/System.Linq/tests/AggregateByTests.cs b/src/libraries/System.Linq/tests/AggregateByTests.cs index b574660c9e5ac8..43b9262f78b813 100644 --- a/src/libraries/System.Linq/tests/AggregateByTests.cs +++ b/src/libraries/System.Linq/tests/AggregateByTests.cs @@ -11,10 +11,10 @@ public class AggregateByTests : EnumerableTests [Fact] public void Empty() { - Assert.All(IdentityTransforms(), transform => + Assert.All(CreateSources([]), source => { - Assert.Equal(Enumerable.Empty>(), transform(Enumerable.Empty()).AggregateBy(i => i, i => i, (a, i) => a + i)); - Assert.Equal(Enumerable.Empty>(), transform(Enumerable.Empty()).AggregateBy(i => i, 0, (a, i) => a + i)); + Assert.Equal([], source.AggregateBy(i => i, i => i, (a, i) => a + i)); + Assert.Equal([], source.AggregateBy(i => i, 0, (a, i) => a + i)); }); } diff --git a/src/libraries/System.Linq/tests/ChunkTests.cs b/src/libraries/System.Linq/tests/ChunkTests.cs index 31433ddabff30f..1a12ac7fd6765d 100644 --- a/src/libraries/System.Linq/tests/ChunkTests.cs +++ b/src/libraries/System.Linq/tests/ChunkTests.cs @@ -42,10 +42,8 @@ public void ChunkSourceLazily() [InlineData(new[] {9999, 0, 888, -1, 66, -777, 1, 2, -12345})] public void ChunkSourceRepeatCalls(int[] array) { - Assert.All(IdentityTransforms(), t => + Assert.All(CreateSources(array), source => { - IEnumerable source = t(array); - Assert.Equal(source.Chunk(3), source.Chunk(3)); }); } @@ -54,10 +52,8 @@ public void ChunkSourceRepeatCalls(int[] array) [InlineData(new[] {9999, 0, 888, -1, 66, -777, 1, 2, -12345})] public void ChunkSourceEvenly(int[] array) { - Assert.All(IdentityTransforms(), t => + Assert.All(CreateSources(array), source => { - IEnumerable source = t(array); - using IEnumerator chunks = source.Chunk(3).GetEnumerator(); chunks.MoveNext(); Assert.Equal(new[] { 9999, 0, 888 }, chunks.Current); @@ -73,10 +69,8 @@ public void ChunkSourceEvenly(int[] array) [InlineData(new[] {9999, 0, 888, -1, 66, -777, 1, 2})] public void ChunkSourceUnevenly(int[] array) { - Assert.All(IdentityTransforms(), t => + Assert.All(CreateSources(array), source => { - IEnumerable source = t(array); - using IEnumerator chunks = source.Chunk(3).GetEnumerator(); chunks.MoveNext(); Assert.Equal(new[] { 9999, 0, 888 }, chunks.Current); @@ -92,10 +86,8 @@ public void ChunkSourceUnevenly(int[] array) [InlineData(new[] {9999, 0})] public void ChunkSourceSmallerThanMaxSize(int[] array) { - Assert.All(IdentityTransforms(), t => + Assert.All(CreateSources(array), source => { - IEnumerable source = t(array); - using IEnumerator chunks = source.Chunk(3).GetEnumerator(); chunks.MoveNext(); Assert.Equal(new[] { 9999, 0 }, chunks.Current); @@ -107,10 +99,8 @@ public void ChunkSourceSmallerThanMaxSize(int[] array) [InlineData(new int[0])] public void EmptySourceYieldsNoChunks(int[] array) { - Assert.All(IdentityTransforms(), t => + Assert.All(CreateSources(array), source => { - IEnumerable source = t(array); - using IEnumerator chunks = source.Chunk(3).GetEnumerator(); Assert.False(chunks.MoveNext()); }); diff --git a/src/libraries/System.Linq/tests/ConcatTests.cs b/src/libraries/System.Linq/tests/ConcatTests.cs index 544027450d80c2..4069bbdf5de5a4 100644 --- a/src/libraries/System.Linq/tests/ConcatTests.cs +++ b/src/libraries/System.Linq/tests/ConcatTests.cs @@ -31,8 +31,8 @@ private static void SameResultsWithQueryAndRepeatCallsWorker(IEnumerable f first = from item in first select item; second = from item in second select item; - VerifyEqualsWorker(first.Concat(second), first.Concat(second)); - VerifyEqualsWorker(second.Concat(first), second.Concat(first)); + Assert.Equal(first.Concat(second), first.Concat(second)); + Assert.Equal(second.Concat(first), second.Concat(first)); } [Theory] @@ -41,8 +41,8 @@ private static void SameResultsWithQueryAndRepeatCallsWorker(IEnumerable f [InlineData(new int[] { 2, 3, 5, 9 }, new int[] { 8, 10 }, new int[] { 2, 3, 5, 9, 8, 10 })] // Neither side is empty public void PossiblyEmptyInputs(IEnumerable first, IEnumerable second, IEnumerable expected) { - VerifyEqualsWorker(expected, first.Concat(second)); - VerifyEqualsWorker(expected.Skip(first.Count()).Concat(expected.Take(first.Count())), second.Concat(first)); // Swap the inputs around + Assert.Equal(expected, first.Concat(second)); + Assert.Equal(expected.Skip(first.Count()).Concat(expected.Take(first.Count())), second.Concat(first)); // Swap the inputs around } [Fact] @@ -80,7 +80,7 @@ public void SecondNull() public void VerifyEquals(IEnumerable expected, IEnumerable actual) { // workaround: xUnit type inference doesn't work if the input type is not T (like IEnumerable) - VerifyEqualsWorker(expected, actual); + Assert.Equal(expected, actual); } [Theory] @@ -133,23 +133,6 @@ public void First_Last_ElementAt(IEnumerable _, IEnumerable actual) } } - private static void VerifyEqualsWorker(IEnumerable expected, IEnumerable actual) - { - // Returns a list of functions that, when applied to enumerable, should return - // another one that has equivalent contents. - var identityTransforms = IdentityTransforms(); - - // We run the transforms N^2 times, by testing all transforms - // of expected against all transforms of actual. - foreach (var outTransform in identityTransforms) - { - foreach (var inTransform in identityTransforms) - { - Assert.Equal(outTransform(expected), inTransform(actual)); - } - } - } - public static IEnumerable ArraySourcesData() => GenerateSourcesData(outerTransform: e => e.ToArray()); public static IEnumerable SelectArraySourcesData() => GenerateSourcesData(outerTransform: e => e.Select(i => i).ToArray()); @@ -292,7 +275,7 @@ public void ManyConcats(IEnumerable> sources) } Assert.Equal(sources.Sum(s => s.Count()), concatee.Count()); - VerifyEqualsWorker(sources.SelectMany(s => s), concatee); + Assert.Equal(sources.SelectMany(s => s), concatee); } } diff --git a/src/libraries/System.Linq/tests/CountTests.cs b/src/libraries/System.Linq/tests/CountTests.cs index 5b0730163721db..2937f116367f71 100644 --- a/src/libraries/System.Linq/tests/CountTests.cs +++ b/src/libraries/System.Linq/tests/CountTests.cs @@ -99,9 +99,9 @@ public void RunOnce(int count, IEnumerable enumerable) private static IEnumerable EnumerateCollectionTypesAndCounts(int count, IEnumerable enumerable) { - foreach (var transform in IdentityTransforms()) + foreach (IEnumerable source in CreateSources(enumerable)) { - yield return new object[] { count, transform(enumerable) }; + yield return [count, source]; } } diff --git a/src/libraries/System.Linq/tests/EnumerableTests.cs b/src/libraries/System.Linq/tests/EnumerableTests.cs index d28ace92a4026b..66bc25861e080e 100644 --- a/src/libraries/System.Linq/tests/EnumerableTests.cs +++ b/src/libraries/System.Linq/tests/EnumerableTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using Xunit; +using Xunit.Sdk; namespace System.Linq.Tests { @@ -243,6 +244,7 @@ protected static IEnumerable FlipIsCollection(IEnumerable source) { return source is ICollection ? ForceNotCollection(source) : new List(source); } + protected static T[] Repeat(Func factory, int count) { T[] results = new T[count]; @@ -316,26 +318,83 @@ protected static IEnumerable> CreateSources(IEnumerable sou } } - protected static List, IEnumerable>> IdentityTransforms() + protected static IEnumerable, IEnumerable>> IdentityTransforms() { - // All of these transforms should take an enumerable and produce - // another enumerable with the same contents. - return new List, IEnumerable>> + // Various collection types all representing the same source. + List, IEnumerable>> sources = + [ + e => e, // original + e => e.ToArray(), // T[] + e => e.ToList(), // List + e => new ReadOnlyCollection(e.ToArray()), // IList that's not List/T[] + e => new TestCollection(e.ToArray()), // ICollection that's not IList + e => new TestReadOnlyCollection(e.ToArray()), // IReadOnlyCollection that's not ICollection + e => ForceNotCollection(e), // IEnumerable with no other interfaces + ]; + if (typeof(T) == typeof(char)) { - e => e, - e => e.ToArray(), - e => e.ToList(), - e => e.ToList().Take(int.MaxValue), + sources.Add(e => (IEnumerable)(object)string.Concat((IEnumerable)(object)e)); // string + } + + // Various transforms that all yield the same elements as the source. + List, IEnumerable>> transforms = + [ + // Append + e => + { + T[] values = e.ToArray(); + return values.Length == 0 ? [] : values[0..^1].Append(values[^1]); + }, + + // Concat + e => e.Concat(ForceNotCollection([])), + e => ForceNotCollection([]).Concat(e), + + // Prepend + e => + { + T[] values = e.ToArray(); + return values.Length == 0 ? [] : values[1..].Prepend(values[0]); + }, + + // Reverse + e => e.Reverse().Reverse(), + + // Select e => e.Select(i => i), - e => e.Select(i => i).Take(int.MaxValue), - e => e.Select(i => i).Where(i => true), + + // SelectMany + e => e.SelectMany(i => [i]), + + // Take + e => e.Take(int.MaxValue), + e => e.TakeLast(int.MaxValue), + e => e.TakeWhile(i => true), + + // Skip + e => e.SkipWhile(i => false), + + // Where e => e.Where(i => true), - e => e.Concat(Array.Empty()), - e => e.Concat(ForceNotCollection(Array.Empty())), - e => ForceNotCollection(e), - e => ForceNotCollection(e).Skip(0), - e => new ReadOnlyCollection(e.ToArray()), - }; + ]; + + foreach (Func, IEnumerable> source in sources) + { + // Yield the source itself. + yield return source; + + foreach (Func, IEnumerable> transform in transforms) + { + // Yield a single transform on the source + yield return e => transform(source(e)); + + foreach (Func, IEnumerable> transform2 in transforms) + { + // Yield a second transform on the first transform on the source. + yield return e => transform2(transform(source(e))); + } + } + } } protected sealed class DelegateIterator : IEnumerable, IEnumerator diff --git a/src/libraries/System.Linq/tests/SelectManyTests.cs b/src/libraries/System.Linq/tests/SelectManyTests.cs index cb359f067848ba..98f2e37e54e32b 100644 --- a/src/libraries/System.Linq/tests/SelectManyTests.cs +++ b/src/libraries/System.Linq/tests/SelectManyTests.cs @@ -372,31 +372,23 @@ public void ForcedToEnumeratorDoesntEnumerateIndexedResultSel() Assert.False(en is not null && en.MoveNext()); } - [Theory] - [MemberData(nameof(ParameterizedTestsData))] - public void ParameterizedTests(IEnumerable source, Func> selector) + [Fact] + public void ParameterizedTests() { - Assert.All(CreateSources(source), source => + for (int i = 1; i <= 20; i++) { - var expected = source.Select(i => selector(i)).Aggregate((l, r) => l.Concat(r)); - var actual = source.SelectMany(selector); + Assert.All(CreateSources(Enumerable.Range(1, i)), source => + { + Func> selector = n => Enumerable.Range(i, n); - Assert.Equal(expected, actual); - Assert.Equal(expected.Count(), actual.Count()); // SelectMany may employ an optimized Count implementation. - Assert.Equal(expected.ToArray(), actual.ToArray()); - Assert.Equal(expected.ToList(), actual.ToList()); - }); - } + var expected = source.Select(i => selector(i)).Aggregate((l, r) => l.Concat(r)).ToArray(); + var actual = source.SelectMany(selector); - public static IEnumerable ParameterizedTestsData() - { - foreach (Func, IEnumerable> transform in IdentityTransforms()) - { - for (int i = 1; i <= 20; i++) - { - Func> selector = n => transform(Enumerable.Range(i, n)); - yield return new object[] { Enumerable.Range(1, i), selector }; - } + Assert.Equal(expected, actual); + Assert.Equal(expected.Length, actual.Count()); // SelectMany may employ an optimized Count implementation. + Assert.Equal(expected, actual.ToArray()); + Assert.Equal(expected, actual.ToList()); + }); } } diff --git a/src/libraries/System.Linq/tests/SingleOrDefaultTests.cs b/src/libraries/System.Linq/tests/SingleOrDefaultTests.cs index 8441f8a3c68a34..e04279bd00eac4 100644 --- a/src/libraries/System.Linq/tests/SingleOrDefaultTests.cs +++ b/src/libraries/System.Linq/tests/SingleOrDefaultTests.cs @@ -27,81 +27,33 @@ public void SameResultsRepeatCallsStringQuery() } [Fact] - public void EmptyIList() + public void Empty() { - int?[] source = { }; - int? expected = null; - - Assert.Equal(expected, source.SingleOrDefault()); - } - - [Fact] - public void EmptyIListDefault() - { - int?[] source = { }; - int expected = 5; - - Assert.Equal(expected, source.SingleOrDefault(5)); - } - - [Fact] - public void SingleElementIList() - { - int[] source = { 4 }; - int expected = 4; - - Assert.Equal(expected, source.SingleOrDefault()); + foreach (IEnumerable source in CreateSources([])) + { + Assert.Null(source.SingleOrDefault()); + Assert.Equal(5, source.SingleOrDefault(5)); + } } [Fact] - public void SingleElementIListDefault() + public void SingleElement() { - int[] source = { 4 }; - int expected = 4; - - Assert.Equal(expected, source.SingleOrDefault(5)); + foreach (IEnumerable source in CreateSources([4])) + { + Assert.Equal(4, source.SingleOrDefault()); + Assert.Equal(4, source.SingleOrDefault(5)); + } } [Fact] public void ManyElementIList() { - int[] source = { 4, 4, 4, 4, 4 }; - - Assert.Throws(() => source.SingleOrDefault()); - } - - [Fact] - public void ManyElementIListDefault() - { - int[] source = { 4, 4, 4, 4, 4 }; - - Assert.Throws(() => source.SingleOrDefault(5)); - } - - [Fact] - public void EmptyNotIList() - { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(0, 0); - int expected = default(int); - - Assert.Equal(expected, source.SingleOrDefault()); - } - - [Fact] - public void SingleElementNotIList() - { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(-5, 1); - int expected = -5; - - Assert.Equal(expected, source.SingleOrDefault()); - } - - [Fact] - public void ManyElementNotIList() - { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(3, 5); - - Assert.Throws(() => source.SingleOrDefault()); + foreach (IEnumerable source in CreateSources([4, 4, 4, 4, 4])) + { + Assert.Throws(() => source.SingleOrDefault()); + Assert.Throws(() => source.SingleOrDefault(4)); + } } [Fact] diff --git a/src/libraries/System.Linq/tests/SingleTests.cs b/src/libraries/System.Linq/tests/SingleTests.cs index 09e49daae1c099..21028511505289 100644 --- a/src/libraries/System.Linq/tests/SingleTests.cs +++ b/src/libraries/System.Linq/tests/SingleTests.cs @@ -37,53 +37,31 @@ public void SameResultsRepeatCallsIntQueryWithZero() } [Fact] - public void EmptyIList() + public void Empty() { - int[] source = { }; - - Assert.Throws(() => source.Single()); + foreach (IEnumerable source in CreateSources([])) + { + Assert.Throws(() => source.Single()); + } } [Fact] - public void SingleElementIList() + public void SingleElement() { - int[] source = { 4 }; int expected = 4; - - Assert.Equal(expected, source.Single()); - } - - [Fact] - public void ManyElementIList() - { - int[] source = { 4, 4, 4, 4, 4 }; - - Assert.Throws(() => source.Single()); - } - - [Fact] - public void EmptyNotIList() - { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(0, 0); - - Assert.Throws(() => source.Single()); - } - - [Fact] - public void SingleElementNotIList() - { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(-5, 1); - int expected = -5; - - Assert.Equal(expected, source.Single()); + foreach (IEnumerable source in CreateSources([4])) + { + Assert.Equal(expected, source.Single()); + } } [Fact] - public void ManyElementNotIList() + public void ManyElement() { - IEnumerable source = RepeatedNumberGuaranteedNotCollectionType(3, 5); - - Assert.Throws(() => source.Single()); + foreach (IEnumerable source in CreateSources([4, 4, 4, 4, 4])) + { + Assert.Throws(() => source.Single()); + } } [Fact] diff --git a/src/libraries/System.Linq/tests/SkipLastTests.cs b/src/libraries/System.Linq/tests/SkipLastTests.cs index c4770410870d47..0a2080a1ad37af 100644 --- a/src/libraries/System.Linq/tests/SkipLastTests.cs +++ b/src/libraries/System.Linq/tests/SkipLastTests.cs @@ -19,25 +19,26 @@ public void SkipLastThrowsOnNull() [MemberData(nameof(EnumerableData), MemberType = typeof(SkipTakeData))] public void SkipLast(IEnumerable source, int count) { - Assert.All(IdentityTransforms(), transform => - { - IEnumerable equivalent = transform(source); + int[] expected = source.Reverse().Skip(count).Reverse().ToArray(); - IEnumerable expected = equivalent.Reverse().Skip(count).Reverse(); - IEnumerable actual = equivalent.SkipLast(count); + Assert.All(CreateSources(source), source => + { + IEnumerable actual = source.SkipLast(count); Assert.Equal(expected, actual); - Assert.Equal(expected.Count(), actual.Count()); + + Assert.Equal(expected.Length, actual.Count()); Assert.Equal(expected, actual.ToArray()); Assert.Equal(expected, actual.ToList()); - Assert.Equal(expected.FirstOrDefault(), actual.FirstOrDefault()); Assert.Equal(expected.LastOrDefault(), actual.LastOrDefault()); - Assert.All(Enumerable.Range(0, expected.Count()), index => + if (expected.Length > 0) { - Assert.Equal(expected.ElementAt(index), actual.ElementAt(index)); - }); + Assert.Equal(expected[0], actual.ElementAt(0)); + Assert.Equal(expected[^1], actual.ElementAt(expected.Length - 1)); + Assert.Equal(expected[expected.Length / 2], actual.ElementAt(expected.Length / 2)); + } Assert.Equal(0, actual.ElementAtOrDefault(-1)); Assert.Equal(0, actual.ElementAtOrDefault(actual.Count())); diff --git a/src/libraries/System.Linq/tests/SkipTests.cs b/src/libraries/System.Linq/tests/SkipTests.cs index cf4d16b1309907..226c8f6b9152f8 100644 --- a/src/libraries/System.Linq/tests/SkipTests.cs +++ b/src/libraries/System.Linq/tests/SkipTests.cs @@ -10,12 +10,6 @@ namespace System.Linq.Tests { public class SkipTests : EnumerableTests { - private static IEnumerable GuaranteeNotIList(IEnumerable source) - { - foreach (T element in source) - yield return element; - } - [Fact] public void SkipSome() { @@ -87,139 +81,95 @@ public void SkipThrowsOnNullIList() [Fact] public void SkipOnEmpty() { - Assert.Equal(Enumerable.Empty(), GuaranteeNotIList(Enumerable.Empty()).Skip(0)); - Assert.Equal(Enumerable.Empty(), GuaranteeNotIList(Enumerable.Empty()).Skip(-1)); - Assert.Equal(Enumerable.Empty(), GuaranteeNotIList(Enumerable.Empty()).Skip(1)); - } + foreach (IEnumerable source in CreateSources([])) + { + Assert.Equal([], source.Skip(0)); + Assert.Equal([], source.Skip(-1)); + Assert.Equal([], source.Skip(1)); + } - [Fact] - public void SkipOnEmptyIList() - { - // Enumerable.Empty does return an IList, but not guaranteed as such - // by the spec. - Assert.Equal(Enumerable.Empty(), Enumerable.Empty().ToList().Skip(0)); - Assert.Equal(Enumerable.Empty(), Enumerable.Empty().ToList().Skip(-1)); - Assert.Equal(Enumerable.Empty(), Enumerable.Empty().ToList().Skip(1)); + foreach (IEnumerable source in CreateSources([])) + { + Assert.Equal([], source.Skip(0)); + Assert.Equal([], source.Skip(-1)); + Assert.Equal([], source.Skip(1)); + } } [Fact] public void SkipNegative() { - Assert.Equal(Enumerable.Range(0, 20), NumberRangeGuaranteedNotCollectionType(0, 20).Skip(-42)); - } - - [Fact] - public void SkipNegativeIList() - { - Assert.Equal(Enumerable.Range(0, 20), NumberRangeGuaranteedNotCollectionType(0, 20).ToList().Skip(-42)); + foreach (IEnumerable source in CreateSources(Enumerable.Range(0, 20))) + { + Assert.Equal(Enumerable.Range(0, 20), source.Skip(-42)); + } } [Fact] public void SameResultsRepeatCallsIntQuery() { - var q = GuaranteeNotIList(from x in new[] { 9999, 0, 888, -1, 66, -777, 1, 2, -12345 } - where x > int.MinValue - select x); - - Assert.Equal(q.Skip(0), q.Skip(0)); - } - - [Fact] - public void SameResultsRepeatCallsIntQueryIList() - { - var q = (from x in new[] { 9999, 0, 888, -1, 66, -777, 1, 2, -12345 } - where x > Int32.MinValue - select x).ToList(); + foreach (IEnumerable source in CreateSources([9999, 0, 888, -1, 66, -777, 1, 2, -12345])) + { + IEnumerable q = from x in source + where x > int.MinValue + select x; - Assert.Equal(q.Skip(0), q.Skip(0)); + Assert.Equal(q.Skip(0), q.Skip(0)); + } } [Fact] public void SameResultsRepeatCallsStringQuery() { - var q = GuaranteeNotIList(from x in new[] { "!@#$%^", "C", "AAA", "", "Calling Twice", "SoS", string.Empty } - where !string.IsNullOrEmpty(x) - select x); - - Assert.Equal(q.Skip(0), q.Skip(0)); - } - - [Fact] - public void SameResultsRepeatCallsStringQueryIList() - { - var q = (from x in new[] { "!@#$%^", "C", "AAA", "", "Calling Twice", "SoS", String.Empty } - where !String.IsNullOrEmpty(x) - select x).ToList(); + foreach (IEnumerable source in CreateSources(["!@#$%^", "C", "AAA", "", "Calling Twice", "SoS", string.Empty])) + { + IEnumerable q = from x in source + where !string.IsNullOrEmpty(x) + select x; - Assert.Equal(q.Skip(0), q.Skip(0)); + Assert.Equal(q.Skip(0), q.Skip(0)); + } } [Fact] public void SkipOne() { - int?[] source = { 3, 100, 4, null, 10 }; - int?[] expected = { 100, 4, null, 10 }; - - Assert.Equal(expected, source.Skip(1)); - } - - [Fact] - public void SkipOneNotIList() - { - int?[] source = { 3, 100, 4, null, 10 }; - int?[] expected = { 100, 4, null, 10 }; - - Assert.Equal(expected, GuaranteeNotIList(source).Skip(1)); + int?[] expected = [100, 4, null, 10]; + foreach (IEnumerable source in CreateSources([3, 100, 4, null, 10])) + { + Assert.Equal(expected, source.Skip(1)); + } } [Fact] public void SkipAllButOne() { - int?[] source = { 3, 100, null, 4, 10 }; - int?[] expected = { 10 }; - - Assert.Equal(expected, source.Skip(source.Length - 1)); - } - - [Fact] - public void SkipAllButOneNotIList() - { - int?[] source = { 3, 100, null, 4, 10 }; - int?[] expected = { 10 }; - - Assert.Equal(expected, GuaranteeNotIList(source.Skip(source.Length - 1))); + int?[] expected = [10]; + foreach (IEnumerable source in CreateSources([3, 100, 4, null, 10])) + { + Assert.Equal(expected, source.Skip(4)); + } } [Fact] public void SkipOneMoreThanAll() { - int[] source = { 3, 100, 4, 10 }; - Assert.Empty(source.Skip(source.Length + 1)); - } - - [Fact] - public void SkipOneMoreThanAllNotIList() - { - int[] source = { 3, 100, 4, 10 }; - Assert.Empty(GuaranteeNotIList(source).Skip(source.Length + 1)); + foreach (IEnumerable source in CreateSources([3, 100, 4, 10])) + { + Assert.Empty(source.Skip(5)); + } } [Fact] public void ForcedToEnumeratorDoesntEnumerate() { - var iterator = NumberRangeGuaranteedNotCollectionType(0, 3).Skip(2); - // Don't insist on this behaviour, but check it's correct if it happens - var en = iterator as IEnumerator; - Assert.False(en is not null && en.MoveNext()); - } - - [Fact] - public void ForcedToEnumeratorDoesntEnumerateIList() - { - var iterator = (new[] { 0, 1, 2 }).Skip(2); - // Don't insist on this behaviour, but check it's correct if it happens - var en = iterator as IEnumerator; - Assert.False(en is not null && en.MoveNext()); + foreach (IEnumerable source in CreateSources(Enumerable.Range(0, 3))) + { + // Don't insist on this behaviour, but check it's correct if it happens + IEnumerable iterator = source.Skip(2); + var en = iterator as IEnumerator; + Assert.False(en is not null && en.MoveNext()); + } } [Fact] @@ -232,243 +182,150 @@ public void Count() [Fact] public void FollowWithTake() { - var source = new[] { 5, 6, 7, 8 }; - var expected = new[] { 6, 7 }; - Assert.Equal(expected, source.Skip(1).Take(2)); - } - - [Fact] - public void FollowWithTakeNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(5, 4); - var expected = new[] { 6, 7 }; - Assert.Equal(expected, source.Skip(1).Take(2)); + int[] expected = [6, 7]; + foreach (IEnumerable source in CreateSources(Enumerable.Range(5, 4))) + { + Assert.Equal(expected, source.Skip(1).Take(2)); + } } [Fact] public void FollowWithTakeThenMassiveTake() { - var source = new[] { 5, 6, 7, 8 }; - var expected = new[] { 7 }; - Assert.Equal(expected, source.Skip(2).Take(1).Take(int.MaxValue)); - } - [Fact] - public void FollowWithTakeThenMassiveTakeNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(5, 4); - var expected = new[] { 7 }; - Assert.Equal(expected, source.Skip(2).Take(1).Take(int.MaxValue)); + int[] expected = [7]; + foreach (IEnumerable source in CreateSources([5, 6, 7, 8])) + { + Assert.Equal(expected, source.Skip(2).Take(1).Take(int.MaxValue)); + } } [Fact] public void FollowWithSkip() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; - var expected = new[] { 4, 5, 6 }; - Assert.Equal(expected, source.Skip(1).Skip(2).Skip(-4)); - } - - [Fact] - public void FollowWithSkipNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(1, 6); - var expected = new[] { 4, 5, 6 }; - Assert.Equal(expected, source.Skip(1).Skip(2).Skip(-4)); + int[] expected = [4, 5, 6]; + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + Assert.Equal(expected, source.Skip(1).Skip(2).Skip(-4)); + } } [Fact] public void ElementAt() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; - var remaining = source.Skip(2); - Assert.Equal(3, remaining.ElementAt(0)); - Assert.Equal(4, remaining.ElementAt(1)); - Assert.Equal(6, remaining.ElementAt(3)); - AssertExtensions.Throws("index", () => remaining.ElementAt(-1)); - AssertExtensions.Throws("index", () => remaining.ElementAt(4)); - } - - [Fact] - public void ElementAtNotIList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5, 6 }); - var remaining = source.Skip(2); - Assert.Equal(3, remaining.ElementAt(0)); - Assert.Equal(4, remaining.ElementAt(1)); - Assert.Equal(6, remaining.ElementAt(3)); - AssertExtensions.Throws("index", () => remaining.ElementAt(-1)); - AssertExtensions.Throws("index", () => remaining.ElementAt(4)); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + IEnumerable remaining = source.Skip(2); + Assert.Equal(3, remaining.ElementAt(0)); + Assert.Equal(4, remaining.ElementAt(1)); + Assert.Equal(6, remaining.ElementAt(3)); + AssertExtensions.Throws("index", () => remaining.ElementAt(-1)); + AssertExtensions.Throws("index", () => remaining.ElementAt(4)); + } } [Fact] public void ElementAtOrDefault() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; - var remaining = source.Skip(2); - Assert.Equal(3, remaining.ElementAtOrDefault(0)); - Assert.Equal(4, remaining.ElementAtOrDefault(1)); - Assert.Equal(6, remaining.ElementAtOrDefault(3)); - Assert.Equal(0, remaining.ElementAtOrDefault(-1)); - Assert.Equal(0, remaining.ElementAtOrDefault(4)); - } - - [Fact] - public void ElementAtOrDefaultNotIList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5, 6 }); - var remaining = source.Skip(2); - Assert.Equal(3, remaining.ElementAtOrDefault(0)); - Assert.Equal(4, remaining.ElementAtOrDefault(1)); - Assert.Equal(6, remaining.ElementAtOrDefault(3)); - Assert.Equal(0, remaining.ElementAtOrDefault(-1)); - Assert.Equal(0, remaining.ElementAtOrDefault(4)); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + IEnumerable remaining = source.Skip(2); + Assert.Equal(3, remaining.ElementAtOrDefault(0)); + Assert.Equal(4, remaining.ElementAtOrDefault(1)); + Assert.Equal(6, remaining.ElementAtOrDefault(3)); + Assert.Equal(0, remaining.ElementAtOrDefault(-1)); + Assert.Equal(0, remaining.ElementAtOrDefault(4)); + } } [Fact] public void First() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Skip(0).First()); - Assert.Equal(3, source.Skip(2).First()); - Assert.Equal(5, source.Skip(4).First()); - Assert.Throws(() => source.Skip(5).First()); - } - - [Fact] - public void FirstNotIList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Skip(0).First()); - Assert.Equal(3, source.Skip(2).First()); - Assert.Equal(5, source.Skip(4).First()); - Assert.Throws(() => source.Skip(5).First()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Skip(0).First()); + Assert.Equal(3, source.Skip(2).First()); + Assert.Equal(5, source.Skip(4).First()); + Assert.Throws(() => source.Skip(5).First()); + } } [Fact] public void FirstOrDefault() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Skip(0).FirstOrDefault()); - Assert.Equal(3, source.Skip(2).FirstOrDefault()); - Assert.Equal(5, source.Skip(4).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).FirstOrDefault()); - } - - [Fact] - public void FirstOrDefaultNotIList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Skip(0).FirstOrDefault()); - Assert.Equal(3, source.Skip(2).FirstOrDefault()); - Assert.Equal(5, source.Skip(4).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).FirstOrDefault()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Skip(0).FirstOrDefault()); + Assert.Equal(3, source.Skip(2).FirstOrDefault()); + Assert.Equal(5, source.Skip(4).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).FirstOrDefault()); + } } [Fact] public void Last() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(5, source.Skip(0).Last()); - Assert.Equal(5, source.Skip(1).Last()); - Assert.Equal(5, source.Skip(4).Last()); - Assert.Throws(() => source.Skip(5).Last()); - } - - [Fact] - public void LastNotList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(5, source.Skip(0).Last()); - Assert.Equal(5, source.Skip(1).Last()); - Assert.Equal(5, source.Skip(4).Last()); - Assert.Throws(() => source.Skip(5).Last()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(5, source.Skip(0).Last()); + Assert.Equal(5, source.Skip(1).Last()); + Assert.Equal(5, source.Skip(4).Last()); + Assert.Throws(() => source.Skip(5).Last()); + } } [Fact] public void LastOrDefault() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(5, source.Skip(0).LastOrDefault()); - Assert.Equal(5, source.Skip(1).LastOrDefault()); - Assert.Equal(5, source.Skip(4).LastOrDefault()); - Assert.Equal(0, source.Skip(5).LastOrDefault()); - } - - [Fact] - public void LastOrDefaultNotList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(5, source.Skip(0).LastOrDefault()); - Assert.Equal(5, source.Skip(1).LastOrDefault()); - Assert.Equal(5, source.Skip(4).LastOrDefault()); - Assert.Equal(0, source.Skip(5).LastOrDefault()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(5, source.Skip(0).LastOrDefault()); + Assert.Equal(5, source.Skip(1).LastOrDefault()); + Assert.Equal(5, source.Skip(4).LastOrDefault()); + Assert.Equal(0, source.Skip(5).LastOrDefault()); + } } [Fact] public void ToArray() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToArray()); - Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToArray()); - Assert.Equal(5, source.Skip(4).ToArray().Single()); - Assert.Empty(source.Skip(5).ToArray()); - Assert.Empty(source.Skip(40).ToArray()); - } - - [Fact] - public void ToArrayNotList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToArray()); - Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToArray()); - Assert.Equal(5, source.Skip(4).ToArray().Single()); - Assert.Empty(source.Skip(5).ToArray()); - Assert.Empty(source.Skip(40).ToArray()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToArray()); + Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToArray()); + Assert.Equal(5, source.Skip(4).ToArray().Single()); + Assert.Empty(source.Skip(5).ToArray()); + Assert.Empty(source.Skip(40).ToArray()); + } } [Fact] public void ToList() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToList()); - Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToList()); - Assert.Equal(5, source.Skip(4).ToList().Single()); - Assert.Empty(source.Skip(5).ToList()); - Assert.Empty(source.Skip(40).ToList()); - } - - [Fact] - public void ToListNotList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToList()); - Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToList()); - Assert.Equal(5, source.Skip(4).ToList().Single()); - Assert.Empty(source.Skip(5).ToList()); - Assert.Empty(source.Skip(40).ToList()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Skip(0).ToList()); + Assert.Equal(new[] { 2, 3, 4, 5 }, source.Skip(1).ToList()); + Assert.Equal(5, source.Skip(4).ToList().Single()); + Assert.Empty(source.Skip(5).ToList()); + Assert.Empty(source.Skip(40).ToList()); + } } [Fact] public void RepeatEnumerating() { - var source = new[] { 1, 2, 3, 4, 5 }; - var remaining = source.Skip(1); - Assert.Equal(remaining, remaining); - } - - [Fact] - public void RepeatEnumeratingNotList() - { - var source = GuaranteeNotIList(new[] { 1, 2, 3, 4, 5 }); - var remaining = source.Skip(1); - Assert.Equal(remaining, remaining); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + IEnumerable remaining = source.Skip(1); + Assert.Equal(remaining, remaining); + } } [Fact] public void LazySkipMoreThan32Bits() { - var range = NumberRangeGuaranteedNotCollectionType(1, 100); - var skipped = range.Skip(50).Skip(int.MaxValue); // Could cause an integer overflow. + IEnumerable range = NumberRangeGuaranteedNotCollectionType(1, 100); + IEnumerable skipped = range.Skip(50).Skip(int.MaxValue); // Could cause an integer overflow. Assert.Empty(skipped); Assert.Equal(0, skipped.Count()); Assert.Empty(skipped.ToArray()); @@ -489,7 +346,7 @@ public void IteratorStateShouldNotChangeIfNumberOfElementsIsUnbounded() // so that it does not overflow to a negative number and enumeration does not // stop prematurely. - var iterator = new FastInfiniteEnumerator().Skip(1).GetEnumerator(); + using IEnumerator iterator = new FastInfiniteEnumerator().Skip(1).GetEnumerator(); iterator.MoveNext(); // Make sure the underlying enumerator has been initialized. FieldInfo state = iterator.GetType().GetTypeInfo() diff --git a/src/libraries/System.Linq/tests/TakeLastTests.cs b/src/libraries/System.Linq/tests/TakeLastTests.cs index b39d59e94263a6..4d011d50cfd63c 100644 --- a/src/libraries/System.Linq/tests/TakeLastTests.cs +++ b/src/libraries/System.Linq/tests/TakeLastTests.cs @@ -19,25 +19,26 @@ public void SkipLastThrowsOnNull() [MemberData(nameof(EnumerableData), MemberType = typeof(SkipTakeData))] public void TakeLast(IEnumerable source, int count) { - Assert.All(IdentityTransforms(), transform => - { - IEnumerable equivalent = transform(source); + int[] expected = source.Reverse().Take(count).Reverse().ToArray(); - IEnumerable expected = equivalent.Reverse().Take(count).Reverse(); - IEnumerable actual = equivalent.TakeLast(count); + Assert.All(CreateSources(source), source => + { + IEnumerable actual = source.TakeLast(count); Assert.Equal(expected, actual); - Assert.Equal(expected.Count(), actual.Count()); + + Assert.Equal(expected.Length, actual.Count()); Assert.Equal(expected, actual.ToArray()); Assert.Equal(expected, actual.ToList()); - Assert.Equal(expected.FirstOrDefault(), actual.FirstOrDefault()); Assert.Equal(expected.LastOrDefault(), actual.LastOrDefault()); - Assert.All(Enumerable.Range(0, expected.Count()), index => + if (expected.Length > 0) { - Assert.Equal(expected.ElementAt(index), actual.ElementAt(index)); - }); + Assert.Equal(expected[0], actual.ElementAt(0)); + Assert.Equal(expected[^1], actual.ElementAt(expected.Length - 1)); + Assert.Equal(expected[expected.Length / 2], actual.ElementAt(expected.Length / 2)); + } Assert.Equal(0, actual.ElementAtOrDefault(-1)); Assert.Equal(0, actual.ElementAtOrDefault(actual.Count())); diff --git a/src/libraries/System.Linq/tests/TakeTests.cs b/src/libraries/System.Linq/tests/TakeTests.cs index d9408a157124bf..c39c9357ea7c57 100644 --- a/src/libraries/System.Linq/tests/TakeTests.cs +++ b/src/libraries/System.Linq/tests/TakeTests.cs @@ -72,135 +72,85 @@ public void SameResultsRepeatCallsStringQueryIList() [Fact] public void SourceEmptyCountPositive() { - var source = new int[] { }; - Assert.Empty(source.Take(5)); - - Assert.Empty(source.Take(0..5)); - Assert.Empty(source.Take(^5..5)); - Assert.Empty(source.Take(0..^0)); - Assert.Empty(source.Take(^5..^0)); - } - - [Fact] - public void SourceEmptyCountPositiveNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(0, 0); - Assert.Empty(source.Take(5)); + foreach (IEnumerable source in CreateSources([])) + { + Assert.Empty(source.Take(5)); - Assert.Empty(source.Take(0..5)); - Assert.Empty(source.Take(^5..5)); - Assert.Empty(source.Take(0..^0)); - Assert.Empty(source.Take(^5..^0)); + Assert.Empty(source.Take(0..5)); + Assert.Empty(source.Take(^5..5)); + Assert.Empty(source.Take(0..^0)); + Assert.Empty(source.Take(^5..^0)); + } } [Fact] public void SourceNonEmptyCountNegative() { - var source = new[] { 2, 5, 9, 1 }; - Assert.Empty(source.Take(-5)); - - Assert.Empty(source.Take(^9..0)); - } - - [Fact] - public void SourceNonEmptyCountNegativeNotIList() - { - var source = ForceNotCollection(new[] { 2, 5, 9, 1 }); - Assert.Empty(source.Take(-5)); - - Assert.Empty(source.Take(^9..0)); + foreach (IEnumerable source in CreateSources([2, 5, 9, 1])) + { + Assert.Empty(source.Take(-5)); + Assert.Empty(source.Take(^9..0)); + } } [Fact] public void SourceNonEmptyCountZero() { - var source = new[] { 2, 5, 9, 1 }; - Assert.Empty(source.Take(0)); - - Assert.Empty(source.Take(0..0)); - Assert.Empty(source.Take(^4..0)); - Assert.Empty(source.Take(0..^4)); - Assert.Empty(source.Take(^4..^4)); - } - - [Fact] - public void SourceNonEmptyCountZeroNotIList() - { - var source = ForceNotCollection(new[] { 2, 5, 9, 1 }); - Assert.Empty(source.Take(0)); + foreach (IEnumerable source in CreateSources([2, 5, 9, 1])) + { + Assert.Empty(source.Take(0)); - Assert.Empty(source.Take(0..0)); - Assert.Empty(source.Take(^4..0)); - Assert.Empty(source.Take(0..^4)); - Assert.Empty(source.Take(^4..^4)); + Assert.Empty(source.Take(0..0)); + Assert.Empty(source.Take(^4..0)); + Assert.Empty(source.Take(0..^4)); + Assert.Empty(source.Take(^4..^4)); + } } [Fact] public void SourceNonEmptyCountOne() { - var source = new[] { 2, 5, 9, 1 }; - int[] expected = { 2 }; + int[] expected = [2]; - Assert.Equal(expected, source.Take(1)); - - Assert.Equal(expected, source.Take(0..1)); - Assert.Equal(expected, source.Take(^4..1)); - Assert.Equal(expected, source.Take(0..^3)); - Assert.Equal(expected, source.Take(^4..^3)); - } - - [Fact] - public void SourceNonEmptyCountOneNotIList() - { - var source = ForceNotCollection(new[] { 2, 5, 9, 1 }); - int[] expected = { 2 }; - - Assert.Equal(expected, source.Take(1)); + foreach (IEnumerable source in CreateSources([2, 5, 9, 1])) + { + Assert.Equal(expected, source.Take(1)); - Assert.Equal(expected, source.Take(0..1)); - Assert.Equal(expected, source.Take(^4..1)); - Assert.Equal(expected, source.Take(0..^3)); - Assert.Equal(expected, source.Take(^4..^3)); + Assert.Equal(expected, source.Take(0..1)); + Assert.Equal(expected, source.Take(^4..1)); + Assert.Equal(expected, source.Take(0..^3)); + Assert.Equal(expected, source.Take(^4..^3)); + } } [Fact] public void SourceNonEmptyTakeAllExactly() { - var source = new[] { 2, 5, 9, 1 }; - - Assert.Equal(source, source.Take(source.Length)); - - Assert.Equal(source, source.Take(0..source.Length)); - Assert.Equal(source, source.Take(^source.Length..source.Length)); - Assert.Equal(source, source.Take(0..^0)); - Assert.Equal(source, source.Take(^source.Length..^0)); - } - - [Fact] - public void SourceNonEmptyTakeAllExactlyNotIList() - { - var source = ForceNotCollection(new[] { 2, 5, 9, 1 }); - - Assert.Equal(source, source.Take(source.Count())); + foreach (IEnumerable source in CreateSources([2, 5, 9, 1])) + { + Assert.Equal(source, source.Take(4)); - Assert.Equal(source, source.Take(0..source.Count())); - Assert.Equal(source, source.Take(^source.Count()..source.Count())); - Assert.Equal(source, source.Take(0..^0)); - Assert.Equal(source, source.Take(^source.Count()..^0)); + Assert.Equal(source, source.Take(0..4)); + Assert.Equal(source, source.Take(^4..4)); + Assert.Equal(source, source.Take(0..^0)); + Assert.Equal(source, source.Take(^4..^0)); + } } [Fact] public void SourceNonEmptyTakeAllButOne() { - var source = new[] { 2, 5, 9, 1 }; - int[] expected = { 2, 5, 9 }; + int[] expected = [2, 5, 9]; - Assert.Equal(expected, source.Take(3)); + foreach (IEnumerable source in CreateSources([2, 5, 9, 1])) + { + Assert.Equal(expected, source.Take(3)); - Assert.Equal(expected, source.Take(0..3)); - Assert.Equal(expected, source.Take(^4..3)); - Assert.Equal(expected, source.Take(0..^1)); - Assert.Equal(expected, source.Take(^4..^1)); + Assert.Equal(expected, source.Take(0..3)); + Assert.Equal(expected, source.Take(^4..3)); + Assert.Equal(expected, source.Take(0..^1)); + Assert.Equal(expected, source.Take(^4..^1)); + } } [Fact] @@ -217,40 +167,16 @@ public void RunOnce() Assert.Equal(expected, source.RunOnce().Take(^4..^1)); } - [Fact] - public void SourceNonEmptyTakeAllButOneNotIList() - { - var source = ForceNotCollection(new[] { 2, 5, 9, 1 }); - int[] expected = { 2, 5, 9 }; - - Assert.Equal(expected, source.RunOnce().Take(3)); - - Assert.Equal(expected, source.RunOnce().Take(0..3)); - Assert.Equal(expected, source.RunOnce().Take(^4..3)); - Assert.Equal(expected, source.RunOnce().Take(0..^1)); - Assert.Equal(expected, source.RunOnce().Take(^4..^1)); - } - [Fact] public void SourceNonEmptyTakeExcessive() { - var source = new int?[] { 2, 5, null, 9, 1 }; - - Assert.Equal(source, source.Take(source.Length + 1)); - - Assert.Equal(source, source.Take(0..(source.Length + 1))); - Assert.Equal(source, source.Take(^(source.Length + 1)..(source.Length + 1))); - } - - [Fact] - public void SourceNonEmptyTakeExcessiveNotIList() - { - var source = ForceNotCollection(new int?[] { 2, 5, null, 9, 1 }); - - Assert.Equal(source, source.Take(source.Count() + 1)); + foreach (IEnumerable source in CreateSources([2, 5, null, 9, 1])) + { + Assert.Equal(source, source.Take(5)); - Assert.Equal(source, source.Take(0..(source.Count() + 1))); - Assert.Equal(source, source.Take(^(source.Count() + 1)..(source.Count() + 1))); + Assert.Equal(source, source.Take(0..5)); + Assert.Equal(source, source.Take(^6..6)); + } } [Fact] @@ -342,741 +268,405 @@ public void ForcedToEnumeratorDoesntEnumerateIList() [Fact] public void FollowWithTake() { - var source = new[] { 5, 6, 7, 8 }; var expected = new[] { 5, 6 }; - Assert.Equal(expected, source.Take(5).Take(3).Take(2).Take(40)); - Assert.Equal(expected, source.Take(0..5).Take(0..3).Take(0..2).Take(0..40)); - Assert.Equal(expected, source.Take(^4..5).Take(^4..3).Take(^3..2).Take(^2..40)); - Assert.Equal(expected, source.Take(0..^0).Take(0..^1).Take(0..^1).Take(0..^0)); - Assert.Equal(expected, source.Take(^4..^0).Take(^4..^1).Take(^3..^1).Take(^2..^0)); - } - - [Fact] - public void FollowWithTakeNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(5, 4); - var expected = new[] { 5, 6 }; - Assert.Equal(expected, source.Take(5).Take(3).Take(2)); + foreach (IEnumerable source in CreateSources([5, 6, 7, 8])) + { + Assert.Equal(expected, source.Take(5).Take(3).Take(2).Take(40)); - Assert.Equal(expected, source.Take(0..5).Take(0..3).Take(0..2)); - Assert.Equal(expected, source.Take(^4..5).Take(^4..3).Take(^3..2)); - Assert.Equal(expected, source.Take(0..^0).Take(0..^1).Take(0..^1)); - Assert.Equal(expected, source.Take(^4..^0).Take(^4..^1).Take(^3..^1)); + Assert.Equal(expected, source.Take(0..5).Take(0..3).Take(0..2).Take(0..40)); + Assert.Equal(expected, source.Take(^4..5).Take(^4..3).Take(^3..2).Take(^2..40)); + Assert.Equal(expected, source.Take(0..^0).Take(0..^1).Take(0..^1).Take(0..^0)); + Assert.Equal(expected, source.Take(^4..^0).Take(^4..^1).Take(^3..^1).Take(^2..^0)); + } } [Fact] public void FollowWithSkip() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; var expected = new[] { 3, 4, 5 }; - Assert.Equal(expected, source.Take(5).Skip(2).Skip(-4)); - - Assert.Equal(expected, source.Take(0..5).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(^6..5).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(0..^1).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(^6..^1).Skip(2).Skip(-4)); - } - [Fact] - public void FollowWithSkipNotIList() - { - var source = NumberRangeGuaranteedNotCollectionType(1, 6); - var expected = new[] { 3, 4, 5 }; - Assert.Equal(expected, source.Take(5).Skip(2).Skip(-4)); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + Assert.Equal(expected, source.Take(5).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(0..5).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(^6..5).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(0..^1).Skip(2).Skip(-4)); - Assert.Equal(expected, source.Take(^6..^1).Skip(2).Skip(-4)); + Assert.Equal(expected, source.Take(0..5).Skip(2).Skip(-4)); + Assert.Equal(expected, source.Take(^6..5).Skip(2).Skip(-4)); + Assert.Equal(expected, source.Take(0..^1).Skip(2).Skip(-4)); + Assert.Equal(expected, source.Take(^6..^1).Skip(2).Skip(-4)); + } } [Fact] public void ElementAt() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; - var taken0 = source.Take(3); - Assert.Equal(1, taken0.ElementAt(0)); - Assert.Equal(3, taken0.ElementAt(2)); - Assert.Throws("index", () => taken0.ElementAt(-1)); - Assert.Throws("index", () => taken0.ElementAt(3)); - - var taken1 = source.Take(0..3); - Assert.Equal(1, taken1.ElementAt(0)); - Assert.Equal(3, taken1.ElementAt(2)); - Assert.Throws("index", () => taken1.ElementAt(-1)); - Assert.Throws("index", () => taken1.ElementAt(3)); - - var taken2 = source.Take(^6..3); - Assert.Equal(1, taken2.ElementAt(0)); - Assert.Equal(3, taken2.ElementAt(2)); - Assert.Throws("index", () => taken2.ElementAt(-1)); - Assert.Throws("index", () => taken2.ElementAt(3)); - - var taken3 = source.Take(0..^3); - Assert.Equal(1, taken3.ElementAt(0)); - Assert.Equal(3, taken3.ElementAt(2)); - Assert.Throws("index", () => taken3.ElementAt(-1)); - Assert.Throws("index", () => taken3.ElementAt(3)); - - var taken4 = source.Take(^6..^3); - Assert.Equal(1, taken4.ElementAt(0)); - Assert.Equal(3, taken4.ElementAt(2)); - Assert.Throws("index", () => taken4.ElementAt(-1)); - Assert.Throws("index", () => taken4.ElementAt(3)); - } - - [Fact] - public void ElementAtNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5, 6 }); - var taken0 = source.Take(3); - Assert.Equal(1, taken0.ElementAt(0)); - Assert.Equal(3, taken0.ElementAt(2)); - Assert.Throws("index", () => taken0.ElementAt(-1)); - Assert.Throws("index", () => taken0.ElementAt(3)); - - var taken1 = source.Take(0..3); - Assert.Equal(1, taken1.ElementAt(0)); - Assert.Equal(3, taken1.ElementAt(2)); - Assert.Throws("index", () => taken1.ElementAt(-1)); - Assert.Throws("index", () => taken1.ElementAt(3)); - - var taken2 = source.Take(^6..3); - Assert.Equal(1, taken2.ElementAt(0)); - Assert.Equal(3, taken2.ElementAt(2)); - Assert.Throws("index", () => taken2.ElementAt(-1)); - Assert.Throws("index", () => taken2.ElementAt(3)); - - var taken3 = source.Take(0..^3); - Assert.Equal(1, taken3.ElementAt(0)); - Assert.Equal(3, taken3.ElementAt(2)); - Assert.Throws("index", () => taken3.ElementAt(-1)); - Assert.Throws("index", () => taken3.ElementAt(3)); - - var taken4 = source.Take(^6..^3); - Assert.Equal(1, taken4.ElementAt(0)); - Assert.Equal(3, taken4.ElementAt(2)); - Assert.Throws("index", () => taken4.ElementAt(-1)); - Assert.Throws("index", () => taken4.ElementAt(3)); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + var taken0 = source.Take(3); + Assert.Equal(1, taken0.ElementAt(0)); + Assert.Equal(3, taken0.ElementAt(2)); + Assert.Throws("index", () => taken0.ElementAt(-1)); + Assert.Throws("index", () => taken0.ElementAt(3)); + + var taken1 = source.Take(0..3); + Assert.Equal(1, taken1.ElementAt(0)); + Assert.Equal(3, taken1.ElementAt(2)); + Assert.Throws("index", () => taken1.ElementAt(-1)); + Assert.Throws("index", () => taken1.ElementAt(3)); + + var taken2 = source.Take(^6..3); + Assert.Equal(1, taken2.ElementAt(0)); + Assert.Equal(3, taken2.ElementAt(2)); + Assert.Throws("index", () => taken2.ElementAt(-1)); + Assert.Throws("index", () => taken2.ElementAt(3)); + + var taken3 = source.Take(0..^3); + Assert.Equal(1, taken3.ElementAt(0)); + Assert.Equal(3, taken3.ElementAt(2)); + Assert.Throws("index", () => taken3.ElementAt(-1)); + Assert.Throws("index", () => taken3.ElementAt(3)); + + var taken4 = source.Take(^6..^3); + Assert.Equal(1, taken4.ElementAt(0)); + Assert.Equal(3, taken4.ElementAt(2)); + Assert.Throws("index", () => taken4.ElementAt(-1)); + Assert.Throws("index", () => taken4.ElementAt(3)); + } } [Fact] public void ElementAtOrDefault() { - var source = new[] { 1, 2, 3, 4, 5, 6 }; - var taken0 = source.Take(3); - Assert.Equal(1, taken0.ElementAtOrDefault(0)); - Assert.Equal(3, taken0.ElementAtOrDefault(2)); - Assert.Equal(0, taken0.ElementAtOrDefault(-1)); - Assert.Equal(0, taken0.ElementAtOrDefault(3)); - - var taken1 = source.Take(0..3); - Assert.Equal(1, taken1.ElementAtOrDefault(0)); - Assert.Equal(3, taken1.ElementAtOrDefault(2)); - Assert.Equal(0, taken1.ElementAtOrDefault(-1)); - Assert.Equal(0, taken1.ElementAtOrDefault(3)); - - var taken2 = source.Take(^6..3); - Assert.Equal(1, taken2.ElementAtOrDefault(0)); - Assert.Equal(3, taken2.ElementAtOrDefault(2)); - Assert.Equal(0, taken2.ElementAtOrDefault(-1)); - Assert.Equal(0, taken2.ElementAtOrDefault(3)); - - var taken3 = source.Take(0..^3); - Assert.Equal(1, taken3.ElementAtOrDefault(0)); - Assert.Equal(3, taken3.ElementAtOrDefault(2)); - Assert.Equal(0, taken3.ElementAtOrDefault(-1)); - Assert.Equal(0, taken3.ElementAtOrDefault(3)); - - var taken4 = source.Take(^6..^3); - Assert.Equal(1, taken4.ElementAtOrDefault(0)); - Assert.Equal(3, taken4.ElementAtOrDefault(2)); - Assert.Equal(0, taken4.ElementAtOrDefault(-1)); - Assert.Equal(0, taken4.ElementAtOrDefault(3)); - } - - [Fact] - public void ElementAtOrDefaultNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5, 6 }); - var taken0 = source.Take(3); - Assert.Equal(1, taken0.ElementAtOrDefault(0)); - Assert.Equal(3, taken0.ElementAtOrDefault(2)); - Assert.Equal(0, taken0.ElementAtOrDefault(-1)); - Assert.Equal(0, taken0.ElementAtOrDefault(3)); - - var taken1 = source.Take(0..3); - Assert.Equal(1, taken1.ElementAtOrDefault(0)); - Assert.Equal(3, taken1.ElementAtOrDefault(2)); - Assert.Equal(0, taken1.ElementAtOrDefault(-1)); - Assert.Equal(0, taken1.ElementAtOrDefault(3)); - - var taken2 = source.Take(^6..3); - Assert.Equal(1, taken2.ElementAtOrDefault(0)); - Assert.Equal(3, taken2.ElementAtOrDefault(2)); - Assert.Equal(0, taken2.ElementAtOrDefault(-1)); - Assert.Equal(0, taken2.ElementAtOrDefault(3)); - - var taken3 = source.Take(0..^3); - Assert.Equal(1, taken3.ElementAtOrDefault(0)); - Assert.Equal(3, taken3.ElementAtOrDefault(2)); - Assert.Equal(0, taken3.ElementAtOrDefault(-1)); - Assert.Equal(0, taken3.ElementAtOrDefault(3)); - - var taken4 = source.Take(^6..^3); - Assert.Equal(1, taken4.ElementAtOrDefault(0)); - Assert.Equal(3, taken4.ElementAtOrDefault(2)); - Assert.Equal(0, taken4.ElementAtOrDefault(-1)); - Assert.Equal(0, taken4.ElementAtOrDefault(3)); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5, 6])) + { + var taken0 = source.Take(3); + Assert.Equal(1, taken0.ElementAtOrDefault(0)); + Assert.Equal(3, taken0.ElementAtOrDefault(2)); + Assert.Equal(0, taken0.ElementAtOrDefault(-1)); + Assert.Equal(0, taken0.ElementAtOrDefault(3)); + + var taken1 = source.Take(0..3); + Assert.Equal(1, taken1.ElementAtOrDefault(0)); + Assert.Equal(3, taken1.ElementAtOrDefault(2)); + Assert.Equal(0, taken1.ElementAtOrDefault(-1)); + Assert.Equal(0, taken1.ElementAtOrDefault(3)); + + var taken2 = source.Take(^6..3); + Assert.Equal(1, taken2.ElementAtOrDefault(0)); + Assert.Equal(3, taken2.ElementAtOrDefault(2)); + Assert.Equal(0, taken2.ElementAtOrDefault(-1)); + Assert.Equal(0, taken2.ElementAtOrDefault(3)); + + var taken3 = source.Take(0..^3); + Assert.Equal(1, taken3.ElementAtOrDefault(0)); + Assert.Equal(3, taken3.ElementAtOrDefault(2)); + Assert.Equal(0, taken3.ElementAtOrDefault(-1)); + Assert.Equal(0, taken3.ElementAtOrDefault(3)); + + var taken4 = source.Take(^6..^3); + Assert.Equal(1, taken4.ElementAtOrDefault(0)); + Assert.Equal(3, taken4.ElementAtOrDefault(2)); + Assert.Equal(0, taken4.ElementAtOrDefault(-1)); + Assert.Equal(0, taken4.ElementAtOrDefault(3)); + } } [Fact] public void First() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Take(1).First()); - Assert.Equal(1, source.Take(4).First()); - Assert.Equal(1, source.Take(40).First()); - Assert.Throws(() => source.Take(0).First()); - Assert.Throws(() => source.Skip(5).Take(10).First()); - - Assert.Equal(1, source.Take(0..1).First()); - Assert.Equal(1, source.Take(0..4).First()); - Assert.Equal(1, source.Take(0..40).First()); - Assert.Throws(() => source.Take(0..0).First()); - Assert.Throws(() => source.Skip(5).Take(0..10).First()); - - Assert.Equal(1, source.Take(^5..1).First()); - Assert.Equal(1, source.Take(^5..4).First()); - Assert.Equal(1, source.Take(^5..40).First()); - Assert.Throws(() => source.Take(^5..0).First()); - Assert.Throws(() => source.Skip(5).Take(^5..10).First()); - - Assert.Equal(1, source.Take(0..^4).First()); - Assert.Equal(1, source.Take(0..^1).First()); - Assert.Equal(1, source.Take(0..^0).First()); - Assert.Throws(() => source.Take(0..^5).First()); - Assert.Throws(() => source.Skip(5).Take(0..^5).First()); - - Assert.Equal(1, source.Take(^5..^4).First()); - Assert.Equal(1, source.Take(^5..^1).First()); - Assert.Equal(1, source.Take(^5..^0).First()); - Assert.Throws(() => source.Take(^5..^5).First()); - Assert.Throws(() => source.Skip(5).Take(^10..^0).First()); - } - - [Fact] - public void FirstNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Take(1).First()); - Assert.Equal(1, source.Take(4).First()); - Assert.Equal(1, source.Take(40).First()); - Assert.Throws(() => source.Take(0).First()); - Assert.Throws(() => source.Skip(5).Take(10).First()); - - Assert.Equal(1, source.Take(0..1).First()); - Assert.Equal(1, source.Take(0..4).First()); - Assert.Equal(1, source.Take(0..40).First()); - Assert.Throws(() => source.Take(0..0).First()); - Assert.Throws(() => source.Skip(5).Take(0..10).First()); - - Assert.Equal(1, source.Take(^5..1).First()); - Assert.Equal(1, source.Take(^5..4).First()); - Assert.Equal(1, source.Take(^5..40).First()); - Assert.Throws(() => source.Take(^5..0).First()); - Assert.Throws(() => source.Skip(5).Take(^5..10).First()); - - Assert.Equal(1, source.Take(0..^4).First()); - Assert.Equal(1, source.Take(0..^1).First()); - Assert.Equal(1, source.Take(0..^0).First()); - Assert.Throws(() => source.Take(0..^5).First()); - Assert.Throws(() => source.Skip(5).Take(0..^5).First()); - - Assert.Equal(1, source.Take(^5..^4).First()); - Assert.Equal(1, source.Take(^5..^1).First()); - Assert.Equal(1, source.Take(^5..^0).First()); - Assert.Throws(() => source.Take(^5..^5).First()); - Assert.Throws(() => source.Skip(5).Take(^10..^0).First()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Take(1).First()); + Assert.Equal(1, source.Take(4).First()); + Assert.Equal(1, source.Take(40).First()); + Assert.Throws(() => source.Take(0).First()); + Assert.Throws(() => source.Skip(5).Take(10).First()); + + Assert.Equal(1, source.Take(0..1).First()); + Assert.Equal(1, source.Take(0..4).First()); + Assert.Equal(1, source.Take(0..40).First()); + Assert.Throws(() => source.Take(0..0).First()); + Assert.Throws(() => source.Skip(5).Take(0..10).First()); + + Assert.Equal(1, source.Take(^5..1).First()); + Assert.Equal(1, source.Take(^5..4).First()); + Assert.Equal(1, source.Take(^5..40).First()); + Assert.Throws(() => source.Take(^5..0).First()); + Assert.Throws(() => source.Skip(5).Take(^5..10).First()); + + Assert.Equal(1, source.Take(0..^4).First()); + Assert.Equal(1, source.Take(0..^1).First()); + Assert.Equal(1, source.Take(0..^0).First()); + Assert.Throws(() => source.Take(0..^5).First()); + Assert.Throws(() => source.Skip(5).Take(0..^5).First()); + + Assert.Equal(1, source.Take(^5..^4).First()); + Assert.Equal(1, source.Take(^5..^1).First()); + Assert.Equal(1, source.Take(^5..^0).First()); + Assert.Throws(() => source.Take(^5..^5).First()); + Assert.Throws(() => source.Skip(5).Take(^10..^0).First()); + } } [Fact] public void FirstOrDefault() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Take(1).FirstOrDefault()); - Assert.Equal(1, source.Take(4).FirstOrDefault()); - Assert.Equal(1, source.Take(40).FirstOrDefault()); - Assert.Equal(0, source.Take(0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(10).FirstOrDefault()); - - Assert.Equal(1, source.Take(0..1).FirstOrDefault()); - Assert.Equal(1, source.Take(0..4).FirstOrDefault()); - Assert.Equal(1, source.Take(0..40).FirstOrDefault()); - Assert.Equal(0, source.Take(0..0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(0..10).FirstOrDefault()); - - Assert.Equal(1, source.Take(^5..1).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..4).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..40).FirstOrDefault()); - Assert.Equal(0, source.Take(^5..0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(^10..10).FirstOrDefault()); - - Assert.Equal(1, source.Take(0..^4).FirstOrDefault()); - Assert.Equal(1, source.Take(0..^1).FirstOrDefault()); - Assert.Equal(1, source.Take(0..^0).FirstOrDefault()); - Assert.Equal(0, source.Take(0..^5).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(0..^10).FirstOrDefault()); - - Assert.Equal(1, source.Take(^5..^4).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..^1).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..^0).FirstOrDefault()); - Assert.Equal(0, source.Take(^5..^5).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(^10..^0).FirstOrDefault()); - } - - [Fact] - public void FirstOrDefaultNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Take(1).FirstOrDefault()); - Assert.Equal(1, source.Take(4).FirstOrDefault()); - Assert.Equal(1, source.Take(40).FirstOrDefault()); - Assert.Equal(0, source.Take(0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(10).FirstOrDefault()); - - Assert.Equal(1, source.Take(0..1).FirstOrDefault()); - Assert.Equal(1, source.Take(0..4).FirstOrDefault()); - Assert.Equal(1, source.Take(0..40).FirstOrDefault()); - Assert.Equal(0, source.Take(0..0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(0..10).FirstOrDefault()); - - Assert.Equal(1, source.Take(^5..1).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..4).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..40).FirstOrDefault()); - Assert.Equal(0, source.Take(^5..0).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(^10..10).FirstOrDefault()); - - Assert.Equal(1, source.Take(0..^4).FirstOrDefault()); - Assert.Equal(1, source.Take(0..^1).FirstOrDefault()); - Assert.Equal(1, source.Take(0..^0).FirstOrDefault()); - Assert.Equal(0, source.Take(0..^5).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(0..^10).FirstOrDefault()); - - Assert.Equal(1, source.Take(^5..^4).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..^1).FirstOrDefault()); - Assert.Equal(1, source.Take(^5..^0).FirstOrDefault()); - Assert.Equal(0, source.Take(^5..^5).FirstOrDefault()); - Assert.Equal(0, source.Skip(5).Take(^10..^0).FirstOrDefault()); + foreach (IEnumerable source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Take(1).FirstOrDefault()); + Assert.Equal(1, source.Take(4).FirstOrDefault()); + Assert.Equal(1, source.Take(40).FirstOrDefault()); + Assert.Equal(0, source.Take(0).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).Take(10).FirstOrDefault()); + + Assert.Equal(1, source.Take(0..1).FirstOrDefault()); + Assert.Equal(1, source.Take(0..4).FirstOrDefault()); + Assert.Equal(1, source.Take(0..40).FirstOrDefault()); + Assert.Equal(0, source.Take(0..0).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).Take(0..10).FirstOrDefault()); + + Assert.Equal(1, source.Take(^5..1).FirstOrDefault()); + Assert.Equal(1, source.Take(^5..4).FirstOrDefault()); + Assert.Equal(1, source.Take(^5..40).FirstOrDefault()); + Assert.Equal(0, source.Take(^5..0).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).Take(^10..10).FirstOrDefault()); + + Assert.Equal(1, source.Take(0..^4).FirstOrDefault()); + Assert.Equal(1, source.Take(0..^1).FirstOrDefault()); + Assert.Equal(1, source.Take(0..^0).FirstOrDefault()); + Assert.Equal(0, source.Take(0..^5).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).Take(0..^10).FirstOrDefault()); + + Assert.Equal(1, source.Take(^5..^4).FirstOrDefault()); + Assert.Equal(1, source.Take(^5..^1).FirstOrDefault()); + Assert.Equal(1, source.Take(^5..^0).FirstOrDefault()); + Assert.Equal(0, source.Take(^5..^5).FirstOrDefault()); + Assert.Equal(0, source.Skip(5).Take(^10..^0).FirstOrDefault()); + } } [Fact] public void Last() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Take(1).Last()); - Assert.Equal(5, source.Take(5).Last()); - Assert.Equal(5, source.Take(40).Last()); - Assert.Throws(() => source.Take(0).Last()); - Assert.Throws(() => Array.Empty().Take(40).Last()); - - Assert.Equal(1, source.Take(0..1).Last()); - Assert.Equal(5, source.Take(0..5).Last()); - Assert.Equal(5, source.Take(0..40).Last()); - Assert.Throws(() => source.Take(0..0).Last()); - Assert.Throws(() => Array.Empty().Take(0..40).Last()); - - Assert.Equal(1, source.Take(^5..1).Last()); - Assert.Equal(5, source.Take(^5..5).Last()); - Assert.Equal(5, source.Take(^5..40).Last()); - Assert.Throws(() => source.Take(^5..0).Last()); - Assert.Throws(() => Array.Empty().Take(^5..40).Last()); - - Assert.Equal(1, source.Take(0..^4).Last()); - Assert.Equal(5, source.Take(0..^0).Last()); - Assert.Equal(5, source.Take(3..^0).Last()); - Assert.Throws(() => source.Take(0..^5).Last()); - Assert.Throws(() => Array.Empty().Take(0..^0).Last()); - - Assert.Equal(1, source.Take(^5..^4).Last()); - Assert.Equal(5, source.Take(^5..^0).Last()); - Assert.Equal(5, source.Take(^5..^0).Last()); - Assert.Throws(() => source.Take(^5..^5).Last()); - Assert.Throws(() => Array.Empty().Take(^40..^0).Last()); - } - - [Fact] - public void LastNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Take(1).Last()); - Assert.Equal(5, source.Take(5).Last()); - Assert.Equal(5, source.Take(40).Last()); - Assert.Throws(() => source.Take(0).Last()); - Assert.Throws(() => ForceNotCollection(Array.Empty()).Take(40).Last()); - - Assert.Equal(1, source.Take(0..1).Last()); - Assert.Equal(5, source.Take(0..5).Last()); - Assert.Equal(5, source.Take(0..40).Last()); - Assert.Throws(() => source.Take(0..0).Last()); - Assert.Throws(() => ForceNotCollection(Array.Empty()).Take(0..40).Last()); - - Assert.Equal(1, source.Take(^5..1).Last()); - Assert.Equal(5, source.Take(^5..5).Last()); - Assert.Equal(5, source.Take(^5..40).Last()); - Assert.Throws(() => source.Take(^5..0).Last()); - Assert.Throws(() => ForceNotCollection(Array.Empty()).Take(^5..40).Last()); - - Assert.Equal(1, source.Take(0..^4).Last()); - Assert.Equal(5, source.Take(0..^0).Last()); - Assert.Equal(5, source.Take(3..^0).Last()); - Assert.Throws(() => source.Take(0..^5).Last()); - Assert.Throws(() => ForceNotCollection(Array.Empty()).Take(0..^0).Last()); - - Assert.Equal(1, source.Take(^5..^4).Last()); - Assert.Equal(5, source.Take(^5..^0).Last()); - Assert.Equal(5, source.Take(^5..^0).Last()); - Assert.Throws(() => source.Take(^5..^5).Last()); - Assert.Throws(() => ForceNotCollection(Array.Empty()).Take(^40..^0).Last()); + foreach (var source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Take(1).Last()); + Assert.Equal(2, source.Take(2).Last()); + Assert.Equal(3, source.Take(3).Last()); + Assert.Equal(4, source.Take(4).Last()); + Assert.Equal(5, source.Take(5).Last()); + Assert.Equal(5, source.Take(6).Last()); + Assert.Equal(5, source.Take(40).Last()); + Assert.Throws(() => source.Take(0).Last()); + Assert.Throws(() => Array.Empty().Take(40).Last()); + + Assert.Equal(1, source.Take(0..1).Last()); + Assert.Equal(5, source.Take(0..5).Last()); + Assert.Equal(5, source.Take(0..40).Last()); + Assert.Throws(() => source.Take(0..0).Last()); + Assert.Throws(() => Array.Empty().Take(0..40).Last()); + + Assert.Equal(1, source.Take(^5..1).Last()); + Assert.Equal(5, source.Take(^5..5).Last()); + Assert.Equal(5, source.Take(^5..40).Last()); + Assert.Throws(() => source.Take(^5..0).Last()); + Assert.Throws(() => Array.Empty().Take(^5..40).Last()); + + Assert.Equal(1, source.Take(0..^4).Last()); + Assert.Equal(5, source.Take(0..^0).Last()); + Assert.Equal(5, source.Take(3..^0).Last()); + Assert.Throws(() => source.Take(0..^5).Last()); + Assert.Throws(() => Array.Empty().Take(0..^0).Last()); + + Assert.Equal(1, source.Take(^5..^4).Last()); + Assert.Equal(5, source.Take(^5..^0).Last()); + Assert.Equal(5, source.Take(^5..^0).Last()); + Assert.Throws(() => source.Take(^5..^5).Last()); + Assert.Throws(() => Array.Empty().Take(^40..^0).Last()); + } } [Fact] public void LastOrDefault() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(1, source.Take(1).LastOrDefault()); - Assert.Equal(5, source.Take(5).LastOrDefault()); - Assert.Equal(5, source.Take(40).LastOrDefault()); - Assert.Equal(0, source.Take(0).LastOrDefault()); - Assert.Equal(0, Array.Empty().Take(40).LastOrDefault()); - - Assert.Equal(1, source.Take(0..1).LastOrDefault()); - Assert.Equal(5, source.Take(0..5).LastOrDefault()); - Assert.Equal(5, source.Take(0..40).LastOrDefault()); - Assert.Equal(0, source.Take(0..0).LastOrDefault()); - Assert.Equal(0, Array.Empty().Take(0..40).LastOrDefault()); - - Assert.Equal(1, source.Take(^5..1).LastOrDefault()); - Assert.Equal(5, source.Take(^5..5).LastOrDefault()); - Assert.Equal(5, source.Take(^5..40).LastOrDefault()); - Assert.Equal(0, source.Take(^5..0).LastOrDefault()); - Assert.Equal(0, Array.Empty().Take(^5..40).LastOrDefault()); - - Assert.Equal(1, source.Take(0..^4).LastOrDefault()); - Assert.Equal(5, source.Take(0..^0).LastOrDefault()); - Assert.Equal(5, source.Take(3..^0).LastOrDefault()); - Assert.Equal(0, source.Take(0..^5).LastOrDefault()); - Assert.Equal(0, Array.Empty().Take(0..^0).LastOrDefault()); - - Assert.Equal(1, source.Take(^5..^4).LastOrDefault()); - Assert.Equal(5, source.Take(^5..^0).LastOrDefault()); - Assert.Equal(5, source.Take(^40..^0).LastOrDefault()); - Assert.Equal(0, source.Take(^5..^5).LastOrDefault()); - Assert.Equal(0, Array.Empty().Take(^40..^0).LastOrDefault()); - } - - [Fact] - public void LastOrDefaultNotIList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(1, source.Take(1).LastOrDefault()); - Assert.Equal(5, source.Take(5).LastOrDefault()); - Assert.Equal(5, source.Take(40).LastOrDefault()); - Assert.Equal(0, source.Take(0).LastOrDefault()); - Assert.Equal(0, ForceNotCollection(Array.Empty()).Take(40).LastOrDefault()); - - Assert.Equal(1, source.Take(0..1).LastOrDefault()); - Assert.Equal(5, source.Take(0..5).LastOrDefault()); - Assert.Equal(5, source.Take(0..40).LastOrDefault()); - Assert.Equal(0, source.Take(0..0).LastOrDefault()); - Assert.Equal(0, ForceNotCollection(Array.Empty()).Take(0..40).LastOrDefault()); - - Assert.Equal(1, source.Take(^5..1).LastOrDefault()); - Assert.Equal(5, source.Take(^5..5).LastOrDefault()); - Assert.Equal(5, source.Take(^5..40).LastOrDefault()); - Assert.Equal(0, source.Take(^5..0).LastOrDefault()); - Assert.Equal(0, ForceNotCollection(Array.Empty()).Take(^5..40).LastOrDefault()); - - Assert.Equal(1, source.Take(0..^4).LastOrDefault()); - Assert.Equal(5, source.Take(0..^0).LastOrDefault()); - Assert.Equal(5, source.Take(3..^0).LastOrDefault()); - Assert.Equal(0, source.Take(0..^5).LastOrDefault()); - Assert.Equal(0, ForceNotCollection(Array.Empty()).Take(0..^0).LastOrDefault()); - - Assert.Equal(1, source.Take(^5..^4).LastOrDefault()); - Assert.Equal(5, source.Take(^5..^0).LastOrDefault()); - Assert.Equal(5, source.Take(^40..^0).LastOrDefault()); - Assert.Equal(0, source.Take(^5..^5).LastOrDefault()); - Assert.Equal(0, ForceNotCollection(Array.Empty()).Take(^40..^0).LastOrDefault()); + foreach (var source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(1, source.Take(1).LastOrDefault()); + Assert.Equal(2, source.Take(2).LastOrDefault()); + Assert.Equal(3, source.Take(3).LastOrDefault()); + Assert.Equal(4, source.Take(4).LastOrDefault()); + Assert.Equal(5, source.Take(5).LastOrDefault()); + Assert.Equal(5, source.Take(6).LastOrDefault()); + Assert.Equal(5, source.Take(40).LastOrDefault()); + Assert.Equal(0, source.Take(0).LastOrDefault()); + Assert.Equal(0, Array.Empty().Take(40).LastOrDefault()); + + Assert.Equal(1, source.Take(0..1).LastOrDefault()); + Assert.Equal(5, source.Take(0..5).LastOrDefault()); + Assert.Equal(5, source.Take(0..40).LastOrDefault()); + Assert.Equal(0, source.Take(0..0).LastOrDefault()); + Assert.Equal(0, Array.Empty().Take(0..40).LastOrDefault()); + + Assert.Equal(1, source.Take(^5..1).LastOrDefault()); + Assert.Equal(5, source.Take(^5..5).LastOrDefault()); + Assert.Equal(5, source.Take(^5..40).LastOrDefault()); + Assert.Equal(0, source.Take(^5..0).LastOrDefault()); + Assert.Equal(0, Array.Empty().Take(^5..40).LastOrDefault()); + + Assert.Equal(1, source.Take(0..^4).LastOrDefault()); + Assert.Equal(5, source.Take(0..^0).LastOrDefault()); + Assert.Equal(5, source.Take(3..^0).LastOrDefault()); + Assert.Equal(0, source.Take(0..^5).LastOrDefault()); + Assert.Equal(0, Array.Empty().Take(0..^0).LastOrDefault()); + + Assert.Equal(1, source.Take(^5..^4).LastOrDefault()); + Assert.Equal(5, source.Take(^5..^0).LastOrDefault()); + Assert.Equal(5, source.Take(^40..^0).LastOrDefault()); + Assert.Equal(0, source.Take(^5..^5).LastOrDefault()); + Assert.Equal(0, Array.Empty().Take(^40..^0).LastOrDefault()); + } } [Fact] public void ToArray() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToArray()); - Assert.Equal(1, source.Take(1).ToArray().Single()); - Assert.Empty(source.Take(0).ToArray()); - Assert.Empty(source.Take(-10).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToArray()); - Assert.Equal(1, source.Take(0..1).ToArray().Single()); - Assert.Empty(source.Take(0..0).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToArray()); - Assert.Equal(1, source.Take(^5..1).ToArray().Single()); - Assert.Empty(source.Take(^5..0).ToArray()); - Assert.Empty(source.Take(^15..0).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToArray()); - Assert.Equal(1, source.Take(0..^4).ToArray().Single()); - Assert.Empty(source.Take(0..^5).ToArray()); - Assert.Empty(source.Take(0..^15).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToArray()); - Assert.Equal(1, source.Take(^5..^4).ToArray().Single()); - Assert.Empty(source.Take(^5..^5).ToArray()); - Assert.Empty(source.Take(^15..^5).ToArray()); - } - - [Fact] - public void ToArrayNotList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToArray()); - Assert.Equal(1, source.Take(1).ToArray().Single()); - Assert.Empty(source.Take(0).ToArray()); - Assert.Empty(source.Take(-10).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToArray()); - Assert.Equal(1, source.Take(0..1).ToArray().Single()); - Assert.Empty(source.Take(0..0).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToArray()); - Assert.Equal(1, source.Take(^5..1).ToArray().Single()); - Assert.Empty(source.Take(^5..0).ToArray()); - Assert.Empty(source.Take(^15..0).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToArray()); - Assert.Equal(1, source.Take(0..^4).ToArray().Single()); - Assert.Empty(source.Take(0..^5).ToArray()); - Assert.Empty(source.Take(0..^15).ToArray()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToArray()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToArray()); - Assert.Equal(1, source.Take(^5..^4).ToArray().Single()); - Assert.Empty(source.Take(^5..^5).ToArray()); - Assert.Empty(source.Take(^15..^5).ToArray()); + foreach (var source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToArray()); + Assert.Equal(1, source.Take(1).ToArray().Single()); + Assert.Empty(source.Take(0).ToArray()); + Assert.Empty(source.Take(-10).ToArray()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToArray()); + Assert.Equal(1, source.Take(0..1).ToArray().Single()); + Assert.Empty(source.Take(0..0).ToArray()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToArray()); + Assert.Equal(1, source.Take(^5..1).ToArray().Single()); + Assert.Empty(source.Take(^5..0).ToArray()); + Assert.Empty(source.Take(^15..0).ToArray()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToArray()); + Assert.Equal(1, source.Take(0..^4).ToArray().Single()); + Assert.Empty(source.Take(0..^5).ToArray()); + Assert.Empty(source.Take(0..^15).ToArray()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToArray()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToArray()); + Assert.Equal(1, source.Take(^5..^4).ToArray().Single()); + Assert.Empty(source.Take(^5..^5).ToArray()); + Assert.Empty(source.Take(^15..^5).ToArray()); + } } [Fact] public void ToList() { - var source = new[] { 1, 2, 3, 4, 5 }; - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToList()); - Assert.Equal(1, source.Take(1).ToList().Single()); - Assert.Empty(source.Take(0).ToList()); - Assert.Empty(source.Take(-10).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToList()); - Assert.Equal(1, source.Take(0..1).ToList().Single()); - Assert.Empty(source.Take(0..0).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToList()); - Assert.Equal(1, source.Take(^5..1).ToList().Single()); - Assert.Empty(source.Take(^5..0).ToList()); - Assert.Empty(source.Take(^15..0).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToList()); - Assert.Equal(1, source.Take(0..^4).ToList().Single()); - Assert.Empty(source.Take(0..^5).ToList()); - Assert.Empty(source.Take(0..^15).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToList()); - Assert.Equal(1, source.Take(^5..^4).ToList().Single()); - Assert.Empty(source.Take(^5..^5).ToList()); - Assert.Empty(source.Take(^15..^5).ToList()); - } - - [Fact] - public void ToListNotList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToList()); - Assert.Equal(1, source.Take(1).ToList().Single()); - Assert.Empty(source.Take(0).ToList()); - Assert.Empty(source.Take(-10).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToList()); - Assert.Equal(1, source.Take(0..1).ToList().Single()); - Assert.Empty(source.Take(0..0).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToList()); - Assert.Equal(1, source.Take(^5..1).ToList().Single()); - Assert.Empty(source.Take(^5..0).ToList()); - Assert.Empty(source.Take(^15..0).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToList()); - Assert.Equal(1, source.Take(0..^4).ToList().Single()); - Assert.Empty(source.Take(0..^5).ToList()); - Assert.Empty(source.Take(0..^15).ToList()); - - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToList()); - Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToList()); - Assert.Equal(1, source.Take(^5..^4).ToList().Single()); - Assert.Empty(source.Take(^5..^5).ToList()); - Assert.Empty(source.Take(^15..^5).ToList()); + foreach (var source in CreateSources([1, 2, 3, 4, 5])) + { + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(5).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(6).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(40).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(4).ToList()); + Assert.Equal(1, source.Take(1).ToList().Single()); + Assert.Empty(source.Take(0).ToList()); + Assert.Empty(source.Take(-10).ToList()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..5).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..6).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..40).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..4).ToList()); + Assert.Equal(1, source.Take(0..1).ToList().Single()); + Assert.Empty(source.Take(0..0).ToList()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..5).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..6).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..40).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..4).ToList()); + Assert.Equal(1, source.Take(^5..1).ToList().Single()); + Assert.Empty(source.Take(^5..0).ToList()); + Assert.Empty(source.Take(^15..0).ToList()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(0..^0).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(0..^1).ToList()); + Assert.Equal(1, source.Take(0..^4).ToList().Single()); + Assert.Empty(source.Take(0..^5).ToList()); + Assert.Empty(source.Take(0..^15).ToList()); + + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^5..^0).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^6..^0).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4, 5 }, source.Take(^45..^0).ToList()); + Assert.Equal(new[] { 1, 2, 3, 4 }, source.Take(^5..^1).ToList()); + Assert.Equal(1, source.Take(^5..^4).ToList().Single()); + Assert.Empty(source.Take(^5..^5).ToList()); + Assert.Empty(source.Take(^15..^5).ToList()); + } } [Fact] public void TakeCanOnlyBeOneList() { - var source = new[] { 2, 4, 6, 8, 10 }; - Assert.Equal(new[] { 2 }, source.Take(1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(1)); - Assert.Equal(new[] { 6 }, source.Take(3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(3).Take(1)); - - Assert.Equal(new[] { 2 }, source.Take(0..1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(0..1)); - Assert.Equal(new[] { 6 }, source.Take(0..3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(0..3).Take(0..1)); - - Assert.Equal(new[] { 2 }, source.Take(^5..1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(^4..1)); - Assert.Equal(new[] { 6 }, source.Take(^5..3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(^5..3).Take(^4..1)); - - Assert.Equal(new[] { 2 }, source.Take(0..^4)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(0..^3)); - Assert.Equal(new[] { 6 }, source.Take(0..^2).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(0..^2).Take(0..^2)); - - Assert.Equal(new[] { 2 }, source.Take(^5..^4)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(^4..^3)); - Assert.Equal(new[] { 6 }, source.Take(^5..^2).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(^5..^2).Take(^4..^2)); - } - - [Fact] - public void TakeCanOnlyBeOneNotList() - { - var source = ForceNotCollection(new[] { 2, 4, 6, 8, 10 }); - Assert.Equal(new[] { 2 }, source.Take(1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(1)); - Assert.Equal(new[] { 6 }, source.Take(3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(3).Take(1)); - - Assert.Equal(new[] { 2 }, source.Take(0..1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(0..1)); - Assert.Equal(new[] { 6 }, source.Take(0..3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(0..3).Take(0..1)); - - Assert.Equal(new[] { 2 }, source.Take(^5..1)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(^4..1)); - Assert.Equal(new[] { 6 }, source.Take(^5..3).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(^5..3).Take(^4..1)); - - Assert.Equal(new[] { 2 }, source.Take(0..^4)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(0..^3)); - Assert.Equal(new[] { 6 }, source.Take(0..^2).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(0..^2).Take(0..^2)); - - Assert.Equal(new[] { 2 }, source.Take(^5..^4)); - Assert.Equal(new[] { 4 }, source.Skip(1).Take(^4..^3)); - Assert.Equal(new[] { 6 }, source.Take(^5..^2).Skip(2)); - Assert.Equal(new[] { 2 }, source.Take(^5..^2).Take(^4..^2)); + foreach (var source in CreateSources([2, 4, 6, 8, 10])) + { + Assert.Equal([2], source.Take(1)); + Assert.Equal([4], source.Skip(1).Take(1)); + Assert.Equal([6], source.Take(3).Skip(2)); + Assert.Equal([2], source.Take(3).Take(1)); + + Assert.Equal([2], source.Take(0..1)); + Assert.Equal([4], source.Skip(1).Take(0..1)); + Assert.Equal([6], source.Take(0..3).Skip(2)); + Assert.Equal([2], source.Take(0..3).Take(0..1)); + + Assert.Equal([2], source.Take(^5..1)); + Assert.Equal([4], source.Skip(1).Take(^4..1)); + Assert.Equal([6], source.Take(^5..3).Skip(2)); + Assert.Equal([2], source.Take(^5..3).Take(^4..1)); + + Assert.Equal([2], source.Take(0..^4)); + Assert.Equal([4], source.Skip(1).Take(0..^3)); + Assert.Equal([6], source.Take(0..^2).Skip(2)); + Assert.Equal([2], source.Take(0..^2).Take(0..^2)); + + Assert.Equal([2], source.Take(^5..^4)); + Assert.Equal([4], source.Skip(1).Take(^4..^3)); + Assert.Equal([6], source.Take(^5..^2).Skip(2)); + Assert.Equal([2], source.Take(^5..^2).Take(^4..^2)); + } } [Fact] public void RepeatEnumerating() { - var source = new[] { 1, 2, 3, 4, 5 }; - var taken1 = source.Take(3); - Assert.Equal(taken1, taken1); - - var taken2 = source.Take(0..3); - Assert.Equal(taken2, taken2); - - var taken3 = source.Take(^5..3); - Assert.Equal(taken3, taken3); - - var taken4 = source.Take(0..^2); - Assert.Equal(taken4, taken4); - - var taken5 = source.Take(^5..^2); - Assert.Equal(taken5, taken5); - } - - [Fact] - public void RepeatEnumeratingNotList() - { - var source = ForceNotCollection(new[] { 1, 2, 3, 4, 5 }); - var taken1 = source.Take(3); - Assert.Equal(taken1, taken1); + foreach (var source in CreateSources([1, 2, 3, 4, 5])) + { + var taken1 = source.Take(3); + Assert.Equal(taken1, taken1); - var taken2 = source.Take(0..3); - Assert.Equal(taken2, taken2); + var taken2 = source.Take(0..3); + Assert.Equal(taken2, taken2); - var taken3 = source.Take(^5..3); - Assert.Equal(taken3, taken3); + var taken3 = source.Take(^5..3); + Assert.Equal(taken3, taken3); - var taken4 = source.Take(0..^2); - Assert.Equal(taken4, taken4); + var taken4 = source.Take(0..^2); + Assert.Equal(taken4, taken4); - var taken5 = source.Take(^5..^2); - Assert.Equal(taken5, taken5); + var taken5 = source.Take(^5..^2); + Assert.Equal(taken5, taken5); + } } [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSpeedOptimized))] diff --git a/src/libraries/System.Linq/tests/WhereTests.cs b/src/libraries/System.Linq/tests/WhereTests.cs index 0cf0ff50cd38a2..a80e8076629ce2 100644 --- a/src/libraries/System.Linq/tests/WhereTests.cs +++ b/src/libraries/System.Linq/tests/WhereTests.cs @@ -1097,44 +1097,40 @@ public void ToCollection(IEnumerable source) [Fact] public void WhereFirstLast() { - Assert.All(IdentityTransforms(), transform => + Assert.All(CreateSources(Enumerable.Range(0, 10)), source => { - IEnumerable data = transform(Enumerable.Range(0, 10)); + Assert.Equal(3, source.Where(i => i == 3).First()); + Assert.Equal(0, source.Where(i => i % 2 == 0).First()); - Assert.Equal(3, data.Where(i => i == 3).First()); - Assert.Equal(0, data.Where(i => i % 2 == 0).First()); + Assert.Equal(3, source.Where(i => i == 3).Last()); + Assert.Equal(8, source.Where(i => i % 2 == 0).Last()); - Assert.Equal(3, data.Where(i => i == 3).Last()); - Assert.Equal(8, data.Where(i => i % 2 == 0).Last()); + Assert.Equal(3, source.Where(i => i == 3).ElementAt(0)); + Assert.Equal(8, source.Where(i => i % 2 == 0).ElementAt(4)); - Assert.Equal(3, data.Where(i => i == 3).ElementAt(0)); - Assert.Equal(8, data.Where(i => i % 2 == 0).ElementAt(4)); - - Assert.Throws(() => data.Where(i => i == 10).First()); - Assert.Throws(() => data.Where(i => i == 10).Last()); - Assert.Throws(() => data.Where(i => i == 10).ElementAt(0)); + Assert.Throws(() => source.Where(i => i == 10).First()); + Assert.Throws(() => source.Where(i => i == 10).Last()); + Assert.Throws(() => source.Where(i => i == 10).ElementAt(0)); }); } [Fact] public void WhereSelectFirstLast() { - Assert.All(IdentityTransforms(), transform => + Assert.All(CreateSources(Enumerable.Range(0, 10)), source => { - IEnumerable data = transform(Enumerable.Range(0, 10)); - - Assert.Equal(6, data.Where(i => i == 3).Select(i => i * 2).First()); - Assert.Equal(0, data.Where(i => i % 2 == 0).Select(i => i * 2).First()); + Assert.Equal(6, source.Where(i => i == 3).Select(i => i * 2).First()); + Assert.Equal(0, source.Where(i => i % 2 == 0).Select(i => i * 2).First()); - Assert.Equal(6, data.Where(i => i == 3).Select(i => i * 2).Last()); - Assert.Equal(16, data.Where(i => i % 2 == 0).Select(i => i * 2).Last()); + Assert.Equal(6, source.Where(i => i == 3).Select(i => i * 2).Last()); + Assert.Equal(16, source.Where(i => i % 2 == 0).Select(i => i * 2).Last()); - Assert.Equal(6, data.Where(i => i == 3).Select(i => i * 2).ElementAt(0)); - Assert.Equal(16, data.Where(i => i % 2 == 0).Select(i => i * 2).ElementAt(4)); + Assert.Equal(6, source.Where(i => i == 3).Select(i => i * 2).ElementAt(0)); + Assert.Equal(16, source.Where(i => i % 2 == 0).Select(i => i * 2).ElementAt(4)); - Assert.Throws(() => data.Where(i => i == 10).Select(i => i * 2).First()); - Assert.Throws(() => data.Where(i => i == 10).Select(i => i * 2).Last()); - Assert.Throws(() => data.Where(i => i == 10).Select(i => i * 2).ElementAt(0)); + Assert.Throws(() => source.Where(i => i == 10).Select(i => i * 2).First()); + Assert.Throws(() => source.Where(i => i == 10).Select(i => i * 2).Last()); + Assert.Throws(() => source.Where(i => i == 10).Select(i => i * 2).ElementAt(0)); }); } @@ -1142,7 +1138,7 @@ public static IEnumerable ToCollectionData() { IEnumerable seq = GenerateRandomSequnce(seed: 0xdeadbeef, count: 10); - foreach (IEnumerable seq2 in IdentityTransforms().Select(t => t(seq))) + foreach (IEnumerable seq2 in CreateSources(seq)) { yield return new object[] { seq2 }; } 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 9e4f19ec066f65..4af49d748e9b28 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 @@ -80,6 +80,7 @@ System.Net.Http.WinHttpHandler Link="Common\System\Runtime\ExceptionServices\ExceptionStackTrace.cs" /> + @@ -117,6 +118,7 @@ System.Net.Http.WinHttpHandler + diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/CachedCertificateValue.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/CachedCertificateValue.cs new file mode 100644 index 00000000000000..58ca950a8855a1 --- /dev/null +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/CachedCertificateValue.cs @@ -0,0 +1,45 @@ +// 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.Collections.Generic; +using System.Diagnostics; +using System.Text; +using System.Threading; + +namespace System.Net.Http +{ + internal sealed class CachedCertificateValue(byte[] rawCertificateData, long lastUsedTime) + { + private long _lastUsedTime = lastUsedTime; + public byte[] RawCertificateData { get; } = rawCertificateData; + public long LastUsedTime + { + get => Volatile.Read(ref _lastUsedTime); + set => Volatile.Write(ref _lastUsedTime, value); + } + } + + internal readonly struct CachedCertificateKey : IEquatable + { + public CachedCertificateKey(IPAddress address, HttpRequestMessage message) + { + Debug.Assert(message.RequestUri != null); + Address = address; + Host = message.Headers.Host ?? message.RequestUri.Host; + } + public IPAddress Address { get; } + public string Host { get; } + + public bool Equals(CachedCertificateKey other) => + Address.Equals(other.Address) && + Host == other.Host; + + public override bool Equals(object? obj) + { + throw new Exception("Unreachable"); + } + + public override int GetHashCode() => HashCode.Combine(Address, Host); + } +} diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs index 86c893169270b2..aa797ecf4ca5ea 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs @@ -1,8 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net.Http.Headers; using System.Net.Security; @@ -41,11 +43,14 @@ public class WinHttpHandler : HttpMessageHandler internal static readonly Version HttpVersion20 = new Version(2, 0); internal static readonly Version HttpVersion30 = new Version(3, 0); internal static readonly Version HttpVersionUnknown = new Version(0, 0); + internal static bool CertificateCachingAppContextSwitchEnabled { get; } = AppContext.TryGetSwitch("System.Net.Http.UseWinHttpCertificateCaching", out bool enabled) && enabled; private static readonly TimeSpan s_maxTimeout = TimeSpan.FromMilliseconds(int.MaxValue); private static readonly StringWithQualityHeaderValue s_gzipHeaderValue = new StringWithQualityHeaderValue("gzip"); private static readonly StringWithQualityHeaderValue s_deflateHeaderValue = new StringWithQualityHeaderValue("deflate"); private static readonly Lazy s_supportsTls13 = new Lazy(CheckTls13Support); + private static readonly TimeSpan s_cleanCachedCertificateTimeout = TimeSpan.FromMilliseconds((int?)AppDomain.CurrentDomain.GetData("System.Net.Http.WinHttpCertificateCachingCleanupTimerInterval") ?? 60_000); + private static readonly long s_staleTimeout = (long)(s_cleanCachedCertificateTimeout.TotalSeconds * Stopwatch.Frequency); [ThreadStatic] private static StringBuilder? t_requestHeadersBuilder; @@ -93,9 +98,44 @@ private Func< private volatile bool _disposed; private SafeWinHttpHandle? _sessionHandle; private readonly WinHttpAuthHelper _authHelper = new WinHttpAuthHelper(); + private readonly Timer? _certificateCleanupTimer; + private bool _isTimerRunning; + private readonly ConcurrentDictionary _cachedCertificates = new(); public WinHttpHandler() { + if (CertificateCachingAppContextSwitchEnabled) + { + WeakReference thisRef = new(this); + bool restoreFlow = false; + try + { + if (!ExecutionContext.IsFlowSuppressed()) + { + ExecutionContext.SuppressFlow(); + restoreFlow = true; + } + + _certificateCleanupTimer = new Timer( + static s => + { + if (((WeakReference)s!).TryGetTarget(out WinHttpHandler? thisRef)) + { + thisRef.ClearStaleCertificates(); + } + }, + thisRef, + Timeout.Infinite, + Timeout.Infinite); + } + finally + { + if (restoreFlow) + { + ExecutionContext.RestoreFlow(); + } + } + } } #region Properties @@ -543,9 +583,12 @@ protected override void Dispose(bool disposing) { _disposed = true; - if (disposing && _sessionHandle != null) + if (disposing) { - SafeWinHttpHandle.DisposeAndClearHandle(ref _sessionHandle); + if (_sessionHandle is not null) { + SafeWinHttpHandle.DisposeAndClearHandle(ref _sessionHandle); + } + _certificateCleanupTimer?.Dispose(); } } @@ -1644,7 +1687,8 @@ private void SetStatusCallback( Interop.WinHttp.WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS | Interop.WinHttp.WINHTTP_CALLBACK_FLAG_HANDLES | Interop.WinHttp.WINHTTP_CALLBACK_FLAG_REDIRECT | - Interop.WinHttp.WINHTTP_CALLBACK_FLAG_SEND_REQUEST; + Interop.WinHttp.WINHTTP_CALLBACK_FLAG_SEND_REQUEST | + Interop.WinHttp.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER; IntPtr oldCallback = Interop.WinHttp.WinHttpSetStatusCallback( requestHandle, @@ -1730,5 +1774,90 @@ private RendezvousAwaitable InternalReceiveResponseHeadersAsync(WinHttpRequ return state.LifecycleAwaitable; } + + internal bool GetCertificateFromCache(CachedCertificateKey key, [NotNullWhen(true)] out byte[]? rawCertificateBytes) + { + if (_cachedCertificates.TryGetValue(key, out CachedCertificateValue? cachedValue)) + { + cachedValue.LastUsedTime = Stopwatch.GetTimestamp(); + rawCertificateBytes = cachedValue.RawCertificateData; + return true; + } + + rawCertificateBytes = null; + return false; + } + + internal void AddCertificateToCache(CachedCertificateKey key, byte[] rawCertificateData) + { + if (_cachedCertificates.TryAdd(key, new CachedCertificateValue(rawCertificateData, Stopwatch.GetTimestamp()))) + { + EnsureCleanupTimerRunning(); + } + } + + internal bool TryRemoveCertificateFromCache(CachedCertificateKey key) + { + bool result = _cachedCertificates.TryRemove(key, out _); + if (result) + { + StopCleanupTimerIfEmpty(); + } + return result; + } + + private void ChangeCleanerTimer(TimeSpan timeout) + { + Debug.Assert(Monitor.IsEntered(_lockObject)); + Debug.Assert(_certificateCleanupTimer != null); + if (_certificateCleanupTimer!.Change(timeout, Timeout.InfiniteTimeSpan)) + { + _isTimerRunning = timeout != Timeout.InfiniteTimeSpan; + } + } + + private void ClearStaleCertificates() + { + foreach (KeyValuePair kvPair in _cachedCertificates) + { + if (IsStale(kvPair.Value.LastUsedTime)) + { + _cachedCertificates.TryRemove(kvPair.Key, out _); + } + } + + lock (_lockObject) + { + ChangeCleanerTimer(_cachedCertificates.IsEmpty ? Timeout.InfiniteTimeSpan : s_cleanCachedCertificateTimeout); + } + + static bool IsStale(long lastUsedTime) + { + long now = Stopwatch.GetTimestamp(); + return (now - lastUsedTime) > s_staleTimeout; + } + } + + private void EnsureCleanupTimerRunning() + { + lock (_lockObject) + { + if (!_cachedCertificates.IsEmpty && !_isTimerRunning) + { + ChangeCleanerTimer(s_cleanCachedCertificateTimeout); + } + } + } + + private void StopCleanupTimerIfEmpty() + { + lock (_lockObject) + { + if (_cachedCertificates.IsEmpty && _isTimerRunning) + { + ChangeCleanerTimer(Timeout.InfiniteTimeSpan); + } + } + } } } 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 c30694a20460b1..6c50ee16817cf7 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 @@ -2,12 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Buffers.Binary; using System.Diagnostics; using System.IO; +using System.Linq; using System.Net.Security; +using System.Net.Sockets; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; - +using System.Threading; using SafeWinHttpHandle = Interop.WinHttp.SafeWinHttpHandle; namespace System.Net.Http @@ -56,6 +60,14 @@ private static void RequestCallback( { switch (internetStatus) { + case Interop.WinHttp.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER: + if (WinHttpHandler.CertificateCachingAppContextSwitchEnabled) + { + IPAddress connectedToIPAddress = IPAddress.Parse(Marshal.PtrToStringUni(statusInformation)!); + OnRequestConnectedToServer(state, connectedToIPAddress); + } + return; + case Interop.WinHttp.WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING: OnRequestHandleClosing(state); return; @@ -121,6 +133,22 @@ private static void RequestCallback( } } + private static void OnRequestConnectedToServer(WinHttpRequestState state, IPAddress connectedIPAddress) + { + Debug.Assert(state != null); + Debug.Assert(state.Handler != null); + Debug.Assert(state.RequestMessage != null); + + if (state.Handler.TryRemoveCertificateFromCache(new CachedCertificateKey(connectedIPAddress, state.RequestMessage))) + { + if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(state, $"Removed cached certificate for {connectedIPAddress}"); + } + else + { + if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(state, $"No cached certificate for {connectedIPAddress} to remove"); + } + } + private static void OnRequestHandleClosing(WinHttpRequestState state) { Debug.Assert(state != null, "OnRequestSendRequestComplete: state is null"); @@ -231,6 +259,7 @@ 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.Handler != null, "OnRequestSendingRequest: state.Handler is null"); Debug.Assert(state.RequestMessage != null, "OnRequestSendingRequest: state.RequestMessage is null"); Debug.Assert(state.RequestMessage.RequestUri != null, "OnRequestSendingRequest: state.RequestMessage.RequestUri is null"); @@ -279,6 +308,62 @@ private static void OnRequestSendingRequest(WinHttpRequestState state) var serverCertificate = new X509Certificate2(certHandle); Interop.Crypt32.CertFreeCertificateContext(certHandle); + IPAddress? ipAddress = null; + if (WinHttpHandler.CertificateCachingAppContextSwitchEnabled) + { + unsafe + { + Interop.WinHttp.WINHTTP_CONNECTION_INFO connectionInfo; + Interop.WinHttp.WINHTTP_CONNECTION_INFO* pConnectionInfo = &connectionInfo; + uint infoSize = (uint)sizeof(Interop.WinHttp.WINHTTP_CONNECTION_INFO); + if (Interop.WinHttp.WinHttpQueryOption( + state.RequestHandle, + // This option is available on Windows XP SP2 and later; Windows 2003 with SP1 and later. + Interop.WinHttp.WINHTTP_OPTION_CONNECTION_INFO, + (IntPtr)pConnectionInfo, + ref infoSize)) + { + // RemoteAddress is SOCKADDR_STORAGE structure, which is 128 bytes. + // See: https://learn.microsoft.com/en-us/windows/win32/api/winhttp/ns-winhttp-winhttp_connection_info + // SOCKADDR_STORAGE can hold either IPv4 or IPv6 address. + // For offset numbers: https://learn.microsoft.com/en-us/windows/win32/winsock/sockaddr-2 + ReadOnlySpan remoteAddressSpan = new ReadOnlySpan(connectionInfo.RemoteAddress, 128); + AddressFamily addressFamily = (AddressFamily)(remoteAddressSpan[0] + (remoteAddressSpan[1] << 8)); + ipAddress = addressFamily switch + { + AddressFamily.InterNetwork => new IPAddress(BinaryPrimitives.ReadUInt32LittleEndian(remoteAddressSpan.Slice(4))), + AddressFamily.InterNetworkV6 => new IPAddress(remoteAddressSpan.Slice(8, 16).ToArray()), + _ => null + }; + Debug.Assert(ipAddress != null, "AddressFamily is not supported"); + if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(state, $"ipAddress: {ipAddress}"); + + } + else + { + int lastError = Marshal.GetLastWin32Error(); + if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(state, $"Error getting WINHTTP_OPTION_CONNECTION_INFO, {lastError}"); + } + } + + if (ipAddress is not null && + state.Handler.GetCertificateFromCache(new CachedCertificateKey(ipAddress, state.RequestMessage), out byte[]? rawCertData) && +#if NETFRAMEWORK + rawCertData.AsSpan().SequenceEqual(serverCertificate.RawData)) +#else + rawCertData.AsSpan().SequenceEqual(serverCertificate.RawDataMemory.Span)) +#endif + { + if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(state, $"Skipping certificate validation. ipAddress: {ipAddress}, Thumbprint: {serverCertificate.Thumbprint}"); + serverCertificate.Dispose(); + return; + } + else + { + if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(state, $"Certificate validation is required! IPAddress = {ipAddress}, Thumbprint: {serverCertificate.Thumbprint}"); + } + } + X509Chain? chain = null; SslPolicyErrors sslPolicyErrors; bool result = false; @@ -298,6 +383,10 @@ private static void OnRequestSendingRequest(WinHttpRequestState state) serverCertificate, chain, sslPolicyErrors); + if (WinHttpHandler.CertificateCachingAppContextSwitchEnabled && result && ipAddress is not null) + { + state.Handler.AddCertificateToCache(new CachedCertificateKey(ipAddress, state.RequestMessage), serverCertificate.RawData); + } } catch (Exception ex) { 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 0abe14c11887bf..08d3d560c7b4d4 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; - +using Microsoft.DotNet.RemoteExecutor; using Xunit; using Xunit.Abstractions; @@ -27,6 +27,8 @@ public class WinHttpHandlerTest private readonly ITestOutputHelper _output; + public static IEnumerable HttpVersions = [[HttpVersion.Version11, Configuration.Http.SecureRemoteEchoServer], [HttpVersion20.Value, Configuration.Http.Http2RemoteEchoServer]]; + public WinHttpHandlerTest(ITestOutputHelper output) { _output = output; @@ -46,6 +48,75 @@ public void SendAsync_SimpleGet_Success() } } + [OuterLoop] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(nameof(HttpVersions))] + public async Task SendAsync_ServerCertificateValidationCallback_CalledOnce(Version version, Uri uri) + { + await RemoteExecutor.Invoke(async (version, uri) => + { + AppContext.SetSwitch("System.Net.Http.UseWinHttpCertificateCaching", true); + int callbackCount = 0; + var handler = new WinHttpHandler() + { + ServerCertificateValidationCallback = (_, _, _, _) => + { + Interlocked.Increment(ref callbackCount); + return true; + } + }; + using (var client = new HttpClient(handler)) + { + for (int i = 0; i < 5; i++) + { + var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri) + { + Version = Version.Parse(version) + }); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + _ = await response.Content.ReadAsStringAsync(); + } + Assert.Equal(1, callbackCount); + } + }, version.ToString(), uri.ToString()).DisposeAsync(); + } + + [OuterLoop] + [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] + [MemberData(nameof(HttpVersions))] + public async Task SendAsync_ServerCertificateValidationCallbackCertificateTimerTriggered_CalledTwice(Version version, Uri uri) + { + await RemoteExecutor.Invoke(async (version, uri) => + { + const int certificateCacheCleanupInterval = 10; + AppContext.SetSwitch("System.Net.Http.UseWinHttpCertificateCaching", true); + AppDomain.CurrentDomain.SetData("System.Net.Http.WinHttpCertificateCachingCleanupTimerInterval", certificateCacheCleanupInterval); + int callbackCount = 0; + var handler = new WinHttpHandler() + { + ServerCertificateValidationCallback = (_, _, _, _) => + { + Interlocked.Increment(ref callbackCount); + return true; + } + }; + using (var client = new HttpClient(handler)) + { + for (int i = 0; i < 5; i++) + { + var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri) + { + Version = Version.Parse(version) + }); + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + _ = await response.Content.ReadAsStringAsync(); + await Task.Delay(TimeSpan.FromMilliseconds(certificateCacheCleanupInterval * 3)); + } + Assert.True(callbackCount > 1); + } + }, version.ToString(), uri.ToString()).DisposeAsync(); + } + [OuterLoop] [Theory] [InlineData(CookieUsePolicy.UseInternalCookieStoreOnly, "cookieName1", "cookieValue1")] diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj index f8b72896871da4..68ca61edeb5817 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj @@ -56,6 +56,8 @@ Link="Common\System\Text\SimpleRegex.cs" /> + instance. /// /// > [!IMPORTANT] - /// > The intance must not be used from outside of the enrichment callbacks. + /// > The instance must not be used from outside of the enrichment callbacks. /// public sealed class HttpMetricsEnrichmentContext { - private static readonly HttpRequestOptionsKey s_optionsKeyForContext = new(nameof(HttpMetricsEnrichmentContext)); - private static readonly ConcurrentQueue s_pool = new(); - private static int s_poolItemCount; - private const int PoolCapacity = 1024; + private static readonly HttpRequestOptionsKey>> s_optionsKeyForCallbacks = new(nameof(HttpMetricsEnrichmentContext)); - private readonly List> _callbacks = new(); private HttpRequestMessage? _request; private HttpResponseMessage? _response; private Exception? _exception; - private List> _tags = new(capacity: 16); + private TagList _tags; - internal HttpMetricsEnrichmentContext() { } // Hide the default parameterless constructor. + private HttpMetricsEnrichmentContext() { } // Hide the default parameterless constructor. /// /// Gets the that has been sent. @@ -68,7 +61,7 @@ public sealed class HttpMetricsEnrichmentContext /// /// This method must not be used from outside of the enrichment callbacks. /// - public void AddCustomTag(string name, object? value) => _tags.Add(new KeyValuePair(name, value)); + public void AddCustomTag(string name, object? value) => _tags.Add(name, value); /// /// Adds a callback to register custom tags for request metrics `http-client-request-duration` and `http-client-failed-requests`. @@ -77,85 +70,55 @@ public sealed class HttpMetricsEnrichmentContext /// The callback responsible to add custom tags via . public static void AddCallback(HttpRequestMessage request, Action callback) { + ArgumentNullException.ThrowIfNull(request); + ArgumentNullException.ThrowIfNull(callback); + HttpRequestOptions options = request.Options; - // We associate an HttpMetricsEnrichmentContext with the request on the first call to AddCallback(), - // and store the callbacks in the context. This allows us to cache all the enrichment objects together. - if (!options.TryGetValue(s_optionsKeyForContext, out HttpMetricsEnrichmentContext? context)) + if (options.TryGetValue(s_optionsKeyForCallbacks, out List>? callbacks)) + { + callbacks.Add(callback); + } + else { - if (s_pool.TryDequeue(out context)) - { - Debug.Assert(context._callbacks.Count == 0); - Interlocked.Decrement(ref s_poolItemCount); - } - else - { - context = new HttpMetricsEnrichmentContext(); - } - - options.Set(s_optionsKeyForContext, context); + options.Set(s_optionsKeyForCallbacks, [callback]); } - context._callbacks.Add(callback); } - internal static HttpMetricsEnrichmentContext? GetEnrichmentContextForRequest(HttpRequestMessage request) + internal static List>? GetEnrichmentCallbacksForRequest(HttpRequestMessage request) { - if (request._options is null) + if (request._options is HttpRequestOptions options && + options.Remove(s_optionsKeyForCallbacks.Key, out object? callbacks)) { - return null; + return (List>)callbacks!; } - request._options.TryGetValue(s_optionsKeyForContext, out HttpMetricsEnrichmentContext? context); - return context; + + return null; } - internal void RecordDurationWithEnrichment(HttpRequestMessage request, + internal static void RecordDurationWithEnrichment( + List> callbacks, + HttpRequestMessage request, HttpResponseMessage? response, Exception? exception, TimeSpan durationTime, in TagList commonTags, Histogram requestDuration) { - _request = request; - _response = response; - _exception = exception; - - Debug.Assert(_tags.Count == 0); - - // Adding the enrichment tags to the TagList would likely exceed its' on-stack capacity, leading to an allocation. - // To avoid this, we add all the tags to a List which is cached together with HttpMetricsEnrichmentContext. - // Use a for loop to iterate over the TagList, since TagList.GetEnumerator() allocates, see - // https://github.com/dotnet/runtime/issues/87022. - for (int i = 0; i < commonTags.Count; i++) + var context = new HttpMetricsEnrichmentContext { - _tags.Add(commonTags[i]); - } + _request = request, + _response = response, + _exception = exception, + _tags = commonTags, + }; - try + foreach (Action callback in callbacks) { - foreach (Action callback in _callbacks) - { - callback(this); - } - - requestDuration.Record(durationTime.TotalSeconds, CollectionsMarshal.AsSpan(_tags)); - } - finally - { - _request = null; - _response = null; - _exception = null; - _callbacks.Clear(); - _tags.Clear(); - - if (Interlocked.Increment(ref s_poolItemCount) <= PoolCapacity) - { - s_pool.Enqueue(this); - } - else - { - Interlocked.Decrement(ref s_poolItemCount); - } + callback(context); } + + requestDuration.Record(durationTime.TotalSeconds, context._tags); } } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Metrics/MetricsHandler.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Metrics/MetricsHandler.cs index 7a381483099d4d..79a544816ccb09 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/Metrics/MetricsHandler.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/Metrics/MetricsHandler.cs @@ -121,14 +121,14 @@ private void RequestStop(HttpRequestMessage request, HttpResponseMessage? respon TimeSpan durationTime = Stopwatch.GetElapsedTime(startTimestamp, Stopwatch.GetTimestamp()); - HttpMetricsEnrichmentContext? enrichmentContext = HttpMetricsEnrichmentContext.GetEnrichmentContextForRequest(request); - if (enrichmentContext is null) + List>? callbacks = HttpMetricsEnrichmentContext.GetEnrichmentCallbacksForRequest(request); + if (callbacks is null) { _requestsDuration.Record(durationTime.TotalSeconds, tags); } else { - enrichmentContext.RecordDurationWithEnrichment(request, response, exception, durationTime, tags, _requestsDuration); + HttpMetricsEnrichmentContext.RecordDurationWithEnrichment(callbacks, request, response, exception, durationTime, tags, _requestsDuration); } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http1.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http1.cs index d65e1b6486de21..af78d4d4cb9a9c 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http1.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http1.cs @@ -259,8 +259,7 @@ private async Task InjectNewHttp11ConnectionAsync(RequestQueue.Q HttpConnection? connection = null; Exception? connectionException = null; - CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(); - waiter.ConnectionCancellationTokenSource = cts; + CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter); try { connection = await CreateHttp11ConnectionAsync(queueItem.Request, true, cts.Token).ConfigureAwait(false); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs index c3999c520f0f24..33155f12d8b73b 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http2.cs @@ -181,8 +181,7 @@ private async Task InjectNewHttp2ConnectionAsync(RequestQueue. Exception? connectionException = null; HttpConnectionWaiter waiter = queueItem.Waiter; - CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(); - waiter.ConnectionCancellationTokenSource = cts; + CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter); try { (Stream stream, TransportContext? transportContext, Activity? activity, IPEndPoint? remoteEndPoint) = await ConnectAsync(queueItem.Request, true, cts.Token).ConfigureAwait(false); diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http3.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http3.cs index bae0ef38952555..b9e2bc2a98edf1 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http3.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.Http3.cs @@ -75,52 +75,60 @@ internal sealed partial class HttpConnectionPool // Loop in case we get a 421 and need to send the request to a different authority. while (true) { - if (!TryGetHttp3Authority(request, out HttpAuthority? authority, out Exception? reasonException)) + HttpConnectionWaiter? http3ConnectionWaiter = null; + try { - if (reasonException is null) + if (!TryGetHttp3Authority(request, out HttpAuthority? authority, out Exception? reasonException)) { - return null; + if (reasonException is null) + { + return null; + } + ThrowGetVersionException(request, 3, reasonException); } - ThrowGetVersionException(request, 3, reasonException); - } - long queueStartingTimestamp = HttpTelemetry.Log.IsEnabled() || Settings._metrics!.RequestsQueueDuration.Enabled ? Stopwatch.GetTimestamp() : 0; - Activity? waitForConnectionActivity = ConnectionSetupDistributedTracing.StartWaitForConnectionActivity(authority); + long queueStartingTimestamp = HttpTelemetry.Log.IsEnabled() || Settings._metrics!.RequestsQueueDuration.Enabled ? Stopwatch.GetTimestamp() : 0; + Activity? waitForConnectionActivity = ConnectionSetupDistributedTracing.StartWaitForConnectionActivity(authority); - if (!TryGetPooledHttp3Connection(request, out Http3Connection? connection, out HttpConnectionWaiter? http3ConnectionWaiter)) - { - try + if (!TryGetPooledHttp3Connection(request, out Http3Connection? connection, out http3ConnectionWaiter)) { - connection = await http3ConnectionWaiter.WaitWithCancellationAsync(cancellationToken).ConfigureAwait(false); + try + { + connection = await http3ConnectionWaiter.WaitWithCancellationAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + ConnectionSetupDistributedTracing.ReportError(waitForConnectionActivity, ex); + waitForConnectionActivity?.Stop(); + throw; + } } - catch (Exception ex) + + // Request cannot be sent over H/3 connection, try downgrade or report failure. + // Note that if there's an H/3 suitable origin authority but is unavailable or blocked via Alt-Svc, exception is thrown instead. + if (connection is null) { - ConnectionSetupDistributedTracing.ReportError(waitForConnectionActivity, ex); - waitForConnectionActivity?.Stop(); - throw; + return null; } - } - // Request cannot be sent over H/3 connection, try downgrade or report failure. - // Note that if there's an H/3 suitable origin authority but is unavailable or blocked via Alt-Svc, exception is thrown instead. - if (connection is null) - { - return null; - } + HttpResponseMessage response = await connection.SendAsync(request, queueStartingTimestamp, waitForConnectionActivity, cancellationToken).ConfigureAwait(false); - HttpResponseMessage response = await connection.SendAsync(request, queueStartingTimestamp, waitForConnectionActivity, cancellationToken).ConfigureAwait(false); + // If an Alt-Svc authority returns 421, it means it can't actually handle the request. + // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug. + // In this case, we blocklist the authority and retry the request at the origin. + if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority) + { + response.Dispose(); + BlocklistAuthority(connection.Authority); + continue; + } - // If an Alt-Svc authority returns 421, it means it can't actually handle the request. - // An authority is supposed to be able to handle ALL requests to the origin, so this is a server bug. - // In this case, we blocklist the authority and retry the request at the origin. - if (response.StatusCode == HttpStatusCode.MisdirectedRequest && connection.Authority != _originAuthority) + return response; + } + finally { - response.Dispose(); - BlocklistAuthority(connection.Authority); - continue; + http3ConnectionWaiter?.CancelIfNecessary(this, cancellationToken.IsCancellationRequested); } - - return response; } } @@ -253,8 +261,7 @@ private async Task InjectNewHttp3ConnectionAsync(RequestQueue. HttpAuthority? authority = null; HttpConnectionWaiter waiter = queueItem.Waiter; - CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(); - waiter.ConnectionCancellationTokenSource = cts; + CancellationTokenSource cts = GetConnectTimeoutCancellationTokenSource(waiter); Activity? connectionSetupActivity = null; try { diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs index 3c91fc4ccde43f..e72c048b717b2f 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs @@ -827,7 +827,27 @@ private async ValueTask EstablishSocksTunnel(HttpRequestMessage request, return stream; } - private CancellationTokenSource GetConnectTimeoutCancellationTokenSource() => new CancellationTokenSource(Settings._connectTimeout); + private CancellationTokenSource GetConnectTimeoutCancellationTokenSource(HttpConnectionWaiter waiter) + where T : HttpConnectionBase? + { + var cts = new CancellationTokenSource(Settings._connectTimeout); + + lock (waiter) + { + waiter.ConnectionCancellationTokenSource = cts; + + // The initiating request for this connection attempt may complete concurrently at any time. + // If it completed before we've set the CTS, CancelIfNecessary would no-op. + // Check it again now that we're holding the lock and ensure we always set a timeout. + if (waiter.Task.IsCompleted) + { + waiter.CancelIfNecessary(this, requestCancelled: waiter.Task.IsCanceled); + waiter.ConnectionCancellationTokenSource = null; + } + } + + return cts; + } private static Exception CreateConnectTimeoutException(OperationCanceledException oce) { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs index 161b1e793b78bc..cb8a2b7c833556 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs @@ -467,6 +467,49 @@ public Task RequestDuration_CustomTags_Recorded() VerifyRequestDuration(m, uri, UseVersion, 200); Assert.Equal("/test", m.Tags.ToArray().Single(t => t.Key == "route").Value); + }, async server => + { + await server.HandleRequestAsync(); + }); + } + + [Fact] + public Task RequestDuration_MultipleCallbacksPerRequest_AllCalledInOrder() + { + return LoopbackServerFactory.CreateClientAndServerAsync(async uri => + { + using HttpMessageInvoker client = CreateHttpMessageInvoker(); + using InstrumentRecorder recorder = SetupInstrumentRecorder(InstrumentNames.RequestDuration); + using HttpRequestMessage request = new(HttpMethod.Get, uri) { Version = UseVersion }; + + int lastCallback = -1; + + HttpMetricsEnrichmentContext.AddCallback(request, ctx => + { + Assert.Equal(-1, lastCallback); + lastCallback = 1; + ctx.AddCustomTag("custom1", "foo"); + }); + HttpMetricsEnrichmentContext.AddCallback(request, ctx => + { + Assert.Equal(1, lastCallback); + lastCallback = 2; + ctx.AddCustomTag("custom2", "bar"); + }); + HttpMetricsEnrichmentContext.AddCallback(request, ctx => + { + Assert.Equal(2, lastCallback); + ctx.AddCustomTag("custom3", "baz"); + }); + + using HttpResponseMessage response = await SendAsync(client, request); + + Measurement m = Assert.Single(recorder.GetMeasurements()); + VerifyRequestDuration(m, uri, UseVersion, 200); + Assert.Equal("foo", Assert.Single(m.Tags.ToArray(), t => t.Key == "custom1").Value); + Assert.Equal("bar", Assert.Single(m.Tags.ToArray(), t => t.Key == "custom2").Value); + Assert.Equal("baz", Assert.Single(m.Tags.ToArray(), t => t.Key == "custom3").Value); + }, async server => { await server.AcceptConnectionSendResponseAndCloseAsync(); @@ -1075,6 +1118,96 @@ public class HttpMetricsTest_Http11_Async_HttpMessageInvoker : HttpMetricsTest_H public HttpMetricsTest_Http11_Async_HttpMessageInvoker(ITestOutputHelper output) : base(output) { } + + [Fact] + public async Task RequestDuration_RequestReused_EnrichmentCallbacksAreCleared() + { + await LoopbackServerFactory.CreateClientAndServerAsync(async uri => + { + using HttpMessageInvoker client = CreateHttpMessageInvoker(); + using InstrumentRecorder recorder = SetupInstrumentRecorder(InstrumentNames.RequestDuration); + + using HttpRequestMessage request = new(HttpMethod.Get, uri); + + int firstCallbackCalls = 0; + + HttpMetricsEnrichmentContext.AddCallback(request, ctx => + { + firstCallbackCalls++; + ctx.AddCustomTag("key1", "foo"); + }); + + (await SendAsync(client, request)).Dispose(); + Assert.Equal(1, firstCallbackCalls); + + Measurement m = Assert.Single(recorder.GetMeasurements()); + Assert.Equal("key1", Assert.Single(m.Tags.ToArray(), t => t.Value as string == "foo").Key); + + HttpMetricsEnrichmentContext.AddCallback(request, static ctx => + { + ctx.AddCustomTag("key2", "foo"); + }); + + (await SendAsync(client, request)).Dispose(); + Assert.Equal(1, firstCallbackCalls); + + Assert.Equal(2, recorder.GetMeasurements().Count); + m = recorder.GetMeasurements()[1]; + Assert.Equal("key2", Assert.Single(m.Tags.ToArray(), t => t.Value as string == "foo").Key); + }, async server => + { + await server.HandleRequestAsync(); + await server.HandleRequestAsync(); + }); + } + + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] + public async Task RequestDuration_ConcurrentRequestsSeeDifferentContexts() + { + await LoopbackServerFactory.CreateClientAndServerAsync(async uri => + { + using HttpMessageInvoker client = CreateHttpMessageInvoker(); + using var _ = SetupInstrumentRecorder(InstrumentNames.RequestDuration); + + using HttpRequestMessage request1 = new(HttpMethod.Get, uri); + using HttpRequestMessage request2 = new(HttpMethod.Get, uri); + + HttpMetricsEnrichmentContext.AddCallback(request1, _ => { }); + (await client.SendAsync(request1, CancellationToken.None)).Dispose(); + + HttpMetricsEnrichmentContext context1 = null; + HttpMetricsEnrichmentContext context2 = null; + CountdownEvent countdownEvent = new(2); + + HttpMetricsEnrichmentContext.AddCallback(request1, ctx => + { + context1 = ctx; + countdownEvent.Signal(); + Assert.True(countdownEvent.Wait(TestHelper.PassingTestTimeout)); + }); + HttpMetricsEnrichmentContext.AddCallback(request2, ctx => + { + context2 = ctx; + countdownEvent.Signal(); + Assert.True(countdownEvent.Wait(TestHelper.PassingTestTimeout)); + }); + + Task task1 = Task.Run(() => client.SendAsync(request1, CancellationToken.None)); + Task task2 = Task.Run(() => client.SendAsync(request2, CancellationToken.None)); + + (await task1).Dispose(); + (await task2).Dispose(); + + Assert.NotSame(context1, context2); + }, async server => + { + await server.HandleRequestAsync(); + + await Task.WhenAll( + server.HandleRequestAsync(), + server.HandleRequestAsync()); + }, options: new GenericLoopbackOptions { ListenBacklog = 2 }); + } } [ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMobile))] diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs index ae1669c18e68b8..9ae4d15f64cd73 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs @@ -393,6 +393,68 @@ await RemoteExecutor.Invoke(static async (versionString, timoutStr) => }, UseVersion.ToString(), timeout.ToString()).DisposeAsync(); } + [OuterLoop("We wait for PendingConnectionTimeout which defaults to 5 seconds.")] + [Fact] + public async Task PendingConnectionTimeout_SignalsAllConnectionAttempts() + { + if (UseVersion == HttpVersion.Version30) + { + // HTTP3 does not support ConnectCallback + return; + } + + int pendingConnectionAttempts = 0; + bool connectionAttemptTimedOut = false; + + using var handler = new SocketsHttpHandler + { + ConnectCallback = async (context, cancellation) => + { + Interlocked.Increment(ref pendingConnectionAttempts); + try + { + await Assert.ThrowsAsync(() => Task.Delay(-1, cancellation)).WaitAsync(TestHelper.PassingTestTimeout); + cancellation.ThrowIfCancellationRequested(); + throw new UnreachableException(); + } + catch (TimeoutException) + { + connectionAttemptTimedOut = true; + throw; + } + finally + { + Interlocked.Decrement(ref pendingConnectionAttempts); + } + } + }; + + using HttpClient client = CreateHttpClient(handler); + client.Timeout = TimeSpan.FromSeconds(2); + + // Many of these requests should trigger new connection attempts, and all of those should eventually be cleaned up. + await Parallel.ForAsync(0, 100, async (_, _) => + { + await Assert.ThrowsAnyAsync(() => client.GetAsync("https://dummy")); + }); + + Stopwatch stopwatch = Stopwatch.StartNew(); + + while (Volatile.Read(ref pendingConnectionAttempts) > 0) + { + Assert.False(connectionAttemptTimedOut); + + if (stopwatch.Elapsed > 2 * TestHelper.PassingTestTimeout) + { + Assert.Fail("Connection attempts took too long to get cleaned up"); + } + + await Task.Delay(100); + } + + Assert.False(connectionAttemptTimedOut); + } + private sealed class SetTcsContent : StreamContent { private readonly TaskCompletionSource _tcs; diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 8368cc8f7e4784..90f846b28f8875 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -10,7 +10,8 @@ RUN apt-get update -y && \ RUN git clone --depth 1 --single-branch --branch v2.3.5 --recursive https://github.com/microsoft/msquic RUN cd msquic/ && \ mkdir build && \ - cmake -B build -DCMAKE_BUILD_TYPE=Debug -DQUIC_ENABLE_LOGGING=false -DQUIC_USE_SYSTEM_LIBCRYPTO=true -DQUIC_BUILD_TOOLS=off -DQUIC_BUILD_TEST=off -DQUIC_BUILD_PERF=off -DQUIC_TLS=openssl3 -DQUIC_ENABLE_SANITIZERS=on && \ + cmake -B build -DCMAKE_BUILD_TYPE=Debug -DQUIC_ENABLE_LOGGING=false -DQUIC_USE_SYSTEM_LIBCRYPTO=true -DQUIC_BUILD_TOOLS=off -DQUIC_BUILD_TEST=off -DQUIC_BUILD_PERF=off -DQUIC_TLS=openssl3 && \ + # -DQUIC_ENABLE_SANITIZERS=on && \ cd build && \ cmake --build . --config Debug RUN cd msquic/build/bin/Debug && \ @@ -41,8 +42,8 @@ ENV DOTNET_DbgMiniDumpName="/dumps-share/coredump.%p" EXPOSE 5001 # configure adress sanitizer -ENV ASAN_OPTIONS='detect_leaks=0' -ENV LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/12/libasan.so +# ENV ASAN_OPTIONS='detect_leaks=0' +# ENV LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/12/libasan.so ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/docker-compose.yml b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/docker-compose.yml index c22be392756f26..f0f06320076aa9 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/docker-compose.yml +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3' +version: '3' # Although the version attribute is obsolete and should be ignored, it's seemingly not the case on Build.Ubuntu.2204.Amd64.Open services: client: build: diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs index 9315b0c511fb8e..00932b43ec228f 100644 --- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs +++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs @@ -70,7 +70,9 @@ public bool UnsafeConnectionNtlmAuthentication { return; } - lock ((DisconnectResults as ICollection).SyncRoot) + + var disconnectResults = DisconnectResults; + lock ((disconnectResults as ICollection).SyncRoot) { if (_unsafeConnectionNtlmAuthentication == value) { @@ -79,7 +81,7 @@ public bool UnsafeConnectionNtlmAuthentication _unsafeConnectionNtlmAuthentication = value; if (!value) { - foreach (DisconnectAsyncResult result in DisconnectResults.Values) + foreach (DisconnectAsyncResult result in disconnectResults.Values) { result.AuthenticatedConnection = null; } @@ -694,7 +696,13 @@ public HttpListenerContext EndGetContext(IAsyncResult asyncResult) // assurance that we do this only for NTLM/Negotiate is not here, but in the // code that caches WindowsIdentity instances in the Dictionary. DisconnectAsyncResult? disconnectResult; - DisconnectResults.TryGetValue(connectionId, out disconnectResult); + + var disconnectResults = DisconnectResults; + lock ((disconnectResults as ICollection).SyncRoot) + { + disconnectResults.TryGetValue(connectionId, out disconnectResult); + } + if (UnsafeConnectionNtlmAuthentication) { if (authorizationHeader == null) @@ -1327,7 +1335,12 @@ private static void RegisterForDisconnectNotification(HttpListenerSession sessio // Need to make sure it's going to get returned before adding it to the hash. That way it'll be handled // correctly in HandleAuthentication's finally. disconnectResult = result; - session.Listener.DisconnectResults[connectionId] = disconnectResult; + + var disconnectResults = session.Listener.DisconnectResults; + lock ((disconnectResults as ICollection).SyncRoot) + { + disconnectResults[connectionId] = disconnectResult; + } } if (statusCode == Interop.HttpApi.ERROR_SUCCESS && HttpListener.SkipIOCPCallbackOnSuccess) @@ -1646,8 +1659,21 @@ private void HandleDisconnect() { HttpListener listener = _listenerSession.Listener; - if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"DisconnectResults {listener.DisconnectResults} removing for _connectionId: {_connectionId}"); - listener.DisconnectResults.Remove(_connectionId); + var disconnectResults = listener.DisconnectResults; + if (NetEventSource.Log.IsEnabled()) + { + string? results; + lock ((disconnectResults as ICollection).SyncRoot) + { + results = disconnectResults.ToString(); + } + NetEventSource.Info(this, $"DisconnectResults {results} removing for _connectionId: {_connectionId}"); + } + + lock ((disconnectResults as ICollection).SyncRoot) + { + disconnectResults.Remove(_connectionId); + } // Cached identity is disposed with the session context Session?.Dispose(); diff --git a/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs b/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs index 72fc7685dffe90..4585e92a8ac9dc 100644 --- a/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs +++ b/src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs @@ -437,6 +437,11 @@ public void RegisterForCancellation(CancellationToken cancellationToken) NetEventSource.Info(@this, $"GetAddrInfoExCancel returned error {cancelResult}"); } } + catch (ObjectDisposedException) + { + // There is a race between checking @this._completed and @this.DangerousAddRef and disposing from another thread. + // We lost the race. No further action needed. + } finally { if (needRelease) diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs index f21cbce950a543..808887732dd5fd 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -745,53 +745,64 @@ public async Task SendPingToExternalHostWithLowTtlTest() Assert.NotEqual(IPAddress.Any, pingReply.Address); } - [Fact] - [OuterLoop] - public void Ping_TimedOut_Sync_Success() + private async Task Ping_TimedOut_Core(Func> sendPing) { - var sender = new Ping(); - PingReply reply = sender.Send(TestSettings.UnreachableAddress); + Ping sender = new Ping(); + PingReply reply = await sendPing(sender, TestSettings.UnreachableAddress); + if (reply.Status == IPStatus.DestinationNetworkUnreachable) + { + // A network middleware has dropped the packed and replied with DestinationNetworkUnreachable. Repeat the PING attempt on another address. + reply = await sendPing(sender, TestSettings.UnreachableAddress2); + } + + if (reply.Status == IPStatus.DestinationNetworkUnreachable) + { + // Do yet another attempt. + reply = await sendPing(sender, TestSettings.UnreachableAddress3); + } + Assert.Equal(IPStatus.TimedOut, reply.Status); } [Fact] [OuterLoop] - public async Task Ping_TimedOut_EAP_Success() - { - var sender = new Ping(); - sender.PingCompleted += (s, e) => - { - var tcs = (TaskCompletionSource)e.UserState; + public Task Ping_TimedOut_Sync_Success() + => Ping_TimedOut_Core((sender, address) => Task.Run(() => sender.Send(address))); - if (e.Cancelled) - { - tcs.TrySetCanceled(); - } - else if (e.Error != null) - { - tcs.TrySetException(e.Error); - } - else + [Fact] + [OuterLoop] + public Task Ping_TimedOut_EAP_Success() + => Ping_TimedOut_Core(async (sender, address) => + { + static void PingCompleted(object sender, PingCompletedEventArgs e) { - tcs.TrySetResult(e.Reply); - } - }; + var tcs = (TaskCompletionSource)e.UserState; - var tcs = new TaskCompletionSource(); - sender.SendAsync(TestSettings.UnreachableAddress, tcs); - - PingReply reply = await tcs.Task; - Assert.Equal(IPStatus.TimedOut, reply.Status); - } + if (e.Cancelled) + { + tcs.TrySetCanceled(); + } + else if (e.Error != null) + { + tcs.TrySetException(e.Error); + } + else + { + tcs.TrySetResult(e.Reply); + } + } + sender.PingCompleted += PingCompleted; + var tcs = new TaskCompletionSource(); + sender.SendAsync(address, tcs); + PingReply reply = await tcs.Task; + sender.PingCompleted -= PingCompleted; + return reply; + }); [Fact] [OuterLoop] - public async Task Ping_TimedOut_TAP_Success() - { - var sender = new Ping(); - PingReply reply = await sender.SendPingAsync(TestSettings.UnreachableAddress); - Assert.Equal(IPStatus.TimedOut, reply.Status); - } + public Task Ping_TimedOut_TAP_Success() + => Ping_TimedOut_Core((sender, address) => sender.SendPingAsync(address)); private static bool IsRemoteExecutorSupportedAndPrivilegedProcess => RemoteExecutor.IsSupported && PlatformDetection.IsPrivilegedProcess; diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/TestSettings.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/TestSettings.cs index 0e48bb4777b2e1..78b2be986651e6 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/TestSettings.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/TestSettings.cs @@ -11,6 +11,9 @@ internal static class TestSettings { public static readonly string LocalHost = "localhost"; public static readonly string UnreachableAddress = "192.0.2.0"; // TEST-NET-1 + public static readonly string UnreachableAddress2 = "100.64.0.1"; // CGNAT block + public static readonly string UnreachableAddress3 = "10.255.255.1"; // High address in the private 10.0.0.0/8 range. Likely unused and unrouted. + public const int PingTimeout = 10 * 1000; public const string PayloadAsString = "'Post hoc ergo propter hoc'. 'After it, therefore because of it'. It means one thing follows the other, therefore it was caused by the other. But it's not always true. In fact it's hardly ever true."; diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs index db0a4a6c84bf19..bb6407ea4e0e43 100644 --- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs +++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs @@ -1057,8 +1057,9 @@ internal bool VerifyRemoteCertificate(RemoteCertificateValidationCallback? remot return true; } - _remoteCertificate = certificate; - if (_remoteCertificate == null) + // don't assign to _remoteCertificate yet, this prevents weird exceptions if SslStream is disposed in parallel with X509Chain building + + if (certificate == null) { if (NetEventSource.Log.IsEnabled() && RemoteCertRequired) NetEventSource.Error(this, $"Remote certificate required, but no remote certificate received"); sslPolicyErrors |= SslPolicyErrors.RemoteCertificateNotAvailable; @@ -1100,15 +1101,17 @@ internal bool VerifyRemoteCertificate(RemoteCertificateValidationCallback? remot sslPolicyErrors |= CertificateValidationPal.VerifyCertificateProperties( _securityContext!, chain, - _remoteCertificate, + certificate, _sslAuthenticationOptions.CheckCertName, _sslAuthenticationOptions.IsServer, TargetHostNameHelper.NormalizeHostName(_sslAuthenticationOptions.TargetHost)); } + _remoteCertificate = certificate; + if (remoteCertValidationCallback != null) { - success = remoteCertValidationCallback(this, _remoteCertificate, chain, sslPolicyErrors); + success = remoteCertValidationCallback(this, certificate, chain, sslPolicyErrors); } else { diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs index 7b8cc18c40f3b7..662f7d1fa48e93 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamStreamToStreamTest.cs @@ -9,8 +9,9 @@ using System.Text; using System.Threading; using System.Threading.Tasks; - +using Microsoft.DotNet.XUnitExtensions; using Xunit; +using Xunit.Abstractions; namespace System.Net.Security.Tests { @@ -192,6 +193,11 @@ public async Task NegotiateStream_StreamToStream_Authentication_EmptyCredentials { string targetName = "testTargetName"; + if (PlatformDetection.IsWindowsServer2025) + { + throw new SkipTestException("Empty credentials not supported on Server 2025"); + } + // Ensure there is no confusion between DefaultCredentials / DefaultNetworkCredentials and a // NetworkCredential object with empty user, password and domain. NetworkCredential emptyNetworkCredential = new NetworkCredential("", "", ""); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs index de7aa502933b02..9864029c7a0b34 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamDisposeTest.cs @@ -4,6 +4,7 @@ using System.IO; using System.Security.Cryptography.X509Certificates; using System.Threading; +using System.Security.Authentication; using System.Threading.Tasks; using Xunit; @@ -59,6 +60,7 @@ public async Task Dispose_PendingReadAsync_ThrowsODE(bool bufferedRead) using CancellationTokenSource cts = new CancellationTokenSource(); cts.CancelAfter(TestConfiguration.PassingTestTimeout); + (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams(leaveInnerStreamOpen: true); using (client) using (server) @@ -102,5 +104,65 @@ await TestConfiguration.WhenAllOrAnyFailedWithTimeout( await Assert.ThrowsAnyAsync(() => client.ReadAsync(readBuffer, cts.Token).AsTask()); } } + + [Fact] + [OuterLoop("Computationally expensive")] + public async Task Dispose_ParallelWithHandshake_ThrowsODE() + { + using CancellationTokenSource cts = new CancellationTokenSource(); + cts.CancelAfter(TestConfiguration.PassingTestTimeout); + + await Parallel.ForEachAsync(System.Linq.Enumerable.Range(0, 10000), cts.Token, async (i, token) => + { + (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); + + using SslStream client = new SslStream(clientStream); + using SslStream server = new SslStream(serverStream); + using X509Certificate2 serverCertificate = Configuration.Certificates.GetServerCertificate(); + using X509Certificate2 clientCertificate = Configuration.Certificates.GetClientCertificate(); + + SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions() + { + TargetHost = Guid.NewGuid().ToString("N"), + RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true, + }; + + SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions() + { + ServerCertificate = serverCertificate, + }; + + var clientTask = Task.Run(() => client.AuthenticateAsClientAsync(clientOptions, cts.Token)); + var serverTask = Task.Run(() => server.AuthenticateAsServerAsync(serverOptions, cts.Token)); + + // Dispose the instances while the handshake is in progress. + client.Dispose(); + server.Dispose(); + + await ValidateExceptionAsync(clientTask); + await ValidateExceptionAsync(serverTask); + }); + + static async Task ValidateExceptionAsync(Task task) + { + try + { + await task; + } + catch (InvalidOperationException ex) when (ex.StackTrace?.Contains("System.IO.StreamBuffer.WriteAsync") ?? true) + { + // Writing to a disposed ConnectedStream (test only, does not happen with NetworkStream) + return; + } + catch (Exception ex) when (ex + is ObjectDisposedException // disposed locally + or IOException // disposed remotely (received unexpected EOF) + or AuthenticationException) // disposed wrapped in AuthenticationException or error from platform library + { + // expected + return; + } + } + } } } diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs index 87ec6605e37aad..46a4707b43cf01 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs @@ -25,6 +25,7 @@ public SslStreamRemoteExecutorTests() [PlatformSpecific(TestPlatforms.Linux)] // SSLKEYLOGFILE is only supported on Linux for SslStream [InlineData(true)] [InlineData(false)] + //[ActiveIssue("https://github.com/dotnet/runtime/issues/116473")] public async Task SslKeyLogFile_IsCreatedAndFilled(bool enabledBySwitch) { if (PlatformDetection.IsDebugLibrary(typeof(SslStream).Assembly) && !enabledBySwitch) @@ -34,6 +35,13 @@ public async Task SslKeyLogFile_IsCreatedAndFilled(bool enabledBySwitch) return; } + if (PlatformDetection.IsOpenSsl3_5 && !enabledBySwitch) + { + // OpenSSL 3.5 and later versions log into file in SSLKEYLOGFILE environment variable by default, + // regardless of AppContext switch. + return; + } + var psi = new ProcessStartInfo(); var tempFile = Path.GetTempFileName(); psi.Environment.Add("SSLKEYLOGFILE", tempFile); diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs index e1f19c03d6d0ad..817a8221d6bf0f 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs @@ -3602,7 +3602,7 @@ internal void InternalSetBlocking(bool desired) } // CreateAcceptSocket - pulls unmanaged results and assembles them into a new Socket object. - internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint remoteEP) + internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint? remoteEP) { // Internal state of the socket is inherited from listener. Debug.Assert(fd != null && !fd.IsInvalid); @@ -3610,7 +3610,7 @@ internal Socket CreateAcceptSocket(SafeSocketHandle fd, EndPoint remoteEP) return UpdateAcceptSocket(socket, remoteEP); } - internal Socket UpdateAcceptSocket(Socket socket, EndPoint remoteEP) + internal Socket UpdateAcceptSocket(Socket socket, EndPoint? remoteEP) { // Internal state of the socket is inherited from listener. socket._addressFamily = _addressFamily; diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Unix.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Unix.cs index bcb411922ae05e..088fb07ca46d23 100644 --- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Unix.cs +++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Unix.cs @@ -35,7 +35,6 @@ private void CompleteAcceptOperation(IntPtr acceptedFileDescriptor, Memory _acceptedFileDescriptor = acceptedFileDescriptor; if (socketError == SocketError.Success) { - Debug.Assert(socketAddress.Length > 0); _acceptAddressBufferCount = socketAddress.Length; } else @@ -348,9 +347,10 @@ private SocketError FinishOperationAccept(SocketAddress remoteSocketAddress) new ReadOnlySpan(_acceptBuffer, 0, _acceptAddressBufferCount).CopyTo(remoteSocketAddress.Buffer.Span); remoteSocketAddress.Size = _acceptAddressBufferCount; + // on macOS accept can sometimes return empty remote address even when it returns successfully. Socket acceptedSocket = _currentSocket!.CreateAcceptSocket( SocketPal.CreateSocket(_acceptedFileDescriptor), - _currentSocket._rightEndPoint!.Create(remoteSocketAddress)); + remoteSocketAddress.Size > 0 ? _currentSocket._rightEndPoint!.Create(remoteSocketAddress) : null); if (_acceptSocket is null) { // Store the accepted socket diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendTo.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendTo.cs index 7a3c33b64bf796..0b01469e574e91 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendTo.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SendTo.cs @@ -95,6 +95,7 @@ public async Task Datagram_UDP_ShouldImplicitlyBindLocalEndpoint() [Fact] [SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD allows sendto() to broadcast")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/114450", typeof(PlatformDetection), nameof(PlatformDetection.IsMacCatalyst), nameof(PlatformDetection.IsX64Process))] public async Task Datagram_UDP_AccessDenied_Throws_DoesNotBind() { IPEndPoint invalidEndpoint = new IPEndPoint(IPAddress.Broadcast, 1234); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs index 26752dd31f5dcb..2d7139a05803cb 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs @@ -67,6 +67,7 @@ public void MulticastOption_CreateSocketSetGetOption_GroupAndInterfaceIndex_SetS [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Skip on Nano: https://github.com/dotnet/runtime/issues/26286 [ActiveIssue("https://github.com/dotnet/runtime/issues/104547", typeof(PlatformDetection), nameof(PlatformDetection.IsQemuLinux))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/113827", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile))] public async Task MulticastInterface_Set_AnyInterface_Succeeds() { // On all platforms, index 0 means "any interface" diff --git a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs index d21e80ba41fee5..826c3beda3e3dd 100644 --- a/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs +++ b/src/libraries/System.Net.WebSockets.Client/src/System/Net/WebSockets/BrowserWebSockets/BrowserWebSocket.cs @@ -399,7 +399,7 @@ private async Task SendAsyncCore(ArraySegment buffer, WebSocketMessageType if (sendTask != null) // this is optimization for single-threaded build, see resolvedPromise() in web-socket.ts. Null means synchronously resolved. { - await CancellationHelper(sendTask, cancellationToken, previousState, pinBuffer).ConfigureAwait(false); + await CancellationHelper(sendTask, cancellationToken, previousState).ConfigureAwait(false); } } catch (JSException ex) @@ -442,7 +442,7 @@ private async Task ReceiveAsyncCore(ArraySegment b if (receiveTask != null) // this is optimization for single-threaded build, see resolvedPromise() in web-socket.ts. Null means synchronously resolved. { - await CancellationHelper(receiveTask, cancellationToken, previousState, pinBuffer).ConfigureAwait(false); + await CancellationHelper(receiveTask, cancellationToken, previousState).ConfigureAwait(false); } return ConvertResponse(); @@ -550,13 +550,12 @@ private async Task CloseAsyncCore(WebSocketCloseStatus closeStatus, string? stat } } - private async Task CancellationHelper(Task promise, CancellationToken cancellationToken, WebSocketState previousState, IDisposable? disposable = null) + private async Task CancellationHelper(Task promise, CancellationToken cancellationToken, WebSocketState previousState) { try { if (promise.IsCompletedSuccessfully) { - disposable?.Dispose(); return; } if (promise.IsCompleted) @@ -602,10 +601,6 @@ private async Task CancellationHelper(Task promise, CancellationToken cancellati throw new WebSocketException(WebSocketError.NativeError, ex); } } - finally - { - disposable?.Dispose(); - } } // needs to be called with locked _lockObject diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs index 6643f7c8a97434..8c8f02970db525 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs @@ -3456,7 +3456,7 @@ public static Tensor StackAlongDimension(int dimension, params ReadOnlySpa Tensor[] outputs = new Tensor[tensors.Length]; for (int i = 0; i < tensors.Length; i++) { - outputs[i] = Tensor.Unsqueeze(tensors[0], dimension); + outputs[i] = Tensor.Unsqueeze(tensors[i], dimension); } return Tensor.ConcatenateOnDimension(dimension, outputs); } @@ -3494,9 +3494,9 @@ public static ref readonly TensorSpan StackAlongDimension(scoped ReadOnlyS Tensor[] outputs = new Tensor[tensors.Length]; for (int i = 0; i < tensors.Length; i++) { - outputs[i] = Tensor.Unsqueeze(tensors[0], dimension); + outputs[i] = Tensor.Unsqueeze(tensors[i], dimension); } - return ref Tensor.ConcatenateOnDimension(dimension, tensors, destination); + return ref Tensor.ConcatenateOnDimension(dimension, outputs, destination); } #endregion diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MinNumber.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MinNumber.cs index 653e8c7383eae6..8383efdebb884b 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MinNumber.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MinNumber.cs @@ -11,13 +11,13 @@ namespace System.Numerics.Tensors { public static partial class TensorPrimitives { - /// Searches for the largest number in the specified tensor. + /// Searches for the smallest number in the specified tensor. /// The tensor, represented as a span. - /// The maximum element in . + /// The minimum element in . /// Length of must be greater than zero. /// /// - /// The determination of the maximum element matches the IEEE 754:2019 `maximumNumber` function. Positive 0 is considered greater than negative 0. + /// The determination of the minimum element matches the IEEE 754:2019 `minimumNumber` function. Positive 0 is considered greater than negative 0. /// /// /// This method may call into the underlying C runtime or employ instructions specific to the current architecture. Exact results may differ between different @@ -28,7 +28,7 @@ public static T MinNumber(ReadOnlySpan x) where T : INumber => MinMaxCore>(x); - /// Computes the element-wise maximum of the numbers in the specified tensors. + /// Computes the element-wise minimum of the numbers in the specified tensors. /// The first tensor, represented as a span. /// The second tensor, represented as a span. /// The destination tensor, represented as a span. @@ -41,7 +41,7 @@ public static T MinNumber(ReadOnlySpan x) /// This method effectively computes [i] = .MinNumber([i], [i]). /// /// - /// The determination of the maximum element matches the IEEE 754:2019 `maximumNumber` function. If either value is + /// The determination of the minimum element matches the IEEE 754:2019 `minimumNumber` function. If either value is /// the other is returned. Positive 0 is considered greater than negative 0. /// /// @@ -53,7 +53,7 @@ public static void MinNumber(ReadOnlySpan x, ReadOnlySpan y, Span de where T : INumber => InvokeSpanSpanIntoSpan>(x, y, destination); - /// Computes the element-wise maximum of the numbers in the specified tensors. + /// Computes the element-wise minimum of the numbers in the specified tensors. /// The first tensor, represented as a span. /// The second tensor, represented as a scalar. /// The destination tensor, represented as a span. @@ -64,7 +64,7 @@ public static void MinNumber(ReadOnlySpan x, ReadOnlySpan y, Span de /// This method effectively computes [i] = .MinNumber([i], ). /// /// - /// The determination of the maximum element matches the IEEE 754:2019 `maximumNumber` function. If either value is + /// The determination of the minimum element matches the IEEE 754:2019 `minimumNumber` function. If either value is /// the other is returned. Positive 0 is considered greater than negative 0. /// /// diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MultiplyAddEstimate.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MultiplyAddEstimate.cs index d3e651c160e881..b1bb7d379dcb5b 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MultiplyAddEstimate.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MultiplyAddEstimate.cs @@ -128,9 +128,8 @@ public static Vector128 Invoke(Vector128 x, Vector128 y, Vector128 z { return Vector128.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As(); } - else + else if (typeof(T) == typeof(float)) { - Debug.Assert(typeof(T) == typeof(float)); return Vector128.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As(); } #else @@ -149,9 +148,9 @@ public static Vector128 Invoke(Vector128 x, Vector128 y, Vector128 z { if (typeof(T) == typeof(double)) return AdvSimd.Arm64.FusedMultiplyAdd(z.AsDouble(), x.AsDouble(), y.AsDouble()).As(); } +#endif return (x * y) + z; -#endif } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -162,9 +161,8 @@ public static Vector256 Invoke(Vector256 x, Vector256 y, Vector256 z { return Vector256.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As(); } - else + else if (typeof(T) == typeof(float)) { - Debug.Assert(typeof(T) == typeof(float)); return Vector256.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As(); } #else @@ -173,9 +171,9 @@ public static Vector256 Invoke(Vector256 x, Vector256 y, Vector256 z if (typeof(T) == typeof(float)) return Fma.MultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As(); if (typeof(T) == typeof(double)) return Fma.MultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As(); } +#endif return (x * y) + z; -#endif } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -186,9 +184,8 @@ public static Vector512 Invoke(Vector512 x, Vector512 y, Vector512 z { return Vector512.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As(); } - else + else if (typeof(T) == typeof(float)) { - Debug.Assert(typeof(T) == typeof(float)); return Vector512.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As(); } #else @@ -197,9 +194,9 @@ public static Vector512 Invoke(Vector512 x, Vector512 y, Vector512 z if (typeof(T) == typeof(float)) return Avx512F.FusedMultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As(); if (typeof(T) == typeof(double)) return Avx512F.FusedMultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As(); } +#endif return (x * y) + z; -#endif } } } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.Reciprocal.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.Reciprocal.cs index 16d0df26157cb2..2c348a4cd28d92 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.Reciprocal.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.Reciprocal.cs @@ -47,7 +47,7 @@ public static void ReciprocalEstimate(ReadOnlySpan x, Span destination) /// is an integer type and an element in is equal to zero. /// /// - /// This method effectively computes [i] = 1 / [i]. + /// This method effectively computes [i] = 1 / T.Sqrt([i]). /// /// public static void ReciprocalSqrt(ReadOnlySpan x, Span destination) @@ -62,7 +62,7 @@ public static void ReciprocalSqrt(ReadOnlySpan x, Span destination) /// is an integer type and an element in is equal to zero. /// /// - /// This method effectively computes [i] = 1 / [i]. + /// This method effectively computes [i] = 1 / T.Sqrt([i]). /// /// public static void ReciprocalSqrtEstimate(ReadOnlySpan x, Span destination) diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs index 94bbfb8fcebe92..2d3ce10a64d0e3 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitives.Generic.cs @@ -501,7 +501,7 @@ public void SpanDestinationFunctions_ThrowsForTooShortDestination(SpanDestinatio [Theory] [MemberData(nameof(SpanDestinationFunctionsToTest))] - public void SpanDestinationFunctions_ThrowsForOverlapppingInputsWithOutputs(SpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanDestinationFunctions_ThrowsForOverlappingInputsWithOutputs(SpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -639,7 +639,7 @@ public void SpanSpanDestination_ThrowsForTooShortDestination(SpanSpanDestination [Theory] [MemberData(nameof(SpanSpanDestinationFunctionsToTest))] - public void SpanSpanDestination_ThrowsForOverlapppingInputsWithOutputs(SpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanSpanDestination_ThrowsForOverlappingInputsWithOutputs(SpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -751,7 +751,7 @@ public void SpanScalarDestination_ThrowsForTooShortDestination(SpanScalarDestina [Theory] [MemberData(nameof(SpanScalarDestinationFunctionsToTest))] - public void SpanScalarDestination_ThrowsForOverlapppingInputsWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanScalarDestination_ThrowsForOverlappingInputsWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -851,7 +851,7 @@ public void SpanScalarFloatDestination_ThrowsForTooShortDestination(ScalarSpanDe [Theory] [MemberData(nameof(ScalarSpanFloatDestinationFunctionsToTest))] - public void SpanScalarFloatDestination_ThrowsForOverlapppingInputsWithOutputs(ScalarSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanScalarFloatDestination_ThrowsForOverlappingInputsWithOutputs(ScalarSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -949,7 +949,7 @@ public void SpanIntDestination_ThrowsForTooShortDestination(SpanScalarDestinatio [Theory] [MemberData(nameof(SpanIntDestinationFunctionsToTest))] - public void SpanIntDestination_ThrowsForOverlapppingInputsWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanIntDestination_ThrowsForOverlappingInputsWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -1091,7 +1091,7 @@ public void SpanSpanSpanDestination_ThrowsForTooShortDestination(SpanSpanSpanDes [Theory] [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] - public void SpanSpanSpanDestination_ThrowsForOverlapppingInputsWithOutputs(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanSpanSpanDestination_ThrowsForOverlappingInputsWithOutputs(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -1110,7 +1110,7 @@ public static IEnumerable SpanSpanScalarDestinationFunctionsToTest() { yield return Create(TensorPrimitives.FusedMultiplyAdd, T.FusedMultiplyAdd); yield return Create(TensorPrimitives.Lerp, T.Lerp); - yield return Create(TensorPrimitives.MultiplyAddEstimate, T.FusedMultiplyAdd, T.CreateTruncating(Helpers.DefaultToleranceForEstimates)); // TODO: Change T.FusedMultiplyAdd to T.MultiplyAddEstimate when available + yield return Create(TensorPrimitives.MultiplyAddEstimate, T.MultiplyAddEstimate, T.CreateTruncating(Helpers.DefaultToleranceForEstimates)); static object[] Create(SpanSpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) => new object[] { tensorPrimitivesMethod, expectedMethod, tolerance }; @@ -1206,7 +1206,7 @@ public void SpanSpanScalarDestination_ThrowsForTooShortDestination(SpanSpanScala [Theory] [MemberData(nameof(SpanSpanScalarDestinationFunctionsToTest))] - public void SpanSpanScalarDestination_ThrowsForOverlapppingInputsWithOutputs(SpanSpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanSpanScalarDestination_ThrowsForOverlappingInputsWithOutputs(SpanSpanScalarDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -1320,7 +1320,7 @@ public void SpanScalarSpanDestination_ThrowsForTooShortDestination(SpanScalarSpa [Theory] [MemberData(nameof(SpanScalarSpanDestinationFunctionsToTest))] - public void SpanScalarSpanDestination_ThrowsForOverlapppingInputsWithOutputs(SpanScalarSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + public void SpanScalarSpanDestination_ThrowsForOverlappingInputsWithOutputs(SpanScalarSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) { _ = expectedMethod; _ = tolerance; @@ -1474,7 +1474,7 @@ public void SpanDestinationDestinationFunctions_ThrowsForTooShortDestination(Spa [Theory] [MemberData(nameof(SpanDestinationDestinationFunctionsToTest))] - public void SpanDestinationDestinationFunctions_ThrowsForOverlapppingInputsWithOutputs(SpanDestinationDestinationDelegate tensorPrimitivesMethod, Func _) + public void SpanDestinationDestinationFunctions_ThrowsForOverlappingInputsWithOutputs(SpanDestinationDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; Assert.Throws(() => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(0, 2), array.AsSpan(4, 2))); @@ -1747,7 +1747,7 @@ public void SpanDestinationFunctions_ThrowsForTooShortDestination(SpanDestinatio [Theory] [MemberData(nameof(SpanDestinationFunctionsToTest))] - public void SpanDestinationFunctions_ThrowsForOverlapppingInputsWithOutputs(SpanDestinationDelegate tensorPrimitivesMethod, Func _) + public void SpanDestinationFunctions_ThrowsForOverlappingInputsWithOutputs(SpanDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(0, 2))); @@ -1833,7 +1833,7 @@ public void SpanSpanDestination_ThrowsForTooShortDestination(SpanSpanDestination [Theory] [MemberData(nameof(SpanSpanDestinationFunctionsToTest))] - public void SpanSpanDestination_ThrowsForOverlapppingInputsWithOutputs(SpanSpanDestinationDelegate tensorPrimitivesMethod, Func _) + public void SpanSpanDestination_ThrowsForOverlappingInputsWithOutputs(SpanSpanDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(0, 2))); @@ -1915,7 +1915,7 @@ public void SpanScalarDestination_ThrowsForTooShortDestination(SpanScalarDestina [Theory] [MemberData(nameof(SpanScalarDestinationFunctionsToTest))] - public void SpanScalarDestination_ThrowsForOverlapppingInputWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func _) + public void SpanScalarDestination_ThrowsForOverlappingInputWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; T y = NextRandom(); @@ -1924,6 +1924,149 @@ public void SpanScalarDestination_ThrowsForOverlapppingInputWithOutputs(SpanScal } #endregion + #region Span,Span,Span -> Destination + public static IEnumerable SpanSpanSpanDestinationFunctionsToTest() + { + yield return Create(TensorPrimitives.MultiplyAddEstimate, T.MultiplyAddEstimate, T.CreateTruncating(Helpers.DefaultToleranceForEstimates)); + + static object[] Create(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + => new object[] { tensorPrimitivesMethod, expectedMethod, tolerance }; + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_AllLengths(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + Assert.All(Helpers.TensorLengthsIncluding0, tensorLength => + { + using BoundedMemory x = CreateAndFillTensor(tensorLength); + using BoundedMemory y = CreateAndFillTensor(tensorLength); + using BoundedMemory z = CreateAndFillTensor(tensorLength); + using BoundedMemory destination = CreateTensor(tensorLength); + + tensorPrimitivesMethod(x, y, z, destination); + for (int i = 0; i < tensorLength; i++) + { + AssertEqualTolerance(expectedMethod(x[i], y[i], z[i]), destination[i], tolerance); + } + }); + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_InPlace(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + Assert.All(Helpers.TensorLengthsIncluding0, tensorLength => + { + using BoundedMemory x = CreateAndFillTensor(tensorLength); + T[] xOrig = x.Span.ToArray(); + + tensorPrimitivesMethod(x, x, x, x); + + for (int i = 0; i < tensorLength; i++) + { + AssertEqualTolerance(expectedMethod(xOrig[i], xOrig[i], xOrig[i]), x[i], tolerance); + } + }); + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_SpecialValues(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + Assert.All(Helpers.TensorLengths, tensorLength => + { + using BoundedMemory x = CreateAndFillTensor(tensorLength); + using BoundedMemory y = CreateAndFillTensor(tensorLength); + using BoundedMemory z = CreateAndFillTensor(tensorLength); + using BoundedMemory destination = CreateTensor(tensorLength); + + RunForEachSpecialValue(() => + { + tensorPrimitivesMethod(x.Span, y.Span, z.Span, destination.Span); + for (int i = 0; i < tensorLength; i++) + { + AssertEqualTolerance(expectedMethod(x[i], y[i], z[i]), destination[i], tolerance); + } + }, x); + + RunForEachSpecialValue(() => + { + tensorPrimitivesMethod(x.Span, y.Span, z.Span, destination.Span); + for (int i = 0; i < tensorLength; i++) + { + AssertEqualTolerance(expectedMethod(x[i], y[i], z[i]), destination[i], tolerance); + } + }, y); + + RunForEachSpecialValue(() => + { + tensorPrimitivesMethod(x.Span, y.Span, z.Span, destination.Span); + for (int i = 0; i < tensorLength; i++) + { + AssertEqualTolerance(expectedMethod(x[i], y[i], z[i]), destination[i], tolerance); + } + }, z); + }); + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_ThrowsForMismatchedLengths(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + _ = expectedMethod; + _ = tolerance; + + Assert.All(Helpers.TensorLengths, tensorLength => + { + using BoundedMemory x = CreateAndFillTensor(tensorLength); + using BoundedMemory y = CreateAndFillTensor(tensorLength); + using BoundedMemory z = CreateAndFillTensor(tensorLength - 1); + using BoundedMemory destination = CreateTensor(tensorLength); + + Assert.Throws(() => tensorPrimitivesMethod(x, y, z, destination)); + Assert.Throws(() => tensorPrimitivesMethod(x, z, y, destination)); + Assert.Throws(() => tensorPrimitivesMethod(y, x, z, destination)); + Assert.Throws(() => tensorPrimitivesMethod(y, z, x, destination)); + Assert.Throws(() => tensorPrimitivesMethod(z, x, y, destination)); + Assert.Throws(() => tensorPrimitivesMethod(z, y, x, destination)); + }); + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_ThrowsForTooShortDestination(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + _ = expectedMethod; + _ = tolerance; + + Assert.All(Helpers.TensorLengths, tensorLength => + { + using BoundedMemory x = CreateAndFillTensor(tensorLength); + using BoundedMemory y = CreateAndFillTensor(tensorLength); + using BoundedMemory z = CreateAndFillTensor(tensorLength); + using BoundedMemory destination = CreateTensor(tensorLength - 1); + + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(x, y, z, destination)); + }); + } + + [Theory] + [MemberData(nameof(SpanSpanSpanDestinationFunctionsToTest))] + public void SpanSpanSpanDestination_ThrowsForOverlappingInputsWithOutputs(SpanSpanSpanDestinationDelegate tensorPrimitivesMethod, Func expectedMethod, T? tolerance = null) + { + _ = expectedMethod; + _ = tolerance; + + T[] array = new T[10]; + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(7, 2), array.AsSpan(0, 2))); + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(7, 2), array.AsSpan(2, 2))); + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(7, 2), array.AsSpan(4, 2))); + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(7, 2), array.AsSpan(6, 2))); + AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(7, 2), array.AsSpan(8, 2))); + } + #endregion + #region Shifting/Rotating public static IEnumerable ShiftRotateDestinationFunctionsToTest() { @@ -1989,7 +2132,7 @@ public void ShiftRotateDestination_ThrowsForTooShortDestination(SpanScalarDestin [Theory] [MemberData(nameof(ShiftRotateDestinationFunctionsToTest))] - public void ShiftRotateDestination_ThrowsForOverlapppingInputWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func _) + public void ShiftRotateDestination_ThrowsForOverlappingInputWithOutputs(SpanScalarDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(array.AsSpan(1, 2), default, array.AsSpan(0, 2))); @@ -2084,7 +2227,7 @@ public void CopySign_ThrowsForTooShortDestination() } [Fact] - public void CopySign_ThrowsForOverlapppingInputsWithOutputs() + public void CopySign_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; @@ -2347,7 +2490,7 @@ public void ScalarSpanDestination_ThrowsForTooShortDestination(ScalarSpanDestina [Theory] [MemberData(nameof(ScalarSpanDestinationFunctionsToTest))] - public void ScalarSpanDestination_ThrowsForOverlapppingInputsWithOutputs(ScalarSpanDestinationDelegate tensorPrimitivesMethod, Func _) + public void ScalarSpanDestination_ThrowsForOverlappingInputsWithOutputs(ScalarSpanDestinationDelegate tensorPrimitivesMethod, Func _) { T[] array = new T[10]; AssertExtensions.Throws("destination", () => tensorPrimitivesMethod(default, array.AsSpan(4, 2), array.AsSpan(3, 2))); diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs index 920ed00af7e90f..119f57a1f93759 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorPrimitivesTests.cs @@ -236,7 +236,7 @@ public void Abs_ThrowsForTooShortDestination() } [Fact] - public void Abs_ThrowsForOverlapppingInputsWithOutputs() + public void Abs_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Abs(array.AsSpan(1, 5), array.AsSpan(0, 5))); @@ -307,7 +307,7 @@ public void Add_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Add_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Add_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Add(array.AsSpan(1, 2), array.AsSpan(5, 2), array.AsSpan(0, 2))); @@ -366,7 +366,7 @@ public void Add_TensorScalar_ThrowsForTooShortDestination() } [Fact] - public void Add_TensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void Add_TensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Add(array.AsSpan(1, 2), default(T), array.AsSpan(0, 2))); @@ -442,7 +442,7 @@ public void AddMultiply_ThreeTensors_ThrowsForTooShortDestination() } [Fact] - public void AddMultiply_ThreeTensors_ThrowsForOverlapppingInputsWithOutputs() + public void AddMultiply_ThreeTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => AddMultiply(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(7, 2), array.AsSpan(0, 2))); @@ -520,7 +520,7 @@ public void AddMultiply_TensorTensorScalar_ThrowsForTooShortDestination() } [Fact] - public void AddMultiply_TensorTensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void AddMultiply_TensorTensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => AddMultiply(array.AsSpan(1, 2), array.AsSpan(4, 2), default(T), array.AsSpan(0, 2))); @@ -596,7 +596,7 @@ public void AddMultiply_TensorScalarTensor_ThrowsForTooShortDestination() } [Fact] - public void AddMultiply_TensorScalarTensor_ThrowsForOverlapppingInputsWithOutputs() + public void AddMultiply_TensorScalarTensor_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => AddMultiply(array.AsSpan(1, 2), default(T), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -704,7 +704,7 @@ public void Cosh_ThrowsForTooShortDestination() } [Fact] - public void Cosh_ThrowsForOverlapppingInputsWithOutputs() + public void Cosh_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -876,7 +876,7 @@ public void Divide_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Divide_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Divide_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Divide(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -935,7 +935,7 @@ public void Divide_TensorScalar_ThrowsForTooShortDestination() } [Fact] - public void Divide_TensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void Divide_TensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Divide(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -1066,7 +1066,7 @@ public void Exp_ThrowsForTooShortDestination() } [Fact] - public void Exp_ThrowsForOverlapppingInputsWithOutputs() + public void Exp_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -1410,7 +1410,7 @@ public void Log_ThrowsForTooShortDestination() } [Fact] - public void Log_ThrowsForOverlapppingInputsWithOutputs() + public void Log_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -1495,7 +1495,7 @@ public void Log2_ThrowsForTooShortDestination() } [Fact] - public void Log2_ThrowsForOverlapppingInputsWithOutputs() + public void Log2_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -1682,7 +1682,7 @@ public void Max_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Max_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Max_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Max(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -1869,7 +1869,7 @@ public void MaxMagnitude_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void MaxMagnitude_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void MaxMagnitude_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => MaxMagnitude(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -2056,7 +2056,7 @@ public void Min_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Min_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Min_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Min(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -2241,7 +2241,7 @@ public void MinMagnitude_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void MinMagnitude_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void MinMagnitude_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => MinMagnitude(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -2315,7 +2315,7 @@ public void Multiply_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Multiply_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Multiply_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Multiply(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -2374,7 +2374,7 @@ public void Multiply_TensorScalar_ThrowsForTooShortDestination() } [Fact] - public void Multiply_TensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void Multiply_TensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Multiply(array.AsSpan(1, 2), default(T), array.AsSpan(0, 2))); @@ -2450,7 +2450,7 @@ public void MultiplyAdd_ThreeTensors_ThrowsForTooShortDestination() } [Fact] - public void MultiplyAdd_ThreeTensors_ThrowsForOverlapppingInputsWithOutputs() + public void MultiplyAdd_ThreeTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => MultiplyAdd(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(7, 2), array.AsSpan(0, 2))); @@ -2513,7 +2513,7 @@ public void MultiplyAdd_TensorTensorScalar_ThrowsForTooShortDestination() } [Fact] - public void MultiplyAdd_TensorTensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void MultiplyAdd_TensorTensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => MultiplyAdd(array.AsSpan(1, 2), array.AsSpan(4, 2), default(T), array.AsSpan(0, 2))); @@ -2574,7 +2574,7 @@ public void MultiplyAdd_TensorScalarTensor_ThrowsForTooShortDestination() } [Fact] - public void MultiplyAdd_TensorScalarTensor_ThrowsForOverlapppingInputsWithOutputs() + public void MultiplyAdd_TensorScalarTensor_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => MultiplyAdd(array.AsSpan(1, 2), default(T), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -2632,7 +2632,7 @@ public void Negate_ThrowsForTooShortDestination() } [Fact] - public void Negate_ThrowsForOverlapppingInputsWithOutputs() + public void Negate_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Negate(array.AsSpan(1, 2), array.AsSpan(0, 2))); @@ -2827,7 +2827,7 @@ public void Sigmoid_ThrowsForEmptyInput() } [Fact] - public void Sigmoid_ThrowsForOverlapppingInputsWithOutputs() + public void Sigmoid_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -2935,7 +2935,7 @@ public void Sinh_ThrowsForTooShortDestination() } [Fact] - public void Sinh_ThrowsForOverlapppingInputsWithOutputs() + public void Sinh_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -3019,7 +3019,7 @@ public void SoftMax_ThrowsForEmptyInput() } [Fact] - public void SoftMax_ThrowsForOverlapppingInputsWithOutputs() + public void SoftMax_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; @@ -3093,7 +3093,7 @@ public void Subtract_TwoTensors_ThrowsForTooShortDestination() } [Fact] - public void Subtract_TwoTensors_ThrowsForOverlapppingInputsWithOutputs() + public void Subtract_TwoTensors_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Subtract(array.AsSpan(1, 2), array.AsSpan(4, 2), array.AsSpan(0, 2))); @@ -3152,7 +3152,7 @@ public void Subtract_TensorScalar_ThrowsForTooShortDestination() } [Fact] - public void Subtract_TensorScalar_ThrowsForOverlapppingInputsWithOutputs() + public void Subtract_TensorScalar_ThrowsForOverlappingInputsWithOutputs() { T[] array = new T[10]; AssertExtensions.Throws("destination", () => Subtract(array.AsSpan(1, 2), default(T), array.AsSpan(0, 2))); @@ -3317,7 +3317,7 @@ public void Tanh_ThrowsForTooShortDestination() } [Fact] - public void Tanh_ThrowsForOverlapppingInputsWithOutputs() + public void Tanh_ThrowsForOverlappingInputsWithOutputs() { if (!IsFloatingPoint) return; diff --git a/src/libraries/System.Numerics.Tensors/tests/TensorTests.cs b/src/libraries/System.Numerics.Tensors/tests/TensorTests.cs index f1886069e056ce..b1ad7a4c2d78cf 100644 --- a/src/libraries/System.Numerics.Tensors/tests/TensorTests.cs +++ b/src/libraries/System.Numerics.Tensors/tests/TensorTests.cs @@ -988,6 +988,7 @@ public static void TensorSetSliceTests() Assert.Equal(13, t0[1, 3]); Assert.Equal(14, t0[1, 4]); } + [Fact] public static void TensorStackTests() { @@ -1074,6 +1075,47 @@ public static void TensorStackTests() Assert.Equal(8, resultTensor[1, 3, 1]); Assert.Equal(9, resultTensor[1, 4, 0]); Assert.Equal(9, resultTensor[1, 4, 1]); + + // stacking 2x2 tensors along dimension 1 + Tensor v1 = Tensor.Create([1, 2, 3, 4], [2, 2]); + Tensor v2 = Tensor.Create([10, 20, 30, 40], [2, 2]); + + resultTensor = Tensor.StackAlongDimension(1, [v1, v2]); + + Assert.Equal(3, resultTensor.Rank); + Assert.Equal(2, resultTensor.Lengths[0]); + Assert.Equal(2, resultTensor.Lengths[1]); + Assert.Equal(2, resultTensor.Lengths[2]); + + Assert.Equal(1, resultTensor[0, 0, 0]); + Assert.Equal(2, resultTensor[0, 0, 1]); + Assert.Equal(10, resultTensor[0, 1, 0]); + Assert.Equal(20, resultTensor[0, 1, 1]); + + Assert.Equal(3, resultTensor[1, 0, 0]); + Assert.Equal(4, resultTensor[1, 0, 1]); + Assert.Equal(30, resultTensor[1, 1, 0]); + Assert.Equal(40, resultTensor[1, 1, 1]); + + resultTensor = Tensor.StackAlongDimension(0, [v1, v2]); + + Tensor resultTensor2 = Tensor.Create([2, 2, 2]); + Tensor.StackAlongDimension([v1, v2], resultTensor2, 1); + + Assert.Equal(3, resultTensor2.Rank); + Assert.Equal(2, resultTensor2.Lengths[0]); + Assert.Equal(2, resultTensor2.Lengths[1]); + Assert.Equal(2, resultTensor2.Lengths[2]); + + Assert.Equal(1, resultTensor2[0, 0, 0]); + Assert.Equal(2, resultTensor2[0, 0, 1]); + Assert.Equal(10, resultTensor2[0, 1, 0]); + Assert.Equal(20, resultTensor2[0, 1, 1]); + + Assert.Equal(3, resultTensor2[1, 0, 0]); + Assert.Equal(4, resultTensor2[1, 0, 1]); + Assert.Equal(30, resultTensor2[1, 1, 0]); + Assert.Equal(40, resultTensor2[1, 1, 1]); } [Fact] diff --git a/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs b/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs index 80877852d6378d..2107bcf184f8d9 100644 --- a/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs +++ b/src/libraries/System.Numerics.Vectors/tests/Matrix4x4Tests.cs @@ -819,11 +819,38 @@ public void Matrix4x4CreateReflectionTest01() Vector3 v = point - pp; float d = Vector3.Dot(v, plane.Normal); Vector3 vp = point - 2.0f * d * plane.Normal; - Assert.True(MathHelper.Equal(rp, vp), "Matrix4x4.Reflection did not provide expected value."); + Assert.True(MathHelper.Equal(rp, vp), "Matrix4x4.CreateReflection did not provide expected value."); } } } + [Fact] + public void Matrix4x4CreateReflectionTest02() + { + Plane plane = new Plane(0, 1, 0, 60); + Matrix4x4 actual = Matrix4x4.CreateReflection(plane); + + AssertExtensions.Equal(1.0f, actual.M11, 0.0f); + AssertExtensions.Equal(0.0f, actual.M12, 0.0f); + AssertExtensions.Equal(0.0f, actual.M13, 0.0f); + AssertExtensions.Equal(0.0f, actual.M14, 0.0f); + + AssertExtensions.Equal(0.0f, actual.M21, 0.0f); + AssertExtensions.Equal(-1.0f, actual.M22, 0.0f); + AssertExtensions.Equal(0.0f, actual.M23, 0.0f); + AssertExtensions.Equal(0.0f, actual.M24, 0.0f); + + AssertExtensions.Equal(0.0f, actual.M31, 0.0f); + AssertExtensions.Equal(0.0f, actual.M32, 0.0f); + AssertExtensions.Equal(1.0f, actual.M33, 0.0f); + AssertExtensions.Equal(0.0f, actual.M34, 0.0f); + + AssertExtensions.Equal(0.0f, actual.M41, 0.0f); + AssertExtensions.Equal(-120.0f, actual.M42, 0.0f); + AssertExtensions.Equal(0.0f, actual.M43, 0.0f); + AssertExtensions.Equal(1.0f, actual.M44, 0.0f); + } + // A test for CreateRotationZ (float) [Fact] public void Matrix4x4CreateRotationZTest() diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs index c2eab851bd60e2..f8a075cc61c76f 100644 --- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.OverlappedValueTaskSource.Windows.cs @@ -35,7 +35,11 @@ private void TryToReuse(OverlappedValueTaskSource source) if (Interlocked.CompareExchange(ref _reusableOverlappedValueTaskSource, source, null) is not null) { - source._preallocatedOverlapped.Dispose(); + source.Dispose(); + } + else if (IsClosed) + { + Interlocked.Exchange(ref _reusableOverlappedValueTaskSource, null)?.Dispose(); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Convert.cs b/src/libraries/System.Private.CoreLib/src/System/Convert.cs index 8bf81152991ee8..62e4cd8412ab90 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Convert.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Convert.cs @@ -3099,7 +3099,7 @@ public static bool TryToHexString(ReadOnlySpan source, Span destinat charsWritten = 0; return true; } - else if (source.Length > int.MaxValue / 2 || destination.Length > source.Length * 2) + else if (source.Length > int.MaxValue / 2 || destination.Length < source.Length * 2) { charsWritten = 0; return false; @@ -3176,7 +3176,7 @@ public static bool TryToHexStringLower(ReadOnlySpan source, Span des charsWritten = 0; return true; } - else if (source.Length > int.MaxValue / 2 || destination.Length > source.Length * 2) + else if (source.Length > int.MaxValue / 2 || destination.Length < source.Length * 2) { charsWritten = 0; return false; diff --git a/src/libraries/System.Private.CoreLib/src/System/Half.cs b/src/libraries/System.Private.CoreLib/src/System/Half.cs index 73cf14403d59e8..a9159790641707 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Half.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Half.cs @@ -1568,7 +1568,7 @@ public static int ILogB(Half x) } Debug.Assert(IsSubnormal(x)); - return MinExponent - (BitOperations.TrailingZeroCount(x.TrailingSignificand) - BiasedExponentLength); + return MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - BiasedExponentLength); } return x.Exponent; diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs index e06187b5a3de54..147e3815812d0c 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Unix.cs @@ -168,37 +168,30 @@ internal static unsafe void WriteGatherAtOffset(SafeFileHandle handle, IReadOnly var handles = new MemoryHandle[buffersCount]; Span vectors = buffersCount <= IovStackThreshold ? - stackalloc Interop.Sys.IOVector[IovStackThreshold] : + stackalloc Interop.Sys.IOVector[IovStackThreshold].Slice(0, buffersCount) : new Interop.Sys.IOVector[buffersCount]; try { - int buffersOffset = 0, firstBufferOffset = 0; - while (true) + long totalBytesToWrite = 0; + for (int i = 0; i < buffersCount; i++) { - long totalBytesToWrite = 0; - - for (int i = buffersOffset; i < buffersCount; i++) - { - ReadOnlyMemory buffer = buffers[i]; - totalBytesToWrite += buffer.Length; - - MemoryHandle memoryHandle = buffer.Pin(); - vectors[i] = new Interop.Sys.IOVector { Base = firstBufferOffset + (byte*)memoryHandle.Pointer, Count = (UIntPtr)(buffer.Length - firstBufferOffset) }; - handles[i] = memoryHandle; - - firstBufferOffset = 0; - } + ReadOnlyMemory buffer = buffers[i]; + totalBytesToWrite += buffer.Length; - if (totalBytesToWrite == 0) - { - break; - } + MemoryHandle memoryHandle = buffer.Pin(); + vectors[i] = new Interop.Sys.IOVector { Base = (byte*)memoryHandle.Pointer, Count = (UIntPtr)buffer.Length }; + handles[i] = memoryHandle; + } + int buffersOffset = 0; + while (totalBytesToWrite > 0) + { long bytesWritten; - fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(vectors)) + Span left = vectors.Slice(buffersOffset); + fixed (Interop.Sys.IOVector* pinnedVectors = &MemoryMarshal.GetReference(left)) { - bytesWritten = Interop.Sys.PWriteV(handle, pinnedVectors, buffersCount, fileOffset); + bytesWritten = Interop.Sys.PWriteV(handle, pinnedVectors, left.Length, fileOffset); } FileStreamHelpers.CheckFileCall(bytesWritten, handle.Path); @@ -208,22 +201,31 @@ internal static unsafe void WriteGatherAtOffset(SafeFileHandle handle, IReadOnly } // The write completed successfully but for fewer bytes than requested. + // We need to perform next write where the previous one has finished. + fileOffset += bytesWritten; + totalBytesToWrite -= bytesWritten; // We need to try again for the remainder. - for (int i = 0; i < buffersCount; i++) + while (buffersOffset < buffersCount && bytesWritten > 0) { - int n = buffers[i].Length; + int n = (int)vectors[buffersOffset].Count; if (n <= bytesWritten) { - buffersOffset++; bytesWritten -= n; - if (bytesWritten == 0) - { - break; - } + buffersOffset++; } else { - firstBufferOffset = (int)(bytesWritten - n); + // A partial read: the vector needs to point to the new offset. + // But that offset needs to be relative to the previous attempt. + // Example: we have a single buffer with 30 bytes and the first read returned 10. + // The next read should try to read the remaining 20 bytes, but in case it also reads just 10, + // the third attempt should read last 10 bytes (not 20 again). + Interop.Sys.IOVector current = vectors[buffersOffset]; + vectors[buffersOffset] = new Interop.Sys.IOVector + { + Base = current.Base + (int)(bytesWritten), + Count = current.Count - (UIntPtr)(bytesWritten) + }; break; } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs index 3b02cf579934ba..56a72756f10be6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs @@ -435,7 +435,7 @@ internal static long ReadScatterAtOffset(SafeFileHandle handle, IReadOnlyList> buffers, long fileOffset) { // WriteFileGather does not support sync handles, so we just call WriteFile in a loop - int bytesWritten = 0; + long bytesWritten = 0; int buffersCount = buffers.Count; for (int i = 0; i < buffersCount; i++) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Math.cs b/src/libraries/System.Private.CoreLib/src/System/Math.cs index 32c3eee4712bfc..d87123697c9812 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Math.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Math.cs @@ -880,7 +880,7 @@ public static int ILogB(double x) } Debug.Assert(double.IsSubnormal(x)); - return double.MinExponent - (BitOperations.TrailingZeroCount(x.TrailingSignificand) - double.BiasedExponentLength); + return double.MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - double.BiasedExponentLength); } return x.Exponent; diff --git a/src/libraries/System.Private.CoreLib/src/System/MathF.cs b/src/libraries/System.Private.CoreLib/src/System/MathF.cs index 31e74906022666..6a26c29cfef535 100644 --- a/src/libraries/System.Private.CoreLib/src/System/MathF.cs +++ b/src/libraries/System.Private.CoreLib/src/System/MathF.cs @@ -210,7 +210,7 @@ public static int ILogB(float x) } Debug.Assert(float.IsSubnormal(x)); - return float.MinExponent - (BitOperations.TrailingZeroCount(x.TrailingSignificand) - float.BiasedExponentLength); + return float.MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - float.BiasedExponentLength); } return x.Exponent; diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs index 3a489f0fc1af0a..889311ca073028 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs @@ -620,7 +620,7 @@ public static Impl CreateReflection(in Plane value) // https://github.com/microsoft/DirectXMath/blob/master/Inc/DirectXMathMatrix.inl Vector4 p = Plane.Normalize(value).AsVector4(); - Vector4 s = p * -2.0f; + Vector4 s = p * Vector4.Create(-2.0f, -2.0f, -2.0f, 0.0f); Impl result; diff --git a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector_1.cs b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector_1.cs index e6cb7e1d4d4fab..9a0ddfb8d81549 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector_1.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Numerics/Vector_1.cs @@ -37,15 +37,10 @@ namespace System.Numerics /// Creates a new instance with all elements initialized to the specified value. /// The value that all elements will be initialized to. /// A new with all elements initialized to . - [Intrinsic] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Vector(T value) { - Unsafe.SkipInit(out this); - - for (int index = 0; index < Count; index++) - { - this.SetElementUnsafe(index, value); - } + this = Vector.Create(value); } /// Creates a new from a given array. diff --git a/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs b/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs index e7da2f788fa0de..8dca64953b18e3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs +++ b/src/libraries/System.Private.CoreLib/src/System/OperatingSystem.cs @@ -335,13 +335,19 @@ private static bool IsOSVersionAtLeast(int major, int minor, int build, int revi { return current.Minor > minor; } - if (current.Build != build) + // Unspecified build component is to be treated as zero + int currentBuild = current.Build < 0 ? 0 : current.Build; + build = build < 0 ? 0 : build; + if (currentBuild != build) { - return current.Build > build; + return currentBuild > build; } - return current.Revision >= revision - || (current.Revision == -1 && revision == 0); // it is unavailable on OSX and Environment.OSVersion.Version.Revision returns -1 + // Unspecified revision component is to be treated as zero + int currentRevision = current.Revision < 0 ? 0 : current.Revision; + revision = revision < 0 ? 0 : revision; + + return currentRevision >= revision; } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs index 5d1b79a3098e05..d59cde103713e5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs @@ -27,10 +27,26 @@ private static void GateThreadStart() bool debuggerBreakOnWorkStarvation = AppContextConfigHelper.GetBooleanConfig("System.Threading.ThreadPool.DebugBreakOnWorkerStarvation", false); + // CPU utilization is updated when the gate thread performs periodic activities (GateActivitiesPeriodMs), so + // that would also affect the actual interval. Set to 0 to disable using CPU utilization and have components + // behave as though CPU utilization is low. The default value of 1 causes CPU utilization to be updated whenever + // the gate thread performs periodic activities. + int cpuUtilizationIntervalMs = + AppContextConfigHelper.GetInt32Config( + "System.Threading.ThreadPool.CpuUtilizationIntervalMs", + "DOTNET_ThreadPool_CpuUtilizationIntervalMs", + defaultValue: 1, + allowNegative: false); + // The first reading is over a time range other than what we are focusing on, so we do not use the read other // than to send it to any runtime-specific implementation that may also use the CPU utilization. CpuUtilizationReader cpuUtilizationReader = default; - _ = cpuUtilizationReader.CurrentUtilization; + int lastCpuUtilizationRefreshTimeMs = 0; + if (cpuUtilizationIntervalMs > 0) + { + lastCpuUtilizationRefreshTimeMs = Environment.TickCount; + _ = cpuUtilizationReader.CurrentUtilization; + } PortableThreadPool threadPoolInstance = ThreadPoolInstance; LowLevelLock threadAdjustmentLock = threadPoolInstance._threadAdjustmentLock; @@ -102,8 +118,17 @@ private static void GateThreadStart() (uint)threadPoolInstance.GetAndResetHighWatermarkCountOfThreadsProcessingUserCallbacks()); } - int cpuUtilization = (int)cpuUtilizationReader.CurrentUtilization; - threadPoolInstance._cpuUtilization = cpuUtilization; + // Determine whether CPU utilization should be updated. CPU utilization is only used by the starvation + // heuristic and hill climbing, and neither of those are active when there is a pending blocking + // adjustment. + if (cpuUtilizationIntervalMs > 0 && + threadPoolInstance._pendingBlockingAdjustment == PendingBlockingAdjustment.None && + (uint)(currentTimeMs - lastCpuUtilizationRefreshTimeMs) >= (uint)cpuUtilizationIntervalMs) + { + lastCpuUtilizationRefreshTimeMs = currentTimeMs; + int cpuUtilization = (int)cpuUtilizationReader.CurrentUtilization; + threadPoolInstance._cpuUtilization = cpuUtilization; + } if (!disableStarvationDetection && threadPoolInstance._pendingBlockingAdjustment == PendingBlockingAdjustment.None && diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ProcessorIdCache.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ProcessorIdCache.cs index a31516c94f048a..25fac4050acf13 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ProcessorIdCache.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ProcessorIdCache.cs @@ -22,6 +22,10 @@ internal static class ProcessorIdCache // We will not adjust higher than this though. private const int MaxIdRefreshRate = 5000; + // a speed check will determine refresh rate of the cache and will report if caching is not advisable. + // we will record that in a readonly static so that it could become a JIT constant and bypass caching entirely. + private static readonly bool s_isProcessorNumberReallyFast = ProcessorIdCache.ProcessorNumberSpeedCheck(); + private static int RefreshCurrentProcessorId() { int currentProcessorId = Thread.GetCurrentProcessorNumber(); @@ -44,6 +48,9 @@ private static int RefreshCurrentProcessorId() [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static int GetCurrentProcessorId() { + if (s_isProcessorNumberReallyFast) + return Thread.GetCurrentProcessorNumber(); + int currentProcessorIdCache = t_currentProcessorIdCache--; if ((currentProcessorIdCache & ProcessorIdCacheCountDownMask) == 0) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs index 56d8acf0cd8ff4..f265970b506799 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs @@ -3056,6 +3056,27 @@ private bool SpinThenBlockingWait(int millisecondsTimeout, CancellationToken can bool returnValue = SpinWait(millisecondsTimeout); if (!returnValue) { +#if CORECLR + if (ThreadPoolWorkQueue.s_prioritizationExperiment) + { + // We're about to block waiting for the task to complete, which is expensive, and if + // the task being waited on depends on some other work to run, this thread could end up + // waiting for some other thread to do work. If the two threads are part of the same scheduler, + // such as the thread pool, that could lead to a (temporary) deadlock. This is made worse by + // it also leading to a possible priority inversion on previously queued work. Each thread in + // the thread pool has a local queue. A key motivator for this local queue is it allows this + // thread to create work items that it will then prioritize above all other work in the + // pool. However, while this thread makes its own local queue the top priority, that queue is + // every other thread's lowest priority. If this thread blocks, all of its created work that's + // supposed to be high priority becomes low priority, and work that's typically part of a + // currently in-flight operation gets deprioritized relative to new requests coming into the + // pool, which can lead to the whole system slowing down or even deadlocking. To address that, + // just before we block, we move all local work into a global queue, so that it's at least + // prioritized by other threads more fairly with respect to other work. + ThreadPoolWorkQueue.TransferAllLocalWorkItemsToHighPriorityGlobalQueue(); + } +#endif + var mres = new SetOnInvokeMres(); try { diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs index 7af434b641a34c..c68258fb1cbe4b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -713,16 +713,9 @@ public static void SetData(LocalDataStoreSlot slot, object? value) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetCurrentProcessorId() { - if (s_isProcessorNumberReallyFast) - return GetCurrentProcessorNumber(); - return ProcessorIdCache.GetCurrentProcessorId(); } - // a speed check will determine refresh rate of the cache and will report if caching is not advisable. - // we will record that in a readonly static so that it could become a JIT constant and bypass caching entirely. - private static readonly bool s_isProcessorNumberReallyFast = ProcessorIdCache.ProcessorNumberSpeedCheck(); - #if FEATURE_WASM_MANAGED_THREADS [ThreadStatic] public static bool ThrowOnBlockingWaitOnJSInteropThread; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs index 0f7fbc06a9a8eb..29cf2dce305657 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadInt64PersistentCounter.cs @@ -15,6 +15,7 @@ internal sealed class ThreadInt64PersistentCounter private static List? t_nodeFinalizationHelpers; private long _overflowCount; + private long _lastReturnedCount; // dummy node serving as a start and end of the ring list private readonly ThreadLocalNode _nodes; @@ -31,6 +32,13 @@ public static void Increment(object threadLocalCountObject) Unsafe.As(threadLocalCountObject).Increment(); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Decrement(object threadLocalCountObject) + { + Debug.Assert(threadLocalCountObject is ThreadLocalNode); + Unsafe.As(threadLocalCountObject).Decrement(); + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Add(object threadLocalCountObject, uint count) { @@ -76,6 +84,17 @@ public long Count count += node.Count; node = node._next; } + + // Ensure that the returned value is monotonically increasing + long lastReturnedCount = _lastReturnedCount; + if (count > lastReturnedCount) + { + _lastReturnedCount = count; + } + else + { + count = lastReturnedCount; + } } finally { @@ -134,6 +153,18 @@ public void Increment() OnAddOverflow(1); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Decrement() + { + if (_count != 0) + { + _count--; + return; + } + + OnAddOverflow(-1); + } + public void Add(uint count) { Debug.Assert(count != 0); @@ -149,7 +180,7 @@ public void Add(uint count) } [MethodImpl(MethodImplOptions.NoInlining)] - private void OnAddOverflow(uint count) + private void OnAddOverflow(long count) { Debug.Assert(count != 0); @@ -161,7 +192,7 @@ private void OnAddOverflow(uint count) counter._lock.Acquire(); try { - counter._overflowCount += (long)_count + count; + counter._overflowCount += _count + count; _count = 0; } finally diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs index bc0fe4556bb311..7660d427da63fd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPoolWorkQueue.cs @@ -701,6 +701,27 @@ public void EnqueueAtHighPriority(object workItem) EnsureThreadRequested(); } + internal static void TransferAllLocalWorkItemsToHighPriorityGlobalQueue() + { + // If there's no local queue, there's nothing to transfer. + if (ThreadPoolWorkQueueThreadLocals.threadLocals is not ThreadPoolWorkQueueThreadLocals tl) + { + return; + } + + // Pop each work item off the local queue and push it onto the global. This is a + // bounded loop as no other thread is allowed to push into this thread's queue. + ThreadPoolWorkQueue queue = ThreadPool.s_workQueue; + while (tl.workStealingQueue.LocalPop() is object workItem) + { + queue.highPriorityWorkItems.Enqueue(workItem); + } + + Volatile.Write(ref queue._mayHaveHighPriorityWorkItems, true); + + queue.EnsureThreadRequested(); + } + internal static bool LocalFindAndPop(object callback) { ThreadPoolWorkQueueThreadLocals? tl = ThreadPoolWorkQueueThreadLocals.threadLocals; @@ -1354,6 +1375,9 @@ void IThreadPoolWorkItem.Execute() Debug.Assert(stageBeforeUpdate != QueueProcessingStage.NotScheduled); if (stageBeforeUpdate == QueueProcessingStage.Determining) { + // Discount a work item here to avoid counting this queue processing work item + ThreadInt64PersistentCounter.Decrement( + ThreadPoolWorkQueueThreadLocals.threadLocals!.threadLocalCompletionCountObject!); return; } } @@ -1393,7 +1417,11 @@ void IThreadPoolWorkItem.Execute() currentThread.ResetThreadPoolThread(); } - ThreadInt64PersistentCounter.Add(tl.threadLocalCompletionCountObject!, completedCount); + // Discount a work item here to avoid counting this queue processing work item + if (completedCount > 1) + { + ThreadInt64PersistentCounter.Add(tl.threadLocalCompletionCountObject!, completedCount - 1); + } } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs index 8d47b1c1aaa1af..22a465deb5fb8c 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationReader.cs @@ -1682,6 +1682,11 @@ void Wrapper(object? collection, object? collectionItems) { if (member.Source == null && mapping.TypeDesc.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) { + // Always create a collection for (non-array) collection-like types, even if the XML data says the collection should be null. + if (!mapping.TypeDesc.IsArray) + { + member.Collection ??= new CollectionMember(); + } member.Source = (item) => { member.Collection ??= new CollectionMember(); @@ -1694,26 +1699,51 @@ void Wrapper(object? collection, object? collectionItems) if (member.Source == null) { + var isList = mapping.TypeDesc.IsArrayLike && !mapping.TypeDesc.IsArray; var pi = member.Mapping.MemberInfo as PropertyInfo; - if (pi != null && typeof(IList).IsAssignableFrom(pi.PropertyType) - && (pi.SetMethod == null || !pi.SetMethod.IsPublic)) + + // Here we have to deal with some special cases for property members. The old serializers would trip over + // private property setters generally - except in the case of list-like properties. Because lists get special + // treatment, a private setter for a list property would only be a problem if the default constructor didn't + // already create a list instance for the property. If it does create a list, then the serializer can still + // populate it. Try to emulate the old serializer behavior here. + + // First, for non-list properties, private setters are always a problem. + if (!isList && pi != null && pi.SetMethod != null && !pi.SetMethod.IsPublic) { - member.Source = (value) => + member.Source = (value) => throw new InvalidOperationException(SR.Format(SR.XmlReadOnlyPropertyError, pi.Name, pi.DeclaringType!.FullName)); + } + + // Next, for list properties, we need to handle not only the private setter case, but also the case where + // there is no setter at all. Because we need to give the default constructor a chance to create the list + // first before we make noise about not being able to set a list property. + else if (isList && pi != null && (pi.SetMethod == null || !pi.SetMethod.IsPublic)) + { + var addMethod = mapping.TypeDesc.Type!.GetMethod("Add"); + + if (addMethod != null) { - var getOnlyList = (IList)pi.GetValue(o)!; - if (value is IList valueList) + member.Source = (value) => { - foreach (var v in valueList) + var getOnlyList = pi.GetValue(o)!; + if (getOnlyList == null) { - getOnlyList.Add(v); + // No-setter lists should just be ignored if they weren't created by constructor. Private-setter lists are the noisy exception. + if (pi.SetMethod != null && !pi.SetMethod.IsPublic) + throw new InvalidOperationException(SR.Format(SR.XmlReadOnlyPropertyError, pi.Name, pi.DeclaringType!.FullName)); } - } - else - { - getOnlyList.Add(value); - } - }; + else if (value is IEnumerable valueList) + { + foreach (var v in valueList) + { + addMethod.Invoke(getOnlyList, new object[] { v }); + } + } + }; + } } + + // For all other members (fields, public setter properties, etc), just carry on as normal else { if (member.Mapping.Xmlns != null) @@ -1729,6 +1759,21 @@ void Wrapper(object? collection, object? collectionItems) member.Source = (value) => setterDelegate(o, value); } } + + // Finally, special list handling again. ANY list that we can assign/populate should be initialized with + // an empty list if it hasn't been initialized already. Even if the XML data says the list should be null. + // This is an odd legacy behavior, but it's what the old serializers did. + if (isList && member.Source != null) + { + member.EnsureCollection = (obj) => + { + if (GetMemberValue(obj, mapping.MemberInfo!) == null) + { + var empty = ReflectionCreateObject(mapping.TypeDesc.Type!); + member.Source(empty); + } + }; + } } if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite) @@ -1782,23 +1827,29 @@ void Wrapper(object elementNameObject) WriteAttributes(allMembers, anyAttribute, unknownNodeAction, ref o); Reader.MoveToElement(); + if (Reader.IsEmptyElement) { Reader.Skip(); - return o; } - - Reader.ReadStartElement(); - bool IsSequenceAllMembers = IsSequence(); - if (IsSequenceAllMembers) + else { - // https://github.com/dotnet/runtime/issues/1402: - // Currently the reflection based method treat this kind of type as normal types. - // But potentially we can do some optimization for types that have ordered properties. - } + Reader.ReadStartElement(); + bool IsSequenceAllMembers = IsSequence(); + if (IsSequenceAllMembers) + { + // https://github.com/dotnet/runtime/issues/1402: + // Currently the reflection based method treat this kind of type as normal types. + // But potentially we can do some optimization for types that have ordered properties. + } - WriteMembers(allMembers, unknownNodeAction, unknownNodeAction, anyElementMember, anyTextMember); + WriteMembers(allMembers, unknownNodeAction, unknownNodeAction, anyElementMember, anyTextMember); + ReadEndElement(); + } + + // Empty element or not, we need to ensure all our array-like members have been initialized in the same + // way as the IL / CodeGen - based serializers. foreach (Member member in allMembers) { if (member.Collection != null) @@ -1810,9 +1861,10 @@ void Wrapper(object elementNameObject) var setMemberValue = GetSetMemberValueDelegate(o, memberInfo.Name); setMemberValue(o, collection); } + + member.EnsureCollection?.Invoke(o!); } - ReadEndElement(); return o; } } @@ -2090,6 +2142,7 @@ internal sealed class Member public Action? CheckSpecifiedSource; public Action? ChoiceSource; public Action? XmlnsSource; + public Action? EnsureCollection; public Member(MemberMapping mapping) { diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationWriter.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationWriter.cs index 178591cc6dcc22..ecfe693f4f1b84 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationWriter.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/ReflectionXmlSerializationWriter.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Reflection; using System.Text; using System.Xml.Schema; @@ -125,7 +126,7 @@ private void WriteMember(object? o, object? choiceSource, ElementAccessor[] elem } else { - WriteElements(o, elements, text, choice, writeAccessors, memberTypeDesc.IsNullable); + WriteElements(o, choiceSource, elements, text, choice, writeAccessors, memberTypeDesc.IsNullable); } } @@ -150,11 +151,11 @@ private void WriteArray(object o, object? choiceSource, ElementAccessor[] elemen } } - WriteArrayItems(elements, text, choice, o); + WriteArrayItems(elements, text, choice, o, choiceSource); } [RequiresUnreferencedCode("calls WriteElements")] - private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, ChoiceIdentifierAccessor? choice, object o) + private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, ChoiceIdentifierAccessor? choice, object o, object? choiceSources) { var arr = o as IList; @@ -163,7 +164,8 @@ private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, Cho for (int i = 0; i < arr.Count; i++) { object? ai = arr[i]; - WriteElements(ai, elements, text, choice, true, true); + var choiceSource = ((Array?)choiceSources)?.GetValue(i); + WriteElements(ai, choiceSource, elements, text, choice, true, true); } } else @@ -174,17 +176,18 @@ private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, Cho IEnumerator e = a.GetEnumerator(); if (e != null) { + int c = 0; while (e.MoveNext()) { object ai = e.Current; - WriteElements(ai, elements, text, choice, true, true); + var choiceSource = ((Array?)choiceSources)?.GetValue(c++); + WriteElements(ai, choiceSource, elements, text, choice, true, true); } } } } - [RequiresUnreferencedCode("calls CreateUnknownTypeException")] - private void WriteElements(object? o, ElementAccessor[] elements, TextAccessor? text, ChoiceIdentifierAccessor? choice, bool writeAccessors, bool isNullable) + private void WriteElements(object? o, object? choiceSource, ElementAccessor[] elements, TextAccessor? text, ChoiceIdentifierAccessor? choice, bool writeAccessors, bool isNullable) { if (elements.Length == 0 && text == null) return; @@ -222,16 +225,35 @@ private void WriteElements(object? o, ElementAccessor[] elements, TextAccessor? } else if (choice != null) { - if (o != null && o.GetType() == element.Mapping!.TypeDesc!.Type) + // This looks heavy - getting names of enums in string form for comparison rather than just comparing values. + // But this faithfully mimics NetFx, and is necessary to prevent confusion between different enum types. + // ie EnumType.ValueX could == 1, but TotallyDifferentEnumType.ValueY could also == 1. + TypeDesc td = element.Mapping!.TypeDesc!; + bool enumUseReflection = choice.Mapping!.TypeDesc!.UseReflection; + string enumTypeName = choice.Mapping!.TypeDesc!.FullName; + string enumFullName = (enumUseReflection ? "" : enumTypeName + ".@") + FindChoiceEnumValue(element, (EnumMapping)choice.Mapping, enumUseReflection); + string choiceFullName = (enumUseReflection ? "" : choiceSource!.GetType().FullName + ".@") + choiceSource!.ToString(); + + if (choiceFullName == enumFullName) { - WriteElement(o, element, writeAccessors); - return; + // Object is either non-null, or it is allowed to be null + if (o != null || (!isNullable || element.IsNullable)) + { + // But if Object is non-null, it's got to match types + if (o != null && !td.Type!.IsAssignableFrom(o!.GetType())) + { + throw CreateMismatchChoiceException(td.FullName, choice.MemberName!, enumFullName); + } + + WriteElement(o, element, writeAccessors); + return; + } } } else { TypeDesc td = element.IsUnbounded ? element.Mapping!.TypeDesc!.CreateArrayTypeDesc() : element.Mapping!.TypeDesc!; - if (o!.GetType() == td.Type) + if (td.Type!.IsAssignableFrom(o!.GetType())) { WriteElement(o, element, writeAccessors); return; @@ -280,6 +302,58 @@ private void WriteElements(object? o, ElementAccessor[] elements, TextAccessor? } } + private static string FindChoiceEnumValue(ElementAccessor element, EnumMapping choiceMapping, bool useReflection) + { + string? enumValue = null; + + for (int i = 0; i < choiceMapping.Constants!.Length; i++) + { + string xmlName = choiceMapping.Constants[i].XmlName; + + if (element.Any && element.Name.Length == 0) + { + if (xmlName == "##any:") + { + if (useReflection) + enumValue = choiceMapping.Constants[i].Value.ToString(CultureInfo.InvariantCulture); + else + enumValue = choiceMapping.Constants[i].Name; + break; + } + continue; + } + int colon = xmlName.LastIndexOf(':'); + string? choiceNs = colon < 0 ? choiceMapping.Namespace : xmlName.Substring(0, colon); + string choiceName = colon < 0 ? xmlName : xmlName.Substring(colon + 1); + + if (element.Name == choiceName) + { + if ((element.Form == XmlSchemaForm.Unqualified && string.IsNullOrEmpty(choiceNs)) || element.Namespace == choiceNs) + { + if (useReflection) + enumValue = choiceMapping.Constants[i].Value.ToString(CultureInfo.InvariantCulture); + else + enumValue = choiceMapping.Constants[i].Name; + break; + } + } + } + + if (string.IsNullOrEmpty(enumValue)) + { + if (element.Any && element.Name.Length == 0) + { + // Type {0} is missing enumeration value '##any' for XmlAnyElementAttribute. + throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, choiceMapping.TypeDesc!.FullName)); + } + // Type {0} is missing value for '{1}'. + throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, choiceMapping.TypeDesc!.FullName, element.Namespace + ":" + element.Name, element.Name, element.Namespace)); + } + if (!useReflection) + CodeIdentifier.CheckValidIdentifier(enumValue); + return enumValue; + } + private void WriteText(object o, TextAccessor text) { if (text.Mapping is PrimitiveMapping primitiveMapping) @@ -376,7 +450,7 @@ private void WriteElement(object? o, ElementAccessor element, bool writeAccessor if (o != null) { WriteStartElement(name, ns, false); - WriteArrayItems(mapping.ElementsSortedByDerivation!, null, null, o); + WriteArrayItems(mapping.ElementsSortedByDerivation!, null, null, o, null); WriteEndElement(); } } diff --git a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs index 71bd696e6f0e53..e58535876c0c26 100644 --- a/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs +++ b/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializer.cs @@ -379,7 +379,6 @@ public void Serialize(XmlWriter xmlWriter, object? o, XmlSerializerNamespaces? n } else if (_tempAssembly == null || _typedSerializer) { - // The contion for the block is never true, thus the block is never hit. XmlSerializationWriter writer = CreateWriter(); writer.Init(xmlWriter, namespaces == null || namespaces.Count == 0 ? DefaultNamespaces : namespaces, encodingStyle, id); Serialize(o, writer); diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs index 9fa615c142d72c..6e30166765ca0c 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.RuntimeOnly.cs @@ -884,6 +884,39 @@ public static void Xml_XmlDocumentAsRoot() Assert.Equal(expected.OuterXml, actual.OuterXml); } + [Fact] + public static void Xml_TestTypeWithPrivateOrNoSetters() + { + // Private setters are a problem. Traditional XmlSerializer doesn't know what to do with them. + // This should fail when constructing the serializer. +#if ReflectionOnly + // For the moment, the reflection-based serializer doesn't throw until it does deserialization, because + // it doesn't do xml/type mapping in the constructor. This should change in the future with improvements to + // the reflection-based serializer that frontloads more work to make the actual serialization faster. + var ex = Record.Exception(() => SerializeAndDeserialize(new TypeWithPrivateSetters(39), "", null, true)); + ex = AssertTypeAndUnwrap(ex); +#else + var ex = Record.Exception(() => new XmlSerializer(typeof(TypeWithPrivateSetters))); +#endif + Assert.IsType(ex); + Assert.Equal("Cannot deserialize type 'SerializationTypes.TypeWithPrivateSetters' because it contains property 'PrivateSetter' which has no public setter.", ex.Message); + + // If there is no setter at all though, traditional XmlSerializer just doesn't include the property in the serialization. + // Therefore, the following should work. Although the serialized output isn't really worth much. + var noSetter = new TypeWithNoSetters(25); + var actualNoSetter = SerializeAndDeserialize(noSetter, "\r\n"); + Assert.NotNull(actualNoSetter); + Assert.StrictEqual(25, noSetter.NoSetter); + Assert.StrictEqual(200, actualNoSetter.NoSetter); // 200 is what the default constructor sets it to. + + // But private setters aren't a problem if the class is ISerializable. + var value = new TypeWithPrivateOrNoSettersButIsIXmlSerializable(32, 52); + var actual = SerializeAndDeserialize(value, "\r\n\r\n 32\r\n 52\r\n"); + Assert.NotNull(actual); + Assert.StrictEqual(value.PrivateSetter, actual.PrivateSetter); + Assert.StrictEqual(value.NoSetter, actual.NoSetter); + } + [Fact] public static void Xml_TestTypeWithListPropertiesWithoutPublicSetters() { @@ -915,6 +948,7 @@ public static void Xml_TestTypeWithListPropertiesWithoutPublicSetters() AnotherFoo + "); Assert.StrictEqual(value.PropertyWithXmlElementAttribute.Count, actual.PropertyWithXmlElementAttribute.Count); Assert.Equal(value.PropertyWithXmlElementAttribute[0], actual.PropertyWithXmlElementAttribute[0]); @@ -928,6 +962,143 @@ public static void Xml_TestTypeWithListPropertiesWithoutPublicSetters() Assert.Equal(value.AnotherStringList[0], actual.AnotherStringList[0]); Assert.StrictEqual(value.PublicIntListField[0], actual.PublicIntListField[0]); Assert.StrictEqual(value.PublicIntListFieldWithXmlElementAttribute[0], actual.PublicIntListFieldWithXmlElementAttribute[0]); + // In an annoyingly inconsistent behavior, if a list property does not have a setter at all, the serializer is smart enough to + // not try to set an empty list. So the property will be either empty or null depending on how the default constructor leaves it. + Assert.Null(actual.AlwaysNullList); + Assert.Null(actual.AlwaysNullNullableList); + // Fields are always settable though, so the serializer always takes that liberty. *smh* + Assert.Empty(actual.AlwaysNullStringListField); + Assert.Empty(actual.AlwaysNullIntListFieldWithXmlElementAttribute); + + // Try with an empty list + value = new TypeWithListPropertiesWithoutPublicSetters(); + actual = SerializeAndDeserialize(value, +@" + + + + + + +"); + Assert.NotNull(actual); + Assert.Empty(actual.PublicIntListField); + Assert.Empty(actual.IntList); + Assert.Empty(actual.StringList); + Assert.Empty(actual.AnotherStringList); + Assert.Empty(actual.PropertyWithXmlElementAttribute); + // In an annoyingly inconsistent behavior, if a list property does not have a setter at all, the serializer is smart enough to + // not try to set an empty list. So the property will be either empty or null depending on how the default constructor leaves it. + Assert.Empty(actual.PublicIntListFieldWithXmlElementAttribute); + Assert.Null(actual.AlwaysNullList); + Assert.Null(actual.AlwaysNullNullableList); + // Fields are always settable though, so the serializer always takes that liberty. *smh* + Assert.Empty(actual.AlwaysNullStringListField); + Assert.Empty(actual.AlwaysNullIntListFieldWithXmlElementAttribute); + + // And also try with a null list + value = new TypeWithListPropertiesWithoutPublicSetters(createLists: false); + actual = SerializeAndDeserialize(value, +@" + + + + +"); + Assert.NotNull(actual); + Assert.Empty(actual.PublicIntListField); + Assert.Empty(actual.IntList); + Assert.Empty(actual.StringList); + Assert.Empty(actual.AnotherStringList); + Assert.Empty(actual.PropertyWithXmlElementAttribute); + // In an annoyingly inconsistent behavior, if a list property does not have a setter at all, the serializer is smart enough to + // not try to set an empty list. So the property will be either empty or null depending on how the default constructor leaves it. + Assert.Empty(actual.PublicIntListFieldWithXmlElementAttribute); + Assert.Null(actual.AlwaysNullList); + Assert.Null(actual.AlwaysNullNullableList); + // Fields are always settable though, so the serializer always takes that liberty. *smh* + Assert.Empty(actual.AlwaysNullStringListField); + Assert.Empty(actual.AlwaysNullIntListFieldWithXmlElementAttribute); + + // And finally, a corner case where "private-setter" property is left null by the default constructor, but the serializer sees it as null + // and thinks it can call the private setter, so it tries to make it empty and fails. But again, note that the fields and + // no-setter-at-all properties that come first do not cause the failure. + var cannotDeserialize = new TypeWithGetOnlyListsThatDoNotInitialize(); + var ex = Record.Exception(() => + { + SerializeAndDeserialize(cannotDeserialize, +@" +"); + }); + ex = AssertTypeAndUnwrap(ex); + // Attempt by method 'Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderTypeWithGetOnlyListsThatDoNotInitialize.Read2_Item(Boolean, Boolean)' to access method 'SerializationTypes.TypeWithGetOnlyListsThatDoNotInitialize.set_AlwaysNullPropertyPrivateSetter(System.Collections.Generic.List`1)' failed. + Assert.Contains("AlwaysNullPropertyPrivateSetter", ex.Message); + } + + [Fact] + public static void Xml_HiddenMembersChangeMappings() + { + var baseValue = new BaseWithElementsAttributesPropertiesAndLists() { StringField = "BString", TextField = "BText", ListField = new () { "one", "two" }, ListProp = new () { "three" } }; + var baseActual = SerializeAndDeserialize(baseValue, "\r\n\r\n BString\r\n \r\n one\r\n two\r\n \r\n \r\n three\r\n \r\n"); + Assert.IsType(baseActual); + Assert.Equal(baseValue.StringField, baseActual.StringField); + Assert.Equal(baseValue.TextField, baseActual.TextField); + Assert.Equal(baseValue.ListProp.ToArray(), baseActual.ListProp.ToArray()); + Assert.Equal(baseValue.ListField.ToArray(), baseActual.ListField.ToArray()); + + var value1 = new HideElementWithAttribute() { StringField = "DString" }; + ((BaseWithElementsAttributesPropertiesAndLists)value1).Copy(baseValue); + var ex = Record.Exception(() => { SerializeAndDeserialize(value1, null); }); + AssertXmlMappingException(ex, "SerializationTypes.HideElementWithAttribute", "StringField", "Member 'HideElementWithAttribute.StringField' hides inherited member 'BaseWithElementsAttributesPropertiesAndLists.StringField', but has different custom attributes."); + + var value2 = new HideAttributeWithElement() { TextField = "DText" }; + ((BaseWithElementsAttributesPropertiesAndLists)value2).Copy(baseValue); + ex = Record.Exception(() => { SerializeAndDeserialize(value2, null); }); + AssertXmlMappingException(ex, "SerializationTypes.HideAttributeWithElement", "TextField", "Member 'HideAttributeWithElement.TextField' hides inherited member 'BaseWithElementsAttributesPropertiesAndLists.TextField', but has different custom attributes."); + + var value3 = new HideWithNewType() { TextField = 3 }; + ((BaseWithElementsAttributesPropertiesAndLists)value3).Copy(baseValue); + ex = Record.Exception(() => { SerializeAndDeserialize(value3, null); }); + AssertXmlMappingException(ex, "SerializationTypes.HideWithNewType", "TextField", "Member HideWithNewType.TextField of type System.Int32 hides base class member BaseWithElementsAttributesPropertiesAndLists.TextField of type System.String. Use XmlElementAttribute or XmlAttributeAttribute to specify a new name."); + + var value4 = new HideWithNewName() { StringField = "DString" }; + ((BaseWithElementsAttributesPropertiesAndLists)value4).Copy(baseValue); + ex = Record.Exception(() => { SerializeAndDeserialize(value4, null); }); + AssertXmlMappingException(ex, "SerializationTypes.HideWithNewName", "StringField", "Member 'HideWithNewName.StringField' hides inherited member 'BaseWithElementsAttributesPropertiesAndLists.StringField', but has different custom attributes."); + + /* This scenario fails before .Net 10 because the process for xml mapping types incorrectly + * fails to account for hidden members. In this case, 'ListField' actually gets serialized as + * an 'XmlArray' instead of a series of 'XmlElement', because the hidden base-member is an 'XmlArray'. + * Let's just skip this scenario. It's live in .Net 10. + // Funny tricks can be played with XmlArray/Element when it comes to Lists though. + // Stuff kind of doesn't blow up, but hidden members still get left out. + var value5 = new HideArrayWithElement() { ListField = new() { "ONE", "TWO", "THREE" } }; + ((BaseWithElementsAttributesPropertiesAndLists)value5).Copy(baseValue); + var actual5 = SerializeAndDeserialize(value5, +@" + + BString + ONE + TWO + THREE + + three + +"); + Assert.IsType(actual5); + Assert.Equal(value5.StringField, actual5.StringField); + Assert.Equal(value5.TextField, actual5.TextField); + Assert.Equal(value5.ListProp.ToArray(), actual5.ListProp.ToArray()); + Assert.Equal(value5.ListField.ToArray(), actual5.ListField.ToArray()); + // Not only are the hidden values not serialized, but the serialzier doesn't even try to do it's empty list thing + Assert.Null(((BaseWithElementsAttributesPropertiesAndLists)actual5).ListField); + */ + + // But at the end of the day, you still can't get away with changing the name of the element + var value6 = new HideArrayWithRenamedElement() { ListField = new() { "FOUR", "FIVE" } }; + ((BaseWithElementsAttributesPropertiesAndLists)value6).Copy(baseValue); + ex = Record.Exception(() => { SerializeAndDeserialize(value6, null); }); + AssertXmlMappingException(ex, "SerializationTypes.HideArrayWithRenamedElement", "ListField", "Member 'HideArrayWithRenamedElement.ListField' hides inherited member 'BaseWithElementsAttributesPropertiesAndLists.ListField', but has different custom attributes."); } [Fact] @@ -1273,6 +1444,7 @@ public static void Xml_TypeWithMultiXmlAnyElement() Assert.NotNull(actual.Things); Assert.Equal(value.Things.Length, actual.Things.Length); + // Try with an unexpected namespace var expectedElem = (XmlElement)value.Things[1]; var actualElem = (XmlElement)actual.Things[1]; Assert.Equal(expectedElem.Name, actualElem.Name); @@ -1287,6 +1459,26 @@ public static void Xml_TypeWithMultiXmlAnyElement() }; Assert.Throws(() => actual = SerializeAndDeserialize(value, string.Empty, skipStringCompare: true)); + + // Try with no elements + value = new TypeWithMultiNamedXmlAnyElement() + { + Things = new object[] { } + }; + actual = SerializeAndDeserialize(value, + "\r\n"); + Assert.NotNull(actual); + Assert.Null(actual.Things); + + // Try with a null list + value = new TypeWithMultiNamedXmlAnyElement() + { + Things = null + }; + actual = SerializeAndDeserialize(value, + "\r\n"); + Assert.NotNull(actual); + Assert.Null(actual.Things); } @@ -2531,7 +2723,7 @@ public static void XmlMembersMapping_With_ChoiceIdentifier() string ns = s_defaultNs; string memberName1 = "items"; XmlReflectionMember member1 = GetReflectionMemberNoXmlElement(memberName1, ns); - PropertyInfo itemProperty = typeof(TypeWithPropertyHavingChoice).GetProperty("ManyChoices"); + FieldInfo itemProperty = typeof(TypeWithArrayPropertyHavingChoice).GetField("ManyChoices"); member1.XmlAttributes = new XmlAttributes(itemProperty); string memberName2 = "ChoiceArray"; @@ -2556,6 +2748,202 @@ public static void XmlMembersMapping_With_ChoiceIdentifier() Assert.True(items.SequenceEqual(actualItems)); } + [Fact] + public static void XmlMembersMapping_With_ComplexChoiceIdentifier() + { + string ns = s_defaultNs; + string memberName1 = "items"; + XmlReflectionMember member1 = GetReflectionMemberNoXmlElement(memberName1, ns); + FieldInfo itemProperty = typeof(TypeWithPropertyHavingComplexChoice).GetField("ManyChoices"); + member1.XmlAttributes = new XmlAttributes(itemProperty); + + string memberName2 = "ChoiceArray"; + XmlReflectionMember member2 = GetReflectionMemberNoXmlElement(memberName2, ns); + member2.XmlAttributes.XmlIgnore = true; + + var members = new XmlReflectionMember[] { member1, member2 }; + + object[] items = { new ComplexChoiceB { Name = "Beef" }, 5 }; + var itemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount }; + object[] value = { items, itemChoices }; + + object[] actual = RoundTripWithXmlMembersMapping(value, + "\r\n\r\n \r\n Beef\r\n \r\n 5\r\n", + false, + members, + wrapperName: "wrapper"); + + Assert.NotNull(actual); + var actualItems = actual[0] as object[]; + Assert.NotNull(actualItems); + Assert.True(items.SequenceEqual(actualItems)); + + object[] itemsWithNull = { null, 5 }; + object[] valueWithNull = { itemsWithNull, itemChoices }; + + actual = RoundTripWithXmlMembersMapping(valueWithNull, + "\r\n\r\n 5\r\n", + false, + members, + wrapperName: "wrapper"); + + Assert.NotNull(actual); + actualItems = actual[0] as object[]; + // TODO: Ugh. Is losing a 'null' element of the choice array data loss? + // Probably. But that's what NetFx and ILGen do. :( + Assert.Single(actualItems); + Assert.Equal(5, actualItems[0]); + Assert.NotNull(actualItems); + } + + [Fact] + public static void XmlMembersMapping_With_ChoiceErrors() + { + string ns = s_defaultNs; + string memberName1 = "items"; + XmlReflectionMember member1 = GetReflectionMemberNoXmlElement(memberName1, ns); + FieldInfo itemProperty = typeof(TypeWithPropertyHavingComplexChoice).GetField("ManyChoices"); + member1.XmlAttributes = new XmlAttributes(itemProperty); + + string memberName2 = "ChoiceArray"; + XmlReflectionMember member2 = GetReflectionMemberNoXmlElement(memberName2, ns); + member2.XmlAttributes.XmlIgnore = true; + + var members = new XmlReflectionMember[] { member1, member2 }; + + // XmlChoiceMismatchChoiceException + object[] items = { new ComplexChoiceB { Name = "Beef" }, "not integer 5" }; + var itemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount }; + object[] value = { items, itemChoices }; + + var ex = Record.Exception(() => { + RoundTripWithXmlMembersMapping(value, null, true, members, wrapperName: "wrapper"); + }); + ex = AssertTypeAndUnwrap(ex); + Assert.IsType(ex); + Assert.Contains("mismatches the type of ", ex.Message); + + // XmlChoiceMissingValue + object[] newItems = { "random string", new ComplexChoiceB { Name = "Beef" }, 5 }; + object[] newValue = { newItems, itemChoices }; + + ex = Record.Exception(() => { + RoundTripWithXmlMembersMapping(newValue, null, true, members, wrapperName: "wrapper"); + }); + ex = AssertTypeAndUnwrap(ex); + Assert.IsType(ex); + Assert.Contains("Invalid or missing value of the choice identifier", ex.Message); + + // XmlChoiceMissingValue + FieldInfo missingItemProperty = typeof(TypeWithPropertyHavingChoiceError).GetField("ManyChoices"); + member1.XmlAttributes = new XmlAttributes(missingItemProperty); + + object[] missingItems = { new ComplexChoiceB { Name = "Beef" }, 5, "not_a_choice" }; + var missingItemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount, MoreChoices.None }; + object[] missingValue = { missingItems, missingItemChoices }; + + ex = Record.Exception(() => { + RoundTripWithXmlMembersMapping(missingValue, null, true, members, wrapperName: "wrapper"); + }); + ex = AssertTypeAndUnwrap(ex); + Assert.IsType(ex); + Assert.Contains("is missing enumeration value", ex.Message); + } + + [Fact] + public static void Xml_TypeWithArrayPropertyHavingChoiceErrors() + { + MoreChoices[] itemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount }; + + // XmlChoiceMismatchChoiceException + object[] mismatchedChoices = new object[] { new ComplexChoiceB { Name = "Beef" }, "not integer 5" }; + var mismatchedValue = new TypeWithPropertyHavingComplexChoice() { ManyChoices = mismatchedChoices, ChoiceArray = itemChoices }; + var ex = Record.Exception(() => { + Serialize(mismatchedValue, null); + }); + ex = AssertTypeAndUnwrap(ex); + Assert.IsType(ex); + Assert.Contains("mismatches the type of ", ex.Message); + + // XmlChoiceMissingValue + object[] missingChoice = { "random string", new ComplexChoiceB { Name = "Beef" }, 5 }; + var missingValue = new TypeWithPropertyHavingComplexChoice() { ManyChoices = missingChoice, ChoiceArray = itemChoices }; + ex = Record.Exception(() => { + Serialize(missingValue, null); + }); + ex = AssertTypeAndUnwrap(ex); + Assert.IsType(ex); + Assert.Contains("Invalid or missing value of the choice identifier", ex.Message); + + // XmlChoiceMissingValue + object[] invalidChoiceValues = { new ComplexChoiceB { Name = "Beef" }, 5, "not_a_choice" }; + MoreChoices[] invalidChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount, MoreChoices.None }; + var invalidChoiceValue = new TypeWithPropertyHavingChoiceError() { ManyChoices = invalidChoiceValues, ChoiceArray = invalidChoices }; + ex = Record.Exception(() => { + Serialize(invalidChoiceValue, null); + }); +#if ReflectionOnly + // The ILGen Serializer does XmlMapping during serializer ctor and lets the exception out cleanly. + // The Reflection Serializer does XmlMapping in the Serialize() call and wraps the resulting exception + // inside a catch-all IOE in Serialize(). + ex = AssertTypeAndUnwrap(ex, "There was an error generating the XML document"); +#endif + ex = AssertTypeAndUnwrap(ex, "TypeWithPropertyHavingChoiceError"); // There was an error reflecting type... + ex = AssertTypeAndUnwrap(ex, "ManyChoices"); // There was an error reflecting field... + Assert.IsType(ex); + Assert.Contains("is missing enumeration value", ex.Message); + } + + [Fact] + public static void Xml_XmlIncludedTypesInTypedCollection() + { + var value = new List() { + new BaseClass() { Value = "base class" }, + new DerivedClass() { Value = "derived class" } + }; + var actual = SerializeAndDeserialize>(value, +@" + + + base class + + + derived class + +"); + + Assert.NotNull(actual); + Assert.Equal(2, actual.Count); + Assert.Equal("base class", actual[0].Value); + Assert.IsType(actual[0]); + Assert.IsType(actual[1]); + // BaseClass.Value is hidden - not overridden - by DerivedClass.Value, so it shows when accessed as a BaseClass. + Assert.Null(actual[1].Value); + Assert.Equal("derived class", ((DerivedClass)actual[1]).Value); + } + + [Fact] + public static void Xml_XmlIncludedTypesInTypedCollectionSingle() + { + var value = new List() { + new DerivedClass() { Value = "derived class" } + }; + var actual = SerializeAndDeserialize>(value, +@" + + + derived class + +"); + + Assert.NotNull(actual); + Assert.Single(actual); + Assert.IsType(actual[0]); + // BaseClass.Value is hidden - not overridden - by DerivedClass.Value, so it shows when accessed as a BaseClass. + Assert.Null(actual[0].Value); + Assert.Equal("derived class", ((DerivedClass)actual[0]).Value); + } + [Fact] public static void XmlMembersMapping_MultipleMembers() { diff --git a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs index 44453deb7d0035..a093f3cce2d43b 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs @@ -161,6 +161,27 @@ public static void Xml_ArrayAsGetSet() Assert.Equal(x.F2, y.F2); Utils.Equal(x.P1, y.P1, (a, b) => { return SimpleType.AreEqual(a, b); }); Assert.Equal(x.P2, y.P2); + + // Do it again with null and empty arrays + x = new TypeWithGetSetArrayMembers + { + F1 = null, + F2 = new int[] { }, + P1 = new SimpleType[] { }, + P2 = null + }; + y = SerializeAndDeserialize(x, +@" + + + +"); + + Assert.NotNull(y); + Assert.Null(y.F1); // Arrays stay null + Assert.Empty(y.F2); + Assert.Empty(y.P1); + Assert.Null(y.P2); // Arrays stay null } [Fact] @@ -172,15 +193,57 @@ public static void Xml_ArrayAsGetOnly() x.P2[0] = -1; x.P2[1] = 3; - TypeWithGetOnlyArrayProperties y = SerializeAndDeserialize(x, -@" -"); + TypeWithGetOnlyArrayProperties y = SerializeAndDeserialize(x, @""); Assert.NotNull(y); // XmlSerializer seems not complain about missing public setter of Array property // However, it does not serialize the property. So for this test case, I'll use it to verify there are no complaints about missing public setter } + [Fact] + public static void Xml_ArraylikeMembers() + { + var assertEqual = (TypeWithArraylikeMembers a, TypeWithArraylikeMembers b) => { + Assert.Equal(a.IntAField, b.IntAField); + Assert.Equal(a.NIntAField, b.NIntAField); + Assert.Equal(a.IntLField, b.IntLField); + Assert.Equal(a.NIntLField, b.NIntLField); + Assert.Equal(a.IntAProp, b.IntAProp); + Assert.Equal(a.NIntAProp, b.NIntAProp); + Assert.Equal(a.IntLProp, b.IntLProp); + Assert.Equal(a.NIntLProp, b.NIntLProp); + }; + + // Populated array-like members + var x = TypeWithArraylikeMembers.CreateWithPopulatedMembers(); + var y = SerializeAndDeserialize(x, null /* Just checking the input and output objects is good enough here */, null, true); + Assert.NotNull(y); + assertEqual(x, y); + + // Empty array-like members + x = TypeWithArraylikeMembers.CreateWithEmptyMembers(); + y = SerializeAndDeserialize(x, "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"); + Assert.NotNull(y); + assertEqual(x, y); + Assert.Empty(y.IntAField); // Check on a couple fields to be sure they are empty and not null. + Assert.Empty(y.NIntLProp); + + // Null array-like members + // Null arrays and collections are omitted from xml output (or set to 'nil'). But they differ in deserialization. + // Null arrays are deserialized as null as expected. Null collections are unintuitively deserialized as empty collections. This behavior is preserved for compatibility with NetFx. + x = TypeWithArraylikeMembers.CreateWithNullMembers(); + y = SerializeAndDeserialize(x, "\r\n \r\n \r\n"); + Assert.NotNull(y); + Assert.Null(y.IntAField); + Assert.Null(y.NIntAField); + Assert.Empty(y.IntLField); + Assert.Empty(y.NIntLField); + Assert.Null(y.IntAProp); + Assert.Null(y.NIntAProp); + Assert.Empty(y.IntLProp); + Assert.Empty(y.NIntLProp); + } + [Fact] public static void Xml_ListRoot() { @@ -198,10 +261,10 @@ public static void Xml_ListRoot() Assert.Equal((string)x[1], (string)y[1]); } -// ROC and Immutable types are not types from 'SerializableAssembly.dll', so they were not included in the -// pregenerated serializers for the sgen tests. We could wrap them in a type that does exist there... -// but I think the RO/Immutable story is wonky enough and RefEmit vs Reflection is near enough on the -// horizon that it's not worth the trouble. + // ROC and Immutable types are not types from 'SerializableAssembly.dll', so they were not included in the + // pregenerated serializers for the sgen tests. We could wrap them in a type that does exist there... + // but I think the RO/Immutable story is wonky enough and RefEmit vs Reflection is near enough on the + // horizon that it's not worth the trouble. #if !XMLSERIALIZERGENERATORTESTS [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/74247", TestPlatforms.tvOS)] @@ -455,7 +518,42 @@ public static void Xml_BaseClassAndDerivedClassWithSameProperty() Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); Assert.StrictEqual(value.IntProperty, actual.IntProperty); Assert.Equal(value.StringProperty, actual.StringProperty); + // Before .Net 10, the process for xml mapping types incorrectly maps members closest to the base class, + // rather than the most derived class. This isn't a problem for ILGen or source-gen serialziers, since + // they emit code that essentially says "o.problemMember = value;" and since 'o' is the derived type, it + // just works. But when setting that member via reflection with a MemberInfo, the serializer needs + // the MemberInfo from the correct level, and this isn't fixed until .Net 10. So the ILGen and + // the reflection-based serializers will produce different results here. +#if ReflectionOnly + Assert.Empty(actual.ListProperty); +#else Assert.Equal(value.ListProperty.ToArray(), actual.ListProperty.ToArray()); +#endif + + BaseClassWithSamePropertyName castAsBase = (BaseClassWithSamePropertyName)actual; + Assert.Equal(default(int), castAsBase.IntProperty); + Assert.Null(castAsBase.StringProperty); + Assert.Null(castAsBase.ListProperty); + + // Try again with a null list to ensure the correct property is deserialized to an empty list + value = new DerivedClassWithSameProperty() { DateTimeProperty = new DateTime(100), IntProperty = 5, StringProperty = "TestString", ListProperty = null }; + actual = SerializeAndDeserialize(value, +@" + + TestString + 5 + 0001-01-01T00:00:00.00001 +"); + + Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); + Assert.StrictEqual(value.IntProperty, actual.IntProperty); + Assert.Equal(value.StringProperty, actual.StringProperty); + Assert.Empty(actual.ListProperty.ToArray()); + + castAsBase = (BaseClassWithSamePropertyName)actual; + Assert.Equal(default(int), castAsBase.IntProperty); + Assert.Null(castAsBase.StringProperty); + Assert.Null(castAsBase.ListProperty); } [Fact] @@ -1088,7 +1186,7 @@ public static void Xml_SerializedFormat() ms.Position = 0; string nl = Environment.NewLine; string actualFormatting = new StreamReader(ms).ReadToEnd(); - string expectedFormatting = $"{nl}{nl} foo{nl} 1{ nl}"; + string expectedFormatting = $"{nl}{nl} foo{nl} 1{nl}"; Assert.Equal(expectedFormatting, actualFormatting); } } @@ -1115,7 +1213,64 @@ public static void Xml_BaseClassAndDerivedClass2WithSameProperty() Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); Assert.StrictEqual(value.IntProperty, actual.IntProperty); Assert.Equal(value.StringProperty, actual.StringProperty); + // Before .Net 10, the process for xml mapping types incorrectly maps members closest to the base class, + // rather than the most derived class. This isn't a problem for ILGen or source-gen serialziers, since + // they emit code that essentially says "o.problemMember = value;" and since 'o' is the derived type, it + // just works. But when setting that member via reflection with a MemberInfo, the serializer needs + // the MemberInfo from the correct level, and this isn't fixed until .Net 10. So the ILGen and + // the reflection-based serializers will produce different results here. +#if ReflectionOnly + Assert.Empty(actual.ListProperty); +#else Assert.Equal(value.ListProperty.ToArray(), actual.ListProperty.ToArray()); +#endif + + // All base properties have been hidden, so they should be default here in the base class + BaseClassWithSamePropertyName castAsBase = (BaseClassWithSamePropertyName)actual; + Assert.StrictEqual(default(DateTime), castAsBase.DateTimeProperty); + Assert.StrictEqual(default(int), castAsBase.IntProperty); + Assert.Null(castAsBase.StringProperty); + Assert.Null(castAsBase.ListProperty); + + // IntProperty and StringProperty are not hidden in Derived2, so they should be set here in the middle + DerivedClassWithSameProperty castAsMiddle = (DerivedClassWithSameProperty)actual; + Assert.StrictEqual(value.IntProperty, castAsMiddle.IntProperty); + Assert.Equal(value.StringProperty, castAsMiddle.StringProperty); + // The other properties should be default + Assert.StrictEqual(default(DateTime), castAsMiddle.DateTimeProperty); + Assert.Null(castAsMiddle.ListProperty); + + + // Try again with a null list to ensure the correct property is deserialized to an empty list + value = new DerivedClassWithSameProperty2() { DateTimeProperty = new DateTime(100, DateTimeKind.Utc), IntProperty = 5, StringProperty = "TestString", ListProperty = null }; + + actual = SerializeAndDeserialize(value, +@" + + TestString + 5 + 0001-01-01T00:00:00.00001Z +"); + + Assert.StrictEqual(value.DateTimeProperty, actual.DateTimeProperty); + Assert.StrictEqual(value.IntProperty, actual.IntProperty); + Assert.Equal(value.StringProperty, actual.StringProperty); + Assert.Empty(actual.ListProperty.ToArray()); + + // All base properties have been hidden, so they should be default here in the base class + castAsBase = (BaseClassWithSamePropertyName)actual; + Assert.StrictEqual(default(DateTime), castAsBase.DateTimeProperty); + Assert.StrictEqual(default(int), castAsBase.IntProperty); + Assert.Null(castAsBase.StringProperty); + Assert.Null(castAsBase.ListProperty); + + // IntProperty and StringProperty are not hidden in Derived2, so they should be set here in the middle + castAsMiddle = (DerivedClassWithSameProperty)actual; + Assert.StrictEqual(value.IntProperty, castAsMiddle.IntProperty); + Assert.Equal(value.StringProperty, castAsMiddle.StringProperty); + // The other properties should be default + Assert.StrictEqual(default(DateTime), castAsMiddle.DateTimeProperty); + Assert.Null(castAsMiddle.ListProperty); } [Fact] @@ -1382,6 +1537,30 @@ public static void Xml_TypeWithArrayPropertyHavingChoice() Assert.NotNull(actual.ManyChoices); Assert.Equal(value.ManyChoices.Length, actual.ManyChoices.Length); Assert.True(Enumerable.SequenceEqual(value.ManyChoices, actual.ManyChoices)); + + // Try again with a null array + value = new TypeWithArrayPropertyHavingChoice() { ManyChoices = null, ChoiceArray = itemChoices }; + actual = SerializeAndDeserialize(value, ""); + Assert.NotNull(actual); + Assert.Null(actual.ManyChoices); // Arrays keep null-ness + } + + [Fact] + public static void Xml_TypeWithArrayPropertyHavingComplexChoice() + { + object[] choices = new object[] { new ComplexChoiceB { Name = "Beef" }, 5 }; + + // For each item in the choices array, add an enumeration value. + MoreChoices[] itemChoices = new MoreChoices[] { MoreChoices.Item, MoreChoices.Amount }; + + var value = new TypeWithPropertyHavingComplexChoice() { ManyChoices = choices, ChoiceArray = itemChoices }; + + var actual = SerializeAndDeserialize(value, "\r\n\r\n \r\n Beef\r\n \r\n 5\r\n"); + + Assert.NotNull(actual); + Assert.NotNull(actual.ManyChoices); + Assert.Equal(value.ManyChoices.Length, actual.ManyChoices.Length); + Assert.True(Enumerable.SequenceEqual(value.ManyChoices, actual.ManyChoices)); } [Fact] @@ -1588,6 +1767,54 @@ public static void Xml_HiddenDerivedFieldTest() Assert.Equal(value.value, ((DerivedClass)actual).value); } + [Fact] + public static void Xml_XmlIncludedTypesInCollection() + { + var value = new MyList() { + new BaseClass() { Value = "base class" }, + new DerivedClass() { Value = "derived class" } + }; + var actual = SerializeAndDeserialize(value, +@" + + + base class + + + derived class + +", +() => { return new XmlSerializer(typeof(MyList), new Type[] { typeof(BaseClass) }); }); + + Assert.NotNull(actual); + Assert.Equal(2, actual.Count); + Assert.IsType(actual[0]); + Assert.Equal("base class", ((BaseClass)actual[0]).Value); + Assert.IsType(actual[1]); + Assert.Equal("derived class", ((DerivedClass)actual[1]).Value); + } + + [Fact] + public static void Xml_XmlIncludedTypesInCollectionSingle() + { + var value = new MyList() { + new DerivedClass() { Value = "derived class" } + }; + var actual = SerializeAndDeserialize(value, +@" + + + derived class + +", +() => { return new XmlSerializer(typeof(MyList), new Type[] { typeof(BaseClass) }); }); + + Assert.NotNull(actual); + Assert.Single(actual); + Assert.IsType(actual[0]); + Assert.Equal("derived class", ((DerivedClass)actual[0]).Value); + } + [Fact] public static void Xml_NullRefInXmlSerializerCtorTest() { @@ -2379,6 +2606,32 @@ private static T SerializeAndDeserializeWithWrapper(T value, XmlSerializer se } } + private static Exception AssertTypeAndUnwrap(object exception, string? message = null) where T : Exception + { + Assert.IsType(exception); + var ex = exception as Exception; + if (message != null) + Assert.Contains(message, ex.Message); + Assert.NotNull(ex.InnerException); + return ex.InnerException; + } + + private static void AssertXmlMappingException(Exception exception, string typeName, string fieldName, string msg = null) + { + var ex = exception; +#if ReflectionOnly + // The ILGen Serializer does XmlMapping during serializer ctor and lets the exception out cleanly. + // The Reflection Serializer does XmlMapping in the Serialize() call and wraps the resulting exception + // inside a catch-all IOE in Serialize(). + ex = AssertTypeAndUnwrap(ex, "There was an error generating the XML document"); +#endif + ex = AssertTypeAndUnwrap(ex, $"There was an error reflecting type '{typeName}'"); + ex = AssertTypeAndUnwrap(ex, $"There was an error reflecting field '{fieldName}'"); + Assert.IsType(ex); + if (msg != null) + Assert.Contains(msg, ex.Message); + } + private static string Serialize(T value, string baseline, Func serializerFactory = null, bool skipStringCompare = false, XmlSerializerNamespaces xns = null) { diff --git a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs index 5d242a710ae2b1..2ead8405732022 100644 --- a/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs +++ b/src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/ModuleBuilderImpl.cs @@ -603,7 +603,7 @@ private DocumentHandle AddDocument(string url, Guid language, Guid hashAlgorithm _pdbBuilder.AddDocument( name: _pdbBuilder.GetOrAddDocumentName(url), hashAlgorithm: hashAlgorithm == default ? default : _pdbBuilder.GetOrAddGuid(hashAlgorithm), - hash: hash == null ? default : _metadataBuilder.GetOrAddBlob(hash), + hash: hash == null ? default : _pdbBuilder.GetOrAddBlob(hash), language: language == default ? default : _pdbBuilder.GetOrAddGuid(language)); private void FillMemberReferences(ILGeneratorImpl il) @@ -734,13 +734,16 @@ private EntityHandle GetMemberReferenceHandle(MemberInfo memberInfo) { case FieldInfo field: Type declaringType = field.DeclaringType!; - if (field.DeclaringType!.IsGenericTypeDefinition) + if (declaringType.IsGenericTypeDefinition) { //The type of the field has to be fully instantiated type. declaringType = declaringType.MakeGenericType(declaringType.GetGenericArguments()); } + + Type fieldType = ((FieldInfo)GetOriginalMemberIfConstructedType(field)).FieldType; memberHandle = AddMemberReference(field.Name, GetTypeHandle(declaringType), - MetadataSignatureHelper.GetFieldSignature(field.FieldType, field.GetRequiredCustomModifiers(), field.GetOptionalCustomModifiers(), this)); + MetadataSignatureHelper.GetFieldSignature(fieldType, field.GetRequiredCustomModifiers(), field.GetOptionalCustomModifiers(), this)); + break; case ConstructorInfo ctor: ctor = (ConstructorInfo)GetOriginalMemberIfConstructedType(ctor); @@ -809,17 +812,17 @@ internal static SignatureCallingConvention GetSignatureConvention(CallingConvent return convention; } - private MemberInfo GetOriginalMemberIfConstructedType(MethodBase methodBase) + private MemberInfo GetOriginalMemberIfConstructedType(MemberInfo memberInfo) { - Type declaringType = methodBase.DeclaringType!; + Type declaringType = memberInfo.DeclaringType!; if (declaringType.IsConstructedGenericType && declaringType.GetGenericTypeDefinition() is not TypeBuilderImpl && !ContainsTypeBuilder(declaringType.GetGenericArguments())) { - return declaringType.GetGenericTypeDefinition().GetMemberWithSameMetadataDefinitionAs(methodBase); + return declaringType.GetGenericTypeDefinition().GetMemberWithSameMetadataDefinitionAs(memberInfo); } - return methodBase; + return memberInfo; } private static Type[] ParameterTypes(ParameterInfo[] parameterInfos) diff --git a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs index 31536bc266c0a1..f508da07364f26 100644 --- a/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit/tests/PersistedAssemblyBuilder/AssemblySaveTypeBuilderTests.cs @@ -5,6 +5,8 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; using Xunit; namespace System.Reflection.Emit.Tests @@ -124,11 +126,15 @@ public void CreateMembersThatUsesTypeLoadedFromCoreAssemblyTest() } } - private static TypeBuilder CreateAssemblyAndDefineType(out PersistedAssemblyBuilder assemblyBuilder) + private static ModuleBuilder CreateAssembly(out PersistedAssemblyBuilder assemblyBuilder) { assemblyBuilder = AssemblySaveTools.PopulateAssemblyBuilder(s_assemblyName); - return assemblyBuilder.DefineDynamicModule("MyModule") - .DefineType("TestInterface", TypeAttributes.Interface | TypeAttributes.Abstract); + return assemblyBuilder.DefineDynamicModule("MyModule"); + } + + private static TypeBuilder CreateAssemblyAndDefineType(out PersistedAssemblyBuilder assemblyBuilder) + { + return CreateAssembly(out assemblyBuilder).DefineType("TestInterface", TypeAttributes.Interface | TypeAttributes.Abstract); } [Fact] @@ -205,6 +211,83 @@ public void SaveGenericTypeParametersForAType(string[] typeParamNames) } } + private class GenericClassWithGenericField + { +#pragma warning disable CS0649 + public T F; +#pragma warning restore CS0649 + } + + private class GenericClassWithNonGenericField + { +#pragma warning disable CS0649 + public int F; +#pragma warning restore CS0649 + } + + public static IEnumerable GenericTypesWithField() + { + yield return new object[] { typeof(GenericClassWithGenericField), true }; + yield return new object[] { typeof(GenericClassWithNonGenericField), false }; + } + + [Theory] + [MemberData(nameof(GenericTypesWithField))] + public void SaveGenericField(Type declaringType, bool shouldFieldBeGeneric) + { + using (TempFile file = TempFile.Create()) + { + ModuleBuilder mb = CreateAssembly(out PersistedAssemblyBuilder assemblyBuilder); + TypeBuilder tb = mb.DefineType("C", TypeAttributes.Class); + MethodBuilder method = tb.DefineMethod("TestMethod", MethodAttributes.Public, returnType: typeof(int), parameterTypes: null); + ILGenerator il = method.GetILGenerator(); + il.Emit(OpCodes.Newobj, declaringType.GetConstructor([])); + il.Emit(OpCodes.Ldfld, declaringType.GetField("F")); + il.Emit(OpCodes.Ret); + Type createdType = tb.CreateType(); + assemblyBuilder.Save(file.Path); + + using (FileStream stream = File.OpenRead(file.Path)) + { + using (PEReader peReader = new PEReader(stream)) + { + bool found = false; + MetadataReader metadataReader = peReader.GetMetadataReader(); + foreach (MemberReferenceHandle memberRefHandle in metadataReader.MemberReferences) + { + MemberReference memberRef = metadataReader.GetMemberReference(memberRefHandle); + if (memberRef.GetKind() == MemberReferenceKind.Field) + { + Assert.False(found); + found = true; + + Assert.Equal("F", metadataReader.GetString(memberRef.Name)); + + // A reference to a generic field should point to the open generic field, and not the resolved generic type. + Assert.Equal(shouldFieldBeGeneric, IsGenericField(metadataReader.GetBlobReader(memberRef.Signature))); + } + } + + Assert.True(found); + } + } + } + + static bool IsGenericField(BlobReader signatureReader) + { + while (signatureReader.RemainingBytes > 0) + { + SignatureTypeCode typeCode = signatureReader.ReadSignatureTypeCode(); + if (typeCode == SignatureTypeCode.GenericTypeParameter) + { + return true; + } + } + + return false; + } + } + private static void SetVariousGenericParameterValues(GenericTypeParameterBuilder[] typeParams) { typeParams[0].SetInterfaceConstraints([typeof(IAccess), typeof(INoMethod)]); diff --git a/src/libraries/System.Reflection.Emit/tests/PortablePdb/PortablePdbStandalonePdbTest.cs b/src/libraries/System.Reflection.Emit/tests/PortablePdb/PortablePdbStandalonePdbTest.cs index e1ce56f151d81c..7315afe2ded476 100644 --- a/src/libraries/System.Reflection.Emit/tests/PortablePdb/PortablePdbStandalonePdbTest.cs +++ b/src/libraries/System.Reflection.Emit/tests/PortablePdb/PortablePdbStandalonePdbTest.cs @@ -61,7 +61,8 @@ private static void ValidatePDB(MethodBuilder method, MethodBuilder entryPoint, Document doc = reader.GetDocument(docEnumerator.Current); Assert.Equal("MySourceFile.cs", reader.GetString(doc.Name)); Assert.Equal(SymLanguageType.CSharp, reader.GetGuid(doc.Language)); - Assert.Equal(default, reader.GetGuid(doc.HashAlgorithm)); + Assert.Equal(new Guid("8829d00f-11b8-4213-878b-770e8597ac16"), reader.GetGuid(doc.HashAlgorithm)); + Assert.Equal("06CBAB3A501306FDD9176A00A83E5BB92EA4D7863CFD666355743527CF99EDC6", Convert.ToHexString(reader.GetBlobBytes(doc.Hash))); Assert.False(docEnumerator.MoveNext()); MethodDebugInformation mdi1 = reader.GetMethodDebugInformation(MetadataTokens.MethodDebugInformationHandle(method.MetadataToken)); @@ -147,6 +148,7 @@ private static MetadataBuilder GenerateAssemblyAndMetadata(out MethodBuilder met ModuleBuilder mb = ab.DefineDynamicModule("MyModule2"); TypeBuilder tb = mb.DefineType("MyType", TypeAttributes.Public | TypeAttributes.Class); ISymbolDocumentWriter srcdoc = mb.DefineDocument("MySourceFile.cs", SymLanguageType.CSharp); + srcdoc.SetCheckSum(new Guid("8829d00f-11b8-4213-878b-770e8597ac16"), Convert.FromHexString("06CBAB3A501306FDD9176A00A83E5BB92EA4D7863CFD666355743527CF99EDC6")); method = tb.DefineMethod("SumMethod", MethodAttributes.Public | MethodAttributes.Static, typeof(int), [typeof(int), typeof(int)]); ILGenerator il1 = method.GetILGenerator(); LocalBuilder local = il1.DeclareLocal(typeof(int)); diff --git a/src/libraries/System.Reflection.TypeExtensions/tests/ILLink.Descriptors.xml b/src/libraries/System.Reflection.TypeExtensions/tests/ILLink.Descriptors.xml deleted file mode 100644 index 573b67e7172d49..00000000000000 --- a/src/libraries/System.Reflection.TypeExtensions/tests/ILLink.Descriptors.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/libraries/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj b/src/libraries/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj index 4cec27f2eab318..eec6c3be0d0e89 100644 --- a/src/libraries/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj +++ b/src/libraries/System.Reflection.TypeExtensions/tests/System.Reflection.TypeExtensions.Tests.csproj @@ -22,6 +22,5 @@ TinyAssembly.dll PreserveNewest - diff --git a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj index e380af4d84271a..a178d029091157 100644 --- a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj +++ b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj @@ -9,7 +9,6 @@ false true $(BaseIntermediateOutputPath)SuggestedBindingRedirects.targets - $(BeforePack);GeneratePackageTargetsFile Provides classes which read and write resources in a format that supports non-primitive objects. Commonly Used Types: @@ -93,7 +92,8 @@ System.Resources.Extensions.PreserializedResourceWriter + AfterTargets="CoreCompile" + Condition="'$(TargetFramework)' == '$(NetFrameworkMinimum)'"> - - CP0014 - M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/mscorlib.dll - net9.0/mscorlib.dll - - - CP0014 - P:System.Console.WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/mscorlib.dll - net9.0/mscorlib.dll - - - CP0014 - P:System.Console.WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/mscorlib.dll - net9.0/mscorlib.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.EnumConverter.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.ComponentModel.EnumConverter.EnumType:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.Console.WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - P:System.Console.WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/netstandard.dll - net9.0/netstandard.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.Primitives.dll - net9.0/System.ComponentModel.Primitives.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.ComponentModel.EnumConverter.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - P:System.ComponentModel.EnumConverter.EnumType:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.ComponentModel.TypeConverter.dll - net9.0/System.ComponentModel.TypeConverter.dll - - - CP0014 - M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/System.Console.dll - net9.0/System.Console.dll - - - CP0014 - P:System.Console.WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/System.Console.dll - net9.0/System.Console.dll - - - CP0014 - P:System.Console.WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] - net8.0/System.Console.dll - net9.0/System.Console.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.DesignerAttribute.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.String)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.String,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EditorAttribute.#ctor(System.Type,System.Type)$1:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.ComponentModel.EnumConverter.#ctor(System.Type)$0:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - P:System.ComponentModel.DesignerAttribute.DesignerTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorBaseTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - P:System.ComponentModel.EditorAttribute.EditorTypeName:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - P:System.ComponentModel.EnumConverter.EnumType:[T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute] - net8.0/System.dll - net9.0/System.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.DivRem(System.UInt32,System.Int32,System.Int32):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.DivRem(System.UInt32,System.UInt32,System.UInt32):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.DivRem(System.UIntPtr,System.IntPtr,System.IntPtr):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.DivRem(System.UIntPtr,System.UIntPtr,System.UIntPtr):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.X64.DivRem(System.UInt64,System.Int64,System.Int64):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - M:System.Runtime.Intrinsics.X86.X86Base.X64.DivRem(System.UInt64,System.UInt64,System.UInt64):[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0014 - T:System.Runtime.Intrinsics.X86.AvxVnni:[T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftLeftLogicalSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticNarrowingSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticNarrowingSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.ShiftRightLogicalRoundedNarrowingSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.Byte},System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsert(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsertScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftAndInsertScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogical(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturate(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsigned(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalSaturateUnsignedScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningLower(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningUpper(System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningUpper(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningUpper(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftLeftLogicalWideningUpper(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.Byte},System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsert(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsertScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightAndInsertScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmetic(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAdd(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticAddScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRounded(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAdd(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedAddScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUnsignedUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticRoundedScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightArithmeticScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogical(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.Byte},System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAdd(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAddScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalAddScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRounded(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.Byte},System.Runtime.Intrinsics.Vector128{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.Int64},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.SByte},System.Runtime.Intrinsics.Vector128{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector64{System.Byte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector64{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector64{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector64{System.SByte},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector64{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAdd(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector64{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAddScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedAddScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingLower(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateLower(System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Byte},System.Runtime.Intrinsics.Vector128{System.UInt16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Int16},System.Runtime.Intrinsics.Vector128{System.Int32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.Int32},System.Runtime.Intrinsics.Vector128{System.Int64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.SByte},System.Runtime.Intrinsics.Vector128{System.Int16},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.UInt16},System.Runtime.Intrinsics.Vector128{System.UInt32},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedNarrowingUpper(System.Runtime.Intrinsics.Vector64{System.UInt32},System.Runtime.Intrinsics.Vector128{System.UInt64},System.Byte)$2:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalRoundedScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalScalar(System.Runtime.Intrinsics.Vector64{System.Int64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - M:System.Runtime.Intrinsics.Arm.AdvSimd.ShiftRightLogicalScalar(System.Runtime.Intrinsics.Vector64{System.UInt64},System.Byte)$1:[T:System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute] - net8.0/System.Runtime.Intrinsics.dll - net9.0/System.Runtime.Intrinsics.dll - - - CP0015 - T:System.Text.RegularExpressions.GeneratedRegexAttribute:[T:System.AttributeUsageAttribute] - net8.0/System.Text.RegularExpressions.dll - net9.0/System.Text.RegularExpressions.dll - - - CP0021 - T:System.Diagnostics.Metrics.MeasurementCallback`1``0:struct - net8.0/System.Diagnostics.DiagnosticSource.dll - net9.0/System.Diagnostics.DiagnosticSource.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsDefaultMarshaller`1``0:struct - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsDefaultMarshaller`1``0:unmanaged - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:struct - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:T:System.Numerics.INumber{`0} - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsHResultMarshaller`1``0:unmanaged - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:struct - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:T:System.Numerics.IFloatingPointIeee754{`0} - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Runtime.InteropServices.Marshalling.ExceptionAsNaNMarshaller`1``0:unmanaged - net8.0/System.Runtime.InteropServices.dll - net9.0/System.Runtime.InteropServices.dll - - - CP0021 - T:System.Text.Json.Serialization.JsonNumberEnumConverter`1``0:T:System.Enum - net8.0/System.Text.Json.dll - net9.0/System.Text.Json.dll - diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 16c8f16d419ce4..eae58ac93c86b0 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -348,6 +348,10 @@ + + + + diff --git a/src/mono/browser/debugger/BrowserDebugProxy/MonoProxy.cs b/src/mono/browser/debugger/BrowserDebugProxy/MonoProxy.cs index 503f196c17f058..6437b97217fc82 100644 --- a/src/mono/browser/debugger/BrowserDebugProxy/MonoProxy.cs +++ b/src/mono/browser/debugger/BrowserDebugProxy/MonoProxy.cs @@ -916,13 +916,13 @@ protected async Task EvaluateCondition(SessionId sessionId, ExecutionConte logger.LogDebug($"Unable to evaluate breakpoint condition '{condition}': {ree}"); SendLog(sessionId, $"Unable to evaluate breakpoint condition '{condition}': {ree.Message}", token, type: "error"); bp.ConditionAlreadyEvaluatedWithError = true; - SendExceptionToTelemetry(ree, "EvaluateCondition", sessionId, token); + ReportDebuggerExceptionToTelemetry("EvaluateCondition", sessionId, token); } catch (Exception e) { Log("info", $"Unable to evaluate breakpoint condition '{condition}': {e}"); bp.ConditionAlreadyEvaluatedWithError = true; - SendExceptionToTelemetry(e, "EvaluateCondition", sessionId, token); + ReportDebuggerExceptionToTelemetry("EvaluateCondition", sessionId, token); } return false; } @@ -1521,27 +1521,27 @@ private async Task OnEvaluateOnCallFrame(MessageId msg_id, int scopeId, st catch (ReturnAsErrorException ree) { SendResponse(msg_id, AddCallStackInfoToException(ree.Error, context, scopeId), token); - SendExceptionToTelemetry(ree, "OnEvaluateOnCallFrame", msg_id, token); + ReportDebuggerExceptionToTelemetry("OnEvaluateOnCallFrame", msg_id, token); } catch (Exception e) { logger.LogDebug($"Error in EvaluateOnCallFrame for expression '{expression}' with '{e}."); var ree = new ReturnAsErrorException(e.Message, e.GetType().Name); SendResponse(msg_id, AddCallStackInfoToException(ree.Error, context, scopeId), token); - SendExceptionToTelemetry(e, "OnEvaluateOnCallFrame", msg_id, token); + ReportDebuggerExceptionToTelemetry("OnEvaluateOnCallFrame", msg_id, token); } return true; } - private void SendExceptionToTelemetry(Exception exc, string callingFunction, SessionId msg_id, CancellationToken token) + private void ReportDebuggerExceptionToTelemetry(string callingFunction, SessionId msg_id, CancellationToken token) { - JObject reportBlazorDebugError = JObject.FromObject(new + JObject reportBlazorDebugException = JObject.FromObject(new { exceptionType = "uncaughtException", - error = $"{exc.Message} at {callingFunction}", + exception = $"BlazorDebugger exception at {callingFunction}", }); - SendEvent(msg_id, "DotnetDebugger.reportBlazorDebugError", reportBlazorDebugError, token); + SendEvent(msg_id, "DotnetDebugger.reportBlazorDebugException", reportBlazorDebugException, token); } internal async Task GetScopeProperties(SessionId msg_id, int scopeId, CancellationToken token) diff --git a/src/mono/browser/runtime/http.ts b/src/mono/browser/runtime/http.ts index 743972efd8df71..74f86f88791c4d 100644 --- a/src/mono/browser/runtime/http.ts +++ b/src/mono/browser/runtime/http.ts @@ -4,11 +4,12 @@ import BuildConfiguration from "consts:configuration"; 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 { assert_js_interop } from "./invoke-js"; import { MemoryViewType, Span } from "./marshal"; import type { VoidPtr } from "./types/emscripten"; import { ControllablePromise } from "./types/internal"; +import { mono_log_debug } from "./logging"; function verifyEnvironment () { @@ -72,12 +73,11 @@ export function http_wasm_create_controller (): HttpController { return controller; } -function handle_abort_error (promise:Promise) { +function mute_unhandledrejection (promise:Promise) { promise.catch((err) => { if (err && err !== "AbortError" && err.name !== "AbortError" ) { - Module.err("Unexpected error: " + err); + mono_log_debug("http muted: " + err); } - // otherwise, it's expected }); } @@ -86,15 +86,15 @@ export function http_wasm_abort (controller: HttpController): void { try { if (!controller.isAborted) { if (controller.streamWriter) { - handle_abort_error(controller.streamWriter.abort()); + mute_unhandledrejection(controller.streamWriter.abort()); controller.isAborted = true; } if (controller.streamReader) { - handle_abort_error(controller.streamReader.cancel()); + mute_unhandledrejection(controller.streamReader.cancel()); controller.isAborted = true; } } - if (!controller.isAborted) { + if (!controller.isAborted && !controller.abortController.signal.aborted) { controller.abortController.abort("AbortError"); } } catch (err) { @@ -138,8 +138,8 @@ export function http_wasm_fetch_stream (controller: HttpController, url: string, if (BuildConfiguration === "Debug") commonAsserts(controller); const transformStream = new TransformStream(); controller.streamWriter = transformStream.writable.getWriter(); - handle_abort_error(controller.streamWriter.closed); - handle_abort_error(controller.streamWriter.ready); + mute_unhandledrejection(controller.streamWriter.closed); + mute_unhandledrejection(controller.streamWriter.ready); const fetch_promise = http_wasm_fetch(controller, url, header_names, header_values, option_names, option_values, transformStream.readable); return fetch_promise; } @@ -177,16 +177,18 @@ export function http_wasm_fetch (controller: HttpController, url: string, header } // make the fetch cancellable controller.responsePromise = wrap_as_cancelable_promise(() => { - return loaderHelpers.fetch_like(url, options); + return loaderHelpers.fetch_like(url, options).then((res: Response) => { + controller.response = res; + return null;// drop the response from the promise chain + }); }); // avoid processing headers if the fetch is canceled - controller.responsePromise.then((res: Response) => { - controller.response = res; + controller.responsePromise.then(() => { + mono_assert(controller.response, "expected response"); controller.responseHeaderNames = []; controller.responseHeaderValues = []; - if (res.headers && (res.headers).entries) { - const entries: Iterable = (res.headers).entries(); - + if (controller.response.headers && (controller.response.headers).entries) { + const entries: Iterable = (controller.response.headers).entries(); for (const pair of entries) { controller.responseHeaderNames.push(pair[0]); controller.responseHeaderValues.push(pair[1]); @@ -250,9 +252,15 @@ export function http_wasm_get_streamed_response_bytes (controller: HttpControlle // the bufferPtr is pinned by the caller const view = new Span(bufferPtr, bufferLength, MemoryViewType.Byte); return wrap_as_cancelable_promise(async () => { + await controller.responsePromise; mono_assert(controller.response, "expected response"); + if (!controller.response.body) { + // in FF when the verb is HEAD, the body is null + return 0; + } if (!controller.streamReader) { - controller.streamReader = controller.response.body!.getReader(); + controller.streamReader = controller.response.body.getReader(); + mute_unhandledrejection(controller.streamReader.closed); } if (!controller.currentStreamReaderChunk || controller.currentBufferOffset === undefined) { controller.currentStreamReaderChunk = await controller.streamReader.read(); diff --git a/src/mono/mono.proj b/src/mono/mono.proj index 8fe15830cabb53..8bfbb710823937 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -818,7 +818,8 @@ JS_ENGINES = [NODE_JS] <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so" Condition=" Exists('$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib/libclang.so') "/> - <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '$(_LibClang)' == '' "/> + <_LibClang Include="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(MonoToolchainPrebuiltOS)/lib64/libclang.so.*" Condition=" '@(_LibClang)' == '' "/> + <_LibClang Include="/usr/local/lib/libclang.so" Condition="'@(_LibClang)' == ''" /> true diff --git a/src/mono/mono/cil/opcode.def b/src/mono/mono/cil/opcode.def index 47bccb295e99b2..049c0500b66bd1 100644 --- a/src/mono/mono/cil/opcode.def +++ b/src/mono/mono/cil/opcode.def @@ -328,6 +328,8 @@ OPDEF(CEE_MONO_GET_SP, "mono_get_sp", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x20, OPDEF(CEE_MONO_METHODCONST, "mono_methodconst", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x21, NEXT) OPDEF(CEE_MONO_PINVOKE_ADDR_CACHE, "mono_pinvoke_addr_cache", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x22, NEXT) OPDEF(CEE_MONO_REMAP_OVF_EXC, "mono_remap_ovf_exc", Pop0, Push0, InlineI, 0, 2, 0xF0, 0x23, NEXT) +OPDEF(CEE_MONO_LDVIRTFTN_DELEGATE, "mono_ldvirtftn_delegate", PopI+PopI, PushI, InlineNone, 0, 2, 0xF0, 0x24, NEXT) + #ifndef OPALIAS #define _MONO_CIL_OPALIAS_DEFINED_ #define OPALIAS(a,s,r) diff --git a/src/mono/mono/component/hot_reload.c b/src/mono/mono/component/hot_reload.c index 300a46a245f92d..5ce5950556581c 100644 --- a/src/mono/mono/component/hot_reload.c +++ b/src/mono/mono/component/hot_reload.c @@ -924,9 +924,7 @@ delta_info_initialize_mutants (const MonoImage *base, const BaselineInfo *base_i g_assert (prev_table != NULL); MonoTableInfo *tbl = &delta->mutants [i]; - if (prev_table->rows_ == 0) { - /* table was empty in the baseline and it was empty in the prior generation, but now we have some rows. Use the format of the mutant table. */ - g_assert (prev_table->row_size == 0); + if (delta->delta_image->tables [i].row_size != 0 || prev_table->rows_ == 0) { tbl->row_size = delta->delta_image->tables [i].row_size; tbl->size_bitfield = delta->delta_image->tables [i].size_bitfield; } else { @@ -940,8 +938,60 @@ delta_info_initialize_mutants (const MonoImage *base, const BaselineInfo *base_i tbl->base = mono_mempool_alloc (delta->pool, tbl->row_size * rows); g_assert (table_info_get_rows (prev_table) == count->prev_gen_rows); - /* copy the old rows and zero out the new ones */ - memcpy ((char*)tbl->base, prev_table->base, count->prev_gen_rows * tbl->row_size); + /* copy the old rows and zero out the new ones */ + /* we need to copy following the new format (uncompressed one)*/ + for (guint32 j = 0 ; j < count->prev_gen_rows; j++) + { + guint32 src_offset = 0, dst_offset = 0; + guint32 dst_bitfield = tbl->size_bitfield; + guint32 src_bitfield = prev_table->size_bitfield; + const char *src_base = (char*)prev_table->base + j * prev_table->row_size; + char *dst_base = (char*)tbl->base + j * tbl->row_size; + for (guint col = 0; col < mono_metadata_table_count (dst_bitfield); ++col) { + guint32 dst_col_size = mono_metadata_table_size (dst_bitfield, col); + guint32 src_col_size = mono_metadata_table_size (src_bitfield, col); + { + const char *src = src_base + src_offset; + char *dst = dst_base + dst_offset; + + /* copy src to dst, via a temporary to adjust for size differences */ + /* FIXME: unaligned access, endianness */ + guint32 tmp; + + switch (src_col_size) { + case 1: + tmp = *(guint8*)src; + break; + case 2: + tmp = *(guint16*)src; + break; + case 4: + tmp = *(guint32*)src; + break; + default: + g_assert_not_reached (); + } + + /* FIXME: unaligned access, endianness */ + switch (dst_col_size) { + case 1: + *(guint8*)dst = (guint8)tmp; + break; + case 2: + *(guint16*)dst = (guint16)tmp; + break; + case 4: + *(guint32*)dst = tmp; + break; + default: + g_assert_not_reached (); + } + } + src_offset += src_col_size; + dst_offset += dst_col_size; + } + g_assert (dst_offset == tbl->row_size); + } memset (((char*)tbl->base) + count->prev_gen_rows * tbl->row_size, 0, count->inserted_rows * tbl->row_size); } } @@ -1386,8 +1436,8 @@ delta_info_mutate_row (MonoImage *image_dmeta, DeltaInfo *cur_delta, guint32 log /* The complication here is that we want the mutant table to look like the table in * the baseline image with respect to column widths, but the delta tables are generally coming in - * uncompressed (4-byte columns). So we have to copy one column at a time and adjust the - * widths as we go. + * uncompressed (4-byte columns). And we have already adjusted the baseline image column widths + * so we can use memcpy here. */ guint32 dst_bitfield = cur_delta->mutants [token_table].size_bitfield; @@ -1401,41 +1451,10 @@ delta_info_mutate_row (MonoImage *image_dmeta, DeltaInfo *cur_delta, guint32 log guint32 dst_col_size = mono_metadata_table_size (dst_bitfield, col); guint32 src_col_size = mono_metadata_table_size (src_bitfield, col); if ((m_SuppressedDeltaColumns [token_table] & (1 << col)) == 0) { + g_assert(src_col_size <= dst_col_size); const char *src = src_base + src_offset; char *dst = dst_base + dst_offset; - - /* copy src to dst, via a temporary to adjust for size differences */ - /* FIXME: unaligned access, endianness */ - guint32 tmp; - - switch (src_col_size) { - case 1: - tmp = *(guint8*)src; - break; - case 2: - tmp = *(guint16*)src; - break; - case 4: - tmp = *(guint32*)src; - break; - default: - g_assert_not_reached (); - } - - /* FIXME: unaligned access, endianness */ - switch (dst_col_size) { - case 1: - *(guint8*)dst = (guint8)tmp; - break; - case 2: - *(guint16*)dst = (guint16)tmp; - break; - case 4: - *(guint32*)dst = tmp; - break; - default: - g_assert_not_reached (); - } + memcpy(dst, src, src_col_size); } src_offset += src_col_size; dst_offset += dst_col_size; diff --git a/src/mono/mono/metadata/class-internals.h b/src/mono/mono/metadata/class-internals.h index e44ba4c7b49026..55067f680d1b31 100644 --- a/src/mono/mono/metadata/class-internals.h +++ b/src/mono/mono/metadata/class-internals.h @@ -952,25 +952,20 @@ mono_class_get_##shortname##_class (void) \ // GENERATE_TRY_GET_CLASS_WITH_CACHE attempts mono_class_load_from_name approximately // only once. i.e. if it fails, it will return null and not retry. -// In a race it might try a few times, but not indefinitely. -// -// FIXME This maybe has excessive volatile/barriers. -// #define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,name_space,name) \ MonoClass* \ mono_class_try_get_##shortname##_class (void) \ { \ - static volatile MonoClass *tmp_class; \ - static volatile gboolean inited; \ - MonoClass *klass = (MonoClass *)tmp_class; \ - mono_memory_barrier (); \ - if (!inited) { \ - klass = mono_class_try_load_from_name (mono_class_generate_get_corlib_impl (), name_space, name); \ - tmp_class = klass; \ - mono_memory_barrier (); \ - inited = TRUE; \ + static MonoClass *cached_class; \ + static gboolean cached_class_inited; \ + gboolean tmp_inited; \ + mono_atomic_load_acquire(tmp_inited, gboolean, &cached_class_inited); \ + if (G_LIKELY(tmp_inited)) { \ + return (MonoClass*)cached_class; \ } \ - return klass; \ + cached_class = mono_class_try_load_from_name (mono_class_generate_get_corlib_impl (), name_space, name); \ + mono_atomic_store_release(&cached_class_inited, TRUE); \ + return (MonoClass*)cached_class; \ } GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle) diff --git a/src/mono/mono/metadata/class.c b/src/mono/mono/metadata/class.c index abd0948e3a2f5e..c74c5c12e00cfd 100644 --- a/src/mono/mono/metadata/class.c +++ b/src/mono/mono/metadata/class.c @@ -2580,7 +2580,7 @@ mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoTyp MonoClassField *gfield = mono_metadata_get_corresponding_field_from_generic_type_definition (field); g_assert (gfield != NULL); MonoType *field_type = gfield->type; - if (!mono_metadata_type_equal_full (type, field_type, TRUE)) + if (!mono_metadata_type_equal_full (type, field_type, MONO_TYPE_EQ_FLAGS_SIG_ONLY)) continue; } return field; diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index 43f3d32653f321..e326e7a7b085a0 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -3391,6 +3391,8 @@ static void init_io_stream_slots (void) { MonoClass* klass = mono_class_try_get_stream_class (); + g_assert(klass); + mono_class_setup_vtable (klass); MonoMethod **klass_methods = m_class_get_methods (klass); if (!klass_methods) { diff --git a/src/mono/mono/metadata/loader-internals.h b/src/mono/mono/metadata/loader-internals.h index 60d39ff6a6398c..c9a340f928b7b2 100644 --- a/src/mono/mono/metadata/loader-internals.h +++ b/src/mono/mono/metadata/loader-internals.h @@ -175,7 +175,8 @@ struct _MonoMemoryManager { MonoAssemblyLoadContext **alcs; // Generic-specific caches - dn_simdhash_ght_t *ginst_cache, *gmethod_cache, *gsignature_cache; + GHashTable *ginst_cache; + dn_simdhash_ght_t *gmethod_cache, *gsignature_cache; MonoConcurrentHashTable *gclass_cache; /* mirror caches of ones already on MonoImage. These ones contain generics */ diff --git a/src/mono/mono/metadata/marshal-lightweight.c b/src/mono/mono/metadata/marshal-lightweight.c index 9829c95232baef..2095334a818afe 100644 --- a/src/mono/mono/metadata/marshal-lightweight.c +++ b/src/mono/mono/metadata/marshal-lightweight.c @@ -2052,7 +2052,8 @@ emit_delegate_invoke_internal_ilgen (MonoMethodBuilder *mb, MonoMethodSignature } mono_mb_emit_ldarg_addr (mb, 1); mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icall (mb, mono_get_addr_compiled_method); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDVIRTFTN_DELEGATE); mono_mb_emit_op (mb, CEE_CALLI, target_method_sig); } else { mono_mb_emit_byte (mb, CEE_LDNULL); @@ -2305,8 +2306,8 @@ emit_unsafe_accessor_field_wrapper (MonoMethodBuilder *mb, gboolean inflate_gene } MonoClassField *target_field = mono_class_get_field_from_name_full (target_class, member_name, NULL); - if (target_field == NULL || !mono_metadata_type_equal_full (target_field->type, m_class_get_byval_arg (mono_class_from_mono_type_internal (ret_type)), TRUE)) { - mono_mb_emit_exception_full (mb, "System", "MissingFieldException", + if (target_field == NULL || !mono_metadata_type_equal_full (target_field->type, m_class_get_byval_arg (mono_class_from_mono_type_internal (ret_type)), MONO_TYPE_EQ_FLAGS_SIG_ONLY | MONO_TYPE_EQ_FLAG_IGNORE_CMODS)) { + mono_mb_emit_exception_full (mb, "System", "MissingFieldException", g_strdup_printf("No '%s' in '%s'. Or the type of '%s' doesn't match", member_name, m_class_get_name (target_class), member_name)); return; } @@ -2403,7 +2404,7 @@ inflate_method (MonoClass *klass, MonoMethod *method, MonoMethod *accessor_metho if ((context.class_inst != NULL) || (context.method_inst != NULL)) result = mono_class_inflate_generic_method_checked (method, &context, error); mono_error_assert_ok (error); - + return result; } @@ -2425,13 +2426,13 @@ emit_unsafe_accessor_ctor_wrapper (MonoMethodBuilder *mb, gboolean inflate_gener mono_mb_emit_exception_full (mb, "System", "BadImageFormatException", "Invalid usage of UnsafeAccessorAttribute."); return; } - + MonoClass *target_class = mono_class_from_mono_type_internal (target_type); ERROR_DECL(find_method_error); MonoMethodSignature *member_sig = ctor_sig_from_accessor_sig (mb, sig); - + MonoClass *in_class = target_class; MonoMethod *target_method = mono_unsafe_accessor_find_ctor (in_class, member_sig, target_class, find_method_error); @@ -2506,7 +2507,7 @@ emit_unsafe_accessor_method_wrapper (MonoMethodBuilder *mb, gboolean inflate_gen emit_missing_method_error (mb, find_method_error, member_name); return; } - + g_assert (target_method->klass == target_class); emit_unsafe_accessor_ldargs (mb, sig, !hasthis ? 1 : 0); @@ -2733,7 +2734,7 @@ emit_swift_lowered_struct_load (MonoMethodBuilder *mb, MonoMethodSignature *csig } } -/* Swift struct lowering handling causes csig to have additional arguments. +/* Swift struct lowering handling causes csig to have additional arguments. * This function returns the index of the argument in the csig that corresponds to the argument in the original signature. */ static int diff --git a/src/mono/mono/metadata/memory-manager.c b/src/mono/mono/metadata/memory-manager.c index edb7fff24a8d3c..e7a234661db5a3 100644 --- a/src/mono/mono/metadata/memory-manager.c +++ b/src/mono/mono/metadata/memory-manager.c @@ -238,7 +238,7 @@ memory_manager_delete (MonoMemoryManager *memory_manager, gboolean debug_unload) MonoMemoryManager *mm = memory_manager; if (mm->gclass_cache) mono_conc_hashtable_destroy (mm->gclass_cache); - free_simdhash (&mm->ginst_cache); + free_hash (&mm->ginst_cache); free_simdhash (&mm->gmethod_cache); free_simdhash (&mm->gsignature_cache); free_hash (&mm->szarray_cache); diff --git a/src/mono/mono/metadata/metadata-internals.h b/src/mono/mono/metadata/metadata-internals.h index 54d85997d7af4a..3f0345f881185c 100644 --- a/src/mono/mono/metadata/metadata-internals.h +++ b/src/mono/mono/metadata/metadata-internals.h @@ -1021,8 +1021,14 @@ mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open); MONO_API void mono_type_get_desc (GString *res, MonoType *type, mono_bool include_namespace); +enum { + MONO_TYPE_EQ_FLAGS_NONE = 0, + MONO_TYPE_EQ_FLAGS_SIG_ONLY = 1, + MONO_TYPE_EQ_FLAG_IGNORE_CMODS = 2, +}; + gboolean -mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only); +mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, int flags); MonoMarshalSpec * mono_metadata_parse_marshal_spec_full (MonoImage *image, MonoImage *parent_image, const char *ptr); diff --git a/src/mono/mono/metadata/metadata.c b/src/mono/mono/metadata/metadata.c index a9b291bcadc54d..8a96c1ead4c337 100644 --- a/src/mono/mono/metadata/metadata.c +++ b/src/mono/mono/metadata/metadata.c @@ -38,6 +38,7 @@ #include #include #include +#include "../native/containers/dn-simdhash-utils.h" /* Auxiliary structure used for caching inflated signatures */ typedef struct { @@ -45,11 +46,6 @@ typedef struct { MonoGenericContext context; } MonoInflatedMethodSignature; -enum { - MONO_TYPE_EQ_FLAGS_SIG_ONLY = 1, - MONO_TYPE_EQ_FLAG_IGNORE_CMODS = 2, -}; - static gboolean do_mono_metadata_parse_type (MonoType *type, MonoImage *m, MonoGenericContainer *container, gboolean transient, const char *ptr, const char **rptr, MonoError *error); @@ -1879,18 +1875,21 @@ mono_type_equal (gconstpointer ka, gconstpointer kb) guint mono_metadata_generic_inst_hash (gconstpointer data) { + // Custom MurmurHash3 for generic instances to produce a high quality hash const MonoGenericInst *ginst = (const MonoGenericInst *) data; - guint hash = 0; g_assert (ginst); g_assert (ginst->type_argv); + uint32_t h1 = ginst->type_argc; + for (guint i = 0; i < ginst->type_argc; ++i) { - hash *= 13; g_assert (ginst->type_argv [i]); - hash += mono_metadata_type_hash (ginst->type_argv [i]); + MURMUR3_HASH_BLOCK ((uint32_t) mono_metadata_type_hash (ginst->type_argv [i])); } - return hash ^ (ginst->is_open << 8); + h1 ^= ginst->is_open; + + return (guint)murmur3_fmix32 (h1); } static gboolean @@ -2936,7 +2935,7 @@ aggregate_modifiers_equal (gconstpointer ka, gconstpointer kb) for (int i = 0; i < amods1->count; ++i) { if (amods1->modifiers [i].required != amods2->modifiers [i].required) return FALSE; - if (!mono_metadata_type_equal_full (amods1->modifiers [i].type, amods2->modifiers [i].type, TRUE)) + if (!mono_metadata_type_equal_full (amods1->modifiers [i].type, amods2->modifiers [i].type, MONO_TYPE_EQ_FLAGS_SIG_ONLY)) return FALSE; } return TRUE; @@ -3499,10 +3498,9 @@ mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate) mono_loader_lock (); if (!mm->ginst_cache) - mm->ginst_cache = dn_simdhash_ght_new_full (mono_metadata_generic_inst_hash, mono_metadata_generic_inst_equal, NULL, (GDestroyNotify)free_generic_inst, 0, NULL); + mm->ginst_cache = g_hash_table_new_full (mono_metadata_generic_inst_hash, mono_metadata_generic_inst_equal, NULL, (GDestroyNotify)free_generic_inst); - MonoGenericInst *ginst = NULL; - dn_simdhash_ght_try_get_value (mm->ginst_cache, candidate, (void **)&ginst); + MonoGenericInst *ginst = g_hash_table_lookup (mm->ginst_cache, candidate); if (!ginst) { int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *); ginst = (MonoGenericInst *)mono_mem_manager_alloc0 (mm, size); @@ -3516,7 +3514,7 @@ mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate) for (int i = 0; i < type_argc; ++i) ginst->type_argv [i] = mono_metadata_type_dup (NULL, candidate->type_argv [i]); - dn_simdhash_ght_insert (mm->ginst_cache, ginst, ginst); + g_hash_table_insert (mm->ginst_cache, ginst, ginst); } mono_loader_unlock (); @@ -5936,24 +5934,23 @@ do_mono_metadata_type_equal (MonoType *t1, MonoType *t2, int equiv_flags) gboolean mono_metadata_type_equal (MonoType *t1, MonoType *t2) { - return do_mono_metadata_type_equal (t1, t2, 0); + return do_mono_metadata_type_equal (t1, t2, MONO_TYPE_EQ_FLAGS_NONE); } /** * mono_metadata_type_equal_full: * \param t1 a type * \param t2 another type - * \param signature_only if signature only comparison should be made + * \param flags flags used to modify comparison logic * - * Determine if \p t1 and \p t2 are signature compatible if \p signature_only is TRUE, otherwise - * behaves the same way as mono_metadata_type_equal. - * The function mono_metadata_type_equal(a, b) is just a shortcut for mono_metadata_type_equal_full(a, b, FALSE). - * \returns TRUE if \p t1 and \p t2 are equal taking \p signature_only into account. + * Determine if \p t1 and \p t2 are compatible based on the supplied flags. + * The function mono_metadata_type_equal(a, b) is just a shortcut for mono_metadata_type_equal_full(a, b, MONO_TYPE_EQ_FLAGS_NONE). + * \returns TRUE if \p t1 and \p t2 are equal. */ gboolean -mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only) +mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, int flags) { - return do_mono_metadata_type_equal (t1, t2, signature_only ? MONO_TYPE_EQ_FLAGS_SIG_ONLY : 0); + return do_mono_metadata_type_equal (t1, t2, flags); } enum { diff --git a/src/mono/mono/metadata/monitor.c b/src/mono/mono/metadata/monitor.c index 6a72695e9fbedc..2e08f94d3361e7 100644 --- a/src/mono/mono/metadata/monitor.c +++ b/src/mono/mono/metadata/monitor.c @@ -82,9 +82,9 @@ struct _MonitorArray { MonoThreadsSync monitors [MONO_ZERO_LEN_ARRAY]; }; -#define mono_monitor_allocator_lock() mono_os_mutex_lock (&monitor_mutex) -#define mono_monitor_allocator_unlock() mono_os_mutex_unlock (&monitor_mutex) -static mono_mutex_t monitor_mutex; +#define mono_monitor_allocator_lock() mono_coop_mutex_lock (&monitor_mutex) +#define mono_monitor_allocator_unlock() mono_coop_mutex_unlock (&monitor_mutex) +static MonoCoopMutex monitor_mutex; static MonoThreadsSync *monitor_freelist; static MonitorArray *monitor_allocated; static int array_size = 16; @@ -255,7 +255,7 @@ lock_word_new_flat (gint32 owner) void mono_monitor_init (void) { - mono_os_mutex_init_recursive (&monitor_mutex); + mono_coop_mutex_init_recursive (&monitor_mutex); } static int diff --git a/src/mono/mono/metadata/object.c b/src/mono/mono/metadata/object.c index 1c1a632a4003e7..8ff1295057db10 100644 --- a/src/mono/mono/metadata/object.c +++ b/src/mono/mono/metadata/object.c @@ -906,9 +906,13 @@ compute_class_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int guint32 field_iter = 1; guint32 field_instance_offset = field_offset; + int field_size = 0; // If struct has InlineArray attribute, iterate `length` times to set a bitmap - if (m_class_is_inlinearray (p)) + if (m_class_is_inlinearray (p)) { + int align; field_iter = m_class_inlinearray_value (p); + field_size = mono_type_size (field->type, &align); + } if (field_iter > 500) g_warning ("Large number of iterations detected when creating a GC bitmap, might affect performance."); @@ -973,7 +977,7 @@ compute_class_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int break; } - field_instance_offset += field_offset; + field_instance_offset += field_size; field_iter--; } } @@ -6806,6 +6810,7 @@ mono_object_handle_isinst (MonoObjectHandle obj, MonoClass *klass, MonoError *er { error_init (error); + if (!m_class_is_inited (klass)) mono_class_init_internal (klass); diff --git a/src/mono/mono/metadata/sgen-bridge.c b/src/mono/mono/metadata/sgen-bridge.c index 579fc0d376cd6a..1f7dc31c9b4b11 100644 --- a/src/mono/mono/metadata/sgen-bridge.c +++ b/src/mono/mono/metadata/sgen-bridge.c @@ -316,24 +316,24 @@ dump_processor_state (SgenBridgeProcessor *p) { int i; - printf ("------\n"); - printf ("SCCS %d\n", p->num_sccs); + g_message ("------\n"); + g_message ("SCCS %d\n", p->num_sccs); for (i = 0; i < p->num_sccs; ++i) { int j; MonoGCBridgeSCC *scc = p->api_sccs [i]; - printf ("\tSCC %d:", i); + g_message ("\tSCC %d:", i); for (j = 0; j < scc->num_objs; ++j) { MonoObject *obj = scc->objs [j]; - printf (" %p(%s)", obj, SGEN_LOAD_VTABLE (obj)->klass->name); + g_message (" %p(%s)", obj, m_class_get_name (SGEN_LOAD_VTABLE (obj)->klass)); } - printf ("\n"); + g_message ("\n"); } - printf ("XREFS %d\n", p->num_xrefs); + g_message ("XREFS %d\n", p->num_xrefs); for (i = 0; i < p->num_xrefs; ++i) - printf ("\t%d -> %d\n", p->api_xrefs [i].src_scc_index, p->api_xrefs [i].dst_scc_index); + g_message ("\t%d -> %d\n", p->api_xrefs [i].src_scc_index, p->api_xrefs [i].dst_scc_index); - printf ("-------\n"); + g_message ("-------\n"); } */ @@ -352,7 +352,7 @@ sgen_compare_bridge_processor_results (SgenBridgeProcessor *a, SgenBridgeProcess if (a->num_sccs != b->num_sccs) g_error ("SCCS count expected %d but got %d", a->num_sccs, b->num_sccs); if (a->num_xrefs != b->num_xrefs) - g_error ("SCCS count expected %d but got %d", a->num_xrefs, b->num_xrefs); + g_error ("XREFS count expected %d but got %d", a->num_xrefs, b->num_xrefs); /* * First we build a hash of each object in `a` to its respective SCC index within diff --git a/src/mono/mono/metadata/sgen-tarjan-bridge.c b/src/mono/mono/metadata/sgen-tarjan-bridge.c index b0c9cf1f83baef..7a8ad5961d98e7 100644 --- a/src/mono/mono/metadata/sgen-tarjan-bridge.c +++ b/src/mono/mono/metadata/sgen-tarjan-bridge.c @@ -400,16 +400,7 @@ static const char* safe_name_bridge (GCObject *obj) { GCVTable vt = SGEN_LOAD_VTABLE (obj); - return vt->klass->name; -} - -static ScanData* -find_or_create_data (GCObject *obj) -{ - ScanData *entry = find_data (obj); - if (!entry) - entry = create_data (obj); - return entry; + return m_class_get_name (vt->klass); } #endif @@ -566,10 +557,15 @@ find_in_cache (int *insert_index) // Populate other_colors for a give color (other_colors represent the xrefs for this color) static void -add_other_colors (ColorData *color, DynPtrArray *other_colors) +add_other_colors (ColorData *color, DynPtrArray *other_colors, gboolean check_visited) { for (int i = 0; i < dyn_array_ptr_size (other_colors); ++i) { ColorData *points_to = (ColorData *)dyn_array_ptr_get (other_colors, i); + if (check_visited) { + if (points_to->visited) + continue; + points_to->visited = TRUE; + } dyn_array_ptr_add (&color->other_colors, points_to); // Inform targets points_to->incoming_colors = MIN (points_to->incoming_colors + 1, INCOMING_COLORS_MAX); @@ -593,7 +589,7 @@ new_color (gboolean has_bridges) cd = alloc_color_data (); cd->api_index = -1; - add_other_colors (cd, &color_merge_array); + add_other_colors (cd, &color_merge_array, FALSE); /* if cacheSlot >= 0, it means we prepared a given slot to receive the new color */ if (cacheSlot >= 0) @@ -700,11 +696,11 @@ compute_low_index (ScanData *data, GCObject *obj) obj = bridge_object_forward (obj); other = find_data (obj); -#if DUMP_GRAPH - printf ("\tcompute low %p ->%p (%s) %p (%d / %d, color %p)\n", data->obj, obj, safe_name_bridge (obj), other, other ? other->index : -2, other ? other->low_index : -2, other->color); -#endif if (!other) return; +#if DUMP_GRAPH + printf ("\tcompute low %p ->%p (%s) %p (%d / %d, color %p)\n", data->obj, obj, safe_name_bridge (obj), other, other ? other->index : -2, other->low_index, other->color); +#endif g_assert (other->state != INITIAL); @@ -777,10 +773,16 @@ create_scc (ScanData *data) gboolean found = FALSE; gboolean found_bridge = FALSE; ColorData *color_data = NULL; + gboolean can_reduce_color = TRUE; for (i = dyn_array_ptr_size (&loop_stack) - 1; i >= 0; --i) { ScanData *other = (ScanData *)dyn_array_ptr_get (&loop_stack, i); found_bridge |= other->is_bridge; + if (dyn_array_ptr_size (&other->xrefs) > 0 || found_bridge) { + // This scc will have more xrefs than the ones from the color_merge_array, + // we will need to create a new color to store this information. + can_reduce_color = FALSE; + } if (found_bridge || other == data) break; } @@ -788,13 +790,15 @@ create_scc (ScanData *data) if (found_bridge) { color_data = new_color (TRUE); ++num_colors_with_bridges; - } else { + } else if (can_reduce_color) { color_data = reduce_color (); + } else { + color_data = new_color (FALSE); } #if DUMP_GRAPH printf ("|SCC %p rooted in %s (%p) has bridge %d\n", color_data, safe_name_bridge (data->obj), data->obj, found_bridge); printf ("\tloop stack: "); - for (int i = 0; i < dyn_array_ptr_size (&loop_stack); ++i) { + for (i = 0; i < dyn_array_ptr_size (&loop_stack); ++i) { ScanData *other = dyn_array_ptr_get (&loop_stack, i); printf ("(%d/%d)", other->index, other->low_index); } @@ -824,10 +828,19 @@ create_scc (ScanData *data) dyn_array_ptr_add (&color_data->bridges, other->obj); } - // Maybe we should make sure we are not adding duplicates here. It is not really a problem - // since we will get rid of duplicates before submitting the SCCs to the client in gather_xrefs - if (color_data) - add_other_colors (color_data, &other->xrefs); + if (dyn_array_ptr_size (&other->xrefs) > 0) { + g_assert (color_data != NULL); + g_assert (can_reduce_color == FALSE); + // We need to eliminate duplicates early otherwise the heaviness property + // can change in gather_xrefs and it breaks down the loop that reports the + // xrefs to the client. + // + // We reuse the visited flag to mark the objects that are already part of + // the color_data array. The array was created above with the new_color call + // and xrefs were populated from color_merge_array, which is already + // deduplicated and every entry is marked as visited. + add_other_colors (color_data, &other->xrefs, TRUE); + } dyn_array_ptr_uninit (&other->xrefs); if (other == data) { @@ -837,11 +850,22 @@ create_scc (ScanData *data) } g_assert (found); + // Clear the visited flag on nodes that were added with add_other_colors in the loop above + if (!can_reduce_color) { + for (i = dyn_array_ptr_size (&color_merge_array); i < dyn_array_ptr_size (&color_data->other_colors); i++) { + ColorData *cd = (ColorData *)dyn_array_ptr_get (&color_data->other_colors, i); + g_assert (cd->visited); + cd->visited = FALSE; + } + } + #if DUMP_GRAPH - printf ("\tpoints-to-colors: "); - for (int i = 0; i < dyn_array_ptr_size (&color_data->other_colors); i++) - printf ("%p ", dyn_array_ptr_get (&color_data->other_colors, i)); - printf ("\n"); + if (color_data) { + printf ("\tpoints-to-colors: "); + for (i = 0; i < dyn_array_ptr_size (&color_data->other_colors); i++) + printf ("%p ", dyn_array_ptr_get (&color_data->other_colors, i)); + printf ("\n"); + } #endif } @@ -966,8 +990,11 @@ dump_color_table (const char *why, gboolean do_index) printf (" bridges: "); for (j = 0; j < dyn_array_ptr_size (&cd->bridges); ++j) { GCObject *obj = dyn_array_ptr_get (&cd->bridges, j); - ScanData *data = find_or_create_data (obj); - printf ("%d ", data->index); + ScanData *data = find_data (obj); + if (!data) + printf ("%p ", obj); + else + printf ("%p(%d) ", obj, data->index); } } printf ("\n"); @@ -1027,7 +1054,7 @@ processing_stw_step (void) #if defined (DUMP_GRAPH) printf ("----summary----\n"); printf ("bridges:\n"); - for (int i = 0; i < bridge_count; ++i) { + for (i = 0; i < bridge_count; ++i) { ScanData *sd = find_data (dyn_array_ptr_get (®istered_bridges, i)); printf ("\t%s (%p) index %d color %p\n", safe_name_bridge (sd->obj), sd->obj, sd->index, sd->color); } @@ -1141,6 +1168,7 @@ processing_build_callback_data (int generation) gather_xrefs (cd); reset_xrefs (cd); dyn_array_ptr_set_all (&cd->other_colors, &color_merge_array); + g_assert (color_visible_to_client (cd)); xref_count += dyn_array_ptr_size (&cd->other_colors); } } diff --git a/src/mono/mono/mini/interp/interp-simd-intrins.def b/src/mono/mono/mini/interp/interp-simd-intrins.def index d88e543af23471..197b3c269d6612 100644 --- a/src/mono/mono/mini/interp/interp-simd-intrins.def +++ b/src/mono/mono/mini/interp/interp-simd-intrins.def @@ -351,7 +351,7 @@ INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToSingle, U4, wasm_f32x4_convert_u32x4, INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToSingle, R8, wasm_f32x4_demote_f64x2_zero, 0x5e) INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToDoubleLower, I4, wasm_f64x2_convert_low_i32x4, 0xfe) INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToDoubleLower, U4, wasm_f64x2_convert_low_u32x4, 0xff) -INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToDoubleLower, R8, wasm_f64x2_promote_low_f32x4, 0x5f) +INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToDoubleLower, R4, wasm_f64x2_promote_low_f32x4, 0x5f) INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToInt32Saturate, R4, wasm_i32x4_trunc_sat_f32x4, 0xf8) INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToUInt32Saturate, R4, wasm_u32x4_trunc_sat_f32x4, 0xf9) INTERP_WASM_SIMD_INTRINSIC_V_V (ConvertToInt32Saturate, R8, wasm_i32x4_trunc_sat_f64x2_zero, 0xfc) diff --git a/src/mono/mono/mini/interp/interp.c b/src/mono/mono/mini/interp/interp.c index 12f2cdd50350ee..011d99a9625dda 100644 --- a/src/mono/mono/mini/interp/interp.c +++ b/src/mono/mono/mini/interp/interp.c @@ -3862,6 +3862,34 @@ max_d (double lhs, double rhs) return fmax (lhs, rhs); } +// Equivalent of mono_get_addr_compiled_method +static gpointer +interp_ldvirtftn_delegate (gpointer arg, MonoDelegate *del) +{ + MonoMethod *virtual_method = del->method; + ERROR_DECL(error); + + MonoClass *klass = del->object.vtable->klass; + MonoMethod *invoke = mono_get_delegate_invoke_internal (klass); + MonoMethodSignature *invoke_sig = mono_method_signature_internal (invoke); + + MonoClass *arg_class = NULL; + if (m_type_is_byref (invoke_sig->params [0])) { + arg_class = mono_class_from_mono_type_internal (invoke_sig->params [0]); + } else { + MonoObject *object = (MonoObject*)arg; + arg_class = object->vtable->klass; + } + + MonoMethod *res = mono_class_get_virtual_method (arg_class, virtual_method, error); + mono_error_assert_ok (error); + + gboolean need_unbox = m_class_is_valuetype (res->klass) && !m_class_is_valuetype (virtual_method->klass); + + InterpMethod *imethod = mono_interp_get_imethod (res); + return imethod_to_ftnptr (imethod, need_unbox); +} + /* * If CLAUSE_ARGS is non-null, start executing from it. * The ERROR argument is used to avoid declaring an error object for every interp frame, its not used @@ -7790,6 +7818,15 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK; ip += 3; MINT_IN_BREAK; } + MINT_IN_CASE(MINT_LDVIRTFTN_DELEGATE) { + gpointer arg = LOCAL_VAR (ip [2], gpointer); + MonoDelegate *del = LOCAL_VAR (ip [3], MonoDelegate*); + NULL_CHECK (arg); + + LOCAL_VAR (ip [1], gpointer) = interp_ldvirtftn_delegate (arg, del); + ip += 4; + MINT_IN_BREAK; + } #define MATH_UNOP(mathfunc) \ LOCAL_VAR (ip [1], double) = mathfunc (LOCAL_VAR (ip [2], double)); \ @@ -8944,6 +8981,10 @@ mono_ee_interp_init (const char *opts) set_context (NULL); interp_parse_options (opts); + + const char *env_opts = g_getenv ("MONO_INTERPRETER_OPTIONS"); + if (env_opts) + interp_parse_options (env_opts); /* Don't do any optimizations if running under debugger */ if (mini_get_debug_options ()->mdb_optimizations) mono_interp_opt = 0; diff --git a/src/mono/mono/mini/interp/mintops.def b/src/mono/mono/mini/interp/mintops.def index 11e65fb97ade69..bcd6dde1605fab 100644 --- a/src/mono/mono/mini/interp/mintops.def +++ b/src/mono/mono/mini/interp/mintops.def @@ -728,6 +728,7 @@ OPDEF(MINT_SDB_INTR_LOC, "sdb_intr_loc", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_SDB_SEQ_POINT, "sdb_seq_point", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_SDB_BREAKPOINT, "sdb_breakpoint", 1, 0, 0, MintOpNoArgs) OPDEF(MINT_LD_DELEGATE_METHOD_PTR, "ld_delegate_method_ptr", 3, 1, 1, MintOpNoArgs) +OPDEF(MINT_LDVIRTFTN_DELEGATE, "ldvirtftn_delegate", 4, 1, 2, MintOpNoArgs) // Math intrinsics // double diff --git a/src/mono/mono/mini/interp/transform-opt.c b/src/mono/mono/mini/interp/transform-opt.c index b259e116c14404..f5ffbc89df7fdd 100644 --- a/src/mono/mono/mini/interp/transform-opt.c +++ b/src/mono/mono/mini/interp/transform-opt.c @@ -3124,6 +3124,7 @@ interp_cprop (TransformData *td) ins->data [2] = GINT_TO_UINT16 (ldsize); interp_clear_ins (ins->prev); + td->var_values [ins->dreg].def = ins; } if (td->verbose_level) { g_print ("Replace ldloca/ldobj_vt pair :\n\t"); @@ -3204,6 +3205,7 @@ interp_cprop (TransformData *td) ins->data [2] = vtsize; interp_clear_ins (ins->prev); + td->var_values [ins->dreg].def = ins; // MINT_MOV_DST_OFF doesn't work if dreg is allocated at the same location as the // field value to be stored, because its behavior is not atomic in nature. We first @@ -3400,9 +3402,11 @@ interp_super_instructions (TransformData *td) current_liveness.bb_dfs_index = bb->dfs_index; current_liveness.ins_index = 0; for (InterpInst *ins = bb->first_ins; ins != NULL; ins = ins->next) { - int opcode = ins->opcode; + int opcode; if (bb->dfs_index >= td->bblocks_count_no_eh || bb->dfs_index == -1 || (ins->flags & INTERP_INST_FLAG_LIVENESS_MARKER)) current_liveness.ins_index++; +retry_ins: + opcode = ins->opcode; if (MINT_IS_NOP (opcode)) continue; @@ -3801,9 +3805,7 @@ interp_super_instructions (TransformData *td) g_print ("superins: "); interp_dump_ins (ins, td->data_items); } - // The newly added opcode could be part of further superinstructions. Retry - ins = ins->prev; - continue; + goto retry_ins; } } } diff --git a/src/mono/mono/mini/interp/transform-simd.c b/src/mono/mono/mini/interp/transform-simd.c index c1d6b81019d02f..70b88cf0c148d0 100644 --- a/src/mono/mono/mini/interp/transform-simd.c +++ b/src/mono/mono/mini/interp/transform-simd.c @@ -779,6 +779,24 @@ emit_sn_vector4 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature *cs } #if HOST_BROWSER +static MonoTypeEnum +resolve_native_size (MonoTypeEnum type) +{ + if (type == MONO_TYPE_I) +#if TARGET_SIZEOF_VOID_P == 4 + return MONO_TYPE_I4; +#else + return MONO_TYPE_I8; +#endif + else if (type == MONO_TYPE_U) +#if TARGET_SIZEOF_VOID_P == 4 + return MONO_TYPE_U4; +#else + return MONO_TYPE_U8; +#endif + return type; + +} #define PSIMD_ARGTYPE_I1 MONO_TYPE_I1 #define PSIMD_ARGTYPE_I2 MONO_TYPE_I2 @@ -803,6 +821,7 @@ emit_sn_vector4 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature *cs static gboolean packedsimd_type_matches (MonoTypeEnum type, int expected_type) { + type = resolve_native_size (type); if (expected_type == PSIMD_ARGTYPE_ANY) return TRUE; else if (type == expected_type) @@ -906,6 +925,8 @@ lookup_packedsimd_intrinsic (const char *name, MonoType *arg1) arg_type = mono_class_get_context (vector_klass)->class_inst->type_argv [0]; } else if (arg1->type == MONO_TYPE_PTR) { arg_type = arg1->data.type; + } else if (MONO_TYPE_IS_VECTOR_PRIMITIVE(arg1)) { + arg_type = arg1; } else { // g_printf ("%s arg1 type was not pointer or simd type: %s\n", name, m_class_get_name (vector_klass)); return FALSE; @@ -989,7 +1010,13 @@ emit_sri_packedsimd (TransformData *td, MonoMethod *cmethod, MonoMethodSignature int id = lookup_intrins (sri_packedsimd_methods, sizeof (sri_packedsimd_methods), cmethod->name); // We don't early-out for an unrecognized method, we will generate an NIY later - MonoClass *vector_klass = mono_class_from_mono_type_internal (csignature->ret); + MonoClass *vector_klass = NULL; + if (csignature->ret->type == MONO_TYPE_VOID && csignature->param_count > 1 && mono_type_is_pointer (csignature->params [0])) { + // The Store* methods have a more complicated signature + vector_klass = mono_class_from_mono_type_internal (csignature->params [1]); + } else { + vector_klass = mono_class_from_mono_type_internal (csignature->ret); + } MonoTypeEnum atype; int vector_size = -1, arg_size, scalar_arg; diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 4b1865b8310b53..a74e9baafb300b 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -8011,6 +8011,16 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header, push_simple_type (td, STACK_TYPE_I); interp_ins_set_dreg (td->last_ins, td->sp [-1].var); break; + case CEE_MONO_LDVIRTFTN_DELEGATE: + CHECK_STACK (td, 2); + td->sp -= 2; + td->ip += 1; + interp_add_ins (td, MINT_LDVIRTFTN_DELEGATE); + interp_ins_set_sregs2 (td->last_ins, td->sp [0].var, td->sp [1].var); + push_simple_type (td, STACK_TYPE_I); + interp_ins_set_dreg (td->last_ins, td->sp [-1].var); + break; + case CEE_MONO_CALLI_EXTRA_ARG: { int saved_local = td->sp [-1].var; /* Same as CEE_CALLI, except that we drop the extra arg required for llvm specific behaviour */ diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index df7c332f8fcd4c..a62f6959f2b2b7 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -1702,7 +1702,7 @@ mono_throw_type_load (MonoClass* klass) mono_error_set_type_load_class (error, klass, "Attempting to load invalid type '%s'.", klass_name); g_free (klass_name); } - + mono_error_set_pending_exception (error); } @@ -1743,6 +1743,11 @@ mini_init_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, MonoGSharedMeth mono_method_get_context (m), m->klass); g_assert (data); + // we need a barrier before publishing data via mrgctx->infos [i] because the contents of data may not + // have been published to all cores and another thread may read zeroes or partially initialized data + // out of it, even though we have a barrier before publication of entries in mrgctx->entries below + mono_memory_barrier(); + /* The first few entries are stored inline, the rest are stored in mrgctx->entries */ if (i < ninline) mrgctx->infos [i] = data; diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index d9432fd5510de5..97985da7324980 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -5757,8 +5757,11 @@ check_get_virtual_method_assumptions (MonoClass* klass, MonoMethod* method) * Returns null, if the optimization cannot be performed. */ static MonoMethod* -try_prepare_objaddr_callvirt_optimization (MonoCompile *cfg, guchar *next_ip, guchar* end, MonoMethod *method, MonoGenericContext* generic_context, MonoClass *klass) +try_prepare_objaddr_callvirt_optimization (MonoCompile *cfg, guchar *next_ip, guchar* end, MonoMethod *method, MonoGenericContext* generic_context, MonoType *param_type) { + g_assert(param_type); + MonoClass *klass = mono_class_from_mono_type_internal (param_type); + // TODO: relax the _is_def requirement? if (cfg->compile_aot || cfg->compile_llvm || !klass || !mono_class_is_def (klass)) return NULL; @@ -6260,6 +6263,9 @@ method_make_alwaysthrow_typeloadfailure (MonoCompile* cfg, MonoClass* klass) mono_link_bblock (cfg, bb, cfg->bb_exit); cfg->disable_inline = TRUE; + + for (guint i = 0; i < cfg->header->num_clauses; i++) + cfg->clause_is_dead [i] = TRUE; } typedef union _MonoOpcodeParameter { @@ -7256,7 +7262,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b } *sp++ = ins; /*if (!m_method_is_icall (method)) */{ - MonoMethod* callvirt_target = try_prepare_objaddr_callvirt_optimization (cfg, next_ip, end, method, generic_context, param_types [n]->data.klass); + MonoMethod* callvirt_target = try_prepare_objaddr_callvirt_optimization (cfg, next_ip, end, method, generic_context, param_types [n]); if (callvirt_target) cmethod_override = callvirt_target; } @@ -10137,6 +10143,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b EMIT_NEW_PCONST (cfg, *sp, NULL); sp++; } else if (il_op == MONO_CEE_LDFLD || il_op == MONO_CEE_LDSFLD) { + // method_make_alwaysthrow_typeloadfailure currently doesn't work with inlining + INLINE_FAILURE("type load error"); // An object is expected here. It may be impossible to correctly infer its type, // we turn this entire method into a throw. method_make_alwaysthrow_typeloadfailure (cfg, klass); @@ -11589,6 +11597,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b *sp++ = ins; break; } + case MONO_CEE_MONO_LDVIRTFTN_DELEGATE: { + CHECK_STACK (2); + sp -= 2; + + ins = mono_emit_jit_icall (cfg, mono_get_addr_compiled_method, sp); + *sp++ = ins; + break; + } case MONO_CEE_MONO_CALLI_EXTRA_ARG: { MonoInst *addr; MonoInst *arg; @@ -12109,13 +12125,12 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b break; case MONO_CEE_INITOBJ: klass = mini_get_class (method, token, generic_context); + --sp; if (CLASS_HAS_FAILURE (klass)) { HANDLE_TYPELOAD_ERROR (cfg, klass); inline_costs += 10; break; // reached only in AOT } - - --sp; if (mini_class_is_reference (klass)) MONO_EMIT_NEW_STORE_MEMBASE_IMM (cfg, OP_STORE_MEMBASE_IMM, sp [0]->dreg, 0, 0); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 29c8af40b4153d..8cc8c986381b52 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -8433,7 +8433,21 @@ MONO_RESTORE_WARNING LLVMValueRef dest; dest = convert (ctx, LLVMBuildAdd (builder, convert (ctx, values [ins->inst_destbasereg], IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_offset, FALSE), ""), pointer_type (t)); - mono_llvm_build_aligned_store (builder, lhs, dest, FALSE, 1); + if (mono_class_value_size (ins->klass, NULL) == 12) { + const int mask_values [] = { 0, 1, 2 }; + + LLVMValueRef truncatedVec3 = LLVMBuildShuffleVector ( + builder, + lhs, + LLVMGetUndef (t), + create_const_vector_i32 (mask_values, 3), + "truncated_vec3" + ); + + mono_llvm_build_aligned_store (builder, truncatedVec3, dest, FALSE, 1); + } else { + mono_llvm_build_aligned_store (builder, lhs, dest, FALSE, 1); + } break; } case OP_XBINOP: diff --git a/src/mono/mono/mini/mini-posix.c b/src/mono/mono/mini/mini-posix.c index 429d1dc3744f39..fd8b480e5362dc 100644 --- a/src/mono/mono/mini/mini-posix.c +++ b/src/mono/mono/mini/mini-posix.c @@ -188,7 +188,7 @@ save_old_signal_handler (int signo, struct sigaction *old_action) * * Call the original signal handler for the signal given by the arguments, which * should be the same as for a signal handler. Returns TRUE if the original handler - * was called, false otherwise. + * was called, false otherwise. NOTE: sigaction.sa_handler == SIG_DFL handlers are not considered. */ gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) @@ -196,6 +196,7 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) int signal = MONO_SIG_HANDLER_GET_SIGNO (); struct sigaction *saved_handler = (struct sigaction *)get_saved_signal_handler (signal); + // Ignores chaining to default signal handlers i.e. when saved_handler->sa_handler == SIG_DFL if (saved_handler && saved_handler->sa_handler) { if (!(saved_handler->sa_flags & SA_SIGINFO)) { saved_handler->sa_handler (signal); @@ -209,6 +210,27 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) return FALSE; } + +/* + * mono_chain_signal_to_default_sigsegv_handler: + * + * Call the original SIGSEGV signal handler in cases when the original handler is + * sigaction.sa_handler == SIG_DFL. This is used to propagate the crash to the OS. + */ +void +mono_chain_signal_to_default_sigsegv_handler (void) +{ + struct sigaction *saved_handler = (struct sigaction *)get_saved_signal_handler (SIGSEGV); + + if (saved_handler && saved_handler->sa_handler == SIG_DFL) { + sigaction (SIGSEGV, saved_handler, NULL); + raise (SIGSEGV); + } else { + g_async_safe_printf ("\nFailed to chain SIGSEGV signal to the default handler.\n"); + } +} + + MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler) { MonoJitInfo *ji = NULL; @@ -348,8 +370,14 @@ add_signal_handler (int signo, MonoSignalHandler handler, int flags) /* if there was already a handler in place for this signal, store it */ if (! (previous_sa.sa_flags & SA_SIGINFO) && - (SIG_DFL == previous_sa.sa_handler)) { - /* it there is no sa_sigaction function and the sa_handler is default, we can safely ignore this */ + (SIG_DFL == previous_sa.sa_handler) && signo != SIGSEGV) { + /* + * If there is no sa_sigaction function and the sa_handler is default, + * it means the currently registered handler for this signal is the default one. + * For signal chaining, we need to store the default SIGSEGV handler so that the crash + * is properly propagated, while default handlers for other signals are ignored and + * are not considered. + */ } else { if (mono_do_signal_chaining) save_old_signal_handler (signo, &previous_sa); diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index f431897becd001..bcd7754da660a6 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -3908,7 +3908,8 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler) mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info); if (mono_do_crash_chaining) { - mono_chain_signal (MONO_SIG_HANDLER_PARAMS); + if (!mono_chain_signal (MONO_SIG_HANDLER_PARAMS)) + mono_chain_signal_to_default_sigsegv_handler (); return; } } @@ -3918,7 +3919,8 @@ MONO_SIG_HANDLER_FUNC (, mono_sigsegv_signal_handler) } else { mono_handle_native_crash (mono_get_signame (SIGSEGV), &mctx, (MONO_SIG_HANDLER_INFO_TYPE*)info); if (mono_do_crash_chaining) { - mono_chain_signal (MONO_SIG_HANDLER_PARAMS); + if (!mono_chain_signal (MONO_SIG_HANDLER_PARAMS)) + mono_chain_signal_to_default_sigsegv_handler (); return; } } diff --git a/src/mono/mono/mini/mini-runtime.h b/src/mono/mono/mini/mini-runtime.h index 5104a053b30c77..7779909bd944e2 100644 --- a/src/mono/mono/mini/mini-runtime.h +++ b/src/mono/mono/mini/mini-runtime.h @@ -678,6 +678,7 @@ void MONO_SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler); void MONO_SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) ; void MONO_SIG_HANDLER_SIGNATURE (mono_sigterm_signal_handler) ; gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal); +void mono_chain_signal_to_default_sigsegv_handler (void); #if defined (HOST_WASM) diff --git a/src/mono/mono/mini/mini-wasm.c b/src/mono/mono/mini/mini-wasm.c index 2a210e4af6e015..a0587570fe2bdf 100644 --- a/src/mono/mono/mini/mini-wasm.c +++ b/src/mono/mono/mini/mini-wasm.c @@ -587,6 +587,12 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) return FALSE; } +void +mono_chain_signal_to_default_sigsegv_handler (void) +{ + g_error ("mono_chain_signal_to_default_sigsegv_handler not supported on WASM"); +} + gboolean mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info, void *sigctx) { diff --git a/src/mono/mono/mini/mini-windows.c b/src/mono/mono/mini/mini-windows.c index 322488abdaab76..cb79586c98a5ee 100644 --- a/src/mono/mono/mini/mini-windows.c +++ b/src/mono/mono/mini/mini-windows.c @@ -252,6 +252,12 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) return TRUE; } +void +mono_chain_signal_to_default_sigsegv_handler (void) +{ + g_error ("mono_chain_signal_to_default_sigsegv_handler not supported on Windows"); +} + #if !HAVE_EXTERN_DEFINED_NATIVE_CRASH_HANDLER #ifndef MONO_CROSS_COMPILE void diff --git a/src/mono/mono/sgen/sgen-array-list.h b/src/mono/mono/sgen/sgen-array-list.h index d98e678cfc48c5..4de9433dbf891d 100644 --- a/src/mono/mono/sgen/sgen-array-list.h +++ b/src/mono/mono/sgen/sgen-array-list.h @@ -60,7 +60,10 @@ static inline guint32 sgen_clz (guint32 x) { gulong leading_zero_bits; - return _BitScanReverse (&leading_zero_bits, (gulong)x) ? 31 - leading_zero_bits : 32; + if (_BitScanReverse (&leading_zero_bits, (gulong)x)) + return 31 - leading_zero_bits; + else + return 32; } #elif defined(ENABLE_MSVC_LZCNT) && defined(_MSC_VER) static inline guint32 diff --git a/src/mono/mono/sgen/sgen-cardtable.c b/src/mono/mono/sgen/sgen-cardtable.c index 6a662fb605019f..e344ec15fe228f 100644 --- a/src/mono/mono/sgen/sgen-cardtable.c +++ b/src/mono/mono/sgen/sgen-cardtable.c @@ -165,6 +165,31 @@ sgen_card_table_wbarrier_range_copy (gpointer _dest, gconstpointer _src, int siz } } +// Marks more cards so that it works with remset consistency debug checks +static void +sgen_card_table_wbarrier_range_copy_debug (gpointer _dest, gconstpointer _src, int size) +{ + GCObject **dest = (GCObject **)_dest; + GCObject **src = (GCObject **)_src; + + size_t nursery_bits = sgen_nursery_bits; + char *start = sgen_nursery_start; + G_GNUC_UNUSED char *end = sgen_nursery_end; + + while (size) { + GCObject *value = *src; + *dest = value; + if (SGEN_PTR_IN_NURSERY (value, nursery_bits, start, end) || sgen_concurrent_collection_in_progress) { + volatile guint8 *card_address = (volatile guint8 *)sgen_card_table_get_card_address ((mword)dest); + *card_address = 1; + sgen_dummy_use (value); + } + ++src; + ++dest; + size -= SIZEOF_VOID_P; + } +} + MONO_RESTORE_WARNING #ifdef SGEN_HAVE_OVERLAPPING_CARDS @@ -606,7 +631,7 @@ sgen_cardtable_scan_object (GCObject *obj, mword block_obj_size, guint8 *cards, } void -sgen_card_table_init (SgenRememberedSet *remset) +sgen_card_table_init (SgenRememberedSet *remset, gboolean consistency_checks) { sgen_cardtable = (guint8 *)sgen_alloc_os_memory (CARD_COUNT_IN_BYTES, (SgenAllocFlags)(SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE), "card table", MONO_MEM_ACCOUNT_SGEN_CARD_TABLE); @@ -637,7 +662,10 @@ sgen_card_table_init (SgenRememberedSet *remset) remset->find_address = sgen_card_table_find_address; remset->find_address_with_cards = sgen_card_table_find_address_with_cards; - remset->wbarrier_range_copy = sgen_card_table_wbarrier_range_copy; + if (consistency_checks) + remset->wbarrier_range_copy = sgen_card_table_wbarrier_range_copy_debug; + else + remset->wbarrier_range_copy = sgen_card_table_wbarrier_range_copy; need_mod_union = sgen_get_major_collector ()->is_concurrent; } diff --git a/src/mono/mono/sgen/sgen-cardtable.h b/src/mono/mono/sgen/sgen-cardtable.h index 1ea3055fce085d..e07bc2cf5c0348 100644 --- a/src/mono/mono/sgen/sgen-cardtable.h +++ b/src/mono/mono/sgen/sgen-cardtable.h @@ -30,7 +30,7 @@ void sgen_card_table_preclean_mod_union (guint8 *cards, guint8 *cards_preclean, guint8* sgen_get_card_table_configuration (int *shift_bits, gpointer *mask); guint8* sgen_get_target_card_table_configuration (int *shift_bits, target_mgreg_t *mask); -void sgen_card_table_init (SgenRememberedSet *remset); +void sgen_card_table_init (SgenRememberedSet *remset, gboolean consistency_checks); /*How many bytes a single card covers*/ #define CARD_BITS 9 diff --git a/src/mono/mono/sgen/sgen-gc.c b/src/mono/mono/sgen/sgen-gc.c index 705b8168ed36f3..8ca983771ed790 100644 --- a/src/mono/mono/sgen/sgen-gc.c +++ b/src/mono/mono/sgen/sgen-gc.c @@ -3909,7 +3909,7 @@ sgen_gc_init (void) memset (&remset, 0, sizeof (remset)); - sgen_card_table_init (&remset); + sgen_card_table_init (&remset, remset_consistency_checks); sgen_register_root (NULL, 0, sgen_make_user_root_descriptor (sgen_mark_normal_gc_handles), ROOT_TYPE_NORMAL, MONO_ROOT_SOURCE_GC_HANDLE, GINT_TO_POINTER (ROOT_TYPE_NORMAL), "GC Handles (SGen, Normal)"); diff --git a/src/mono/mono/utils/atomic.h b/src/mono/mono/utils/atomic.h index 3f0a01e6beb428..9d4459d932fb1a 100644 --- a/src/mono/mono/utils/atomic.h +++ b/src/mono/mono/utils/atomic.h @@ -95,11 +95,25 @@ Apple targets have historically being problematic, xcode 4.6 would miscompile th #include +#if defined(HOST_ARM64) +// C11 atomics on ARM64 offers a weaker version of sequential consistent, not expected by mono atomics operations. +// C11 seq_cst on ARM64 corresponds to acquire/release semantics, but mono expects these functions to emit a full memory +// barrier preventing any kind of reordering around the atomic operation. GCC atomics on ARM64 had similar limitations, +// see comments on GCC atomics below and mono injected full memory barriers around GCC atomic functions to mitigate this. +// Since mono GCC atomics implementation ended up even stronger (full memory barrier before/after), the C11 atomics +// implementation is still a little weaker, but should correspond to the exact same semantics as implemented by JIT +// compiler for sequential consistent atomic load/store/add/exchange/cas op codes on ARM64. +#define C11_MEMORY_ORDER_SEQ_CST() atomic_thread_fence (memory_order_seq_cst) +#else +#define C11_MEMORY_ORDER_SEQ_CST() +#endif + static inline guint8 mono_atomic_cas_u8 (volatile guint8 *dest, guint8 exch, guint8 comp) { g_static_assert (sizeof (atomic_char) == sizeof (*dest) && ATOMIC_CHAR_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile atomic_char *)dest, (char*)&comp, exch); + C11_MEMORY_ORDER_SEQ_CST (); return comp; } @@ -108,6 +122,7 @@ mono_atomic_cas_u16 (volatile guint16 *dest, guint16 exch, guint16 comp) { g_static_assert (sizeof (atomic_short) == sizeof (*dest) && ATOMIC_SHORT_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile atomic_short *)dest, (short*)&comp, exch); + C11_MEMORY_ORDER_SEQ_CST (); return comp; } @@ -116,6 +131,7 @@ mono_atomic_cas_i32 (volatile gint32 *dest, gint32 exch, gint32 comp) { g_static_assert (sizeof (atomic_int) == sizeof (*dest) && ATOMIC_INT_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile atomic_int *)dest, &comp, exch); + C11_MEMORY_ORDER_SEQ_CST (); return comp; } @@ -125,14 +141,14 @@ mono_atomic_cas_i64 (volatile gint64 *dest, gint64 exch, gint64 comp) #if SIZEOF_LONG == 8 g_static_assert (sizeof (atomic_long) == sizeof (*dest) && ATOMIC_LONG_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile atomic_long *)dest, (long*)&comp, exch); - return comp; #elif SIZEOF_LONG_LONG == 8 g_static_assert (sizeof (atomic_llong) == sizeof (*dest) && ATOMIC_LLONG_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile atomic_llong *)dest, (long long*)&comp, exch); - return comp; #else #error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC" #endif + C11_MEMORY_ORDER_SEQ_CST (); + return comp; } static inline gpointer @@ -140,6 +156,7 @@ mono_atomic_cas_ptr (volatile gpointer *dest, gpointer exch, gpointer comp) { g_static_assert(ATOMIC_POINTER_LOCK_FREE == 2); (void)atomic_compare_exchange_strong ((volatile _Atomic(gpointer) *)dest, &comp, exch); + C11_MEMORY_ORDER_SEQ_CST (); return comp; } @@ -191,21 +208,27 @@ static inline guint8 mono_atomic_xchg_u8 (volatile guint8 *dest, guint8 exch) { g_static_assert (sizeof (atomic_char) == sizeof (*dest) && ATOMIC_CHAR_LOCK_FREE == 2); - return atomic_exchange ((volatile atomic_char *)dest, exch); + guint8 old = atomic_exchange ((volatile atomic_char *)dest, exch); + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline guint16 mono_atomic_xchg_u16 (volatile guint16 *dest, guint16 exch) { g_static_assert (sizeof (atomic_short) == sizeof (*dest) && ATOMIC_SHORT_LOCK_FREE == 2); - return atomic_exchange ((volatile atomic_short *)dest, exch); + guint16 old = atomic_exchange ((volatile atomic_short *)dest, exch); + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gint32 mono_atomic_xchg_i32 (volatile gint32 *dest, gint32 exch) { g_static_assert (sizeof (atomic_int) == sizeof (*dest) && ATOMIC_INT_LOCK_FREE == 2); - return atomic_exchange ((volatile atomic_int *)dest, exch); + gint32 old = atomic_exchange ((volatile atomic_int *)dest, exch); + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gint64 @@ -213,27 +236,33 @@ mono_atomic_xchg_i64 (volatile gint64 *dest, gint64 exch) { #if SIZEOF_LONG == 8 g_static_assert (sizeof (atomic_long) == sizeof (*dest) && ATOMIC_LONG_LOCK_FREE == 2); - return atomic_exchange ((volatile atomic_long *)dest, exch); + gint64 old = atomic_exchange ((volatile atomic_long *)dest, exch); #elif SIZEOF_LONG_LONG == 8 g_static_assert (sizeof (atomic_llong) == sizeof (*dest) && ATOMIC_LLONG_LOCK_FREE == 2); - return atomic_exchange ((volatile atomic_llong *)dest, exch); + gint64 old = atomic_exchange ((volatile atomic_llong *)dest, exch); #else #error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC" #endif + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gpointer mono_atomic_xchg_ptr (volatile gpointer *dest, gpointer exch) { g_static_assert (ATOMIC_POINTER_LOCK_FREE == 2); - return atomic_exchange ((volatile _Atomic(gpointer) *)dest, exch); + gpointer old = atomic_exchange ((volatile _Atomic(gpointer) *)dest, exch); + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gint32 mono_atomic_fetch_add_i32 (volatile gint32 *dest, gint32 add) { g_static_assert (sizeof (atomic_int) == sizeof (*dest) && ATOMIC_INT_LOCK_FREE == 2); - return atomic_fetch_add ((volatile atomic_int *)dest, add); + gint32 old = atomic_fetch_add ((volatile atomic_int *)dest, add); + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gint64 @@ -241,33 +270,41 @@ mono_atomic_fetch_add_i64 (volatile gint64 *dest, gint64 add) { #if SIZEOF_LONG == 8 g_static_assert (sizeof (atomic_long) == sizeof (*dest) && ATOMIC_LONG_LOCK_FREE == 2); - return atomic_fetch_add ((volatile atomic_long *)dest, add); + gint64 old = atomic_fetch_add ((volatile atomic_long *)dest, add); #elif SIZEOF_LONG_LONG == 8 g_static_assert (sizeof (atomic_llong) == sizeof (*dest) && ATOMIC_LLONG_LOCK_FREE == 2); - return atomic_fetch_add ((volatile atomic_llong *)dest, add); + gint64 old = atomic_fetch_add ((volatile atomic_llong *)dest, add); #else #error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC" #endif + C11_MEMORY_ORDER_SEQ_CST (); + return old; } static inline gint8 mono_atomic_load_i8 (volatile gint8 *src) { g_static_assert (sizeof (atomic_char) == sizeof (*src) && ATOMIC_CHAR_LOCK_FREE == 2); - return atomic_load ((volatile atomic_char *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gint8 val = atomic_load ((volatile atomic_char *)src); + return val; } static inline gint16 mono_atomic_load_i16 (volatile gint16 *src) { g_static_assert (sizeof (atomic_short) == sizeof (*src) && ATOMIC_SHORT_LOCK_FREE == 2); - return atomic_load ((volatile atomic_short *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gint16 val = atomic_load ((volatile atomic_short *)src); + return val; } static inline gint32 mono_atomic_load_i32 (volatile gint32 *src) { g_static_assert (sizeof (atomic_int) == sizeof (*src) && ATOMIC_INT_LOCK_FREE == 2); - return atomic_load ((volatile atomic_int *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gint32 val = atomic_load ((volatile atomic_int *)src); + return val; } static inline gint64 @@ -275,20 +312,25 @@ mono_atomic_load_i64 (volatile gint64 *src) { #if SIZEOF_LONG == 8 g_static_assert (sizeof (atomic_long) == sizeof (*src) && ATOMIC_LONG_LOCK_FREE == 2); - return atomic_load ((volatile atomic_long *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gint64 val = atomic_load ((volatile atomic_long *)src); #elif SIZEOF_LONG_LONG == 8 g_static_assert (sizeof (atomic_llong) == sizeof (*src) && ATOMIC_LLONG_LOCK_FREE == 2); - return atomic_load ((volatile atomic_llong *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gint64 val = atomic_load ((volatile atomic_llong *)src); #else #error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC" #endif + return val; } static inline gpointer mono_atomic_load_ptr (volatile gpointer *src) { g_static_assert (ATOMIC_POINTER_LOCK_FREE == 2); - return atomic_load ((volatile _Atomic(gpointer) *)src); + C11_MEMORY_ORDER_SEQ_CST (); + gpointer val = atomic_load ((volatile _Atomic(gpointer) *)src); + return val; } static inline void @@ -296,6 +338,7 @@ mono_atomic_store_i8 (volatile gint8 *dst, gint8 val) { g_static_assert (sizeof (atomic_char) == sizeof (*dst) && ATOMIC_CHAR_LOCK_FREE == 2); atomic_store ((volatile atomic_char *)dst, val); + C11_MEMORY_ORDER_SEQ_CST (); } static inline void @@ -303,6 +346,7 @@ mono_atomic_store_i16 (volatile gint16 *dst, gint16 val) { g_static_assert (sizeof (atomic_short) == sizeof (*dst) && ATOMIC_SHORT_LOCK_FREE == 2); atomic_store ((volatile atomic_short *)dst, val); + C11_MEMORY_ORDER_SEQ_CST (); } static inline void @@ -310,6 +354,7 @@ mono_atomic_store_i32 (volatile gint32 *dst, gint32 val) { g_static_assert (sizeof (atomic_int) == sizeof (*dst) && ATOMIC_INT_LOCK_FREE == 2); atomic_store ((atomic_int *)dst, val); + C11_MEMORY_ORDER_SEQ_CST (); } static inline void @@ -324,6 +369,7 @@ mono_atomic_store_i64 (volatile gint64 *dst, gint64 val) #else #error "gint64 not same size atomic_llong or atomic_long, don't define MONO_USE_STDATOMIC" #endif + C11_MEMORY_ORDER_SEQ_CST (); } static inline void @@ -331,6 +377,7 @@ mono_atomic_store_ptr (volatile gpointer *dst, gpointer val) { g_static_assert (ATOMIC_POINTER_LOCK_FREE == 2); atomic_store ((volatile _Atomic(gpointer) *)dst, val); + C11_MEMORY_ORDER_SEQ_CST (); } #elif defined(MONO_USE_WIN32_ATOMIC) diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets index 917aed88506697..7a6c5ebd687c34 100644 --- a/src/mono/msbuild/android/build/AndroidBuild.targets +++ b/src/mono/msbuild/android/build/AndroidBuild.targets @@ -112,12 +112,21 @@ <_AotOutputType>ObjectFile - - - - - + + <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi + <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android + + + + <_AsOptions>-target $(_Triple) -c -x assembler + <_LdName>clang + <_LdOptions>-fuse-ld=lld + <_AsName>clang + + @@ -141,19 +150,6 @@ 21 - - - - - - - - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) @@ -221,20 +217,23 @@ diff --git a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj index 2847f567f469a1..2035333122a2f0 100644 --- a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj +++ b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj @@ -7,7 +7,6 @@ $([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'extraFiles')) $([MSBuild]::NormalizeDirectory($(TestRootDir), '..', 'obj')) - ConfigureTrimming;_AdjustTrimmedAssembliesToBundle;$(AppleBuildDependsOn) _PublishRuntimePack;_PrepareForAppleBuildAppOnHelix;$(AppleBuildDependsOn);_AfterAppleBuildOnHelix true @@ -71,7 +70,7 @@ - + <_ExtraFiles Include="$(ExtraFilesPath)**\*" /> @@ -95,14 +94,6 @@ - - - - - - - - - - - - - - - - diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.Wasi.targets.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.Wasi.targets.in index e0b7323d6bcee2..07477c653a68a2 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.Wasi.targets.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Current.Manifest/WorkloadManifest.Wasi.targets.in @@ -9,4 +9,8 @@ $(WasiNativeWorkloadAvailable) + + + + diff --git a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net8.Manifest/WorkloadManifest.json.in b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net8.Manifest/WorkloadManifest.json.in index 5fd792e7048ab4..3c3e63c3ae584c 100644 --- a/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net8.Manifest/WorkloadManifest.json.in +++ b/src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.net8.Manifest/WorkloadManifest.json.in @@ -277,7 +277,7 @@ "kind": "framework", "version": "${PackageVersionNet8}", "alias-to": { - "any": "Microsoft.NETCore.App.Runtime.Mono.osx-arm64" + "any": "Microsoft.NETCore.App.Runtime.osx-arm64" } }, "Microsoft.NETCore.App.Runtime.net8.osx-x64": { @@ -312,8 +312,8 @@ "kind": "Sdk", "version": "${PackageVersionNet8}", "alias-to": { - "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.tvos-arm64", - "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64" + "osx-x64": "Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.tvos-arm64", + "osx-arm64": "Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.tvos-arm64" } }, "Microsoft.NETCore.App.Runtime.Mono.net8.tvos-arm64" : { diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index 7fb665824e5bea..573b44ee710530 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -69,36 +69,40 @@ 21 - - - - - - - - - <_AsPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_AsPrefixPath)')) <_ToolPrefixPath>$([MSBuild]::EnsureTrailingSlash('$(_ToolPrefixPath)')) + + <_Triple Condition="'$(TargetArchitecture)' == 'arm'">armv7-linux-gnueabi + <_Triple Condition="'$(TargetArchitecture)' == 'arm64'">aarch64-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x86'">i686-linux-android + <_Triple Condition="'$(TargetArchitecture)' == 'x64'">x86_64-linux-android + + + + <_AsOptions>-target $(_Triple) -c -x assembler + <_LdName>clang + <_LdOptions>-fuse-ld=lld + <_AsName>clang + + diff --git a/src/mono/wasi/Wasi.Build.Tests/Directory.Build.props b/src/mono/wasi/Wasi.Build.Tests/Directory.Build.props index 8da854c6d3fc2f..3b1ab8aa84060b 100644 --- a/src/mono/wasi/Wasi.Build.Tests/Directory.Build.props +++ b/src/mono/wasi/Wasi.Build.Tests/Directory.Build.props @@ -20,5 +20,7 @@ $(OutputRID) true true + + false diff --git a/src/mono/wasi/Wasi.Build.Tests/Wasi.Build.Tests.csproj b/src/mono/wasi/Wasi.Build.Tests/Wasi.Build.Tests.csproj index f316261c14cdbe..17971c992ab785 100644 --- a/src/mono/wasi/Wasi.Build.Tests/Wasi.Build.Tests.csproj +++ b/src/mono/wasi/Wasi.Build.Tests/Wasi.Build.Tests.csproj @@ -95,10 +95,16 @@ + + + <_RuntimePackCurrentVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) + <_RuntimePackCurrentVersion Condition="'$(StabilizePackageVersion)' != 'true'">$(PackageVersion) + - <_RuntimePackVersions Include="$(PackageVersion)" EnvVarName="RUNTIME_PACK_VER9" /> + <_RuntimePackVersions Include="$(_RuntimePackCurrentVersion)" EnvVarName="RUNTIME_PACK_VER9" /> + <_RuntimePackVersions Include="$(PackageVersionNet8)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' != ''" /> - <_RuntimePackVersions Include="$(PackageVersion)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' == ''" /> + <_RuntimePackVersions Include="$(_RuntimePackCurrentVersion)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' == ''" /> diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs index 46c8f2ce132870..e2406c873b986c 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs @@ -46,11 +46,11 @@ public void InitBlazorWasmProjectDir(string id, string targetFramework = Default public string CreateBlazorWasmTemplateProject(string id) { InitBlazorWasmProjectDir(id); - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("new blazorwasm") - .EnsureSuccessful(); + using DotNetCommand dotnetCommand = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false); + CommandResult result = dotnetCommand.WithWorkingDirectory(_projectDir!) + .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .ExecuteWithCapturedOutput("new blazorwasm") + .EnsureSuccessful(); return Path.Combine(_projectDir!, $"{id}.csproj"); } @@ -195,12 +195,12 @@ public async Task BlazorRunTest(string runArgs, runOptions.ServerEnvironment?.ToList().ForEach( kv => s_buildEnv.EnvVars[kv.Key] = kv.Value); - using var runCommand = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(workingDirectory); + using RunCommand runCommand = new RunCommand(s_buildEnv, _testOutput); + ToolCommand cmd = runCommand.WithWorkingDirectory(workingDirectory); await using var runner = new BrowserRunner(_testOutput); var page = await runner.RunAsync( - runCommand, + cmd, runArgs, onConsoleMessage: OnConsoleMessage, onServerMessage: runOptions.OnServerMessage, diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/CleanTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/CleanTests.cs index db3c7da2243ac0..122aa274962373 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/CleanTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/CleanTests.cs @@ -40,11 +40,11 @@ public void Blazor_BuildThenClean_NativeRelinking(string config) Assert.True(Directory.Exists(relinkDir), $"Could not find expected relink dir: {relinkDir}"); string logPath = Path.Combine(s_buildEnv.LogRootPath, id, $"{id}-clean.binlog"); - new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("build", "-t:Clean", $"-p:Configuration={config}", $"-bl:{logPath}") - .EnsureSuccessful(); + using ToolCommand cmd = new DotNetCommand(s_buildEnv, _testOutput) + .WithWorkingDirectory(_projectDir!); + cmd.WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .ExecuteWithCapturedOutput("build", "-t:Clean", $"-p:Configuration={config}", $"-bl:{logPath}") + .EnsureSuccessful(); AssertEmptyOrNonExistentDirectory(relinkDir); } @@ -88,9 +88,9 @@ private void Blazor_BuildNativeNonNative_ThenCleanTest(string config, bool first Assert.True(Directory.Exists(relinkDir), $"Could not find expected relink dir: {relinkDir}"); string logPath = Path.Combine(s_buildEnv.LogRootPath, id, $"{id}-clean.binlog"); - new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _projectDir!) + using ToolCommand cmd = new DotNetCommand(s_buildEnv, _testOutput) + .WithWorkingDirectory(_projectDir!); + cmd.WithEnvironmentVariable("NUGET_PACKAGES", _projectDir!) .ExecuteWithCapturedOutput("build", "-t:Clean", $"-p:Configuration={config}", $"-bl:{logPath}") .EnsureSuccessful(); diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs index 25bd5c7f4d06bf..c93ec2c6af452f 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests.cs @@ -22,7 +22,6 @@ public MiscTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildC [InlineData("Debug", false)] [InlineData("Release", true)] [InlineData("Release", false)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/103566")] public void NativeBuild_WithDeployOnBuild_UsedByVS(string config, bool nativeRelink) { string id = $"blz_deploy_on_build_{config}_{nativeRelink}_{GetRandomId()}"; diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests2.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests2.cs index 23c002b454d91c..00a47837523ce4 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests2.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests2.cs @@ -59,11 +59,11 @@ private CommandResult PublishForRequiresWorkloadTest(string config, string extra extraItems: extraItems); string publishLogPath = Path.Combine(s_buildEnv.LogRootPath, id, $"{id}.binlog"); - return new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("publish", - $"-bl:{publishLogPath}", - $"-p:Configuration={config}"); + using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput); + return cmd.WithWorkingDirectory(_projectDir!) + .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .ExecuteWithCapturedOutput("publish", + $"-bl:{publishLogPath}", + $"-p:Configuration={config}"); } } diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests3.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests3.cs index 4d82356b103790..a7f39ce9d3341a 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests3.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests3.cs @@ -99,17 +99,16 @@ public void BugRegression_60479_WithRazorClassLib() string wasmProjectDir = Path.Combine(_projectDir!, "wasm"); string wasmProjectFile = Path.Combine(wasmProjectDir, "wasm.csproj"); Directory.CreateDirectory(wasmProjectDir); - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(wasmProjectDir) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("new blazorwasm") - .EnsureSuccessful(); + using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false); + cmd.WithWorkingDirectory(wasmProjectDir) + .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .ExecuteWithCapturedOutput("new blazorwasm") + .EnsureSuccessful(); string razorProjectDir = Path.Combine(_projectDir!, "RazorClassLibrary"); Directory.CreateDirectory(razorProjectDir); - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(razorProjectDir) + cmd.WithWorkingDirectory(razorProjectDir) .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) .ExecuteWithCapturedOutput("new razorclasslib") .EnsureSuccessful(); diff --git a/src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs index 3dc64bc556d538..53f25caa3a525f 100644 --- a/src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs @@ -16,6 +16,7 @@ using Xunit; using Xunit.Abstractions; using Xunit.Sdk; +using Microsoft.Build.Logging.StructuredLogger; #nullable enable @@ -163,10 +164,10 @@ public BuildTestBase(ProjectProviderBase providerBase, ITestOutputHelper output, if (buildProjectOptions.Publish && buildProjectOptions.BuildOnlyAfterPublish) commandLineArgs.Append("-p:WasmBuildOnlyAfterPublish=true"); - var cmd = new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .WithEnvironmentVariables(buildProjectOptions.ExtraBuildEnvironmentVariables); + using ToolCommand cmd = new DotNetCommand(s_buildEnv, _testOutput) + .WithWorkingDirectory(_projectDir!); + cmd.WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .WithEnvironmentVariables(buildProjectOptions.ExtraBuildEnvironmentVariables); if (UseWBTOverridePackTargets && s_buildEnv.IsWorkload) cmd.WithEnvironmentVariable("WBTOverrideRuntimePack", "true"); @@ -176,9 +177,48 @@ public BuildTestBase(ProjectProviderBase providerBase, ITestOutputHelper output, else if (res.ExitCode == 0) throw new XunitException($"Build should have failed, but it didn't. Process exited with exitCode : {res.ExitCode}"); + // Ensure we got all output. + string[] successMessages = ["Build succeeded"]; + string[] errorMessages = ["Build failed", "Build FAILED", "Restore failed", "Stopping the build"]; + if ((res.ExitCode == 0 && successMessages.All(m => !res.Output.Contains(m))) || (res.ExitCode != 0 && errorMessages.All(m => !res.Output.Contains(m)))) + { + _testOutput.WriteLine("Replacing dotnet process output with messages from binlog"); + + var outputBuilder = new StringBuilder(); + var buildRoot = BinaryLog.ReadBuild(logFilePath); + buildRoot.VisitAllChildren(m => + { + if (m is Message || m is Error || m is Warning) + { + var context = GetBinlogMessageContext(m); + outputBuilder.AppendLine($"{context}{m.Title}"); + } + }); + + res = new CommandResult(res.StartInfo, res.ExitCode, outputBuilder.ToString()); + } + return (res, logFilePath); } + private string GetBinlogMessageContext(TextNode node) + { + var currentNode = node; + while (currentNode != null) + { + if (currentNode is Error error) + { + return $"{error.File}({error.LineNumber},{error.ColumnNumber}): error {error.Code}: "; + } + else if (currentNode is Warning warning) + { + return $"{warning.File}({warning.LineNumber},{warning.ColumnNumber}): warning {warning.Code}: "; + } + currentNode = currentNode.Parent as TextNode; + } + return string.Empty; + } + protected string RunAndTestWasmApp(BuildArgs buildArgs, RunHost host, string id, @@ -447,6 +487,7 @@ public static (int exitCode, string buildOutput) RunProcess(string path, _testOutput.WriteLine($"WorkingDirectory: {workingDir}"); StringBuilder outputBuilder = new(); object syncObj = new(); + bool isDisposed = false; var processStartInfo = new ProcessStartInfo { @@ -502,11 +543,13 @@ public static (int exitCode, string buildOutput) RunProcess(string path, using CancellationTokenSource cts = new(); cts.CancelAfter(timeoutMs ?? s_defaultPerTestTimeoutMs); - await process.WaitForExitAsync(cts.Token); - - if (cts.IsCancellationRequested) + try { - // process didn't exit + await process.WaitForExitAsync(cts.Token); + } + catch (OperationCanceledException) + { + // process didn't exit within timeout process.Kill(entireProcessTree: true); lock (syncObj) { @@ -520,6 +563,12 @@ public static (int exitCode, string buildOutput) RunProcess(string path, // https://learn.microsoft.com/dotnet/api/system.diagnostics.process.waitforexit?view=net-5.0#System_Diagnostics_Process_WaitForExit_System_Int32_ process.WaitForExit(); + // Mark as disposed before detaching handlers to prevent further TestOutput access + lock (syncObj) + { + isDisposed = true; + } + process.ErrorDataReceived -= logStdErr; process.OutputDataReceived -= logStdOut; process.CancelErrorRead(); @@ -533,7 +582,12 @@ public static (int exitCode, string buildOutput) RunProcess(string path, } catch (Exception ex) { - _testOutput.WriteLine($"-- exception -- {ex}"); + // Mark as disposed before writing to avoid potential race condition + lock (syncObj) + { + isDisposed = true; + } + TryWriteToTestOutput(_testOutput, $"-- exception -- {ex}", outputBuilder); throw; } @@ -541,9 +595,11 @@ void LogData(string label, string? message) { lock (syncObj) { + if (isDisposed) + return; if (message != null) { - _testOutput.WriteLine($"{label} {message}"); + TryWriteToTestOutput(_testOutput, $"{label} {message}", outputBuilder, label); } outputBuilder.AppendLine($"{label} {message}"); } @@ -587,6 +643,24 @@ public static string AddItemsPropertiesToProject(string projectFile, string? ext return projectFile; } + private static void TryWriteToTestOutput(ITestOutputHelper testOutput, string message, StringBuilder? outputBuffer = null, string? warningPrefix = null) + { + try + { + testOutput.WriteLine(message); + } + catch (InvalidOperationException) + { + // Test context has expired, but we still want to capture output in buffer + // for potential debugging purposes + if (outputBuffer != null) + { + string prefix = warningPrefix ?? ""; + outputBuffer.AppendLine($"{prefix}[WARNING: Test context expired, subsequent output may be incomplete]"); + } + } + } + public void Dispose() { if (_projectDir != null && _enablePerTestCleanup) @@ -605,8 +679,8 @@ internal BuildPaths GetBuildPaths(BuildArgs buildArgs, bool forPublish = true) } protected static string GetSkiaSharpReferenceItems() - => @" - + => @" + "; protected static string s_mainReturns42 = @" diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/RunHost.cs b/src/mono/wasm/Wasm.Build.Tests/Common/RunHost.cs index 137316ebb546c5..1208060464a9e7 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/RunHost.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/RunHost.cs @@ -15,6 +15,6 @@ public enum RunHost Firefox = 8, NodeJS = 16, - All = V8 | NodeJS | Chrome//| Firefox//Safari + All = V8 | Chrome//| NodeJS//Firefox//Safari } } diff --git a/src/mono/wasm/Wasm.Build.Tests/Common/ToolCommand.cs b/src/mono/wasm/Wasm.Build.Tests/Common/ToolCommand.cs index c8289da17350d6..4c7531a889007d 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Common/ToolCommand.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Common/ToolCommand.cs @@ -13,6 +13,8 @@ namespace Wasm.Build.Tests { public class ToolCommand : IDisposable { + private bool isDisposed = false; + private readonly object _lock = new object(); private string _label; protected ITestOutputHelper _testOutput; @@ -93,41 +95,45 @@ public virtual CommandResult ExecuteWithCapturedOutput(params string[] args) public virtual void Dispose() { - if (CurrentProcess is not null && !CurrentProcess.HasExited) + lock (_lock) { - CurrentProcess.Kill(entireProcessTree: true); - CurrentProcess.Dispose(); - CurrentProcess = null; + if (isDisposed) + return; + if (CurrentProcess is not null && !CurrentProcess.HasExited) + { + CurrentProcess.Kill(entireProcessTree: true); + CurrentProcess.Dispose(); + CurrentProcess = null; + } + isDisposed = true; } } protected virtual string GetFullArgs(params string[] args) => string.Join(" ", args); - private async Task ExecuteAsyncInternal(string executable, string args) { var output = new List(); CurrentProcess = CreateProcess(executable, args); - DataReceivedEventHandler errorHandler = (s, e) => + + void HandleDataReceived(DataReceivedEventArgs e, DataReceivedEventHandler? additionalHandler) { - if (e.Data == null) + if (e.Data == null || isDisposed) return; - string msg = $"[{_label}] {e.Data}"; - output.Add(msg); - _testOutput.WriteLine(msg); - ErrorDataReceived?.Invoke(s, e); - }; + lock (_lock) + { + if (e.Data == null || isDisposed) + return; - DataReceivedEventHandler outputHandler = (s, e) => - { - if (e.Data == null) - return; + string msg = $"[{_label}] {e.Data}"; + output.Add(msg); + TryWriteToTestOutput(msg, output); + additionalHandler?.Invoke(this, e); + } + } - string msg = $"[{_label}] {e.Data}"; - output.Add(msg); - _testOutput.WriteLine(msg); - OutputDataReceived?.Invoke(s, e); - }; + DataReceivedEventHandler errorHandler = (s, e) => HandleDataReceived(e, ErrorDataReceived); + DataReceivedEventHandler outputHandler = (s, e) => HandleDataReceived(e, OutputDataReceived); CurrentProcess.ErrorDataReceived += errorHandler; CurrentProcess.OutputDataReceived += outputHandler; @@ -148,6 +154,20 @@ private async Task ExecuteAsyncInternal(string executable, string string.Join(System.Environment.NewLine, output)); } + private void TryWriteToTestOutput(string message, List output) + { + try + { + _testOutput.WriteLine(message); + } + catch (InvalidOperationException) + { + // Test context may have expired, continue without logging to test output + // Add a marker to the output buffer so we know this happened + output.Add($"[{_label}] [WARNING: Test context expired, subsequent output may be incomplete]"); + } + } + private Process CreateProcess(string executable, string args) { var psi = new ProcessStartInfo diff --git a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs index 329ecbe0b49ca7..6c525fa4eab22c 100644 --- a/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/ConfigSrcTests.cs @@ -16,7 +16,7 @@ public ConfigSrcTests(ITestOutputHelper output, SharedBuildPerTestClassFixture b // NOTE: port number determinizes dynamically, so could not generate absolute URI [Theory] - [BuildAndRun(host: RunHost.V8 | RunHost.NodeJS)] + [BuildAndRun(host: RunHost.V8)] public void ConfigSrcAbsolutePath(BuildArgs buildArgs, RunHost host, string id) { buildArgs = buildArgs with { ProjectName = $"configsrcabsolute_{buildArgs.Config}_{buildArgs.AOT}" }; diff --git a/src/mono/wasm/Wasm.Build.Tests/Directory.Build.props b/src/mono/wasm/Wasm.Build.Tests/Directory.Build.props index 7bc1738eb86741..ef6e8c386526c2 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Directory.Build.props +++ b/src/mono/wasm/Wasm.Build.Tests/Directory.Build.props @@ -19,5 +19,7 @@ $(OutputRID) true + + false diff --git a/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs b/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs index 3f1bc819ba2a6e..cf311557c27f2e 100644 --- a/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs +++ b/src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs @@ -8,8 +8,8 @@ namespace Wasm.Build.Tests; public class NodeJSHostRunner : IHostRunner { public string GetTestCommand() => "wasm test"; - public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh"; - public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale} --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh"; + public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace"; + public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale}"; public bool UseWasmConsoleOutput() => true; public bool CanRunWBT() => true; } diff --git a/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests.cs b/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests.cs index dbaeba4bb1165b..6381b1ac41b944 100644 --- a/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests.cs @@ -35,8 +35,8 @@ public IcuShardingTests(ITestOutputHelper output, SharedBuildPerTestClassFixture .UnwrapItemsAsArrays(); [Theory] - [MemberData(nameof(IcuExpectedAndMissingCustomShardTestData), parameters: new object[] { false, RunHost.NodeJS | RunHost.Chrome })] - [MemberData(nameof(IcuExpectedAndMissingCustomShardTestData), parameters: new object[] { true, RunHost.NodeJS | RunHost.Chrome })] + [MemberData(nameof(IcuExpectedAndMissingCustomShardTestData), parameters: new object[] { false, RunHost.Chrome })] + [MemberData(nameof(IcuExpectedAndMissingCustomShardTestData), parameters: new object[] { true, RunHost.Chrome })] public void CustomIcuShard(BuildArgs buildArgs, string shardName, string testedLocales, bool onlyPredefinedCultures, RunHost host, string id) => TestIcuShards(buildArgs, shardName, testedLocales, host, id, onlyPredefinedCultures); diff --git a/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests2.cs b/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests2.cs index c04d5c1114dc00..221850f27a188d 100644 --- a/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests2.cs +++ b/src/mono/wasm/Wasm.Build.Tests/IcuShardingTests2.cs @@ -32,8 +32,8 @@ public IcuShardingTests2(ITestOutputHelper output, SharedBuildPerTestClassFixtur [Theory] - [MemberData(nameof(IcuExpectedAndMissingShardFromRuntimePackTestData), parameters: new object[] { false, RunHost.NodeJS | RunHost.Chrome })] - [MemberData(nameof(IcuExpectedAndMissingShardFromRuntimePackTestData), parameters: new object[] { true, RunHost.NodeJS | RunHost.Chrome })] + [MemberData(nameof(IcuExpectedAndMissingShardFromRuntimePackTestData), parameters: new object[] { false, RunHost.Chrome })] + [MemberData(nameof(IcuExpectedAndMissingShardFromRuntimePackTestData), parameters: new object[] { true, RunHost.Chrome })] public void DefaultAvailableIcuShardsFromRuntimePack(BuildArgs buildArgs, string shardName, string testedLocales, RunHost host, string id) => TestIcuShards(buildArgs, shardName, testedLocales, host, id); } \ No newline at end of file diff --git a/src/mono/wasm/Wasm.Build.Tests/IcuTests.cs b/src/mono/wasm/Wasm.Build.Tests/IcuTests.cs index 0f58d24ac9f3d0..5137de3c096a2b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/IcuTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/IcuTests.cs @@ -37,8 +37,8 @@ public IcuTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildCo .UnwrapItemsAsArrays(); [Theory] - [MemberData(nameof(FullIcuWithInvariantTestData), parameters: new object[] { false, RunHost.NodeJS | RunHost.Chrome })] - [MemberData(nameof(FullIcuWithInvariantTestData), parameters: new object[] { true, RunHost.NodeJS | RunHost.Chrome })] + [MemberData(nameof(FullIcuWithInvariantTestData), parameters: new object[] { false, RunHost.Chrome })] + [MemberData(nameof(FullIcuWithInvariantTestData), parameters: new object[] { true, RunHost.Chrome })] public void FullIcuFromRuntimePackWithInvariant(BuildArgs buildArgs, bool invariant, bool fullIcu, string testedLocales, RunHost host, string id) { string projectName = $"fullIcuInvariant_{fullIcu}_{invariant}_{buildArgs.Config}_{buildArgs.AOT}"; @@ -60,8 +60,8 @@ public void FullIcuFromRuntimePackWithInvariant(BuildArgs buildArgs, bool invari } [Theory] - [MemberData(nameof(FullIcuWithICustomIcuTestData), parameters: new object[] { false, RunHost.NodeJS | RunHost.Chrome })] - [MemberData(nameof(FullIcuWithICustomIcuTestData), parameters: new object[] { true, RunHost.NodeJS | RunHost.Chrome })] + [MemberData(nameof(FullIcuWithICustomIcuTestData), parameters: new object[] { false, RunHost.Chrome })] + [MemberData(nameof(FullIcuWithICustomIcuTestData), parameters: new object[] { true, RunHost.Chrome })] public void FullIcuFromRuntimePackWithCustomIcu(BuildArgs buildArgs, bool fullIcu, RunHost host, string id) { string projectName = $"fullIcuCustom_{fullIcu}_{buildArgs.Config}_{buildArgs.AOT}"; diff --git a/src/mono/wasm/Wasm.Build.Tests/MainWithArgsTests.cs b/src/mono/wasm/Wasm.Build.Tests/MainWithArgsTests.cs index fc6099fb727987..c931fe0beeb6de 100644 --- a/src/mono/wasm/Wasm.Build.Tests/MainWithArgsTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/MainWithArgsTests.cs @@ -38,13 +38,13 @@ public static async System.Threading.Tasks.Task Main(string[] args) }", buildArgs, args, host, id); - [Theory] - [MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.NodeJS })] - //[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ true, RunHost.All })] - public void TopLevelWithArgs(BuildArgs buildArgs, string[] args, RunHost host, string id) - => TestMainWithArgs("top_level_args", - @"##CODE## return await System.Threading.Tasks.Task.FromResult(42 + count);", - buildArgs, args, host, id); + // [Theory] + // [MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.NodeJS })] + // //[MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ true, RunHost.All })] + // public void TopLevelWithArgs(BuildArgs buildArgs, string[] args, RunHost host, string id) + // => TestMainWithArgs("top_level_args", + // @"##CODE## return await System.Threading.Tasks.Task.FromResult(42 + count);", + // buildArgs, args, host, id); [Theory] [MemberData(nameof(MainWithArgsTestData), parameters: new object[] { /*aot*/ false, RunHost.All })] diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs b/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs index 8444f54308d5b9..990d331f0c580c 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeLibraryTests.cs @@ -50,8 +50,7 @@ public void ProjectWithNativeReference(BuildArgs buildArgs, RunHost host, string [Theory] [BuildAndRun(aot: false)] - [BuildAndRun(aot: true)] - [ActiveIssue("https://github.com/dotnet/runtime/issues/103566")] + [BuildAndRun(aot: true, config: "Release")] public void ProjectUsingSkiaSharp(BuildArgs buildArgs, RunHost host, string id) { string projectName = $"AppUsingSkiaSharp"; diff --git a/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs b/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs index 4f86c39c3addf8..e85a212f83d49f 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NonWasmTemplateBuildTests.cs @@ -67,9 +67,13 @@ public NonWasmTemplateBuildTests(ITestOutputHelper output, SharedBuildPerTestCla ) .MultiplyWithSingleArgs ( - "net6.0", - s_previousTargetFramework, - s_latestTargetFramework + EnvironmentVariables.WorkloadsTestPreviousVersions + ? [ + "net6.0", + s_previousTargetFramework, + s_latestTargetFramework + ] + : [s_latestTargetFramework] ) .UnwrapItemsAsArrays().ToList(); @@ -108,22 +112,18 @@ private void NonWasmConsoleBuild(string config, File.WriteAllText(Path.Combine(_projectDir, "Directory.Build.props"), ""); File.WriteAllText(Path.Combine(_projectDir, "Directory.Build.targets"), directoryBuildTargets); - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput("new console --no-restore") - .EnsureSuccessful(); + using ToolCommand cmd = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) + .WithWorkingDirectory(_projectDir!); + cmd.ExecuteWithCapturedOutput("new console --no-restore") + .EnsureSuccessful(); - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"build -restore -c {config} -bl:{Path.Combine(s_buildEnv.LogRootPath, $"{id}.binlog")} {extraBuildArgs} -f {targetFramework}") - .EnsureSuccessful(); + cmd.ExecuteWithCapturedOutput($"build -restore -c {config} -bl:{Path.Combine(s_buildEnv.LogRootPath, $"{id}.binlog")} {extraBuildArgs} -f {targetFramework}") + .EnsureSuccessful(); if (shouldRun) { - var result = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"run -c {config} -f {targetFramework} --no-build") - .EnsureSuccessful(); + CommandResult result = cmd.ExecuteWithCapturedOutput($"run -c {config} -f {targetFramework} --no-build") + .EnsureSuccessful(); Assert.Contains("Hello, World!", result.Output); } diff --git a/src/mono/wasm/Wasm.Build.Tests/Templates/NativeBuildTests.cs b/src/mono/wasm/Wasm.Build.Tests/Templates/NativeBuildTests.cs index 37f9b6aa46ca25..5a72a3da5a7713 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Templates/NativeBuildTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Templates/NativeBuildTests.cs @@ -45,10 +45,10 @@ public void BuildWithUndefinedNativeSymbol(bool allowUndefined) File.WriteAllText(Path.Combine(_projectDir!, "Program.cs"), code); File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "native-libs", "undefined-symbol.c"), Path.Combine(_projectDir!, "undefined_xyz.c")); - CommandResult result = new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("build", "-c Release"); + using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput); + CommandResult result = cmd.WithWorkingDirectory(_projectDir!) + .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) + .ExecuteWithCapturedOutput("build", "-c Release"); if (allowUndefined) { @@ -61,41 +61,5 @@ public void BuildWithUndefinedNativeSymbol(bool allowUndefined) Assert.Contains("Use '-p:WasmAllowUndefinedSymbols=true' to allow undefined symbols", result.Output); } } - - [Theory] - [InlineData("Debug")] - [InlineData("Release")] - public void ProjectWithDllImportsRequiringMarshalIlGen_ArrayTypeParameter(string config) - { - string id = $"dllimport_incompatible_{GetRandomId()}"; - string projectPath = CreateWasmTemplateProject(id, template: "wasmconsole"); - - string nativeSourceFilename = "incompatible_type.c"; - string nativeCode = "void call_needing_marhsal_ilgen(void *x) {}"; - File.WriteAllText(path: Path.Combine(_projectDir!, nativeSourceFilename), nativeCode); - - AddItemsPropertiesToProject( - projectPath, - extraItems: "" - ); - - File.Copy(Path.Combine(BuildEnvironment.TestAssetsPath, "marshal_ilgen_test.cs"), - Path.Combine(_projectDir!, "Program.cs"), - overwrite: true); - - CommandResult result = new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) - .ExecuteWithCapturedOutput("build", $"-c {config} -bl"); - - Assert.True(result.ExitCode == 0, "Expected build to succeed"); - - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {config}") - .EnsureSuccessful(); - Assert.Contains("Hello, Console!", res.Output); - Assert.Contains("Hello, World! Greetings from node version", res.Output); - } } } diff --git a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs index b32b95debd879f..64c7a954325ea3 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs @@ -167,117 +167,9 @@ public void BrowserBuildThenPublish(string config) UseCache: false)); } - [Theory] - [InlineData("Debug")] - [InlineData("Release")] - public void ConsoleBuildThenPublish(string config) - { - string id = $"{config}_{GetRandomId()}"; - string projectFile = CreateWasmTemplateProject(id, "wasmconsole"); - string projectName = Path.GetFileNameWithoutExtension(projectFile); - - UpdateConsoleMainJs(); - - var buildArgs = new BuildArgs(projectName, config, false, id, null); - buildArgs = ExpandBuildArgs(buildArgs); - - BuildTemplateProject(buildArgs, - id: id, - new BuildProjectOptions( - DotnetWasmFromRuntimePack: true, - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: false, - TargetFramework: BuildTestBase.DefaultTargetFramework, - IsBrowserProject: false - )); - - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {config}") - .EnsureSuccessful(); - Assert.Contains("Hello, Console!", res.Output); - - if (!_buildContext.TryGetBuildFor(buildArgs, out BuildProduct? product)) - throw new XunitException($"Test bug: could not get the build product in the cache"); - - File.Move(product!.LogFile, Path.ChangeExtension(product.LogFile!, ".first.binlog")); - - _testOutput.WriteLine($"{Environment.NewLine}Publishing with no changes ..{Environment.NewLine}"); - - bool expectRelinking = config == "Release"; - BuildTemplateProject(buildArgs, - id: id, - new BuildProjectOptions( - DotnetWasmFromRuntimePack: !expectRelinking, - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: true, - TargetFramework: BuildTestBase.DefaultTargetFramework, - UseCache: false, - IsBrowserProject: false)); - } - - [Theory] - [InlineData("Debug", false)] - [InlineData("Debug", true)] - [InlineData("Release", false)] - [InlineData("Release", true)] - public void ConsoleBuildAndRunDefault(string config, bool relinking) - => ConsoleBuildAndRun(config, relinking, string.Empty, DefaultTargetFramework, addFrameworkArg: true); - - [Theory] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/79313")] - // [InlineData("Debug", "-f net7.0", "net7.0")] - //[InlineData("Debug", "-f net8.0", "net8.0")] - [InlineData("Debug", "-f net9.0", "net9.0")] - public void ConsoleBuildAndRunForSpecificTFM(string config, string extraNewArgs, string expectedTFM) - => ConsoleBuildAndRun(config, false, extraNewArgs, expectedTFM, addFrameworkArg: extraNewArgs?.Length == 0); - - private void ConsoleBuildAndRun(string config, bool relinking, string extraNewArgs, string expectedTFM, bool addFrameworkArg) - { - string id = $"{config}_{GetRandomId()}"; - string projectFile = CreateWasmTemplateProject(id, "wasmconsole", extraNewArgs, addFrameworkArg: addFrameworkArg); - string projectName = Path.GetFileNameWithoutExtension(projectFile); - - UpdateConsoleProgramCs(); - UpdateConsoleMainJs(); - if (relinking) - AddItemsPropertiesToProject(projectFile, "true"); - - var buildArgs = new BuildArgs(projectName, config, false, id, null); - buildArgs = ExpandBuildArgs(buildArgs); - - BuildTemplateProject(buildArgs, - id: id, - new BuildProjectOptions( - DotnetWasmFromRuntimePack: !relinking, - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: false, - TargetFramework: expectedTFM, - IsBrowserProject: false - )); - - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {config} x y z") - .EnsureExitCode(42); - - Assert.Contains("args[0] = x", res.Output); - Assert.Contains("args[1] = y", res.Output); - Assert.Contains("args[2] = z", res.Output); - } - public static TheoryData TestDataForAppBundleDir() { var data = new TheoryData(); - AddTestData(forConsole: true, runOutsideProjectDirectory: false); - AddTestData(forConsole: true, runOutsideProjectDirectory: true); - AddTestData(forConsole: false, runOutsideProjectDirectory: false); AddTestData(forConsole: false, runOutsideProjectDirectory: true); @@ -355,7 +247,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id) .WithWorkingDirectory(workingDir) .WithEnvironmentVariables(s_buildEnv.EnvVars); - var res = cmd.ExecuteWithCapturedOutput(runArgs).EnsureExitCode(42); + CommandResult res = cmd.ExecuteWithCapturedOutput(runArgs).EnsureExitCode(42); Assert.Contains("args[0] = x", res.Output); Assert.Contains("args[1] = y", res.Output); @@ -370,7 +262,7 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP runArgs += " x y z"; using var cmd = new RunCommand(s_buildEnv, _testOutput, label: id) .WithWorkingDirectory(workingDir); - var res = cmd.ExecuteWithCapturedOutput(runArgs).EnsureExitCode(42); + CommandResult res = cmd.ExecuteWithCapturedOutput(runArgs).EnsureExitCode(42); Assert.Contains("args[0] = x", res.Output); Assert.Contains("args[1] = y", res.Output); @@ -380,74 +272,6 @@ private Task ConsoleRunWithAndThenWithoutBuildAsync(string config, string extraP return Task.CompletedTask; } - public static TheoryData TestDataForConsolePublishAndRun() - { - var data = new TheoryData(); - data.Add("Debug", false, false); - data.Add("Debug", false, true); - data.Add("Release", false, false); // Release relinks by default - data.Add("Release", true, false); - - return data; - } - - [Theory] - [MemberData(nameof(TestDataForConsolePublishAndRun))] - public void ConsolePublishAndRun(string config, bool aot, bool relinking) - { - string id = $"{config}_{GetRandomId()}"; - string projectFile = CreateWasmTemplateProject(id, "wasmconsole"); - string projectName = Path.GetFileNameWithoutExtension(projectFile); - - UpdateConsoleProgramCs(); - UpdateConsoleMainJs(); - - if (aot) - { - // FIXME: pass envvars via the environment, once that is supported - UpdateMainJsEnvironmentVariables(("MONO_LOG_MASK", "aot"), ("MONO_LOG_LEVEL", "debug")); - AddItemsPropertiesToProject(projectFile, "true"); - } - else if (relinking) - { - AddItemsPropertiesToProject(projectFile, "true"); - } - - var buildArgs = new BuildArgs(projectName, config, aot, id, null); - buildArgs = ExpandBuildArgs(buildArgs); - - bool expectRelinking = config == "Release" || aot || relinking; - BuildTemplateProject(buildArgs, - id: id, - new BuildProjectOptions( - DotnetWasmFromRuntimePack: !expectRelinking, - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: true, - TargetFramework: BuildTestBase.DefaultTargetFramework, - UseCache: false, - IsBrowserProject: false)); - - new RunCommand(s_buildEnv, _testOutput, label: id) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput("--info") - .EnsureExitCode(0); - - string runArgs = $"run --no-silent --no-build -c {config} -v diag"; - runArgs += " x y z"; - var res = new RunCommand(s_buildEnv, _testOutput, label: id) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput(runArgs) - .EnsureExitCode(42); - - if (aot) - Assert.Contains($"AOT: image '{Path.GetFileNameWithoutExtension(projectFile)}' found", res.Output); - Assert.Contains("args[0] = x", res.Output); - Assert.Contains("args[1] = y", res.Output); - Assert.Contains("args[2] = z", res.Output); - } - public static IEnumerable BrowserBuildAndRunTestData() { yield return new object?[] { "", BuildTestBase.DefaultTargetFramework, DefaultRuntimeAssetsRelativePath }; @@ -474,10 +298,10 @@ public async Task BrowserBuildAndRun(string extraNewArgs, string targetFramework UpdateBrowserMainJs(targetFramework, runtimeAssetsRelativePath); - new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .Execute($"build -c {config} -bl:{Path.Combine(s_buildEnv.LogRootPath, $"{id}.binlog")} {(runtimeAssetsRelativePath != DefaultRuntimeAssetsRelativePath ? "-p:WasmRuntimeAssetsLocation=" + runtimeAssetsRelativePath : "")}") - .EnsureSuccessful(); + using ToolCommand cmd = new DotNetCommand(s_buildEnv, _testOutput) + .WithWorkingDirectory(_projectDir!); + cmd.Execute($"build -c {config} -bl:{Path.Combine(s_buildEnv.LogRootPath, $"{id}.binlog")} {(runtimeAssetsRelativePath != DefaultRuntimeAssetsRelativePath ? "-p:WasmRuntimeAssetsLocation=" + runtimeAssetsRelativePath : "")}") + .EnsureSuccessful(); using var runCommand = new RunCommand(s_buildEnv, _testOutput) .WithWorkingDirectory(_projectDir!); @@ -488,106 +312,6 @@ public async Task BrowserBuildAndRun(string extraNewArgs, string targetFramework Assert.Contains("Hello, Browser!", string.Join(Environment.NewLine, runner.OutputLines)); } - [Theory] - [InlineData("Debug", /*appendRID*/ true, /*useArtifacts*/ false)] - [InlineData("Debug", /*appendRID*/ true, /*useArtifacts*/ true)] - [InlineData("Debug", /*appendRID*/ false, /*useArtifacts*/ true)] - [InlineData("Debug", /*appendRID*/ false, /*useArtifacts*/ false)] - public void BuildAndRunForDifferentOutputPaths(string config, bool appendRID, bool useArtifacts) - { - string id = $"{config}_{GetRandomId()}"; - string projectFile = CreateWasmTemplateProject(id, "wasmconsole"); - string projectName = Path.GetFileNameWithoutExtension(projectFile); - - string extraPropertiesForDBP = ""; - if (appendRID) - extraPropertiesForDBP += "true"; - if (useArtifacts) - extraPropertiesForDBP += "true."; - - string projectDirectory = Path.GetDirectoryName(projectFile)!; - if (!string.IsNullOrEmpty(extraPropertiesForDBP)) - AddItemsPropertiesToProject(Path.Combine(projectDirectory, "Directory.Build.props"), - extraPropertiesForDBP); - - var buildOptions = new BuildProjectOptions( - DotnetWasmFromRuntimePack: true, - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: false, - TargetFramework: DefaultTargetFramework, - IsBrowserProject: false); - if (useArtifacts) - { - buildOptions = buildOptions with - { - BinFrameworkDir = Path.Combine( - projectDirectory, - "bin", - id, - $"{config.ToLower()}_{BuildEnvironment.DefaultRuntimeIdentifier}", - "AppBundle", - "_framework") - }; - } - - var buildArgs = new BuildArgs(projectName, config, false, id, null); - buildArgs = ExpandBuildArgs(buildArgs); - BuildTemplateProject(buildArgs, id: id, buildOptions); - - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {config} x y z") - .EnsureSuccessful(); - } - - [Theory] - [InlineData("", true)] // Default case - [InlineData("false", false)] // the other case - public void Test_WasmStripILAfterAOT(string stripILAfterAOT, bool expectILStripping) - { - string config = "Release"; - string id = $"strip_{config}_{GetRandomId()}"; - string projectFile = CreateWasmTemplateProject(id, "wasmconsole"); - string projectName = Path.GetFileNameWithoutExtension(projectFile); - string projectDirectory = Path.GetDirectoryName(projectFile)!; - bool aot = true; - - UpdateConsoleProgramCs(); - UpdateConsoleMainJs(); - - string extraProperties = "true"; - if (!string.IsNullOrEmpty(stripILAfterAOT)) - extraProperties += $"{stripILAfterAOT}"; - AddItemsPropertiesToProject(projectFile, extraProperties); - - var buildArgs = new BuildArgs(projectName, config, aot, id, null); - buildArgs = ExpandBuildArgs(buildArgs); - - BuildTemplateProject(buildArgs, - id: id, - new BuildProjectOptions( - CreateProject: false, - HasV8Script: false, - MainJS: "main.mjs", - Publish: true, - TargetFramework: BuildTestBase.DefaultTargetFramework, - UseCache: false, - IsBrowserProject: false, - AssertAppBundle: false)); - - string runArgs = $"run --no-silent --no-build -c {config}"; - var res = new RunCommand(s_buildEnv, _testOutput, label: id) - .WithWorkingDirectory(_projectDir!) - .ExecuteWithCapturedOutput(runArgs) - .EnsureExitCode(42); - - string frameworkDir = Path.Combine(projectDirectory, "bin", config, BuildTestBase.DefaultTargetFramework, "browser-wasm", "AppBundle", "_framework"); - string objBuildDir = Path.Combine(projectDirectory, "obj", config, BuildTestBase.DefaultTargetFramework, "browser-wasm", "wasm", "for-publish"); - TestWasmStripILAfterAOTOutput(objBuildDir, frameworkDir, expectILStripping, _testOutput); - } - internal static void TestWasmStripILAfterAOTOutput(string objBuildDir, string frameworkDir, bool expectILStripping, ITestOutputHelper testOutput) { string origAssemblyDir = Path.Combine(objBuildDir, "aot-in"); diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs index 4ef606b784e45b..ea1037e27872ac 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SatelliteLoadingTests.cs @@ -77,8 +77,8 @@ public async Task LoadSatelliteAssemblyFromReference() // Build the library var libraryCsprojPath = Path.GetFullPath(Path.Combine(_projectDir!, "..", "ResourceLibrary")); - new DotNetCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(libraryCsprojPath) + using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput); + CommandResult res = cmd.WithWorkingDirectory(libraryCsprojPath) .WithEnvironmentVariable("NUGET_PACKAGES", _nugetPackagesDir) .ExecuteWithCapturedOutput("build -c Release") .EnsureSuccessful(); diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/WasmAppBuilderDebugLevelTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/WasmAppBuilderDebugLevelTests.cs index 83809b3c2a9a3a..bf8c3272960b36 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/WasmAppBuilderDebugLevelTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/WasmAppBuilderDebugLevelTests.cs @@ -35,8 +35,8 @@ protected override void SetupProject(string projectId) protected override Task RunForBuild(string configuration) { - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) + using RunCommand cmd = new RunCommand(s_buildEnv, _testOutput); + CommandResult res = cmd.WithWorkingDirectory(_projectDir!) .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {configuration}"); return Task.FromResult(ProcessRunOutput(res)); @@ -61,8 +61,8 @@ protected override Task RunForPublish(string configuration) { // WasmAppBuilder does publish to the same folder as build (it overrides the output), // and thus using dotnet run work correctly for publish as well. - CommandResult res = new RunCommand(s_buildEnv, _testOutput) - .WithWorkingDirectory(_projectDir!) + using RunCommand cmd = new RunCommand(s_buildEnv, _testOutput); + CommandResult res = cmd.WithWorkingDirectory(_projectDir!) .ExecuteWithCapturedOutput($"run --no-silent --no-build -c {configuration}"); return Task.FromResult(ProcessRunOutput(res)); diff --git a/src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj b/src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj index 640dd40a88c172..0b796d87bc0471 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj +++ b/src/mono/wasm/Wasm.Build.Tests/Wasm.Build.Tests.csproj @@ -47,6 +47,7 @@ + @@ -134,13 +135,18 @@ + + + <_RuntimePackCurrentVersion Condition="'$(StabilizePackageVersion)' == 'true'">$(ProductVersion) + <_RuntimePackCurrentVersion Condition="'$(StabilizePackageVersion)' != 'true'">$(PackageVersion) + - <_RuntimePackVersions Include="$(PackageVersion)" EnvVarName="RUNTIME_PACK_VER9" /> + <_RuntimePackVersions Include="$(_RuntimePackCurrentVersion)" EnvVarName="RUNTIME_PACK_VER9" /> <_RuntimePackVersions Include="$(PackageVersionNet8)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' != ''" /> - <_RuntimePackVersions Include="$(PackageVersion)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' == ''" /> + <_RuntimePackVersions Include="$(_RuntimePackCurrentVersion)" EnvVarName="RUNTIME_PACK_VER8" Condition="'$(PackageVersionNet8)' == ''" /> <_RuntimePackVersions Include="$(PackageVersionNet7)" EnvVarName="RUNTIME_PACK_VER7" Condition="'$(PackageVersionNet7)' != ''" /> - <_RuntimePackVersions Include="$(PackageVersion)" EnvVarName="RUNTIME_PACK_VER7" Condition="'$(PackageVersionNet7)' == ''" /> + <_RuntimePackVersions Include="$(_RuntimePackCurrentVersion)" EnvVarName="RUNTIME_PACK_VER7" Condition="'$(PackageVersionNet7)' == ''" /> <_RuntimePackVersions Include="$(PackageVersionNet6)" EnvVarName="RUNTIME_PACK_VER6" /> diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index 46fb36135d6f2a..08ac8512665b75 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -41,7 +41,6 @@ public void Build_NoAOT_ShouldNotRelink(BuildArgs buildArgs, RunHost host, strin Assert.DoesNotContain("Compiling native assets with emcc", output); RunAndTestWasmApp(buildArgs, - extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "", expectedExitCode: 42, test: output => { @@ -66,7 +65,6 @@ public void PublishWithSIMD_AOT(BuildArgs buildArgs, RunHost host, string id) DotnetWasmFromRuntimePack: false)); RunAndTestWasmApp(buildArgs, - extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "", expectedExitCode: 42, test: output => { diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs index 9c923799221553..3ea5078b4da3e2 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmTemplateTestBase.cs @@ -43,8 +43,8 @@ public string CreateWasmTemplateProject(string id, string template = "wasmbrowse if (addFrameworkArg) extraArgs += $" -f {DefaultTargetFramework}"; - new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false) - .WithWorkingDirectory(_projectDir!) + using DotNetCommand cmd = new DotNetCommand(s_buildEnv, _testOutput, useDefaultArgs: false); + CommandResult result = cmd.WithWorkingDirectory(_projectDir!) .ExecuteWithCapturedOutput($"new {template} {extraArgs}") .EnsureSuccessful(); @@ -57,38 +57,11 @@ public string CreateWasmTemplateProject(string id, string template = "wasmbrowse if (runAnalyzers) extraProperties += "true"; - if (template == "wasmconsole") - { - UpdateRuntimeconfigTemplateForNode(_projectDir); - } - AddItemsPropertiesToProject(projectfile, extraProperties); return projectfile; } - private static void UpdateRuntimeconfigTemplateForNode(string projectDir) - { - // TODO: Can be removed once Node >= 20 - - string runtimeconfigTemplatePath = Path.Combine(projectDir, "runtimeconfig.template.json"); - string runtimeconfigTemplateContent = File.ReadAllText(runtimeconfigTemplatePath); - var runtimeconfigTemplate = JsonObject.Parse(runtimeconfigTemplateContent); - if (runtimeconfigTemplate == null) - throw new Exception($"Unable to parse runtimeconfigtemplate at '{runtimeconfigTemplatePath}'"); - - var perHostConfigs = runtimeconfigTemplate?["wasmHostProperties"]?["perHostConfig"]?.AsArray(); - if (perHostConfigs == null || perHostConfigs.Count == 0 || perHostConfigs[0] == null) - throw new Exception($"Unable to find perHostConfig in runtimeconfigtemplate at '{runtimeconfigTemplatePath}'"); - - perHostConfigs[0]!["host-args"] = new JsonArray( - "--experimental-wasm-simd", - "--experimental-wasm-eh" - ); - - File.WriteAllText(runtimeconfigTemplatePath, runtimeconfigTemplate!.ToString()); - } - public (string projectDir, string buildOutput) BuildTemplateProject(BuildArgs buildArgs, string id, BuildProjectOptions buildProjectOptions) diff --git a/src/native/corehost/apphost/standalone/hostfxr_resolver.cpp b/src/native/corehost/apphost/standalone/hostfxr_resolver.cpp index 073445177993cc..84c726ddbf75c0 100644 --- a/src/native/corehost/apphost/standalone/hostfxr_resolver.cpp +++ b/src/native/corehost/apphost/standalone/hostfxr_resolver.cpp @@ -118,6 +118,11 @@ hostfxr_resolver_t::hostfxr_resolver_t(const pal::string_t& app_root) { m_status_code = StatusCode::CoreHostLibMissingFailure; } + else if (!pal::is_path_fully_qualified(m_fxr_path)) + { + // We should always be loading hostfxr from an absolute path + m_status_code = StatusCode::CoreHostLibMissingFailure; + } else if (pal::load_library(&m_fxr_path, &m_hostfxr_dll)) { m_status_code = StatusCode::Success; diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index 3ea4d5d043ca3a..880510d06976b1 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories(${CLR_ARTIFACTS_OBJ_DIR}) # Generated version files add_subdirectory(../../hostmisc hostmisc) configure_file(${CLR_SRC_NATIVE_DIR}/corehost/configure.h.in ${GENERATED_INCLUDE_DIR}/corehost/configure.h) -target_include_directories(hostmisc PUBLIC ${GENERATED_INCLUDE_DIR}/corehost) +target_include_directories(hostmisc_interface INTERFACE ${GENERATED_INCLUDE_DIR}/corehost) if ((NOT DEFINED CLR_CMAKE_USE_SYSTEM_RAPIDJSON) OR (NOT CLR_CMAKE_USE_SYSTEM_RAPIDJSON)) include_directories(${CLR_SRC_NATIVE_DIR}/external/) diff --git a/src/native/corehost/build.cmd b/src/native/corehost/build.cmd index e5f535467ad38b..ff40b5048a66be 100644 --- a/src/native/corehost/build.cmd +++ b/src/native/corehost/build.cmd @@ -5,7 +5,7 @@ setlocal :: Initialize the args that will be passed to cmake set "__sourceDir=%~dp0" :: remove trailing slash -if %__sourceDir:~-1%==\ set "__ProjectDir=%__sourceDir:~0,-1%" +if "%__sourceDir:~-1%"=="\" set "__sourceDir=%__sourceDir:~0,-1%" set "__RepoRootDir=%__sourceDir%\..\..\.." :: normalize diff --git a/src/native/corehost/corehost.cpp b/src/native/corehost/corehost.cpp index c8a94312c5d6d4..c359c30fd7dd89 100644 --- a/src/native/corehost/corehost.cpp +++ b/src/native/corehost/corehost.cpp @@ -115,7 +115,7 @@ int exe_start(const int argc, const pal::char_t* argv[]) // Use realpath to find the path of the host, resolving any symlinks. // hostfxr (for dotnet) and the app dll (for apphost) are found relative to the host. pal::string_t host_path; - if (!pal::get_own_executable_path(&host_path) || !pal::realpath(&host_path)) + if (!pal::get_own_executable_path(&host_path) || !pal::fullpath(&host_path)) { trace::error(_X("Failed to resolve full path of the current executable [%s]"), host_path.c_str()); return StatusCode::CoreHostCurHostFindFailure; @@ -200,6 +200,7 @@ int exe_start(const int argc, const pal::char_t* argv[]) int rc = fxr.status_code(); if (rc != StatusCode::Success) { + trace::error(_X("Failed to resolve %s [%s]. Error code: 0x%x"), LIBFXR_NAME, fxr.fxr_path().empty() ? _X("not found") : fxr.fxr_path().c_str(), rc); return rc; } diff --git a/src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp b/src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp index 4e75400a04a81b..ff68220193d47b 100644 --- a/src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp +++ b/src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp @@ -180,6 +180,10 @@ int hostpolicy_resolver::load( return StatusCode::CoreHostLibMissingFailure; } + // We should always be loading hostpolicy from an absolute path + if (!pal::is_path_fully_qualified(host_path)) + return StatusCode::CoreHostLibMissingFailure; + // Load library // We expect to leak hostpolicy - just as we do not unload coreclr, we do not unload hostpolicy if (!pal::load_library(&host_path, &g_hostpolicy)) diff --git a/src/native/corehost/fxr_resolver.cpp b/src/native/corehost/fxr_resolver.cpp index a69bf7ced896a5..0d1cbddf9deb5c 100644 --- a/src/native/corehost/fxr_resolver.cpp +++ b/src/native/corehost/fxr_resolver.cpp @@ -95,7 +95,7 @@ bool fxr_resolver::try_get_path( bool search_global = (search & search_location_global) != 0; pal::string_t default_install_location; pal::string_t dotnet_root_env_var_name; - if (search_app_relative && pal::realpath(app_relative_dotnet_root)) + if (search_app_relative && pal::fullpath(app_relative_dotnet_root)) { trace::info(_X("Using app-relative location [%s] as runtime location."), app_relative_dotnet_root->c_str()); out_dotnet_root->assign(*app_relative_dotnet_root); diff --git a/src/native/corehost/fxr_resolver.h b/src/native/corehost/fxr_resolver.h index b61f3b8fb4e6dc..4764783b2afc7f 100644 --- a/src/native/corehost/fxr_resolver.h +++ b/src/native/corehost/fxr_resolver.h @@ -55,6 +55,10 @@ int load_fxr_and_get_delegate(hostfxr_delegate_type type, THostPathToConfigCallb return StatusCode::CoreHostLibMissingFailure; } + // We should always be loading hostfxr from an absolute path + if (!pal::is_path_fully_qualified(fxr_path)) + return StatusCode::CoreHostLibMissingFailure; + // Load library if (!pal::load_library(&fxr_path, &fxr)) { diff --git a/src/native/corehost/hostfxr.h b/src/native/corehost/hostfxr.h index 0c316a59b1159f..f25eb609536543 100644 --- a/src/native/corehost/hostfxr.h +++ b/src/native/corehost/hostfxr.h @@ -1,12 +1,17 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#ifndef __HOSTFXR_H__ -#define __HOSTFXR_H__ +#ifndef HAVE_HOSTFXR_H +#define HAVE_HOSTFXR_H #include #include +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + #if defined(_WIN32) #define HOSTFXR_CALLTYPE __cdecl #ifdef _WCHAR_T_DEFINED @@ -296,10 +301,6 @@ struct hostfxr_dotnet_environment_sdk_info const char_t* path; }; -typedef void(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_result_fn)( - const struct hostfxr_dotnet_environment_info* info, - void* result_context); - struct hostfxr_dotnet_environment_framework_info { size_t size; @@ -322,6 +323,10 @@ struct hostfxr_dotnet_environment_info const struct hostfxr_dotnet_environment_framework_info* frameworks; }; +typedef void(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_result_fn)( + const struct hostfxr_dotnet_environment_info* info, + void* result_context); + // // Returns available SDKs and frameworks. // @@ -384,7 +389,7 @@ struct hostfxr_resolve_frameworks_result }; typedef void (HOSTFXR_CALLTYPE* hostfxr_resolve_frameworks_result_fn)( - const hostfxr_resolve_frameworks_result* result, + const struct hostfxr_resolve_frameworks_result* result, void* result_context); // @@ -411,8 +416,12 @@ typedef void (HOSTFXR_CALLTYPE* hostfxr_resolve_frameworks_result_fn)( // typedef int32_t(HOSTFXR_CALLTYPE* hostfxr_resolve_frameworks_for_runtime_config_fn)( const char_t* runtime_config_path, - /*opt*/ const hostfxr_initialize_parameters* parameters, + /*opt*/ const struct hostfxr_initialize_parameters* parameters, /*opt*/ hostfxr_resolve_frameworks_result_fn callback, /*opt*/ void* result_context); -#endif //__HOSTFXR_H__ +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // HAVE_HOSTFXR_H diff --git a/src/native/corehost/hostmisc/CMakeLists.txt b/src/native/corehost/hostmisc/CMakeLists.txt index f39b586590c62a..76669e902fa6ad 100644 --- a/src/native/corehost/hostmisc/CMakeLists.txt +++ b/src/native/corehost/hostmisc/CMakeLists.txt @@ -31,23 +31,34 @@ endif() # hostmisc must be an "object library" as we want to build it once # and embed the objects into static libraries we ship (like libnethost). -add_library(hostmisc OBJECT ${SOURCES}) - -target_include_directories(hostmisc PUBLIC +add_library(hostmisc_interface INTERFACE) +target_include_directories(hostmisc_interface INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ${CLR_SRC_NATIVE_DIR} ${CMAKE_CURRENT_LIST_DIR}) if (MSVC) - target_sources(hostmisc PRIVATE ${HEADERS}) - target_link_libraries(hostmisc PUBLIC advapi32) + target_link_libraries(hostmisc_interface INTERFACE advapi32) endif() -target_link_libraries(hostmisc PUBLIC +target_link_libraries(hostmisc_interface INTERFACE ${CMAKE_DL_LIBS} $<$:${PTHREAD_LIB}>) if(CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARMV6) - target_link_libraries(hostmisc PUBLIC + target_link_libraries(hostmisc_interface INTERFACE $<$:${ATOMIC_SUPPORT_LIB}>) endif() + + +add_library(hostmisc STATIC ${SOURCES}) +target_link_libraries(hostmisc PUBLIC hostmisc_interface) +if (MSVC) + target_sources(hostmisc PRIVATE ${HEADERS}) +endif() + +add_library(hostmisc_public OBJECT ${SOURCES}) +target_link_libraries(hostmisc_public PUBLIC hostmisc_interface) +set_target_properties(hostmisc_public PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) + +add_library(hostmisc::public ALIAS hostmisc_public) \ No newline at end of file diff --git a/src/native/corehost/hostmisc/pal.h b/src/native/corehost/hostmisc/pal.h index bde8446cc22cdf..94166e65d6f63a 100644 --- a/src/native/corehost/hostmisc/pal.h +++ b/src/native/corehost/hostmisc/pal.h @@ -335,6 +335,7 @@ namespace pal bool get_default_breadcrumb_store(string_t* recv); bool is_path_rooted(const string_t& path); + bool is_path_fully_qualified(const string_t& path); // Returns a platform-specific, user-private directory // that can be used for extracting out components of a single-file app. diff --git a/src/native/corehost/hostmisc/pal.unix.cpp b/src/native/corehost/hostmisc/pal.unix.cpp index 613902b5eaf3ac..265ad809d9af19 100644 --- a/src/native/corehost/hostmisc/pal.unix.cpp +++ b/src/native/corehost/hostmisc/pal.unix.cpp @@ -192,7 +192,7 @@ bool pal::get_loaded_library( { pal::string_t library_name_local; #if defined(TARGET_OSX) - if (!pal::is_path_rooted(library_name)) + if (!pal::is_path_fully_qualified(library_name)) library_name_local.append("@rpath/"); #endif library_name_local.append(library_name); @@ -200,7 +200,7 @@ bool pal::get_loaded_library( dll_t dll_maybe = dlopen(library_name_local.c_str(), RTLD_LAZY | RTLD_NOLOAD); if (dll_maybe == nullptr) { - if (pal::is_path_rooted(library_name)) + if (pal::is_path_fully_qualified(library_name)) return false; // dlopen on some systems only finds loaded libraries when given the full path @@ -265,6 +265,11 @@ bool pal::is_path_rooted(const pal::string_t& path) return path.front() == '/'; } +bool pal::is_path_fully_qualified(const pal::string_t& path) +{ + return is_path_rooted(path); +} + bool pal::get_default_breadcrumb_store(string_t* recv) { recv->clear(); diff --git a/src/native/corehost/hostmisc/pal.windows.cpp b/src/native/corehost/hostmisc/pal.windows.cpp index 3a3db968b5bde4..dacafb182899ec 100644 --- a/src/native/corehost/hostmisc/pal.windows.cpp +++ b/src/native/corehost/hostmisc/pal.windows.cpp @@ -641,9 +641,31 @@ pal::string_t pal::get_current_os_rid_platform() return ridOS; } +namespace +{ + bool is_directory_separator(pal::char_t c) + { + return c == DIR_SEPARATOR || c == L'/'; + } +} + bool pal::is_path_rooted(const string_t& path) { - return path.length() >= 2 && path[1] == L':'; + return (path.length() >= 1 && is_directory_separator(path[0])) // UNC or device paths + || (path.length() >= 2 && path[1] == L':'); // Drive letter paths +} + +bool pal::is_path_fully_qualified(const string_t& path) +{ + if (path.length() < 2) + return false; + + // Check for UNC and DOS device paths + if (is_directory_separator(path[0])) + return path[1] == L'?' || is_directory_separator(path[1]); + + // Check for drive absolute path - for example C:\. + return path.length() >= 3 && path[1] == L':' && is_directory_separator(path[2]); } // Returns true only if an env variable can be read successfully to be non-empty. @@ -884,8 +906,12 @@ bool pal::realpath(pal::string_t* path, bool skip_error_logging) } } - // Remove the \\?\ prefix, unless it is necessary or was already there - if (LongFile::IsExtended(str) && !LongFile::IsExtended(*path) && + // Remove the UNC extended prefix (\\?\UNC\) or extended prefix (\\?\) unless it is necessary or was already there + if (LongFile::IsUNCExtended(str) && !LongFile::IsUNCExtended(*path) && str.length() < MAX_PATH) + { + str.replace(0, LongFile::UNCExtendedPathPrefix.size(), LongFile::UNCPathPrefix); + } + else if (LongFile::IsExtended(str) && !LongFile::IsExtended(*path) && !LongFile::ShouldNormalize(str.substr(LongFile::ExtendedPrefix.size()))) { str.erase(0, LongFile::ExtendedPrefix.size()); diff --git a/src/native/corehost/hostpolicy/deps_resolver.cpp b/src/native/corehost/hostpolicy/deps_resolver.cpp index 55d9bd8f948868..88cb29ce6bffdb 100644 --- a/src/native/corehost/hostpolicy/deps_resolver.cpp +++ b/src/native/corehost/hostpolicy/deps_resolver.cpp @@ -601,7 +601,7 @@ void deps_resolver_t::init_known_entry_path(const deps_entry_t& entry, const pal return; } - assert(pal::is_path_rooted(path)); + assert(pal::is_path_fully_qualified(path)); if (m_coreclr_path.empty() && utils::ends_with(path, DIR_SEPARATOR_STR LIBCORECLR_NAME, false)) { m_coreclr_path = path; @@ -830,15 +830,21 @@ bool deps_resolver_t::resolve_probe_dirs( } } - // If the deps file is missing add known locations. - if (!get_app_deps().exists()) + // If the deps file is missing for the app, add known locations. + // For libhost scenarios, there is no app or app path + if (m_host_mode != host_mode_t::libhost && !get_app_deps().exists()) { + assert(!m_app_dir.empty()); + // App local path add_unique_path(asset_type, m_app_dir, &items, output, &non_serviced, core_servicing); - // deps_resolver treats being able to get the coreclr path as optional, so we ignore the return value here. - // The caller is responsible for checking whether coreclr path is set and handling as appropriate. - (void) file_exists_in_dir(m_app_dir, LIBCORECLR_NAME, &m_coreclr_path); + if (m_coreclr_path.empty()) + { + // deps_resolver treats being able to get the coreclr path as optional, so we ignore the return value here. + // The caller is responsible for checking whether coreclr path is set and handling as appropriate. + (void) file_exists_in_dir(m_app_dir, LIBCORECLR_NAME, &m_coreclr_path); + } } // Handle any additional deps.json that were specified. diff --git a/src/native/corehost/hostpolicy/standalone/coreclr_resolver.cpp b/src/native/corehost/hostpolicy/standalone/coreclr_resolver.cpp index b040c3e8546278..adcebeb9a029c5 100644 --- a/src/native/corehost/hostpolicy/standalone/coreclr_resolver.cpp +++ b/src/native/corehost/hostpolicy/standalone/coreclr_resolver.cpp @@ -13,6 +13,10 @@ bool coreclr_resolver_t::resolve_coreclr(const pal::string_t& libcoreclr_path, c pal::string_t coreclr_dll_path(libcoreclr_path); append_path(&coreclr_dll_path, LIBCORECLR_NAME); + // We should always be loading coreclr from an absolute path + if (!pal::is_path_fully_qualified(coreclr_dll_path)) + return false; + if (!pal::load_library(&coreclr_dll_path, &coreclr_resolver_contract.coreclr)) { return false; diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt index 38b103b7178bee..f9a3a5086ec77f 100644 --- a/src/native/corehost/nethost/CMakeLists.txt +++ b/src/native/corehost/nethost/CMakeLists.txt @@ -34,7 +34,7 @@ if (WIN32) endif(WIN32) target_link_libraries(nethost PRIVATE hostmisc fxr_resolver) -target_link_libraries(libnethost PRIVATE hostmisc fxr_resolver) +target_link_libraries(libnethost PRIVATE hostmisc::public fxr_resolver) target_compile_definitions(nethost PRIVATE FEATURE_LIBHOST NETHOST_EXPORT) target_compile_definitions(libnethost PRIVATE FEATURE_LIBHOST NETHOST_EXPORT) diff --git a/src/native/corehost/test/mockhostfxr/CMakeLists.txt b/src/native/corehost/test/mockhostfxr/CMakeLists.txt index 6820b27d84715c..95e57456f57f7a 100644 --- a/src/native/corehost/test/mockhostfxr/CMakeLists.txt +++ b/src/native/corehost/test/mockhostfxr/CMakeLists.txt @@ -1,8 +1,10 @@ # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. -add_library(mockhostfxr_2_2 SHARED mockhostfxr.cpp) -add_library(mockhostfxr_5_0 SHARED mockhostfxr.cpp) +set(MOCKHOSTFXR_SRC mockhostfxr.cpp test_c_api.c) + +add_library(mockhostfxr_2_2 SHARED ${MOCKHOSTFXR_SRC}) +add_library(mockhostfxr_5_0 SHARED ${MOCKHOSTFXR_SRC}) target_link_libraries(mockhostfxr_2_2 PRIVATE libhostcommon) target_link_libraries(mockhostfxr_5_0 PRIVATE libhostcommon) @@ -11,4 +13,4 @@ target_compile_definitions(mockhostfxr_2_2 PRIVATE MOCKHOSTFXR_2_2 EXPORT_SHARED target_compile_definitions(mockhostfxr_5_0 PRIVATE MOCKHOSTFXR_5_0 EXPORT_SHARED_API) install_with_stripped_symbols(mockhostfxr_2_2 TARGETS corehost_test) -install_with_stripped_symbols(mockhostfxr_5_0 TARGETS corehost_test) \ No newline at end of file +install_with_stripped_symbols(mockhostfxr_5_0 TARGETS corehost_test) diff --git a/src/native/corehost/test/mockhostfxr/mockhostfxr.cpp b/src/native/corehost/test/mockhostfxr/mockhostfxr.cpp index 46509a0f14d812..75de5a1c3f7e57 100644 --- a/src/native/corehost/test/mockhostfxr/mockhostfxr.cpp +++ b/src/native/corehost/test/mockhostfxr/mockhostfxr.cpp @@ -1,3 +1,6 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + #include "error_codes.h" #include "hostfxr.h" #include "host_startup_info.h" diff --git a/src/native/corehost/test/mockhostfxr/test_c_api.c b/src/native/corehost/test/mockhostfxr/test_c_api.c new file mode 100644 index 00000000000000..3cb130101c09b2 --- /dev/null +++ b/src/native/corehost/test/mockhostfxr/test_c_api.c @@ -0,0 +1,8 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// hostfxr.h is a public API. When included in .c files, it may fail to compile +// if C++-specific syntax is used within the extern "C" block. Since all usage of +// this API in runtime repo are within C++ code, such breakages are not encountered +// during normal development or testing. +#include "hostfxr.h" diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index 23bdf3c26d37a4..59cc76cb46dbd6 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -123,10 +123,14 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) add_compile_options(-Wno-empty-translation-unit) add_compile_options(-Wno-cast-align) add_compile_options(-Wno-typedef-redefinition) - add_compile_options(-Wno-c11-extensions) - add_compile_options(-Wno-pre-c11-compat) # fixes build on Debian - add_compile_options(-Wno-unknown-warning-option) # unknown warning option '-Wno-pre-c11-compat' add_compile_options(-Wno-thread-safety-analysis) + add_compile_options(-Wno-c11-extensions) + + check_c_compiler_flag(-Wpre-c11-compat COMPILER_SUPPORTS_W_PRE_C11_COMPAT) + if (COMPILER_SUPPORTS_W_PRE_C11_COMPAT) + add_compile_options(-Wno-pre-c11-compat) + endif() + if (CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI) add_compile_options(-Wno-unsafe-buffer-usage) add_compile_options(-Wno-cast-function-type-strict) diff --git a/src/native/libs/System.Globalization.Native/pal_collation.m b/src/native/libs/System.Globalization.Native/pal_collation.m index ebe0db5c2c202a..56af941fb40033 100644 --- a/src/native/libs/System.Globalization.Native/pal_collation.m +++ b/src/native/libs/System.Globalization.Native/pal_collation.m @@ -117,6 +117,11 @@ int32_t GlobalizationNative_CompareStringNative(const uint16_t* localeName, int3 } } +/** + * Removes zero-width and other weightless characters such as U+200B (Zero Width Space), + * U+200C (Zero Width Non-Joiner), U+200D (Zero Width Joiner), U+FEFF (Zero Width No-Break Space), + * and the NUL character from the specified string. + */ static NSString* RemoveWeightlessCharacters(NSString* source) { NSError *error = nil; @@ -143,10 +148,9 @@ static int32_t IsIndexFound(int32_t fromBeginning, int32_t foundLocation, int32_ /* Function: IndexOf -Find detailed explanation how this function works in https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md +Find detailed explanation how this function works in https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md#string-indexing */ -Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNameLength, const uint16_t* lpTarget, int32_t cwTargetLength, - const uint16_t* lpSource, int32_t cwSourceLength, int32_t comparisonOptions, int32_t fromBeginning) +Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNameLength, const uint16_t* lpTarget, int32_t cwTargetLength, const uint16_t* lpSource, int32_t cwSourceLength, int32_t comparisonOptions, int32_t fromBeginning) { @autoreleasepool { @@ -158,6 +162,9 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam return result; } NSStringCompareOptions options = ConvertFromCompareOptionsToNSStringCompareOptions(comparisonOptions, true); + if (!fromBeginning) // LastIndexOf + options |= NSBackwardsSearch; + NSString *searchString = [NSString stringWithCharacters: lpTarget length: (NSUInteger)cwTargetLength]; NSString *searchStrCleaned = RemoveWeightlessCharacters(searchString); NSString *sourceString = [NSString stringWithCharacters: lpSource length: (NSUInteger)cwSourceLength]; @@ -168,7 +175,7 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam searchStrCleaned = ConvertToKatakana(searchStrCleaned); } - if (sourceStrCleaned.length == 0 || searchStrCleaned.length == 0) + if (searchStrCleaned.length == 0) { result.location = fromBeginning ? 0 : (int32_t)sourceString.length; return result; @@ -178,9 +185,6 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam NSString *searchStrPrecomposed = searchStrCleaned.precomposedStringWithCanonicalMapping; NSString *sourceStrPrecomposed = sourceStrCleaned.precomposedStringWithCanonicalMapping; - // last index - if (!fromBeginning) - options |= NSBackwardsSearch; // check if there is a possible match and return -1 if not // doesn't matter which normalization form is used here @@ -233,7 +237,7 @@ Range GlobalizationNative_IndexOfNative(const uint16_t* localeName, int32_t lNam result.location = (int32_t)precomposedRange.location; result.length = (int32_t)precomposedRange.length; if (!(comparisonOptions & IgnoreCase)) - return result; + return result; } // check if sourceString has decomposed form of characters and searchString has precomposed form of characters diff --git a/src/native/libs/System.Globalization.Native/pal_locale.m b/src/native/libs/System.Globalization.Native/pal_locale.m index 6d13c807bec95d..a26cc318f14613 100644 --- a/src/native/libs/System.Globalization.Native/pal_locale.m +++ b/src/native/libs/System.Globalization.Native/pal_locale.m @@ -786,13 +786,6 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) } } -static NSString* GetBaseName(NSString *localeIdentifier) -{ - NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]; - NSString *languageCode = [locale objectForKey:NSLocaleLanguageCode]; - return languageCode; -} - const char* GlobalizationNative_GetDefaultLocaleNameNative(void) { @autoreleasepool @@ -800,7 +793,7 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) if (NSLocale.preferredLanguages.count > 0) { NSString *preferredLanguage = [NSLocale.preferredLanguages objectAtIndex:0]; - return strdup([GetBaseName(preferredLanguage) UTF8String]); + return strdup([preferredLanguage UTF8String]); } else { @@ -821,7 +814,7 @@ int32_t GlobalizationNative_GetLocalesNative(UChar* value, int32_t length) localeName = currentLocale.localeIdentifier; } - return strdup([GetBaseName(localeName) UTF8String]); + return strdup([localeName UTF8String]); } } } diff --git a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt index c8239e4ee04b4a..8cd64461b55694 100644 --- a/src/native/libs/System.IO.Compression.Native/CMakeLists.txt +++ b/src/native/libs/System.IO.Compression.Native/CMakeLists.txt @@ -14,6 +14,10 @@ set(NATIVECOMPRESSION_SOURCES pal_zlib.c ) +if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_TARGET_ARCH_I386) + list(APPEND NATIVECOMPRESSION_SOURCES "zlib_allocator_win.c") +endif() + if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) if (CLR_CMAKE_USE_SYSTEM_BROTLI) diff --git a/src/native/libs/System.IO.Compression.Native/pal_zlib.c b/src/native/libs/System.IO.Compression.Native/pal_zlib.c index a04f60aa876a88..8910bab7b6d7cb 100644 --- a/src/native/libs/System.IO.Compression.Native/pal_zlib.c +++ b/src/native/libs/System.IO.Compression.Native/pal_zlib.c @@ -8,6 +8,9 @@ #ifdef _WIN32 #define c_static_assert(e) static_assert((e),"") #include "../Common/pal_utilities.h" + #if _WIN64 + #include + #endif #else #include "pal_utilities.h" #endif @@ -39,6 +42,11 @@ static int32_t Init(PAL_ZStream* stream) { z_stream* zStream = (z_stream*)calloc(1, sizeof(z_stream)); +#ifdef _WIN64 + zStream->zalloc = z_custom_calloc; + zStream->zfree = z_custom_cfree; +#endif + stream->internalState = zStream; if (zStream != NULL) diff --git a/src/native/libs/System.IO.Compression.Native/zlib_allocator.h b/src/native/libs/System.IO.Compression.Native/zlib_allocator.h new file mode 100644 index 00000000000000..cadd00bb5879c5 --- /dev/null +++ b/src/native/libs/System.IO.Compression.Native/zlib_allocator.h @@ -0,0 +1,8 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include // voidpf + +voidpf z_custom_calloc(voidpf opaque, unsigned items, unsigned size); + +void z_custom_cfree(voidpf opaque, voidpf ptr); diff --git a/src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c b/src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c new file mode 100644 index 00000000000000..239a46e0bfb64b --- /dev/null +++ b/src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c @@ -0,0 +1,81 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include +#include +#include +#include /* _ASSERTE */ + +#include + +/* A custom allocator for zlib that uses a dedicated heap. + This provides better performance and avoids fragmentation + that can occur on Windows when using the default process heap. + */ + +// Gets the special heap we'll allocate from. +HANDLE GetZlibHeap() +{ + static HANDLE s_hPublishedHeap = NULL; + + // If already initialized, return immediately. + // We don't need a volatile read here since the publish is performed with release semantics. + if (s_hPublishedHeap != NULL) { return s_hPublishedHeap; } + + // Attempt to create a new heap. The heap will be dynamically sized. + HANDLE hNewHeap = HeapCreate(0, 0, 0); + + if (hNewHeap != NULL) + { + // We created a new heap. Attempt to publish it. + if (InterlockedCompareExchangePointer(&s_hPublishedHeap, hNewHeap, NULL) != NULL) + { + HeapDestroy(hNewHeap); // Somebody published before us. Destroy our heap. + hNewHeap = NULL; // Guard against accidental use later in the method. + } + } + else + { + // If we can't create a new heap, fall back to the process default heap. + InterlockedCompareExchangePointer(&s_hPublishedHeap, GetProcessHeap(), NULL); + } + + // Some thread - perhaps us, perhaps somebody else - published the heap. Return it. + // We don't need a volatile read here since the publish is performed with release semantics. + _ASSERTE(s_hPublishedHeap != NULL); + return s_hPublishedHeap; +} + +voidpf z_custom_calloc(opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + + SIZE_T cbRequested; + if (sizeof(items) + sizeof(size) <= sizeof(cbRequested)) + { + // multiplication can't overflow; no need for safeint + cbRequested = (SIZE_T)items * (SIZE_T)size; + } + else + { + // multiplication can overflow; go through safeint + if (FAILED(SIZETMult(items, size, &cbRequested))) { return NULL; } + } + + return HeapAlloc(GetZlibHeap(), 0, cbRequested); +} + +void z_custom_cfree(opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + if (ptr == NULL) { return; } // ok to free nullptr + + if (!HeapFree(GetZlibHeap(), 0, ptr)) { goto Fail; } + return; + +Fail: + __fastfail(FAST_FAIL_HEAP_METADATA_CORRUPTION); +} diff --git a/src/native/libs/System.Native/pal_io.c b/src/native/libs/System.Native/pal_io.c index 0b6eab7e8c22bd..9bdd28616ad475 100644 --- a/src/native/libs/System.Native/pal_io.c +++ b/src/native/libs/System.Native/pal_io.c @@ -1883,6 +1883,53 @@ int32_t SystemNative_PWrite(intptr_t fd, void* buffer, int32_t bufferSize, int64 return (int32_t)count; } +#if (HAVE_PREADV || HAVE_PWRITEV) && !defined(TARGET_WASM) +static int GetAllowedVectorCount(IOVector* vectors, int32_t vectorCount) +{ +#if defined(IOV_MAX) + const int IovMax = IOV_MAX; +#else + // In theory all the platforms that we support define IOV_MAX, + // but we want to be extra safe and provde a fallback + // in case it turns out to not be true. + // 16 is low, but supported on every platform. + const int IovMax = 16; +#endif + + int allowedCount = (int)vectorCount; + + // We need to respect the limit of items that can be passed in iov. + // In case of writes, the managed code is responsible for handling incomplete writes. + // In case of reads, we simply returns the number of bytes read and it's up to the users. + if (IovMax < allowedCount) + { + allowedCount = IovMax; + } + +#if defined(TARGET_APPLE) + // For macOS preadv and pwritev can fail with EINVAL when the total length + // of all vectors overflows a 32-bit integer. + size_t totalLength = 0; + for (int i = 0; i < allowedCount; i++) + { + assert(INT_MAX >= vectors[i].Count); + + totalLength += vectors[i].Count; + + if (totalLength > INT_MAX) + { + allowedCount = i; + break; + } + } +#else + (void)vectors; +#endif + + return allowedCount; +} +#endif // (HAVE_PREADV || HAVE_PWRITEV) && !defined(TARGET_WASM) + int64_t SystemNative_PReadV(intptr_t fd, IOVector* vectors, int32_t vectorCount, int64_t fileOffset) { assert(vectors != NULL); @@ -1891,7 +1938,8 @@ int64_t SystemNative_PReadV(intptr_t fd, IOVector* vectors, int32_t vectorCount, int64_t count = 0; int fileDescriptor = ToFileDescriptor(fd); #if HAVE_PREADV && !defined(TARGET_WASM) // preadv is buggy on WASM - while ((count = preadv(fileDescriptor, (struct iovec*)vectors, (int)vectorCount, (off_t)fileOffset)) < 0 && errno == EINTR); + int allowedVectorCount = GetAllowedVectorCount(vectors, vectorCount); + while ((count = preadv(fileDescriptor, (struct iovec*)vectors, allowedVectorCount, (off_t)fileOffset)) < 0 && errno == EINTR); #else int64_t current; for (int i = 0; i < vectorCount; i++) @@ -1931,7 +1979,8 @@ int64_t SystemNative_PWriteV(intptr_t fd, IOVector* vectors, int32_t vectorCount int64_t count = 0; int fileDescriptor = ToFileDescriptor(fd); #if HAVE_PWRITEV && !defined(TARGET_WASM) // pwritev is buggy on WASM - while ((count = pwritev(fileDescriptor, (struct iovec*)vectors, (int)vectorCount, (off_t)fileOffset)) < 0 && errno == EINTR); + int allowedVectorCount = GetAllowedVectorCount(vectors, vectorCount); + while ((count = pwritev(fileDescriptor, (struct iovec*)vectors, allowedVectorCount, (off_t)fileOffset)) < 0 && errno == EINTR); #else int64_t current; for (int i = 0; i < vectorCount; i++) diff --git a/src/native/libs/System.Native/pal_networking.c b/src/native/libs/System.Native/pal_networking.c index dc727fe5465045..cae1285e7e74e4 100644 --- a/src/native/libs/System.Native/pal_networking.c +++ b/src/native/libs/System.Native/pal_networking.c @@ -1660,6 +1660,11 @@ int32_t SystemNative_Connect(intptr_t socket, uint8_t* socketAddress, int32_t so return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno); } +#if defined(__linux__) && !defined(TCP_FASTOPEN_CONNECT) +// fixup if compiled against old Kernel headers. +// Can be removed once we have at least 4.11 +#define TCP_FASTOPEN_CONNECT 30 +#endif int32_t SystemNative_Connectx(intptr_t socket, uint8_t* socketAddress, int32_t socketAddressLen, uint8_t* data, int32_t dataLen, int32_t tfo, int* sent) { if (socketAddress == NULL || socketAddressLen < 0 || sent == NULL) 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 84615493f4495c..bc333326b9837e 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -77,9 +77,14 @@ if (NOT SWIFT_COMPILER_TARGET) endif() 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 -enable-library-evolution -g ${SWIFT_OPTIMIZATION_FLAG} -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 -enable-library-evolution -g ${SWIFT_OPTIMIZATION_FLAG} -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/System.Security.Cryptography.Native/opensslshim.h b/src/native/libs/System.Security.Cryptography.Native/opensslshim.h index b85316556c0aac..7dd78a5edfd08a 100644 --- a/src/native/libs/System.Security.Cryptography.Native/opensslshim.h +++ b/src/native/libs/System.Security.Cryptography.Native/opensslshim.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -690,6 +691,8 @@ extern bool g_libSslUses32BitTime; LIGHTUP_FUNCTION(SSL_verify_client_post_handshake) \ LIGHTUP_FUNCTION(SSL_set_post_handshake_auth) \ REQUIRED_FUNCTION(SSL_version) \ + REQUIRED_FUNCTION(UI_create_method) \ + REQUIRED_FUNCTION(UI_destroy_method) \ FALLBACK_FUNCTION(X509_check_host) \ REQUIRED_FUNCTION(X509_check_purpose) \ REQUIRED_FUNCTION(X509_cmp_time) \ @@ -1246,6 +1249,8 @@ extern TYPEOF(OPENSSL_gmtime)* OPENSSL_gmtime_ptr; #define SSL_set_post_handshake_auth SSL_set_post_handshake_auth_ptr #define SSL_version SSL_version_ptr #define TLS_method TLS_method_ptr +#define UI_create_method UI_create_method_ptr +#define UI_destroy_method UI_destroy_method_ptr #define X509_check_host X509_check_host_ptr #define X509_check_purpose X509_check_purpose_ptr #define X509_cmp_time X509_cmp_time_ptr diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c index a7af40330316a5..31d5c0eaadec81 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_kdf.c @@ -201,18 +201,27 @@ static int32_t HkdfCore( size_t keyLengthT = Int32ToSizeT(keyLength); size_t destinationLengthT = Int32ToSizeT(destinationLength); - size_t saltLengthT = Int32ToSizeT(saltLength); - size_t infoLengthT = Int32ToSizeT(infoLength); - OSSL_PARAM params[] = + OSSL_PARAM params[6] = {{0}}; + int i = 0; + params[i++] = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY, (void*)key, keyLengthT); + params[i++] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, algorithm, 0); + + if (salt != NULL && saltLength > 0) { - OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY, (void*)key, keyLengthT), - OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, algorithm, 0), - OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT, (void*)salt, saltLengthT), - OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO, (void*)info, infoLengthT), - OSSL_PARAM_construct_int(OSSL_KDF_PARAM_MODE, &operation), - OSSL_PARAM_construct_end(), - }; + size_t saltLengthT = Int32ToSizeT(saltLength); + params[i++] = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT, (void*)salt, saltLengthT); + } + + if (info != NULL && infoLength > 0) + { + size_t infoLengthT = Int32ToSizeT(infoLength); + params[i++] = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO, (void*)info, infoLengthT); + } + + params[i++] = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_MODE, &operation); + params[i] = OSSL_PARAM_construct_end(); + assert(i < 6); if (EVP_KDF_derive(ctx, destination, destinationLengthT, params) <= 0) { diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c index f80ef99c02515b..14b4f1eaa49ee6 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c @@ -556,6 +556,7 @@ static EVP_PKEY* LoadKeyFromEngine( *haveEngine = 1; EVP_PKEY* ret = NULL; ENGINE* engine = NULL; + UI_METHOD* ui = NULL; // Per https://github.com/openssl/openssl/discussions/21427 // using EVP_PKEY after freeing ENGINE is correct. @@ -567,12 +568,30 @@ static EVP_PKEY* LoadKeyFromEngine( { ret = load_func(engine, keyName, NULL, NULL); + if (ret == NULL) + { + // Some engines do not tolerate having NULL passed to the ui_method parameter. + // We re-try with a non-NULL UI_METHOD. + ERR_clear_error(); + ui = UI_create_method(".NET NULL UI"); + + if (ui) + { + ret = load_func(engine, keyName, ui, NULL); + } + } + ENGINE_finish(engine); } ENGINE_free(engine); } + if (ui) + { + UI_destroy_method(ui); + } + return ret; } diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c index e444d8c0c57b12..f4a79df5fa1498 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey_rsa.c @@ -215,6 +215,15 @@ int32_t CryptoNative_RsaEncrypt(EVP_PKEY* pkey, static bool ConfigureSignature(EVP_PKEY_CTX* ctx, RsaPaddingMode padding, const EVP_MD* digest) { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcast-qual" + if (EVP_PKEY_CTX_set_signature_md(ctx, digest) <= 0) +#pragma clang diagnostic pop + { + return false; + } + if (padding == RsaPaddingPkcs1) { if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) @@ -233,14 +242,6 @@ static bool ConfigureSignature(EVP_PKEY_CTX* ctx, RsaPaddingMode padding, const } } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-qual" - if (EVP_PKEY_CTX_set_signature_md(ctx, digest) <= 0) -#pragma clang diagnostic pop - { - return false; - } - return true; } diff --git a/src/native/libs/build-native.proj b/src/native/libs/build-native.proj index 36bfccbfe07ad8..a60ddf43f4000a 100644 --- a/src/native/libs/build-native.proj +++ b/src/native/libs/build-native.proj @@ -70,7 +70,7 @@ - + - + public string? ToolPrefix { get; set; } + /// + /// Name of the assembler tool ran by the AOT compiler. + /// + public string? AsName { get; set; } + + /// + /// Passes as-options to the AOT compiler + /// + public string? AsOptions { get; set; } + /// /// Prepends a prefix to the name of the assembler (as) tool ran by the AOT compiler. /// @@ -277,6 +287,11 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task /// public string? LdFlags { get; set; } + /// + /// Passes ld-options to the AOT compiler + /// + public string? LdOptions { get; set; } + /// /// Specify WorkingDirectory for the AOT compiler /// @@ -741,6 +756,16 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st aotArgs.Add($"tool-prefix={ToolPrefix}"); } + if (!string.IsNullOrEmpty(AsName)) + { + aotArgs.Add($"as-name={AsName}"); + } + + if (!string.IsNullOrEmpty(AsOptions)) + { + aotArgs.Add($"as-options={AsOptions}"); + } + if (!string.IsNullOrEmpty(AsPrefix)) { aotArgs.Add($"as-prefix={AsPrefix}"); @@ -956,6 +981,11 @@ private PrecompileArguments GetPrecompileArgumentsFor(ITaskItem assemblyItem, st aotArgs.Add($"ld-flags={LdFlags}"); } + if (!string.IsNullOrEmpty(LdOptions)) + { + aotArgs.Add($"ld-options={LdOptions}"); + } + // we need to quote the entire --aot arguments here to make sure it is parsed // on Windows as one argument. Otherwise it will be split up into multiple // values, which wont work. diff --git a/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs b/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs index 6370c49df85405..0741e92dfe8116 100644 --- a/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs +++ b/src/tasks/MobileBuildTasks/Android/Ndk/NdkTools.cs @@ -101,9 +101,9 @@ public string ClangPath private void ValidateRequiredProps(string hostOS) { - if (Ndk.NdkVersion.Main.Major != 23) + if (Ndk.NdkVersion.Main.Major != 27) { - throw new Exception($"NDK 23 is required. An unsupported NDK version was found ({Ndk.NdkVersion.Main.Major})."); + throw new Exception($"NDK 27 is required. An unsupported NDK version was found ({Ndk.NdkVersion.Main.Major})."); } try diff --git a/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/Program.cs b/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/Program.cs new file mode 100644 index 00000000000000..493efaae51f91a --- /dev/null +++ b/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/Program.cs @@ -0,0 +1,50 @@ +// 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.Threading; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Linq; + +public static class Program +{ + [DllImport("__Internal")] + public static extern void mono_ios_set_summary (string value); + + private static async Task GitHubIssue_114262_Async() + { + var options = new ParallelOptions + { + MaxDegreeOfParallelism = 5, + CancellationToken = new CancellationTokenSource().Token + }; + + var range = Enumerable.Range(1, 1000); + + for (int i = 0; i < 100; i++) + { + await Parallel.ForEachAsync(range, options, async (data, token) => + { + for (int i = 0; i < 5; i++) + { + await Task.Yield(); + var buffer = new byte[10_000]; + await Task.Run(() => {var _ = buffer[0];} ); + await Task.Yield(); + } + }); + } + } + + public static async Task Main(string[] args) + { + mono_ios_set_summary($"Starting functional test"); + + await GitHubIssue_114262_Async(); + + Console.WriteLine("Done!"); + + return 42; + } +} diff --git a/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/iOS.Device.ParallelForEachAsync.Test.csproj b/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/iOS.Device.ParallelForEachAsync.Test.csproj new file mode 100644 index 00000000000000..ae748949616933 --- /dev/null +++ b/src/tests/FunctionalTests/iOS/Device/ParallelForEachAsync/iOS.Device.ParallelForEachAsync.Test.csproj @@ -0,0 +1,22 @@ + + + Exe + true + $(NetCoreAppCurrent) + ios + arm64 + false + 42 + true + + + + true + false + iOS.Device.ParallelForEachAsync.Test.dll + + + + + + diff --git a/src/tests/FunctionalTests/tvOS/Device/AOT/tvOS.Device.Aot.Test.csproj b/src/tests/FunctionalTests/tvOS/Device/AOT/tvOS.Device.Aot.Test.csproj index 0e2f71fe06b3d0..92271eb0c889ce 100644 --- a/src/tests/FunctionalTests/tvOS/Device/AOT/tvOS.Device.Aot.Test.csproj +++ b/src/tests/FunctionalTests/tvOS/Device/AOT/tvOS.Device.Aot.Test.csproj @@ -19,11 +19,6 @@ false - - - - - diff --git a/src/tests/GC/Features/Bridge/Bridge.cs b/src/tests/GC/Features/Bridge/Bridge.cs new file mode 100644 index 00000000000000..c481087943efcd --- /dev/null +++ b/src/tests/GC/Features/Bridge/Bridge.cs @@ -0,0 +1,422 @@ +// 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.Collections; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Threading; + +// False pinning cases are still possible. For example the thread can die +// and its stack reused by another thread. It also seems that a thread that +// does a GC can keep on the stack references to objects it encountered +// during the collection which are never released afterwards. This would +// be more likely to happen with the interpreter which reuses more stack. +public static class FinalizerHelpers +{ + private static IntPtr aptr; + + private static unsafe void NoPinActionHelper(int depth, Action act) + { + // Avoid tail calls + int* values = stackalloc int[20]; + aptr = new IntPtr(values); + + if (depth <= 0) + { + // + // When the action is called, this new thread might have not allocated + // anything yet in the nursery. This means that the address of the first + // object that would be allocated would be at the start of the tlab and + // implicitly the end of the previous tlab (address which can be in use + // when allocating on another thread, at checking if an object fits in + // this other tlab). We allocate a new dummy object to avoid this type + // of false pinning for most common cases. + // + new object(); + act(); + ClearStack(); + } + else + { + NoPinActionHelper(depth - 1, act); + } + } + + private static unsafe void ClearStack() + { + int* values = stackalloc int[25000]; + for (int i = 0; i < 25000; i++) + values[i] = 0; + } + + public static void PerformNoPinAction(Action act) + { + Thread thr = new Thread(() => NoPinActionHelper (128, act)); + thr.Start(); + thr.Join(); + } +} + +public class BridgeBase +{ + public static int fin_count; + + ~BridgeBase() + { + fin_count++; + } +} + +public class Bridge : BridgeBase +{ + public List Links = new List(); + public int __test; + + ~Bridge() + { + Links = null; + } +} + +public class Bridge1 : BridgeBase +{ + public object Link; + ~Bridge1() + { + Link = null; + } +} + +// 128 size +public class Bridge14 : BridgeBase +{ + public object a,b,c,d,e,f,g,h,i,j,k,l,m,n; +} + +public class NonBridge +{ + public object Link; +} + +public class NonBridge2 : NonBridge +{ + public object Link2; +} + +public class NonBridge14 +{ + public object a,b,c,d,e,f,g,h,i,j,k,l,m,n; +} + + +public class BridgeTest +{ + const int OBJ_COUNT = 100 * 1000; + const int LINK_COUNT = 2; + const int EXTRAS_COUNT = 0; + const double survival_rate = 0.1; + + // Pathological case for the original old algorithm. Goes + // away when merging is replaced by appending with flag + // checking. + static void SetupLinks() + { + var list = new List(); + for (int i = 0; i < OBJ_COUNT; ++i) + { + var bridge = new Bridge(); + list.Add(bridge); + } + + var r = new Random(100); + for (int i = 0; i < OBJ_COUNT; ++i) + { + var n = list[i]; + for (int j = 0; j < LINK_COUNT; ++j) + n.Links.Add(list[r.Next (OBJ_COUNT)]); + for (int j = 0; j < EXTRAS_COUNT; ++j) + n.Links.Add(j); + if (r.NextDouble() <= survival_rate) + n.__test = 1; + } + } + + const int LIST_LENGTH = 10000; + const int FAN_OUT = 10000; + + // Pathological case for the new algorithm. Goes away with + // the single-node elimination optimization, but will still + // persist if modified by using a ladder instead of the single + // list. + static void SetupLinkedFan() + { + var head = new Bridge(); + var tail = new NonBridge(); + head.Links.Add(tail); + for (int i = 0; i < LIST_LENGTH; ++i) + { + var obj = new NonBridge (); + tail.Link = obj; + tail = obj; + } + var list = new List(); + tail.Link = list; + for (int i = 0; i < FAN_OUT; ++i) + list.Add (new Bridge()); + } + + // Pathological case for the improved old algorithm. Goes + // away with copy-on-write DynArrays, but will still persist + // if modified by using a ladder instead of the single list. + static void SetupInverseFan() + { + var tail = new Bridge(); + object list = tail; + for (int i = 0; i < LIST_LENGTH; ++i) + { + var obj = new NonBridge(); + obj.Link = list; + list = obj; + } + var heads = new Bridge[FAN_OUT]; + for (int i = 0; i < FAN_OUT; ++i) + { + var obj = new Bridge(); + obj.Links.Add(list); + heads[i] = obj; + } + } + + // Not necessarily a pathology, but a special case of where we + // generate lots of "dead" SCCs. A non-bridge object that + // can't reach a bridge object can safely be removed from the + // graph. In this special case it's a linked list hanging off + // a bridge object. We can handle this by "forwarding" edges + // going to non-bridge nodes that have only a single outgoing + // edge. That collapses the whole list into a single node. + // We could remove that node, too, by removing non-bridge + // nodes with no outgoing edges. + static void SetupDeadList() + { + var head = new Bridge(); + var tail = new NonBridge(); + head.Links.Add(tail); + for (int i = 0; i < LIST_LENGTH; ++i) + { + var obj = new NonBridge(); + tail.Link = obj; + tail = obj; + } + } + + // Triggered a bug in the forwarding mechanic. + static void SetupSelfLinks() + { + var head = new Bridge(); + var tail = new NonBridge(); + head.Links.Add(tail); + tail.Link = tail; + } + + const int L0_COUNT = 50000; + const int L1_COUNT = 50000; + const int EXTRA_LEVELS = 4; + + // Set a complex graph from one bridge to a couple. + // The graph is designed to expose naive coloring on + // tarjan and SCC explosion on classic. + static void Spider() + { + Bridge a = new Bridge(); + Bridge b = new Bridge(); + + var l1 = new List(); + for (int i = 0; i < L0_COUNT; ++i) { + var l0 = new List(); + l0.Add(a); + l0.Add(b); + l1.Add(l0); + } + var last_level = l1; + for (int l = 0; l < EXTRA_LEVELS; ++l) { + int j = 0; + var l2 = new List(); + for (int i = 0; i < L1_COUNT; ++i) { + var tmp = new List(); + tmp.Add(last_level [j++ % last_level.Count]); + tmp.Add(last_level [j++ % last_level.Count]); + l2.Add(tmp); + } + last_level = l2; + } + Bridge c = new Bridge(); + c.Links.Add(last_level); + } + + // Simulates a graph with two nested cycles that is produces by + // the async state machine when `async Task M()` method gets its + // continuation rooted by an Action held by RunnableImplementor + // (ie. the task continuation is hooked through the SynchronizationContext + // implentation and rooted only by Android bridge objects). + static void NestedCycles() + { + Bridge runnableImplementor = new Bridge (); + Bridge byteArrayOutputStream = new Bridge (); + NonBridge2 action = new NonBridge2 (); + NonBridge displayClass = new NonBridge (); + NonBridge2 asyncStateMachineBox = new NonBridge2 (); + NonBridge2 asyncStreamWriter = new NonBridge2 (); + + runnableImplementor.Links.Add(action); + action.Link = displayClass; + action.Link2 = asyncStateMachineBox; + displayClass.Link = action; + asyncStateMachineBox.Link = asyncStreamWriter; + asyncStateMachineBox.Link2 = action; + asyncStreamWriter.Link = byteArrayOutputStream; + asyncStreamWriter.Link2 = asyncStateMachineBox; + } + + // Simulates a graph where a heavy node has its fanout components + // represented by cycles with back-references to the heavy node and + // references to the same bridge objects. + // This enters a pathological path in the SCC contraction where the + // links to the bridge objects need to be correctly deduplicated. The + // deduplication causes the heavy node to no longer be heavy. + static void FauxHeavyNodeWithCycles() + { + Bridge fanout = new Bridge(); + + // Need enough edges for the node to be considered heavy by bridgeless_color_is_heavy + NonBridge[] fauxHeavyNode = new NonBridge[100]; + for (int i = 0; i < fauxHeavyNode.Length; i++) + { + NonBridge2 cycle = new NonBridge2(); + cycle.Link = fanout; + cycle.Link2 = fauxHeavyNode; + fauxHeavyNode[i] = cycle; + } + + // Need at least HEAVY_REFS_MIN + 1 fan-in nodes + Bridge[] faninNodes = new Bridge[3]; + for (int i = 0; i < faninNodes.Length; i++) + { + faninNodes[i] = new Bridge(); + faninNodes[i].Links.Add(fauxHeavyNode); + } + } + + static void RunGraphTest(Action test) + { + Console.WriteLine("Start test {0}", test.Method.Name); + FinalizerHelpers.PerformNoPinAction(test); + Console.WriteLine("-graph built-"); + for (int i = 0; i < 5; i++) + { + Console.WriteLine("-GC {0}/5-", i); + GC.Collect (); + GC.WaitForPendingFinalizers(); + } + + Console.WriteLine("Finished test {0}, finalized {1}", test.Method.Name, Bridge.fin_count); + } + + static void TestLinkedList() + { + int count = Environment.ProcessorCount + 2; + var th = new Thread [count]; + for (int i = 0; i < count; ++i) + { + th [i] = new Thread( _ => + { + var lst = new ArrayList(); + for (var j = 0; j < 500 * 1000; j++) + { + lst.Add (new object()); + if ((j % 999) == 0) + lst.Add (new BridgeBase()); + if ((j % 1000) == 0) + new BridgeBase(); + if ((j % 50000) == 0) + lst = new ArrayList(); + } + }); + + th [i].Start(); + } + + for (int i = 0; i < count; ++i) + th [i].Join(); + + GC.Collect(2); + Console.WriteLine("Finished test LinkedTest, finalized {0}", BridgeBase.fin_count); + } + + //we fill 16Mb worth of stuff, eg, 256k objects + const int major_fill = 1024 * 256; + + //4mb nursery with 64 bytes objects -> alloc half + const int nursery_obj_count = 16 * 1024; + + static void SetupFragmentation() + where TBridge : new() + where TNonBridge : new() + { + const int loops = 4; + for (int k = 0; k < loops; k++) + { + Console.WriteLine("[{0}] CrashLoop {1}/{2}", DateTime.Now, k + 1, loops); + var arr = new object[major_fill]; + for (int i = 0; i < major_fill; i++) + arr[i] = new TNonBridge(); + GC.Collect(1); + Console.WriteLine("[{0}] major fill done", DateTime.Now); + + //induce massive fragmentation + for (int i = 0; i < major_fill; i += 4) + { + arr[i + 1] = null; + arr[i + 2] = null; + arr[i + 3] = null; + } + GC.Collect (1); + Console.WriteLine("[{0}] fragmentation done", DateTime.Now); + + //since 50% is garbage, do 2 fill passes + for (int j = 0; j < 2; ++j) + { + for (int i = 0; i < major_fill; i++) + { + if ((i % 1000) == 0) + new TBridge(); + else + arr[i] = new TBridge(); + } + } + Console.WriteLine("[{0}] done spewing bridges", DateTime.Now); + + for (int i = 0; i < major_fill; i++) + arr[i] = null; + GC.Collect (); + } + } + + public static int Main(string[] args) + { +// TestLinkedList(); // Crashes, but only in this multithreaded variant + RunGraphTest(SetupFragmentation); // This passes but the following crashes ?? +// RunGraphTest(SetupFragmentation); + RunGraphTest(SetupLinks); + RunGraphTest(SetupLinkedFan); + RunGraphTest(SetupInverseFan); + + RunGraphTest(SetupDeadList); + RunGraphTest(SetupSelfLinks); + RunGraphTest(NestedCycles); + RunGraphTest(FauxHeavyNodeWithCycles); +// RunGraphTest(Spider); // Crashes + return 100; + } +} diff --git a/src/tests/GC/Features/Bridge/Bridge.csproj b/src/tests/GC/Features/Bridge/Bridge.csproj new file mode 100644 index 00000000000000..29b8c0f5fd3a2d --- /dev/null +++ b/src/tests/GC/Features/Bridge/Bridge.csproj @@ -0,0 +1,11 @@ + + + + true + false + BuildOnly + + + + + diff --git a/src/tests/GC/Features/Bridge/BridgeTester.cs b/src/tests/GC/Features/Bridge/BridgeTester.cs new file mode 100644 index 00000000000000..960e39a5e6eb0d --- /dev/null +++ b/src/tests/GC/Features/Bridge/BridgeTester.cs @@ -0,0 +1,35 @@ +// 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.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime; +using System.Text; + +using Xunit; + +public class BridgeTester +{ + [Fact] + public static void RunTests() + { + string corerun = TestLibrary.Utilities.IsWindows ? "corerun.exe" : "corerun"; + string coreRoot = Environment.GetEnvironmentVariable("CORE_ROOT"); + string bridgeTestApp = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Bridge.dll"); + + var startInfo = new ProcessStartInfo(Path.Combine(coreRoot, corerun), bridgeTestApp); + startInfo.EnvironmentVariables["MONO_GC_DEBUG"] = "bridge=BridgeBase,bridge-compare-to=new"; + startInfo.EnvironmentVariables["MONO_GC_PARAMS"] = "bridge-implementation=tarjan,bridge-require-precise-merge"; + + using (Process p = Process.Start(startInfo)) + { + p.WaitForExit(); + Console.WriteLine ("Bridge Test App returned {0}", p.ExitCode); + if (p.ExitCode != 100) + throw new Exception("Bridge Test App failed execution"); + } + } +} diff --git a/src/tests/GC/Features/Bridge/BridgeTester.csproj b/src/tests/GC/Features/Bridge/BridgeTester.csproj new file mode 100644 index 00000000000000..5045d91e4c89a8 --- /dev/null +++ b/src/tests/GC/Features/Bridge/BridgeTester.csproj @@ -0,0 +1,17 @@ + + + true + true + + + + + + + + false + Content + Always + + + diff --git a/src/tests/Interop/COM/ComWrappers/API/Program.cs b/src/tests/Interop/COM/ComWrappers/API/Program.cs index 7ef5d29c0ab635..3ed01e8604ad3e 100644 --- a/src/tests/Interop/COM/ComWrappers/API/Program.cs +++ b/src/tests/Interop/COM/ComWrappers/API/Program.cs @@ -10,6 +10,7 @@ namespace ComWrappersTests using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.Marshalling; + using System.Threading; using ComWrappersTests.Common; using TestLibrary; @@ -962,6 +963,167 @@ public void ValidateAggregationWithReferenceTrackerObject() Assert.Equal(0, allocTracker.GetCount()); } + + [Fact] + public void ComWrappersNoLockAroundQueryInterface() + { + Console.WriteLine($"Running {nameof(ComWrappersNoLockAroundQueryInterface)}..."); + + var cw = new RecursiveSimpleComWrappers(); + + IntPtr comObject = cw.GetOrCreateComInterfaceForObject(new RecursiveCrossThreadQI(cw), CreateComInterfaceFlags.None); + try + { + _ = cw.GetOrCreateObjectForComInstance(comObject, CreateObjectFlags.TrackerObject); + } + finally + { + Marshal.Release(comObject); + } + } + + private class RecursiveCrossThreadQI(ComWrappers? wrappers) : ICustomQueryInterface + { + CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out IntPtr ppv) + { + ppv = IntPtr.Zero; + if (iid == ComWrappersHelper.IID_IReferenceTracker && wrappers is not null) + { + Console.WriteLine("Attempting to create a new COM object on a different thread."); + Thread thread = new Thread(() => + { + IntPtr comObject = wrappers.GetOrCreateComInterfaceForObject(new RecursiveCrossThreadQI(null), CreateComInterfaceFlags.None); + try + { + // Make sure that ComWrappers isn't locking in GetOrCreateObjectForComInstance + // around the QI call by calling it on a different thread from within a QI call to register a new managed wrapper + // for a COM object representing "this". + _ = wrappers.GetOrCreateObjectForComInstance(comObject, CreateObjectFlags.None); + } + finally + { + Marshal.Release(comObject); + } + }); + thread.Start(); + thread.Join(TimeSpan.FromSeconds(20)); // 20 seconds should be more than long enough for the thread to complete + } + + return CustomQueryInterfaceResult.Failed; + } + } + + private unsafe class RecursiveSimpleComWrappers : ComWrappers + { + protected override ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) + { + count = 0; + return null; + } + + protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) + { + return new object(); + } + + protected override void ReleaseObjects(IEnumerable objects) + { + throw new NotImplementedException(); + } + } + + [Fact] + [PlatformSpecific(TestPlatforms.Windows)] // COM apartments are Windows-specific + public unsafe void CrossApartmentQueryInterface_NoDeadlock() + { + Console.WriteLine($"Running {nameof(CrossApartmentQueryInterface_NoDeadlock)}..."); + using ManualResetEvent hasAgileReference = new(false); + using ManualResetEvent testCompleted = new(false); + + IntPtr agileReference = IntPtr.Zero; + try + { + Thread staThread = new(() => + { + var cw = new RecursiveSimpleComWrappers(); + IntPtr comObject = cw.GetOrCreateComInterfaceForObject(new RecursiveQI(cw), CreateComInterfaceFlags.None); + try + { + Marshal.ThrowExceptionForHR(RoGetAgileReference(0, IUnknownVtbl.IID_IUnknown, comObject, out agileReference)); + } + finally + { + Marshal.Release(comObject); + } + hasAgileReference.Set(); + testCompleted.WaitOne(); + }); + staThread.SetApartmentState(ApartmentState.STA); + + Thread mtaThread = new(() => + { + hasAgileReference.WaitOne(); + IntPtr comObject; + int hr = ((delegate* unmanaged)(*(*(void***)agileReference + 3 /* IAgileReference.Resolve slot */)))(agileReference, IUnknownVtbl.IID_IUnknown, out comObject); + Marshal.ThrowExceptionForHR(hr); + try + { + var cw = new RecursiveSimpleComWrappers(); + // Make sure that ComWrappers isn't locking in GetOrCreateObjectForComInstance + // across the QI call + // by forcing marshalling across COM apartments. + _ = cw.GetOrCreateObjectForComInstance(comObject, CreateObjectFlags.TrackerObject); + } + finally + { + Marshal.Release(comObject); + } + testCompleted.Set(); + }); + mtaThread.SetApartmentState(ApartmentState.MTA); + + staThread.Start(); + mtaThread.Start(); + } + finally + { + if (agileReference != IntPtr.Zero) + { + Marshal.Release(agileReference); + } + } + + testCompleted.WaitOne(); + } + + [DllImport("ole32.dll")] + private static extern int RoGetAgileReference(int options, in Guid iid, IntPtr unknown, out IntPtr agileReference); + + private class RecursiveQI(ComWrappers? wrappers) : ICustomQueryInterface + { + CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out IntPtr ppv) + { + ppv = IntPtr.Zero; + if (wrappers is not null) + { + Console.WriteLine("Attempting to create a new COM object on the same thread."); + IntPtr comObject = wrappers.GetOrCreateComInterfaceForObject(new RecursiveQI(null), CreateComInterfaceFlags.None); + try + { + // Make sure that ComWrappers isn't locking in GetOrCreateObjectForComInstance + // around the QI call by calling it on a different thread from within a QI call to register a new managed wrapper + // for a COM object representing "this". + _ = wrappers.GetOrCreateObjectForComInstance(comObject, CreateObjectFlags.None); + } + finally + { + Marshal.Release(comObject); + } + } + + return CustomQueryInterfaceResult.Failed; + } + } } } diff --git a/src/tests/Interop/COM/ComWrappers/Common.cs b/src/tests/Interop/COM/ComWrappers/Common.cs index 96d21a349d69dc..dbcefa47ac175e 100644 --- a/src/tests/Interop/COM/ComWrappers/Common.cs +++ b/src/tests/Interop/COM/ComWrappers/Common.cs @@ -339,7 +339,7 @@ CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out class ComWrappersHelper { - private static Guid IID_IReferenceTracker = new Guid("11d3b13a-180e-4789-a8be-7712882893e6"); + public static readonly Guid IID_IReferenceTracker = new Guid("11d3b13a-180e-4789-a8be-7712882893e6"); [Flags] public enum ReleaseFlags diff --git a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs index dc3e35d0d48129..ccf91480faaa3f 100644 --- a/src/tests/Interop/IDynamicInterfaceCastable/Program.cs +++ b/src/tests/Interop/IDynamicInterfaceCastable/Program.cs @@ -380,7 +380,6 @@ public static void ValidateBasicInterface() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtimelab/issues/1442", typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNativeAot))] public static void ValidateGenericInterface() { Console.WriteLine($"Running {nameof(ValidateGenericInterface)}"); @@ -394,26 +393,38 @@ public static void ValidateGenericInterface() Console.WriteLine(" -- Validate cast"); // ITestGeneric -> ITestGenericIntImpl - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); + if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 + { + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); + } ITestGeneric testInt = (ITestGeneric)castableObj; // ITestGeneric -> ITestGenericImpl - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); + if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 + { + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); + } ITestGeneric testStr = (ITestGeneric)castableObj; // Validate Variance // ITestGeneric -> ITestGenericImpl - Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); - Assert.NotNull(castableObj as ITestGeneric); + if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 + { + Assert.True(castableObj is ITestGeneric, $"Should be castable to {nameof(ITestGeneric)} via is"); + Assert.NotNull(castableObj as ITestGeneric); + } ITestGeneric testVar = (ITestGeneric)castableObj; - // ITestGeneric is not recognized - Assert.False(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); - Assert.Null(castableObj as ITestGeneric); - var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); - Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); + if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108229 + { + // ITestGeneric is not recognized + Assert.False(castableObj is ITestGeneric, $"Should not be castable to {nameof(ITestGeneric)} via is"); + Assert.Null(castableObj as ITestGeneric); + var ex = Assert.Throws(() => { var _ = (ITestGeneric)castableObj; }); + Assert.Equal(string.Format(DynamicInterfaceCastableException.ErrorFormat, typeof(ITestGeneric)), ex.Message); + } int expectedInt = 42; string expectedStr = "str"; @@ -423,13 +434,16 @@ public static void ValidateGenericInterface() Assert.Equal(expectedStr, testStr.ReturnArg(expectedStr)); Assert.Equal(expectedStr, testVar.ReturnArg(expectedStr)); - Console.WriteLine(" -- Validate generic method call"); - Assert.Equal(expectedInt * 2, testInt.DoubleGenericArg(42)); - Assert.Equal(expectedStr + expectedStr, testInt.DoubleGenericArg("str")); - Assert.Equal(expectedInt * 2, testStr.DoubleGenericArg(42)); - Assert.Equal(expectedStr + expectedStr, testStr.DoubleGenericArg("str")); - Assert.Equal(expectedInt * 2, testVar.DoubleGenericArg(42)); - Assert.Equal(expectedStr + expectedStr, testVar.DoubleGenericArg("str")); + if (!TestLibrary.Utilities.IsNativeAot) // https://github.com/dotnet/runtime/issues/108228 + { + Console.WriteLine(" -- Validate generic method call"); + Assert.Equal(expectedInt * 2, testInt.DoubleGenericArg(42)); + Assert.Equal(expectedStr + expectedStr, testInt.DoubleGenericArg("str")); + Assert.Equal(expectedInt * 2, testStr.DoubleGenericArg(42)); + Assert.Equal(expectedStr + expectedStr, testStr.DoubleGenericArg("str")); + Assert.Equal(expectedInt * 2, testVar.DoubleGenericArg(42)); + Assert.Equal(expectedStr + expectedStr, testVar.DoubleGenericArg("str")); + } Console.WriteLine(" -- Validate delegate call"); Func funcInt = new Func(testInt.ReturnArg); diff --git a/src/tests/Interop/IJW/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp b/src/tests/Interop/IJW/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp index 15e7098774db27..e581c7ae185e11 100644 --- a/src/tests/Interop/IJW/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp +++ b/src/tests/Interop/IJW/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp @@ -17,10 +17,22 @@ extern "C" DLL_EXPORT int __cdecl NativeEntryPoint() } #pragma managed + +// Needed to provide a regression case for https://github.com/dotnet/runtime/issues/110365 +[assembly:System::Diagnostics::DebuggableAttribute(true, true)]; +[module:System::Diagnostics::DebuggableAttribute(true, true)]; + +public value struct ValueToReturnStorage +{ + int valueToReturn; + bool valueSet; +}; + +// store the value to return in an appdomain local static variable to allow this test to be a regression test for https://github.com/dotnet/runtime/issues/110365 +static __declspec(appdomain) ValueToReturnStorage s_valueToReturnStorage; + public ref class TestClass { -private: - static int s_valueToReturn = 100; public: int ManagedEntryPoint() { @@ -29,12 +41,16 @@ public ref class TestClass static void ChangeReturnedValue(int i) { - s_valueToReturn = i; + s_valueToReturnStorage.valueToReturn = i; + s_valueToReturnStorage.valueSet = true; } static int GetReturnValue() { - return s_valueToReturn; + if (s_valueToReturnStorage.valueSet) + return s_valueToReturnStorage.valueToReturn; + else + return 100; } }; diff --git a/src/tests/JIT/Directed/tls/TestTLSWithLoadedDlls.csproj b/src/tests/JIT/Directed/tls/TestTLSWithLoadedDlls.csproj index c17a210af0c9de..ac1a042106e22d 100644 --- a/src/tests/JIT/Directed/tls/TestTLSWithLoadedDlls.csproj +++ b/src/tests/JIT/Directed/tls/TestTLSWithLoadedDlls.csproj @@ -4,6 +4,8 @@ true false true + + true PdbOnly diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.cs b/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.cs new file mode 100644 index 00000000000000..df3f9af0ee54ce --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.cs @@ -0,0 +1,55 @@ +// 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.Runtime.Intrinsics; +using Xunit; + +public class Runtime_108969 +{ + [Fact] + public static int TestEntryPoint() => Foo(null); + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int Foo(object o) + { + S v = default; + try + { + v = Bar(); + + // "(int?)o" creates a QMARK with a branch that may throw; we would + // end up reading back v.A inside the QMARK + Use((int?)o); + } + catch (Exception) + { + } + + // Induce promotion of v.A field + Use(v.A); + Use(v.A); + Use(v.A); + Use(v.A); + Use(v.A); + Use(v.A); + return v.A; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static S Bar() + { + return new S { A = 100 }; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Use(T x) + { + } + + private struct S + { + public int A, B, C, D; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_108969/Runtime_108969.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.cs b/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.cs new file mode 100644 index 00000000000000..a7c8bcd92d81aa --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.cs @@ -0,0 +1,63 @@ +// 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 Xunit; + +public class Runtime_109981 +{ + [Fact] + public static int TestEntryPoint() => Foo(14); + + public static int Foo(int x) + { + if (x == 123) + return 0; + + int sum = 9; + for (int i = 0; i < x; i++) + { + sum += i; + } + + try + { + if (x != 123) + return sum; + + try + { + try + { + Bar(); + } + finally + { + sum += 1000; + } + } + catch (ArgumentException) + { + sum += 10000; + } + } + catch when (Filter()) + { + sum += 100000; + } + + return sum; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Bar() + { + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static bool Filter() + { + return true; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_109981/Runtime_109981.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.cs b/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.cs new file mode 100644 index 00000000000000..c4abf023a4df92 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Xunit; +using System.Numerics; + +public class Foo +{ + public Vector3 v1; + public Vector3 v2; +} + +public class Runtime_110820 +{ + [Fact] + public static void TestEntryPoint() + { + var foo = new Foo(); + foo.v2 = new Vector3(4, 5, 6); + foo.v1 = new Vector3(1, 2, 3); + Assert.Equal(new Vector3(1, 2, 3), foo.v1); + Assert.Equal(new Vector3(4, 5, 6), foo.v2); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_110820/Runtime_110820.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.cs b/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.cs new file mode 100644 index 00000000000000..654b71021d4a73 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using Xunit; + +public class Runtime_111352 +{ + [Fact] + public static int Test1() => Problem1(0x1_0000_0001L, 0x2_0000_0001L); + + [MethodImpl(MethodImplOptions.NoInlining)] + public static int Problem1(long x, long y) + { + if ((uint)x == (uint)y) + { + if (x == y) + { + return -1; + } + } + + return 100; + } + + [Fact] + public static int Test2() => Problem2(0x1_0000_0000L); + + [MethodImpl(MethodImplOptions.NoInlining)] + public static int Problem2(long x) + { + if ((uint)x == 0) + { + if (x == 0) + { + return -1; + } + } + + return 100; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_111352/Runtime_111352.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.cs b/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.cs new file mode 100644 index 00000000000000..089f666d280002 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.cs @@ -0,0 +1,34 @@ +// 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 Xunit; + +public static class Runtime_113658 +{ + [Fact] + public static int TestEntryPoint() + { + FillStackWithGarbage(); + long? nullable = FaultyDefaultNullable(); + return (int)(100 + nullable.GetValueOrDefault()); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void FillStackWithGarbage() + { + stackalloc byte[256].Fill(0xcc); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + [SkipLocalsInit] + private static T FaultyDefaultNullable() + { + // When T is a Nullable (and only in that case), we support returning null + if (default(T) is null && typeof(T).IsValueType) + return default!; + + throw new InvalidOperationException("Not nullable"); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.cs b/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.cs new file mode 100644 index 00000000000000..77f42fe7d49453 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Threading; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Xunit; + +public class Runtime_115815 +{ + [Fact] + public static void TestEntryPoint() + { + var destination = new KeyValuePair[1_000]; + + // loop to make this method fully interruptible + to get into OSR version + for (int i = 0; i < destination.Length * 1000; i++) + { + destination[i / 1000] = default; + } + + for (int i = 0; i < 5; i++) + { + for (int j = 0; j < destination.Length; j++) + { + destination[j] = GetValue(j); + } + + Thread.Sleep(10); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static KeyValuePair GetValue(int i) + => KeyValuePair.Create(new Container(i.ToString()), (double)i); + + private struct Container + { + public string Name; + public Container(string name) { this.Name = name; } + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_115815/Runtime_115815.csproj @@ -0,0 +1,8 @@ + + + True + + + + + diff --git a/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.cs b/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.cs new file mode 100644 index 00000000000000..d84d3d05769c80 --- /dev/null +++ b/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.cs @@ -0,0 +1,103 @@ +// 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.Reflection; +using System.Reflection.Emit; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Threading; +using Xunit; + +namespace CollectibleThreadStaticShutdownRace +{ + public class CollectibleThreadStaticShutdownRace + { + Action? UseTLSStaticFromLoaderAllocator = null; + GCHandle IsLoaderAllocatorLive; + static ulong s_collectibleIndex; + + [MethodImpl(MethodImplOptions.NoInlining)] + void CallUseTLSStaticFromLoaderAllocator() + { + UseTLSStaticFromLoaderAllocator!(); + UseTLSStaticFromLoaderAllocator = null; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + bool CheckLALive() + { + return IsLoaderAllocatorLive.Target != null; + } + + + void ThreadThatWaitsForLoaderAllocatorToDisappear() + { + CallUseTLSStaticFromLoaderAllocator(); + while (CheckLALive()) + { + GC.Collect(2); + } + } + + void CreateLoaderAllocatorWithTLS() + { + ulong collectibleIndex = s_collectibleIndex++; + + var ab = + AssemblyBuilder.DefineDynamicAssembly( + new AssemblyName($"CollectibleDerivedAssembly{collectibleIndex}"), + AssemblyBuilderAccess.RunAndCollect); + var mob = ab.DefineDynamicModule($"CollectibleDerivedModule{collectibleIndex}"); + var tb = + mob.DefineType( + $"CollectibleDerived{collectibleIndex}", + TypeAttributes.Class | TypeAttributes.Public, + typeof(object)); + + { + var fb = + tb.DefineField( + "Field", typeof(int), FieldAttributes.Static); + fb.SetCustomAttribute(typeof(ThreadStaticAttribute).GetConstructors()[0], new byte[0]); + + var mb = + tb.DefineMethod( + "Method", + MethodAttributes.Public | MethodAttributes.Static); + var ilg = mb.GetILGenerator(); + ilg.Emit(OpCodes.Ldc_I4_1); + ilg.Emit(OpCodes.Stsfld, fb); + ilg.Emit(OpCodes.Ret); + } + + Type createdType = tb.CreateType(); + UseTLSStaticFromLoaderAllocator = (Action)createdType.GetMethods()[0].CreateDelegate(typeof(Action)); + IsLoaderAllocatorLive = GCHandle.Alloc(createdType, GCHandleType.WeakTrackResurrection); + } + + void ForceCollectibleTLSStaticToGoThroughThreadTermination() + { + int iteration = 0; + for (int i = 0; i < 10; i++) + { + Console.WriteLine($"Iteration {iteration++}"); + var createLAThread = new Thread(CreateLoaderAllocatorWithTLS); + createLAThread.Start(); + createLAThread.Join(); + + var crashThread = new Thread(ThreadThatWaitsForLoaderAllocatorToDisappear); + crashThread.Start(); + crashThread.Join(); + } + + } + + [Fact] + public static void TestEntryPoint() + { + new CollectibleThreadStaticShutdownRace().ForceCollectibleTLSStaticToGoThroughThreadTermination(); + } + } +} + diff --git a/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.csproj b/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.csproj new file mode 100644 index 00000000000000..b2bf6ae30660e7 --- /dev/null +++ b/src/tests/Loader/CollectibleAssemblies/Statics/CollectibleTLSStaticCollection.csproj @@ -0,0 +1,10 @@ + + + + true + true + + + + + diff --git a/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.il b/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.il new file mode 100644 index 00000000000000..c4891a07551f14 --- /dev/null +++ b/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.il @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +.assembly extern System.Runtime +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) +} + +.assembly extern ResourceAssembly +{ + .publickeytoken = (00 00 00 00 00 00 00 00) +} + +.assembly ManifestResourceAssemblyRef { } + +.mresource public 'MyResource' +{ + .assembly extern 'ResourceAssembly' +} diff --git a/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.ilproj b/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.ilproj new file mode 100644 index 00000000000000..bfc5d0bb00df9b --- /dev/null +++ b/src/tests/Loader/ResourceResolve/ManifestResourceAssemblyRef.ilproj @@ -0,0 +1,8 @@ + + + library + + + + + diff --git a/src/tests/Loader/ResourceResolve/ResourceAssembly.csproj b/src/tests/Loader/ResourceResolve/ResourceAssembly.csproj new file mode 100644 index 00000000000000..e014b87610bd87 --- /dev/null +++ b/src/tests/Loader/ResourceResolve/ResourceAssembly.csproj @@ -0,0 +1,8 @@ + + + Library + + + + + diff --git a/src/tests/Loader/ResourceResolve/ResourceResolve.cs b/src/tests/Loader/ResourceResolve/ResourceResolve.cs new file mode 100644 index 00000000000000..2cf30a36216ffe --- /dev/null +++ b/src/tests/Loader/ResourceResolve/ResourceResolve.cs @@ -0,0 +1,47 @@ +// 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.IO; +using System.Reflection; +using Xunit; + +[ConditionalClass(typeof(TestLibrary.Utilities), nameof(TestLibrary.Utilities.IsNotNativeAot))] +public unsafe class ResourceResolve +{ + [Fact] + [SkipOnMono("AssemblyRef manifest resource is not supported")] + public static void AssemblyRef() + { + string resourceName = "MyResource"; + Assembly assembly = typeof(ResourceResolve).Assembly; + + // Manifest resource is not in the current assembly + Stream stream = assembly.GetManifestResourceStream(resourceName); + Assert.Null(stream); + + // Handler returns assembly with a manifest resource assembly ref that + // points to another assembly with the resource + ResolveEventHandler handler = (sender, args) => + { + if (args.Name == resourceName && args.RequestingAssembly == assembly) + return Assembly.Load("ManifestResourceAssemblyRef"); + + return null; + }; + AppDomain.CurrentDomain.ResourceResolve += handler; + stream = assembly.GetManifestResourceStream(resourceName); + AppDomain.CurrentDomain.ResourceResolve -= handler; + Assert.NotNull(stream); + + // Verify that the stream matches the expected one in the resource assembly + Assembly resourceAssembly = Assembly.Load("ResourceAssembly"); + Stream expected = resourceAssembly.GetManifestResourceStream(resourceName); + Assert.Equal(expected.Length, stream.Length); + Span expectedBytes = new byte[expected.Length]; + expected.Read(expectedBytes); + Span streamBytes = new byte[stream.Length]; + stream.Read(streamBytes); + Assert.Equal(expectedBytes, streamBytes); + } +} diff --git a/src/tests/Loader/ResourceResolve/ResourceResolve.csproj b/src/tests/Loader/ResourceResolve/ResourceResolve.csproj new file mode 100644 index 00000000000000..5fc4c77bada41d --- /dev/null +++ b/src/tests/Loader/ResourceResolve/ResourceResolve.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/tests/Regressions/coreclr/GitHub_109242/test109242.cs b/src/tests/Regressions/coreclr/GitHub_109242/test109242.cs new file mode 100644 index 00000000000000..080744316bdd73 --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_109242/test109242.cs @@ -0,0 +1,21 @@ +// 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.Reflection; +using Xunit; + +public class Test109242 +{ + [Fact] + public static void TestEntryPoint() + { + unsafe + { + void* p = stackalloc byte[Random.Shared.Next(100)]; + GC.KeepAlive(((IntPtr)p).ToString()); + } + + Assembly.Load("System.Runtime"); + } +} + diff --git a/src/tests/Regressions/coreclr/GitHub_109242/test109242.csproj b/src/tests/Regressions/coreclr/GitHub_109242/test109242.csproj new file mode 100644 index 00000000000000..d087213b695b82 --- /dev/null +++ b/src/tests/Regressions/coreclr/GitHub_109242/test109242.csproj @@ -0,0 +1,12 @@ + + + 1 + true + + + + + + + + diff --git a/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.cs b/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.cs index 72821f396b4f23..fcdb479c1a6353 100644 --- a/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.cs +++ b/src/tests/baseservices/compilerservices/UnsafeAccessors/UnsafeAccessorsTests.cs @@ -328,6 +328,72 @@ public static void Verify_AccessAllFields_CorElementType() extern static ref delegate* GetFPtr(ref AllFields f); } + // Contains fields that are volatile + struct VolatileFields + { + private static volatile int s_vInt; + private volatile int _vInt; + } + + // Accessors for fields that are volatile + static class AccessorsVolatile + { + [UnsafeAccessor(UnsafeAccessorKind.StaticField, Name="s_vInt")] + public extern static ref int GetStaticVolatileInt(ref VolatileFields f); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name="_vInt")] + public extern static ref int GetVolatileInt(ref VolatileFields f); + } + + [Fact] + public static void Verify_AccessFieldsWithVolatile() + { + Console.WriteLine($"Running {nameof(Verify_AccessFieldsWithVolatile)}"); + + VolatileFields fieldsWithVolatile = default; + + AccessorsVolatile.GetStaticVolatileInt(ref fieldsWithVolatile) = default; + AccessorsVolatile.GetVolatileInt(ref fieldsWithVolatile) = default; + } + + // Contains fields that are readonly + readonly struct ReadOnlyFields + { + public static readonly int s_rInt; + public readonly int _rInt; + } + + // Accessors for fields that are readonly + static class AccessorsReadOnly + { + [UnsafeAccessor(UnsafeAccessorKind.StaticField, Name="s_rInt")] + public extern static ref readonly int GetStaticReadOnlyInt(ref readonly ReadOnlyFields f); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name="_rInt")] + public extern static ref readonly int GetReadOnlyInt(ref readonly ReadOnlyFields f); + } + + [Fact] + public static void Verify_AccessFieldsWithReadOnlyRefs() + { + Console.WriteLine($"Running {nameof(Verify_AccessFieldsWithReadOnlyRefs)}"); + + ReadOnlyFields readOnlyFields = default; + + Assert.True(Unsafe.AreSame(in AccessorsReadOnly.GetStaticReadOnlyInt(in readOnlyFields), in ReadOnlyFields.s_rInt)); + Assert.True(Unsafe.AreSame(in AccessorsReadOnly.GetReadOnlyInt(in readOnlyFields), in readOnlyFields._rInt)); + + // Test the local declaration of the signature since it places modopts/modreqs differently. + Assert.True(Unsafe.AreSame(in GetStaticReadOnlyIntLocal(in readOnlyFields), in ReadOnlyFields.s_rInt)); + Assert.True(Unsafe.AreSame(in GetReadOnlyIntLocal(in readOnlyFields), in readOnlyFields._rInt)); + + [UnsafeAccessor(UnsafeAccessorKind.StaticField, Name="s_rInt")] + extern static ref readonly int GetStaticReadOnlyIntLocal(ref readonly ReadOnlyFields f); + + [UnsafeAccessor(UnsafeAccessorKind.Field, Name="_rInt")] + extern static ref readonly int GetReadOnlyIntLocal(ref readonly ReadOnlyFields f); + } + [Fact] public static void Verify_AccessStaticMethodClass() { diff --git a/src/tests/issues.targets b/src/tests/issues.targets index ec449e4620b91a..b246551a819603 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -1010,6 +1010,9 @@ https://github.com/dotnet/runtimelab/issues/155: Collectible assemblies + + https://github.com/dotnet/runtimelab/issues/155: Collectible assemblies + https://github.com/dotnet/runtimelab/issues/155: Collectible assemblies @@ -1067,9 +1070,6 @@ https://github.com/dotnet/runtimelab/issues/861 - - https://github.com/dotnet/runtimelab/issues/1442 - https://github.com/dotnet/runtimelab/issues/306 @@ -2467,6 +2467,10 @@ Reflection.Emit is not supported on fullaot + + + Attempting to JIT compile method 'void CMain:RunInvalidTest1 ()' while running in aot-only mode. + diff --git a/src/tests/nativeaot/SmokeTests/TrimmingBehaviors/DeadCodeElimination.cs b/src/tests/nativeaot/SmokeTests/TrimmingBehaviors/DeadCodeElimination.cs index 0a6090f8092432..032c3a07d7dea6 100644 --- a/src/tests/nativeaot/SmokeTests/TrimmingBehaviors/DeadCodeElimination.cs +++ b/src/tests/nativeaot/SmokeTests/TrimmingBehaviors/DeadCodeElimination.cs @@ -12,6 +12,7 @@ class DeadCodeElimination public static int Run() { SanityTest.Run(); + Test110932Regression.Run(); TestInstanceMethodOptimization.Run(); TestReflectionInvokeSignatures.Run(); TestAbstractTypeNeverDerivedVirtualsOptimization.Run(); @@ -52,6 +53,34 @@ public static void Run() } } + class Test110932Regression + { + static bool s_trueConst = true; + static bool s_falseConst = false; + + interface I + { + static virtual bool GetValue() => false; + } + + class C : I + { + static bool I.GetValue() => true; + } + + public static void Run() + { + if (!Call()) + throw new Exception(); + } + static bool Call() where T : I + { + if (T.GetValue()) + return s_trueConst; + return s_falseConst; + } + } + class TestInstanceMethodOptimization { class UnreferencedType { } diff --git a/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs b/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs index b5023e8c84163e..7647ce545bb573 100644 --- a/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs +++ b/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs @@ -4,6 +4,7 @@ using System; using System.Text; using System.Collections.Generic; +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Diagnostics.CodeAnalysis; @@ -15,6 +16,8 @@ public class Interfaces public static int Run() { + TestRuntime109893Regression.Run(); + if (TestInterfaceCache() == Fail) return Fail; @@ -42,6 +45,7 @@ public static int Run() TestVariantInterfaceOptimizations.Run(); TestSharedInterfaceMethods.Run(); TestGenericAnalysis.Run(); + TestRuntime108229Regression.Run(); TestCovariantReturns.Run(); TestDynamicInterfaceCastable.Run(); TestStaticInterfaceMethodsAnalysis.Run(); @@ -57,10 +61,42 @@ public static int Run() TestDefaultDynamicStaticNonGeneric.Run(); TestDefaultDynamicStaticGeneric.Run(); TestDynamicStaticGenericVirtualMethods.Run(); + TestRuntime109496Regression.Run(); return Pass; } + class TestRuntime109893Regression + { + class Type : IType; + + class MyVisitor : IVisitor + { + public object? Visit(IType _) => typeof(T); + } + + interface IType + { + object? Accept(IVisitor visitor); + } + + interface IType : IType + { + object? IType.Accept(IVisitor visitor) => visitor.Visit(this); + } + + interface IVisitor + { + object? Visit(IType type); + } + + public static void Run() + { + IType type = new Type(); + type.Accept(new MyVisitor()); + } + } + private static MyInterface[] MakeInterfaceArray() { MyInterface[] itfs = new MyInterface[50]; @@ -705,6 +741,27 @@ public static void Run() } } + class TestRuntime108229Regression + { + class Shapeshifter : IDynamicInterfaceCastable + { + public RuntimeTypeHandle GetInterfaceImplementation(RuntimeTypeHandle interfaceType) => throw new NotImplementedException(); + public bool IsInterfaceImplemented(RuntimeTypeHandle interfaceType, bool throwIfNotImplemented) => true; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static bool Is(object o) => o is IEnumerable; + + public static void Run() + { + object o = new Shapeshifter(); + + // Call multiple times in case we just flushed the cast cache (when we flush we don't store). + if (!Is(o) || !Is(o) || !Is(o)) + throw new Exception(); + } + } + class TestCovariantReturns { interface IFoo @@ -886,6 +943,16 @@ interface IInterfaceImpl : IInterface [DynamicInterfaceCastableImplementation] interface IInterfaceIndirectCastableImpl : IInterfaceImpl { } + interface IInterfaceImpl : IInterface + { + string IInterface.GetCookie() => typeof(T).Name; + } + + [DynamicInterfaceCastableImplementation] + interface IInterfaceIndirectCastableImpl : IInterfaceImpl { } + + class Atom { } + public static void Run() { Console.WriteLine("Testing IDynamicInterfaceCastable..."); @@ -922,6 +989,18 @@ public static void Run() if (o.GetCookie() != "Int32") throw new Exception(); } + + { + IInterface o = (IInterface)new CastableClass>(); + if (o.GetCookie() != "Atom") + throw new Exception(); + } + + { + IInterface o = (IInterface)new CastableClass>(); + if (o.GetCookie() != "Atom") + throw new Exception(); + } } } @@ -1703,4 +1782,57 @@ public static void Run() Console.WriteLine(s_entry.Enter1>("One")); } } + + class TestRuntime109496Regression + { + class CastableThing : IDynamicInterfaceCastable + { + RuntimeTypeHandle IDynamicInterfaceCastable.GetInterfaceImplementation(RuntimeTypeHandle interfaceType) + => Type.GetTypeFromHandle(interfaceType).GetCustomAttribute().TheType.TypeHandle; + bool IDynamicInterfaceCastable.IsInterfaceImplemented(RuntimeTypeHandle interfaceType, bool throwIfNotImplemented) + => Type.GetTypeFromHandle(interfaceType).IsDefined(typeof(TypeAttribute)); + } + + [Type(typeof(IMyInterfaceImpl))] + interface IMyInterface + { + int Method(); + } + + [DynamicInterfaceCastableImplementation] + interface IMyInterfaceImpl : IMyInterface + { + int IMyInterface.Method() => 42; + } + + [Type(typeof(IMyGenericInterfaceImpl))] + interface IMyGenericInterface + { + int Method(); + } + + [DynamicInterfaceCastableImplementation] + interface IMyGenericInterfaceImpl : IMyGenericInterface + { + int IMyGenericInterface.Method() => typeof(T).Name.Length; + } + + class TypeAttribute : Attribute + { + public Type TheType { get; } + + public TypeAttribute(Type t) => TheType = t; + } + + public static void Run() + { + object o = new CastableThing(); + + if (((IMyInterface)o).Method() != 42) + throw new Exception(); + + if (((IMyGenericInterface)o).Method() != 5) + throw new Exception(); + } + } } diff --git a/src/tests/profiler/native/CMakeLists.txt b/src/tests/profiler/native/CMakeLists.txt index 1279874df07c32..4333a8b2698280 100644 --- a/src/tests/profiler/native/CMakeLists.txt +++ b/src/tests/profiler/native/CMakeLists.txt @@ -5,11 +5,11 @@ project(Profiler) set(SOURCES assemblyprofiler/assemblyprofiler.cpp eltprofiler/slowpatheltprofiler.cpp + enumthreadsprofiler/enumthreadsprofiler.cpp eventpipeprofiler/eventpipereadingprofiler.cpp eventpipeprofiler/eventpipewritingprofiler.cpp eventpipeprofiler/eventpipemetadatareader.cpp gcallocateprofiler/gcallocateprofiler.cpp - nongcheap/nongcheap.cpp gcbasicprofiler/gcbasicprofiler.cpp gcheapenumerationprofiler/gcheapenumerationprofiler.cpp gcheapenumerationprofiler/gcheapenumerationprofiler.def @@ -20,6 +20,7 @@ set(SOURCES metadatagetdispenser/metadatagetdispenser.cpp moduleload/moduleload.cpp multiple/multiple.cpp + nongcheap/nongcheap.cpp nullprofiler/nullprofiler.cpp rejitprofiler/rejitprofiler.cpp rejitprofiler/ilrewriter.cpp diff --git a/src/tests/profiler/native/classfactory.cpp b/src/tests/profiler/native/classfactory.cpp index bb27152f8581f8..677b57fef95efc 100644 --- a/src/tests/profiler/native/classfactory.cpp +++ b/src/tests/profiler/native/classfactory.cpp @@ -3,6 +3,7 @@ #include "classfactory.h" #include "eltprofiler/slowpatheltprofiler.h" +#include "enumthreadsprofiler/enumthreadsprofiler.h" #include "eventpipeprofiler/eventpipereadingprofiler.h" #include "eventpipeprofiler/eventpipewritingprofiler.h" #include "getappdomainstaticaddress/getappdomainstaticaddress.h" @@ -144,6 +145,10 @@ HRESULT STDMETHODCALLTYPE ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFI { profiler = new GCHeapEnumerationProfiler(); } + else if (clsid == EnumThreadsProfiler::GetClsid()) + { + profiler = new EnumThreadsProfiler(); + } else { printf("No profiler found in ClassFactory::CreateInstance. Did you add your profiler to the list?\n"); diff --git a/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.cpp b/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.cpp new file mode 100644 index 00000000000000..de6caeaef7100a --- /dev/null +++ b/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.cpp @@ -0,0 +1,104 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "enumthreadsprofiler.h" + +GUID EnumThreadsProfiler::GetClsid() +{ + // {0742962D-2ED3-44B0-BA84-06B1EF0A0A0B} + GUID clsid = { 0x0742962d, 0x2ed3, 0x44b0,{ 0xba, 0x84, 0x06, 0xb1, 0xef, 0x0a, 0x0a, 0x0b } }; + return clsid; +} + +HRESULT EnumThreadsProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) +{ + Profiler::Initialize(pICorProfilerInfoUnk); + printf("EnumThreadsProfiler::Initialize\n"); + + HRESULT hr = S_OK; + if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_MONITOR_GC | COR_PRF_MONITOR_SUSPENDS, COR_PRF_HIGH_MONITOR_NONE))) + { + printf("FAIL: ICorProfilerInfo::SetEventMask2() failed hr=0x%x", hr); + IncrementFailures(); + } + + return hr; +} + +HRESULT STDMETHODCALLTYPE EnumThreadsProfiler::GarbageCollectionStarted(int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason) +{ + SHUTDOWNGUARD(); + + printf("EnumThreadsProfiler::GarbageCollectionStarted\n"); + _gcStarts.fetch_add(1, std::memory_order_relaxed); + if (_gcStarts < _gcFinishes) + { + IncrementFailures(); + printf("EnumThreadsProfiler::GarbageCollectionStarted: FAIL: Expected GCStart >= GCFinish. Start=%d, Finish=%d\n", (int)_gcStarts, (int)_gcFinishes); + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE EnumThreadsProfiler::GarbageCollectionFinished() +{ + SHUTDOWNGUARD(); + + printf("EnumThreadsProfiler::GarbageCollectionFinished\n"); + _gcFinishes.fetch_add(1, std::memory_order_relaxed); + if (_gcStarts < _gcFinishes) + { + IncrementFailures(); + printf("EnumThreadsProfiler::GarbageCollectionFinished: FAIL: Expected GCStart >= GCFinish. Start=%d, Finish=%d\n", (int)_gcStarts, (int)_gcFinishes); + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE EnumThreadsProfiler::RuntimeSuspendFinished() +{ + SHUTDOWNGUARD(); + + printf("EnumThreadsProfiler::RuntimeSuspendFinished\n"); + + ICorProfilerThreadEnum* threadEnum = nullptr; + HRESULT enumThreadsHR = pCorProfilerInfo->EnumThreads(&threadEnum); + printf("Finished enumerating threads\n"); + _profilerEnumThreadsCompleted.fetch_add(1, std::memory_order_relaxed); + threadEnum->Release(); + return enumThreadsHR; +} + +HRESULT EnumThreadsProfiler::Shutdown() +{ + Profiler::Shutdown(); + + if (_gcStarts == 0) + { + printf("EnumThreadsProfiler::Shutdown: FAIL: Expected GarbageCollectionStarted to be called\n"); + } + else if (_gcFinishes == 0) + { + printf("EnumThreadsProfiler::Shutdown: FAIL: Expected GarbageCollectionFinished to be called\n"); + } + else if (_profilerEnumThreadsCompleted == 0) + { + printf("EnumThreadsProfiler::Shutdown: FAIL: Expected RuntimeSuspendFinished to be called and EnumThreads completed\n"); + } + else if(_failures == 0) + { + printf("PROFILER TEST PASSES\n"); + } + else + { + // failures were printed earlier when _failures was incremented + } + fflush(stdout); + + return S_OK; +} + +void EnumThreadsProfiler::IncrementFailures() +{ + _failures.fetch_add(1, std::memory_order_relaxed); +} diff --git a/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.h b/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.h new file mode 100644 index 00000000000000..df716108432594 --- /dev/null +++ b/src/tests/profiler/native/enumthreadsprofiler/enumthreadsprofiler.h @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma once + +#include "../profiler.h" + +class EnumThreadsProfiler : public Profiler +{ +public: + EnumThreadsProfiler() : Profiler(), + _gcStarts(0), + _gcFinishes(0), + _profilerEnumThreadsCompleted(0), + _failures(0) + {} + + // Profiler callbacks override + static GUID GetClsid(); + virtual HRESULT STDMETHODCALLTYPE Initialize(IUnknown* pICorProfilerInfoUnk); + virtual HRESULT STDMETHODCALLTYPE GarbageCollectionStarted(int cGenerations, BOOL generationCollected[], COR_PRF_GC_REASON reason); + virtual HRESULT STDMETHODCALLTYPE GarbageCollectionFinished(); + virtual HRESULT STDMETHODCALLTYPE RuntimeSuspendFinished(); + virtual HRESULT STDMETHODCALLTYPE Shutdown(); + + // Helper methods + void IncrementFailures(); + +private: + std::atomic _gcStarts; + std::atomic _gcFinishes; + std::atomic _profilerEnumThreadsCompleted; + std::atomic _failures; +}; diff --git a/src/tests/profiler/unittest/enumthreads.cs b/src/tests/profiler/unittest/enumthreads.cs new file mode 100644 index 00000000000000..95562decc3f551 --- /dev/null +++ b/src/tests/profiler/unittest/enumthreads.cs @@ -0,0 +1,56 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +namespace Profiler.Tests +{ + class EnumThreadsTests + { + static readonly Guid EnumThreadsProfilerGuid = new Guid("0742962D-2ED3-44B0-BA84-06B1EF0A0A0B"); + + public static int EnumerateThreadsWithNonProfilerRequestedRuntimeSuspension() + { + GC.Collect(); + return 100; + } + + public static int Main(string[] args) + { + if (args.Length > 0 && args[0].Equals("RunTest", StringComparison.OrdinalIgnoreCase)) + { + switch (args[1]) + { + case nameof(EnumerateThreadsWithNonProfilerRequestedRuntimeSuspension): + return EnumerateThreadsWithNonProfilerRequestedRuntimeSuspension(); + default: + return 102; + } + } + + if (!RunProfilerTest(nameof(EnumerateThreadsWithNonProfilerRequestedRuntimeSuspension))) + { + return 101; + } + + return 100; + } + + private static bool RunProfilerTest(string testName) + { + try + { + return ProfilerTestRunner.Run(profileePath: System.Reflection.Assembly.GetExecutingAssembly().Location, + testName: "EnumThreads", + profilerClsid: EnumThreadsProfilerGuid, + profileeArguments: testName + ) == 100; + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + return false; + } + } +} diff --git a/src/tests/profiler/unittest/enumthreads.csproj b/src/tests/profiler/unittest/enumthreads.csproj new file mode 100644 index 00000000000000..d51dcb692abfe0 --- /dev/null +++ b/src/tests/profiler/unittest/enumthreads.csproj @@ -0,0 +1,21 @@ + + + .NETCoreApp + exe + true + true + + true + + true + + + + + + + + diff --git a/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/SingleValueExtensions.cs b/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/SingleValueExtensions.cs index 5362f267afa531..7730958dd87e62 100644 --- a/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/SingleValueExtensions.cs +++ b/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/SingleValueExtensions.cs @@ -21,7 +21,7 @@ public static class SingleValueExtensions new GenericParameterValue ((ITypeParameterSymbol) underlyingType)), // typeof(Nullable<>) TypeKind.Error => new SystemTypeValue (new TypeProxy (type)), - TypeKind.Class or TypeKind.Struct or TypeKind.Interface => + TypeKind.Class or TypeKind.Enum or TypeKind.Interface or TypeKind.Struct => new NullableSystemTypeValue (new TypeProxy (type), new SystemTypeValue (new TypeProxy (underlyingType))), _ => UnknownValue.Instance }; diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index 2e41771ee39634..ef88f6d4d007c4 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -417,8 +417,8 @@ bool ProcessPrimaryQueue () while (!QueueIsEmpty ()) { ProcessQueue (); - ProcessInterfaceMethods (); ProcessMarkedTypesWithInterfaces (); + ProcessInterfaceMethods (); ProcessDynamicCastableImplementationInterfaces (); ProcessPendingBodies (); DoAdditionalProcessing (); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs index 6b58c1dbf0de9c..1a97ef3fa1e972 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/MethodWithUnmanagedConstraint.cs @@ -6,6 +6,11 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed { [SetupCSharpCompilerToUse ("csc")] [SetupLinkerArgument ("--used-attrs-only", "true")] + + // Necessary to allow trimming the attribute instance from types in CoreLib. + [SetupLinkerTrimMode ("link")] + // When we allow trimming CoreLib, some well-known types expected by ILVerify are removed. + [SkipILVerify] public class MethodWithUnmanagedConstraint { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs index 8f0b7127038f14..409a052e672f8a 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallString.cs @@ -10,6 +10,8 @@ namespace Mono.Linker.Tests.Cases.Reflection [Reference ("System.Core.dll")] [ExpectedNoWarnings] [KeptPrivateImplementationDetails ("ThrowSwitchExpressionException")] + [KeptAttributeAttribute(typeof(UnconditionalSuppressMessageAttribute))] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class ExpressionCallString { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs index 12adc8f07bf3f9..6916935480fd1f 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ExpressionCallStringAndLocals.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; @@ -7,6 +8,8 @@ namespace Mono.Linker.Tests.Cases.Reflection { [Reference ("System.Core.dll")] [ExpectedNoWarnings] + [KeptAttributeAttribute (typeof (UnconditionalSuppressMessageAttribute))] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class ExpressionCallStringAndLocals { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs index 20812c86edf305..8c38ac7742f35f 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/RunClassConstructor.cs @@ -22,6 +22,7 @@ public static void Main () TestIfElseUsingRuntimeTypeHandle (1); TestIfElseUsingType (1); TestNullableValueType (); + TestNullableEnum (); } [Kept] @@ -132,6 +133,16 @@ static void TestNullableValueType () RuntimeHelpers.RunClassConstructor (typeof (int?).TypeHandle); } + [Kept] + [KeptMember ( "value__")] + enum MyEnum {} + + [Kept] + static void TestNullableEnum () + { + RuntimeHelpers.RunClassConstructor (typeof (Nullable).TypeHandle); + } + [Kept] [KeptMember (".cctor()")] class OnlyUsedViaReflection diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/AddSuppressionsBeforeAttributeRemoval.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/AddSuppressionsBeforeAttributeRemoval.cs index dc0d349c3c9b80..fffc017345a6e6 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/AddSuppressionsBeforeAttributeRemoval.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/AddSuppressionsBeforeAttributeRemoval.cs @@ -9,6 +9,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression [SetupLinkAttributesFile ("AddSuppressionsBeforeAttributeRemoval.xml")] [ExpectedNoWarnings] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class AddSuppressionsBeforeAttributeRemoval { [Kept] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFeatureSubstitutions.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFeatureSubstitutions.cs index a5cb25f761348f..c357ba3c17b2b5 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFeatureSubstitutions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFeatureSubstitutions.cs @@ -13,6 +13,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression [SetupLinkerArgument ("--feature", "Feature", "false")] [ExpectedNoWarnings] [SkipKeptItemsValidation] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class DetectRedundantSuppressionsFeatureSubstitutions { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs index 884ceb4a6c81b5..f507fdfc3372cc 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs @@ -10,6 +10,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression { [ExpectedNoWarnings] [SkipKeptItemsValidation] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class DetectRedundantSuppressionsInMembersAndTypes { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsTrimmedMembersTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsTrimmedMembersTarget.cs index caaa05a6a0bce2..df1634b0cd1a4c 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsTrimmedMembersTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsTrimmedMembersTarget.cs @@ -23,6 +23,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression { [ExpectedNoWarnings] [SkipKeptItemsValidation] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] class DetectRedundantSuppressionsTrimmedMembersTarget { [ExpectedWarning ("IL2072")] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsInMembersAndTypesUsingTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsInMembersAndTypesUsingTarget.cs index d00ac7d68fb484..c0098d1d1ff59d 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsInMembersAndTypesUsingTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsInMembersAndTypesUsingTarget.cs @@ -17,6 +17,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression #endif [SkipKeptItemsValidation] [LogDoesNotContain ("TriggerUnrecognizedPattern()")] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class SuppressWarningsInMembersAndTypesUsingTarget { /// @@ -83,6 +84,7 @@ void Warning4 () } [ExpectedNoWarnings] + [UnconditionalSuppressMessage ("AOT", "IL3050", Justification = "These tests are not targeted at AOT scenarios")] public class WarningsInMembers { public void Method ()