diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..5fb9d493e7e --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 + +ARG DOTNET_SDK_INSTALL_URL=https://dot.net/v1/dotnet-install.sh +# Install the correct Roslyn SDK into the same directory that the base image installs the SDK in. +ENV DOTNET_INSTALL_DIR=/usr/share/dotnet + +# Copy the global.json file so its available in the image before the repo is cloned +COPY global.json /tmp/ + +RUN cd /tmp \ + && curl --location --output dotnet-install.sh "${DOTNET_SDK_INSTALL_URL}" \ + && chmod +x dotnet-install.sh \ + && mkdir -p "${DOTNET_INSTALL_DIR}" \ + && ./dotnet-install.sh --jsonfile "./global.json" --install-dir "${DOTNET_INSTALL_DIR}" \ + && rm dotnet-install.sh + +# Set up machine requirements to build the repo +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl git \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..04a96644854 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,60 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/dotnetcore +{ + "name": "Razor DevContainer", + "build": { + "dockerfile": "Dockerfile", + // Set the context to the workspace folder to allow us to copy files from it. + "context": ".." + }, + "customizations": { + "vscode": { + "settings": { + "files.associations": { + "*.csproj": "msbuild", + "*.fsproj": "msbuild", + "*.globalconfig": "ini", + "*.manifest": "xml", + "*.nuspec": "xml", + "*.pkgdef": "ini", + "*.projitems": "msbuild", + "*.props": "msbuild", + "*.resx": "xml", + "*.rsp": "Powershell", + "*.ruleset": "xml", + "*.settings": "xml", + "*.shproj": "msbuild", + "*.slnf": "json", + "*.targets": "msbuild", + "*.vbproj": "msbuild", + "*.vsixmanifest": "xml", + "*.vstemplate": "xml", + "*.xlf": "xml", + "*.yml": "azure-pipelines" + }, + // ms-dotnettools.csharp settings + "omnisharp.disableMSBuildDiagnosticWarning": true, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableImportCompletion": true, + "omnisharp.useModernNet": true, + "omnisharp.enableAsyncCompletion": true, + // ms-dotnettools.csdevkit settings + "dotnet.defaultSolution": "Razor.sln", + // ms-vscode.powershell settings + "powershell.promptToUpdatePowerShell": false, + "powershell.integratedConsole.showOnStartup": false, + "powershell.startAutomatically": false, + // ms-azure-devops.azure-pipelines settings + }, + "extensions": [ + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "EditorConfig.EditorConfig", + "ms-vscode.powershell", + "tintoy.msbuild-project-tools", + "ms-azure-devops.azure-pipelines" + ] + } + }, + "postCreateCommand": "${containerWorkspaceFolder}/restore.sh" +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index 3189f0d9ab7..3b58df10fad 100644 --- a/.editorconfig +++ b/.editorconfig @@ -39,6 +39,9 @@ dotnet_separate_import_directive_groups = false # IDE0005 - Remove unnecessary imports dotnet_diagnostic.IDE0005.severity = warning +# IDE0052 - Private member can be removed +dotnet_diagnostic.IDE0052.severity = warning + # IDE0046: If expression can be simplified dotnet_style_prefer_conditional_expression_over_return = false:silent diff --git a/.vscode/settings.json b/.vscode/settings.json index f9c2ef84cbd..b3c579440ca 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,6 @@ }, "dotnet.defaultSolution": "Razor.sln", "omnisharp.defaultLaunchSolution": "Razor.sln", - "files.encoding": "utf8bom" + "files.encoding": "utf8bom", + "dotnet.testWindow.disableBuildOnRefresh": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6cf71f4a893..776a214d8b3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,27 +1,52 @@ { - "version": "2.0.0", - "tasks": [ - { - "label": "ActivateDotnet", - "type": "shell", - "windows": { - "command": "echo", - "args": [ - "Skipping activation on windows" - ] - }, - "linux": { - "command": "source", - "args": [ - "activate.sh" - ], - "options": { - "cwd": "${workspaceFolder}" - }, - "presentation": { - "reveal": "silent" - } - }, + "version": "2.0.0", + "tasks": [ + { + "label": "ActivateDotnet", + "type": "shell", + "windows": { + "command": "echo", + "args": [ + "Skipping activation on windows" + ] + }, + "linux": { + "command": "source", + "args": [ + "activate.sh" + ], + "options": { + "cwd": "${workspaceFolder}" }, - ] + "presentation": { + "reveal": "silent" + } + }, + }, + { + "label": "build.sh", + "command": "./build.sh", + "type": "shell", + "args": [ + ], + "windows": { + "command": "${workspaceFolder}/build.cmd", + }, + "problemMatcher": "$msCompile", + "group": "build" + }, + { + "label": "build Rasor.Slim.slnf", + "command": "dotnet", + "type": "shell", + "args": [ + "build", + "-p:RunAnalyzersDuringBuild=false", + "-p:GenerateFullPaths=true", + "Razor.Slim.slnf" + ], + "problemMatcher": "$msCompile", + "group": "build" + } + ] } \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 69a3cd1524c..3556b512a08 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -22,9 +22,9 @@ true true true - true + true $(MSBuildThisFileDirectory) - true + true true true @@ -40,15 +40,9 @@ false - true + true net472 - - - false - + $(NetCurrent) $(DefaultNetCoreTargetFramework);$(NetPrevious) @@ -71,7 +65,7 @@ - + $(NetCurrent) $(DefaultNetCoreTargetFramework) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8bfc1b8a0f2..19c6deb856d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ here should be _ prefixed to indicate that they are not meant to be used outside this file. --> - <_MicrosoftWebToolsPackageVersion>17.9.67-preview-0001 + <_MicrosoftWebToolsPackageVersion>17.11.11-preview-0001 <_MicrosoftVisualStudioShellPackagesVersion>17.11.39721 <_MicrosoftVisualStudioPackagesVersion>17.11.191 <_VisualStudioLanguageServerProtocolVersion>17.12.1-preview diff --git a/NOTICE.txt b/NOTICE.txt index 41f6e0c9132..14ff477043e 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,4 +1,4 @@ -NOTICES AND INFORMATION +NOTICES AND INFORMATION Do Not Translate or Localize This software incorporates material from third parties. @@ -17,12 +17,9 @@ required to debug changes to any libraries licensed under the GNU Lesser General --------------------------------------------------------- -Castle.Core 4.4.0 - Apache-2.0 +Castle.Core 4.3.1 - Apache-2.0 -Copyright 2004-2016 Castle Project -Copyright (c) 2004-2019 Castle Project -GCopyright (c) 2004-2019 Castle Project Copyright 2004-2016 Castle Project - http://www.castleproject.org/ @@ -42,7 +39,32 @@ limitations under the License. --------------------------------------------------------- -DiffPlex 1.4.4 - Apache-2.0 +Castle.Core 5.1.1 - Apache-2.0 + + +(c) 2004-2022 Castle Project - http://www.castleproject.org +Copyright 2004-2021 Castle Project - http://www.castleproject.org +Copyright (c) 2004-2022 Castle Project - http://www.castleproject.org + +Copyright 2004-2021 Castle Project - http://www.castleproject.org/ + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +--------------------------------------------------------- + +--------------------------------------------------------- + +DiffPlex 1.7.2 - Apache-2.0 @@ -54,43 +76,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -148,10 +170,9 @@ limitations under the License. --------------------------------------------------------- -MediatR 8.1.0 - Apache-2.0 +FluentAssertions 6.7.0 - Apache-2.0 -Copyright Jimmy Bogard Apache License @@ -161,43 +182,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -255,11 +276,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Configuration 2.0.0 - Apache-2.0 +Microsoft.Extensions.Configuration 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -269,43 +289,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -363,11 +383,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Configuration.Abstractions 2.0.0 - Apache-2.0 +Microsoft.Extensions.Configuration.Abstractions 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -377,43 +396,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -471,11 +490,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Configuration.Binder 2.0.0 - Apache-2.0 +Microsoft.Extensions.Configuration.Binder 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -485,43 +503,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -579,11 +597,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.DependencyInjection 2.0.0 - Apache-2.0 +Microsoft.Extensions.DependencyInjection.Abstractions 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -593,43 +610,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -687,11 +704,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0 - Apache-2.0 +Microsoft.Extensions.Logging 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -701,43 +717,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -795,11 +811,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Logging 2.0.0 - Apache-2.0 +Microsoft.Extensions.Logging.Abstractions 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -809,43 +824,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -903,11 +918,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Logging.Abstractions 2.0.0 - Apache-2.0 +Microsoft.Extensions.Options 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -917,43 +931,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1011,11 +1025,10 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Options 2.0.0 - Apache-2.0 +Microsoft.Extensions.Primitives 2.1.1 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation +(c) Microsoft Corporation. Apache License @@ -1025,43 +1038,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1119,11 +1132,9 @@ limitations under the License. --------------------------------------------------------- -Microsoft.Extensions.Options.ConfigurationExtensions 2.0.0 - Apache-2.0 +NuGet.Common 6.3.4 - Apache-2.0 -Copyright Microsoft Corporation -Copyright (c) Microsoft Corporation Apache License @@ -1133,43 +1144,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1227,10 +1238,9 @@ limitations under the License. --------------------------------------------------------- -NuGet.Common 5.2.0 - Apache-2.0 +NuGet.Configuration 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. Apache License @@ -1240,43 +1250,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1334,7 +1344,7 @@ limitations under the License. --------------------------------------------------------- -NuGet.Common 5.6.0 - Apache-2.0 +NuGet.Frameworks 5.11.0 - Apache-2.0 (c) Microsoft Corporation. @@ -1347,43 +1357,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1441,10 +1451,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Configuration 5.2.0 - Apache-2.0 +NuGet.Frameworks 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1454,43 +1464,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1548,10 +1558,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Configuration 5.6.0 - Apache-2.0 +NuGet.Packaging 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1561,43 +1571,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1655,10 +1665,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.DependencyResolver.Core 5.2.0 - Apache-2.0 +NuGet.Protocol 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1668,43 +1678,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1762,10 +1772,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Frameworks 5.2.0 - Apache-2.0 +NuGet.Resolver 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1775,43 +1785,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1869,10 +1879,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Frameworks 5.6.0 - Apache-2.0 +NuGet.Versioning 6.3.4 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1882,43 +1892,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -1976,10 +1986,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.LibraryModel 5.2.0 - Apache-2.0 +NuGet.VisualStudio 17.9.1 - Apache-2.0 -(c) Microsoft Corporation. +(c) Microsoft Corporation Apache License @@ -1989,43 +1999,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2083,10 +2093,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Packaging 5.2.0 - Apache-2.0 +xunit 2.6.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) .NET Foundation Apache License @@ -2096,43 +2106,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2190,10 +2200,11 @@ limitations under the License. --------------------------------------------------------- -NuGet.Packaging 5.6.0 - Apache-2.0 +xunit.abstractions 2.0.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) Outercurve Foundation +Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS Apache License @@ -2203,43 +2214,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2297,9 +2308,12 @@ limitations under the License. --------------------------------------------------------- -NuGet.Packaging.Core 5.2.0 - Apache-2.0 +xunit.analyzers 1.7.0 - Apache-2.0 +Copyright (c) .NET Foundation +Copyright (c) .NET Foundation xUnit.net +Copyright (c) .NET Foundation xunit.analyzers, analyzers, roslyn, xunit, xunit.net Apache License @@ -2309,43 +2323,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2403,10 +2417,11 @@ limitations under the License. --------------------------------------------------------- -NuGet.ProjectModel 5.2.0 - Apache-2.0 +xunit.assert 2.6.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) .NET Foundation +Copyright (c) .NET Foundation xUnit.net Apache License @@ -2416,43 +2431,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2510,10 +2525,10 @@ limitations under the License. --------------------------------------------------------- -NuGet.Protocol 5.2.0 - Apache-2.0 +xunit.core 2.6.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) .NET Foundation Apache License @@ -2523,43 +2538,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2617,10 +2632,13 @@ limitations under the License. --------------------------------------------------------- -NuGet.Protocol 5.6.0 - Apache-2.0 +xunit.extensibility.core 2.6.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) .NET Foundation +Copyright (c) .NET Foundation xUnit.net +Copyright (c) .NET Foundation 0xUnit.net +Copyright (c) .NET Foundation xUnit.net Runner Utility Apache License @@ -2630,43 +2648,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2724,9 +2742,11 @@ limitations under the License. --------------------------------------------------------- -NuGet.Resolver 5.6.0 - Apache-2.0 +xunit.extensibility.execution 2.6.3 - Apache-2.0 +Copyright (c) .NET Foundation +Copyright (c) .NET Foundation xUnit.net Apache License @@ -2736,43 +2756,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2830,10 +2850,19 @@ limitations under the License. --------------------------------------------------------- -NuGet.SolutionRestoreManager.Interop 4.8.0 - Apache-2.0 +xunit.runner.console 2.6.3 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) Microsoft +(c) Microsoft Corporation +Copyright (c) .NET Foundation +Copyright (c) Outercurve Foundation +Copyright (c) .NET Foundation xUnit.net Runner Utility +Copyright (c) .NET Foundation xUnit.net Runner Reporters +Copyright (c) .NET Foundation xUnit.net Console Test Runner +Copyright (c) .NET Foundation &xUnit.net Console Test Runner +Copyright (c) .NET Foundation -xUnit.net Console Test Runner +Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS Apache License @@ -2843,43 +2872,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -2937,10 +2966,9 @@ limitations under the License. --------------------------------------------------------- -NuGet.Versioning 5.2.0 - Apache-2.0 +xunit.runner.utility 2.4.1 - Apache-2.0 -(c) Microsoft Corporation. Apache License @@ -2950,43 +2978,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -3044,10 +3072,16 @@ limitations under the License. --------------------------------------------------------- -NuGet.Versioning 5.6.0 - Apache-2.0 +xunit.runner.visualstudio 2.8.1 - Apache-2.0 -(c) Microsoft Corporation. +Copyright (c) .NET Foundation +Copyright (c) Outercurve Foundation +Copyright (c) .NET Foundation and Contributors +Copyright (c) .NET Foundation xUnit.net Runner Utility +Copyright (c) .NET Foundation xUnit.net Runner Reporters +Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS +Copyright (c) .NET Foundation and Contributors. xUnit.net Testing Framework +xUnit.net Apache License @@ -3057,43 +3091,43 @@ http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND 1. Definitions. - + "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - + "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - + "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - + "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - + "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - + "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - + "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. @@ -3151,4881 +3185,521 @@ limitations under the License. --------------------------------------------------------- -xunit.abstractions 2.0.1 - Apache-2.0 - - -Copyright (c) Outercurve Foundation -Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS +Moq 4.10.1 - BSD-3-Clause -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +Copyright (c) . All rights reserved. - 1. Definitions. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------- - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +--------------------------------------------------------- +Moq 4.18.4 - BSD-3-Clause - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, and Contributors +Copyright (c) . All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--------------------------------------------------------- +--------------------------------------------------------- - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +Azure.Core 1.35.0 - MIT +(c) Microsoft Corporation - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +MIT License +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +--------------------------------------------------------- +Basic.Reference.Assemblies.AspNet80 1.7.2 - MIT - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +copyright Unmanaged32Bit Required32Bit - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +MIT License - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +Copyright (c) - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +--------------------------------------------------------- - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +--------------------------------------------------------- - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +Basic.Reference.Assemblies.Net461 1.7.2 - MIT - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +Copyright Init Default +Copyright SevenBit SetBit +(c) Communication Foundation +Copyright (c) Microsoft Corp. +Copyright PagefileLimit TimeLimit +Copyright Managed32Bit Native32Bit +(c) Microsoft Corporation 1996-2005 +Copyright (c) Microsoft Corporation +copyright Unmanaged32Bit Required32Bit +Copyright (c) Microsoft Corporation 2005 +Copyright (c) 1998 Hewlett-Packard Company +Copyright DialogResult SystemDataOracleClient +Copyright HasElementChildBit HasContentChildBit +Copyright SystemDataOracleClient SystemManagement +Copyright TryGetMemberMethodExplicit TryGetPropertySetterExplicit - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +MIT License - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +Copyright (c) - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -APPENDIX: How to apply the Apache License to your work. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Copyright [yyyy] [name of copyright owner] +--------------------------------------------------------- -Licensed under the Apache License, Version 2.0 (the "License"); +--------------------------------------------------------- -you may not use this file except in compliance with the License. +Basic.Reference.Assemblies.Net70 1.7.2 - MIT -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 +copyright Unmanaged32Bit Required32Bit -Unless required by applicable law or agreed to in writing, software +MIT License -distributed under the License is distributed on an "AS IS" BASIS, +Copyright (c) -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -See the License for the specific language governing permissions and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -limitations under the License. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -xunit.abstractions 2.0.3 - Apache-2.0 +Basic.Reference.Assemblies.Net80 1.7.2 - MIT -Copyright (c) Outercurve Foundation -Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS +copyright Unmanaged32Bit Required32Bit -Apache License +MIT License -Version 2.0, January 2004 +Copyright (c) -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - 1. Definitions. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +--------------------------------------------------------- +Basic.Reference.Assemblies.NetStandard20 1.7.2 - MIT - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +copyright Unmanaged32Bit Required32Bit +MIT License +Copyright (c) - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +--------------------------------------------------------- +--------------------------------------------------------- +CommandLineParser 2.4.3 - MIT - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +copyright Excepting NotParsed +copyright symbol. name author' The company +Copyright WrapNonExceptionThrows CommandLine.Tests, PublicKey +Copyright (c) 2005 - 2015 Giacomo Stelluti Scala & Contributors +Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors +MIT License - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - - - - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - - - - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +--------------------------------------------------------- - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +--------------------------------------------------------- - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +Gee.External.Capstone 2.3.0 - MIT - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +Copyright (c) Ahmed Garhy +Copyright (c) Ahmed Garhy Capstone.NET - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +MIT License - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +Copyright (c) - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -APPENDIX: How to apply the Apache License to your work. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Copyright [yyyy] [name of copyright owner] +--------------------------------------------------------- -Licensed under the Apache License, Version 2.0 (the "License"); +--------------------------------------------------------- -you may not use this file except in compliance with the License. +Humanizer.Core 2.14.1 - MIT -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 +Copyright .NET Foundation and Contributors +Copyright (c) .NET Foundation and Contributors -Unless required by applicable law or agreed to in writing, software +MIT License -distributed under the License is distributed on an "AS IS" BASIS, +Copyright (c) -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -See the License for the specific language governing permissions and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -limitations under the License. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -xunit.assert 2.3.0 - Apache-2.0 - +Iced 1.17.0 - MIT -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. +(c) 2018-present iced project and contributors +Copyright (c) 2018-present iced project and contributors +https://github.com/icedland/iced +Copyright (C) 2018-present iced project and contributors +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +--------------------------------------------------------- +--------------------------------------------------------- +ICSharpCode.Decompiler 8.1.1.7464 - MIT - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +Copyright 2011-2023 AlphaSierraPapa +Copyright 2011-2023 AlphaSierraPapa C Decompiler +MIT License - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- +--------------------------------------------------------- - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +MessagePack 2.5.168 - MIT +(c) Yoshifumi Kawai and contributors - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +MIT License +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +--------------------------------------------------------- +MessagePack.Annotations 2.5.168 - MIT - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +(c) Yoshifumi Kawai and contributors - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +MIT License - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +Copyright (c) - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +--------------------------------------------------------- - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +--------------------------------------------------------- - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +MessagePackAnalyzer 2.5.108 - MIT - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +(c) Yoshifumi Kawai and contributors - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +MIT License - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +Copyright (c) - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -APPENDIX: How to apply the Apache License to your work. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Copyright [yyyy] [name of copyright owner] +--------------------------------------------------------- -Licensed under the Apache License, Version 2.0 (the "License"); +--------------------------------------------------------- -you may not use this file except in compliance with the License. +Microsoft.Build.Locator 1.4.1 - MIT -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 +(c) Microsoft Corporation. -Unless required by applicable law or agreed to in writing, software +MIT License -distributed under the License is distributed on an "AS IS" BASIS, +Copyright (c) -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -See the License for the specific language governing permissions and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -limitations under the License. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -xunit.assert 2.4.1 - Apache-2.0 - - -Copyright (c) .NET Foundation -Copyright (c) .NET Foundation xUnit.net Assertion Library - -Apache License - -Version 2.0, January 2004 +Microsoft.CodeAnalysis.CSharp.Workspaces 4.9.2 - MIT -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - 1. Definitions. +(c) Microsoft Corporation +Copyright (c) .NET Foundation and Contributors +MIT License +Copyright (c) - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. +--------------------------------------------------------- +--------------------------------------------------------- +Microsoft.CodeAnalysis.Elfie 1.0.0 - MIT - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. +MIT License - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- +--------------------------------------------------------- - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. +Microsoft.CodeAnalysis.Workspaces.Common 4.9.2 - MIT +(c) Microsoft Corporation +Copyright (c) .NET Foundation and Contributors - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). +MIT License +Copyright (c) +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--------------------------------------------------------- - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." +--------------------------------------------------------- +Microsoft.CodeAnalysis.Workspaces.MSBuild 4.9.2 - MIT - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. +(c) Microsoft Corporation +Copyright James Newton-King 2008 +Copyright James Newton-King 2008 Json.NET +Copyright .NET Foundation and Contributors +Copyright (c) .NET Foundation and Contributors - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. +MIT License - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. +Copyright (c) - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +--------------------------------------------------------- - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. +--------------------------------------------------------- - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +Microsoft.Diagnostics.NETCore.Client 0.2.251802 - MIT - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. +(c) Microsoft Corporation. - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. +MIT License - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. +Copyright (c) - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -APPENDIX: How to apply the Apache License to your work. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Copyright [yyyy] [name of copyright owner] +--------------------------------------------------------- -Licensed under the Apache License, Version 2.0 (the "License"); +--------------------------------------------------------- -you may not use this file except in compliance with the License. +Microsoft.Diagnostics.Tracing.TraceEvent 3.0.2 - MIT -You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 +Copyright Microsoft 2010 +(c) Microsoft Corporation +Copyright 1995-2017 Mark Adler +Copyright Microsoft 2010 TraceEvent +Copyright Microsoft 2010 Serialization +Copyright Microsoft 2010 Operating System Extensions -Unless required by applicable law or agreed to in writing, software +MIT License -distributed under the License is distributed on an "AS IS" BASIS, +Copyright (c) -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -See the License for the specific language governing permissions and +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -limitations under the License. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -xunit.extensibility.core 2.2.0 - Apache-2.0 - - -Copyright (c) .NET Foundation -Copyright (c) .NET Foundation RSDSk C BuildAgent - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - - - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - - - - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - - - - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - - - - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - - - - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - - - - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - - - - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - - - - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - - - - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. - ---------------------------------------------------------- - ---------------------------------------------------------- - -xunit.extensibility.core 2.4.1 - Apache-2.0 - - -Copyright (c) .NET Foundation -Copyright (c) .NET Foundation xUnit.net -Copyright (c) .NET Foundation 0xUnit.net -Copyright (c) .NET Foundation xUnit.net Runner Utility - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - - - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - - - - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - - - - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - - - - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - - - - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - - - - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - - - - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - - - - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - - - - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. - ---------------------------------------------------------- - ---------------------------------------------------------- - -xunit.extensibility.execution 2.4.1 - Apache-2.0 - - -Copyright (c) .NET Foundation -Copyright (c) 2015 .NET Foundation -Copyright (c) .NET Foundation xUnit.net -Copyright (c) .NET Foundation and Contributors - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - - - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - - - - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - - - - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - - - - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - - - - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - - - - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - - - - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - - - - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - - - - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Yarn.MSBuild 1.22.10 - Apache-2.0 - - -(c) Sindre Sorhus -Copyright Nate McMaster -Copyright (c) 2005 Tom Wu -Copyright 2016, Joyent Inc -Copyright (c) Marak Squires -Copyright (c) Nate McMaster -Copyright 2012 Joyent, Inc. -Copyright 2015 Joyent, Inc. -Copyright 2016 Joyent, Inc. -Copyright 2017 Joyent, Inc. -Copyright (c) 2015 Jed Watson -Copyright (c) 2005-2009 Tom Wu -Copyright (c) 2013, Yahoo! Inc. -Copyright (c) 2014 Jonathan Ong -Copyright 2015 Kyle E. Mitchell -Copyright (c) 2012, Mark Cavage. -Copyright (c) 2016-present, Yarn -Copyright 2010-2012 Mikeal Rogers -Copyright (c) 2015 Jon Schlinkert. -copyright (c) 2018 Denis Pushkarev -Copyright (c) 2015, Jon Schlinkert. -Copyright (c) Microsoft Corporation. -Copyright (c) 2012-2014 TJ Holowaychuk -Copyright (c) 2014-2015, Jon Schlinkert. -Copyright (c) 2014-2017, Jon Schlinkert. -Copyright (c) 2014-2018, Jon Schlinkert. -Copyright (c) 2015, Salesforce.com, Inc. -Copyright (c) 2015-2016, Jon Schlinkert. -Copyright (c) 2015-2017, Jon Schlinkert. -Copyright (c) 2015-2018, Jon Schlinkert. -Copyright (c) 2013-present, Facebook, Inc. -Copyright (c) 2015 Douglas Christopher Wilson -Copyright 2010 LearnBoost -Copyright 2011 Mark Cavage -Copyright (c) 2014 Jon Schlinkert, contributors. -Copyright (c) 2013 Ted Unangst -Copyright Joyent, Inc. and other Node contributors. -Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com) -Copyright 1997 Niels Provos -Copyright (c) 2011-2017 KARASZI Istvan -Copyright 2012-2016 The Dojo Foundation -Copyright JS Foundation and other contributors, https://js.foundation -Copyright (c) Sindre Sorhus (sindresorhus.com) -Copyright JS Foundation and other contributors -Copyright jQuery Foundation and other contributors -Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - - - "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - - - - "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - - - - "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - - - - "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - - - - "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - - - - "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - - - - "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - - - - "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - - - - "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - - - - "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - - (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - - You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - -To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); - -you may not use this file except in compliance with the License. - -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software - -distributed under the License is distributed on an "AS IS" BASIS, - -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - -See the License for the specific language governing permissions and - -limitations under the License. - ---------------------------------------------------------- - ---------------------------------------------------------- - -yarn 1.22.10 - BSD-2-Clause -https://github.com/yarnpkg/yarn#readme - -(c) Sindre Sorhus -Copyright (c) 2005 Tom Wu -Copyright 2016, Joyent Inc -Copyright (c) Marak Squires -Copyright 2012 Joyent, Inc. -Copyright 2015 Joyent, Inc. -Copyright 2016 Joyent, Inc. -Copyright 2017 Joyent, Inc. -Copyright (c) 2015 Jed Watson -Copyright (c) 2005-2009 Tom Wu -Copyright (c) 2013, Yahoo! Inc. -Copyright (c) 2014 Jonathan Ong -Copyright 2015 Kyle E. Mitchell -Copyright (c) 2012, Mark Cavage. -Copyright (c) 2016-present, Yarn -Copyright 2010-2012 Mikeal Rogers -Copyright (c) 2015 Jon Schlinkert. -copyright (c) 2018 Denis Pushkarev -Copyright (c) 2015, Jon Schlinkert. -Copyright (c) Microsoft Corporation. -Copyright (c) 2012-2014 TJ Holowaychuk -Copyright (c) 2014-2015, Jon Schlinkert. -Copyright (c) 2014-2017, Jon Schlinkert. -Copyright (c) 2014-2018, Jon Schlinkert. -Copyright (c) 2015, Salesforce.com, Inc. -Copyright (c) 2015-2016, Jon Schlinkert. -Copyright (c) 2015-2017, Jon Schlinkert. -Copyright (c) 2015-2018, Jon Schlinkert. -Copyright (c) 2013-present, Facebook, Inc. -Copyright (c) 2015 Douglas Christopher Wilson -Copyright 2010 LearnBoost -Copyright 2011 Mark Cavage -Copyright (c) 2014 Jon Schlinkert, contributors. -Copyright (c) 2013 Ted Unangst -Copyright Joyent, Inc. and other Node contributors. -Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com) -Copyright 1997 Niels Provos -Copyright (c) 2011-2017 KARASZI Istvan -Copyright 2012-2016 The Dojo Foundation -Copyright JS Foundation and other contributors, https://js.foundation -Copyright (c) Sindre Sorhus (sindresorhus.com) -Copyright JS Foundation and other contributors -Copyright jQuery Foundation and other contributors -Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - -Copyright (c) . All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -diff 5.0.0 - BSD-3-Clause -https://github.com/kpdecker/jsdiff#readme - -Copyright (c) 2009-2015, Kevin Decker - -Software License Agreement (BSD License) - -Copyright (c) 2009-2015, Kevin Decker - -All rights reserved. - -Redistribution and use of this software in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of Kevin Decker nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Moq 4.16.0 - BSD-3-Clause - - -Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, and Contributors. - -Copyright (c) . All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -chownr 2.0.0 - ISC -https://github.com/isaacs/chownr#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -fs.realpath 1.0.0 - ISC -https://github.com/isaacs/fs.realpath#readme - -Copyright (c) Isaac Z. Schlueter and Contributors -Copyright Joyent, Inc. and other Node contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----- - -This library bundles a version of the `fs.realpath` and `fs.realpathSync` -methods from Node.js v0.10 under the terms of the Node.js MIT license. - -Node's license follows, also included at the header of `old.js` which contains -the licensed code: - - Copyright Joyent, Inc. and other Node contributors. - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -fs-minipass 2.1.0 - ISC -https://github.com/npm/fs-minipass#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -glob 7.1.6 - ISC -https://github.com/isaacs/node-glob#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -## Glob Logo - -Glob's logo created by Tanya Brassie , licensed -under a Creative Commons Attribution-ShareAlike 4.0 International License -https://creativecommons.org/licenses/by-sa/4.0/ - - ---------------------------------------------------------- - ---------------------------------------------------------- - -inflight 1.0.6 - ISC -https://github.com/isaacs/inflight - -Copyright (c) Isaac Z. Schlueter - -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -inherits 2.0.4 - ISC -https://github.com/isaacs/inherits#readme - -Copyright (c) Isaac Z. Schlueter - -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - - - ---------------------------------------------------------- - ---------------------------------------------------------- - -minimatch 3.0.4 - ISC -https://github.com/isaacs/minimatch#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -minipass 3.1.6 - ISC -https://github.com/isaacs/minipass#readme - -Copyright (c) npm, Inc. and Contributors - -The ISC License - -Copyright (c) npm, Inc. and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -once 1.4.0 - ISC -https://github.com/isaacs/once#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -rimraf 2.7.1 - ISC -https://github.com/isaacs/rimraf#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -semver 5.7.1 - ISC -https://github.com/npm/node-semver#readme - -Copyright Isaac Z. -Copyright Isaac Z. Schlueter -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -tar 6.1.11 - ISC -https://github.com/npm/node-tar#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -wrappy 1.0.2 - ISC -https://github.com/npm/wrappy - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -yallist 4.0.0 - ISC -https://github.com/isaacs/yallist#readme - -Copyright (c) Isaac Z. Schlueter and Contributors - -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -agent-base 4.3.0 - MIT -https://github.com/TooTallNate/node-agent-base#readme - -Copyright (c) 2013 Nathan Rajlich - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -balanced-match 1.0.0 - MIT -https://github.com/juliangruber/balanced-match - -Copyright (c) 2013 Julian Gruber - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -brace-expansion 1.1.11 - MIT -https://github.com/juliangruber/brace-expansion - -Copyright (c) 2013 Julian Gruber - -MIT License - -Copyright (c) 2013 Julian Gruber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -CommandLineParser 2.4.3 - MIT - - -copyright Excepting NotParsed -copyright symbol. name author' The company -Copyright WrapNonExceptionThrows CommandLine.Tests, PublicKey -Copyright (c) 2005 - 2015 Giacomo Stelluti Scala & Contributors -Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -concat-map 0.0.1 - MIT -https://github.com/substack/node-concat-map - - -This software is released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -debug 3.1.0 - MIT -https://github.com/visionmedia/debug#readme - -Copyright (c) 2014 TJ Holowaychuk -Copyright (c) 2014-2017 TJ Holowaychuk - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the 'Software'), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - ---------------------------------------------------------- - ---------------------------------------------------------- - -debug 3.2.6 - MIT -https://github.com/visionmedia/debug#readme - -Copyright (c) 2014 TJ Holowaychuk -Copyright (c) 2014-2017 TJ Holowaychuk - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software -and associated documentation files (the 'Software'), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - ---------------------------------------------------------- - ---------------------------------------------------------- - -es6-promise 4.2.8 - MIT -https://github.com/stefanpenner/es6-promise - -Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors - -Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -es6-promisify 5.0.0 - MIT -https://github.com/digitaldesignlabs/es6-promisify#readme - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -http-proxy-agent 2.1.0 - MIT -https://github.com/TooTallNate/node-http-proxy-agent#readme - -Copyright (c) 2013 Nathan Rajlich - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -https-proxy-agent 2.2.4 - MIT -https://github.com/TooTallNate/node-https-proxy-agent#readme - -Copyright (c) 2013 Nathan Rajlich - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Humanizer.Core 2.14.1 - MIT - - -Copyright .NET Foundation and Contributors -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Iced 1.8.0 - MIT - - - -Copyright (C) 2018-2020 de4dot@gmail.com - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -ICSharpCode.Decompiler 7.1.0.6543 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack 2.1.152 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack 2.2.85 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack 2.3.85 - MIT - - - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack.Annotations 2.1.152 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack.Annotations 2.2.85 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePack.Annotations 2.3.85 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MessagePackAnalyzer 2.1.152 - MIT - - -(c) Yoshifumi Kawai and contributors. -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2017 Yoshifumi Kawai and contributors - -MessagePack for C# - -MIT License - -Copyright (c) 2017 Yoshifumi Kawai and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -lz4net - -Copyright (c) 2013-2017, Milosz Krajewski - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Bcl.AsyncInterfaces 1.1.1 - MIT - - - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Bcl.AsyncInterfaces 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Build.Framework 16.5.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) 2015 Christian Klutz -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.CodeAnalysis.Elfie 1.0.0 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Diagnostics.NETCore.Client 0.2.61701 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Diagnostics.Runtime 1.1.126102 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.DotNet.PlatformAbstractions 2.1.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2015 .NET Foundation -Copyright (c) Microsoft Corporation -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) 2015 .NET Foundation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.IO.Redist 4.7.1 - MIT - - -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.NETCore.App.Ref 3.1.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 1991-2017 Unicode, Inc. -copyright Unmanaged32Bit Required32Bit -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.NETCore.Platforms 3.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.NETCore.Platforms 5.0.1 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition 16.1.8 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition 16.4.11 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition 16.9.20 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition.Analyzers 16.9.20 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition.NetFxAttributes 16.1.8 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition.NetFxAttributes 16.4.11 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Composition.NetFxAttributes 16.9.20 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.SDK.Analyzers 16.10.10 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading 16.7.56 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading 16.8.55 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading 17.0.64 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading 17.1.46 - MIT - - -(c) Microsoft Corporation - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading 17.2.20-alpha - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 15.8.122 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 16.7.56 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 16.8.55 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 17.0.64 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 17.1.46 - MIT - - -(c) Microsoft Corporation - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Threading.Analyzers 17.2.20-alpha - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Validation 16.10.35 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Validation 16.8.33 - MIT - - -(c) Microsoft Corporation. - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.VisualStudio.Validation 17.0.43 - MIT - - -(c) Microsoft Corporation - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Win32.Registry 4.6.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.Win32.Registry 4.7.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Microsoft.WindowsDesktop.App.Ref 3.1.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -microsoft/vscode 2e16c59fde65096c9ac2b3334f6b8b1fcbf87606 - MIT - - -(c) I Power Users -Copyright (c) 2011 -Copyright (c) 2014 -Copyright (c) 2015 -Copyright (c) 2015 AJ -Copyright (c) 2008 Tim -Copyright Joyent, Inc. -Copyright (c) 2002-2007 -Copyright (c) 2011 Jxck -Copyright (c) 2014 Darin -Copyright (c) 2018 Mozilla -Copyright (c) 2017 Emmet.io -Copyright (c) 2016 Microsoft -Copyright (c) 2017 Tim Jones -Copyright (c) 2019 Yuki Ueda -Copyright (c) 2008 Tim Harper -Copyright (c) 2014 Jesse Weed -Copyright (c) 2016 David Rios -Copyright (c) 2019 Jeff Hykin -Copyright (c) 2019 Microsoft. -Copyright (c) Joshaven Potter -Copyright (c) 2014 GitHub Inc. -Copyright (c) 2015 David Owens -Copyright (c) 2014 Taylor Hakes -Copyright (c) 2017 Michael Mims -Copyright Microsoft Corporation -Copyright 2013-2018 Docker, Inc. -Copyright (c) 2014 Darin Morrison -Copyright (c) 2015 David Owens II -Copyright (c) 2011 Fabrice Bellard -Copyright (c) 2014 Forbes Lindesay -Copyright (c) 2014 James Summerton -Copyright (c) 2016 .NET Foundation -Copyright (c) 2015 Colorsublime.com -Copyright (c) 2015 Nicolas Bevacqua -Copyright (c) 2010- Mark McGranaghan -Copyright (c) 2015 Krzysztof Cieslak -Copyright (c) Microsoft Corporation. -Copyright 2015 The Chromium Authors. -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2018 Mozilla Corporation -Copyright (c) 2009-2014 Jeremy Ashkenas -Copyright (c) daaain/Handlebars project -Copyright (c) 2008 Microsoft Corporation -Copyright Drifty Co. http://drifty.com/. -Document Object Model. Copyright (c) 2015 -Copyright (c) textmate-ini.tmbundle project -Copyright (c) textmate-lua.tmbundle project -Copyright (c) textmate-diff.tmbundle project -Copyright (c) textmate-html.tmbundle project -Copyright (c) textmate-make.tmbundle project -Copyright (c) textmate-perl.tmbundle project -Copyright (c) textmate-ruby.tmbundle project -Copyright (c) textmate-groovy.tmbundle project -from Document Object Model. Copyright (c) 2015 -Copyright (c) 2010 Scott Kyle and Rasmus Andersson -Copyright (c) 2015 - present Microsoft Corporation -Copyright (c) 2016 - present Microsoft Corporation -Copyright (c) textmate-asp.vb.net.tmbundle project -Copyright (c) textmate-javascript.tmbundle project -Copyright Joyent, Inc. and other Node contributors. -Copyright (c) 2013 Andreas Neuhaus http://zargony.com -Copyright (c) 2012 Alex Sancho, http://alexsancho.name -Copyright (c) 2004, John Gruber http://daringfireball.net -Copyright (c) 2015 FichteFoll -Copyright (c) 2015-present MagicStack Inc. http://magic.io -Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors. -Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) -Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/) -Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) https://github.com/chjj/term.js -Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) https://github.com/markedjs/marked - -MIT License - -Copyright (c) 2015 - present Microsoft Corporation - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -minizlib 2.1.2 - MIT -https://github.com/isaacs/minizlib#readme - -Copyright Isaac Z. Schlueter and Contributors -Copyright Joyent, Inc. and other Node contributors. - -Minizlib was created by Isaac Z. Schlueter. -It is a derivative work of the Node.js project. - -""" -Copyright Isaac Z. Schlueter and Contributors -Copyright Node.js contributors. All rights reserved. -Copyright Joyent, Inc. and other Node contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - - ---------------------------------------------------------- - ---------------------------------------------------------- - -mkdirp 1.0.4 - MIT -https://github.com/isaacs/node-mkdirp#readme - -Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) - -Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) - -This project is free software released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -ms 2.0.0 - MIT -https://github.com/zeit/ms#readme - -Copyright (c) 2016 Zeit, Inc. - -The MIT License (MIT) - -Copyright (c) 2016 Zeit, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -ms 2.1.2 - MIT -https://github.com/zeit/ms#readme - -Copyright (c) 2016 Zeit, Inc. - -The MIT License (MIT) - -Copyright (c) 2016 Zeit, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MSTest.TestAdapter 2.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Microsoft Corporation. - -MSTest Framework - -Copyright (c) Microsoft Corporation. All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -MSTest.TestFramework 2.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Microsoft Corporation. - -MSTest Framework - -Copyright (c) Microsoft Corporation. All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Nerdbank.Streams 2.6.81 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Nerdbank.Streams 2.8.54 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Nerdbank.Streams 2.8.57 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -Newtonsoft.Json 12.0.3 - MIT - - -Copyright James Newton-King 2008 -Copyright (c) 2007 James Newton-King -Copyright (c) James Newton-King 2008 - -The MIT License (MIT) - -Copyright (c) 2007 James Newton-King - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Newtonsoft.Json 13.0.1 - MIT - - -Copyright James Newton-King 2008 -Copyright (c) 2007 James Newton-King -Copyright (c) James Newton-King 2008 - -The MIT License (MIT) - -Copyright (c) 2007 James Newton-King - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Newtonsoft.Json 9.0.1 - MIT - - -Copyright James Newton-King 2008 - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Abstractions 1.37.13 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Extensions.JsonRpc 0.19.7 - MIT - - -Copyright OmniSharp and contributors -Copyright OmniSharp and contributors (c) 2018 -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) .NET Foundation and Contributors -All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Extensions.JsonRpc.Generators 0.19.7 - MIT - - -Copyright OmniSharp and contributors -Copyright OmniSharp and contributors (c) 2018 -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) .NET Foundation and Contributors -All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Extensions.LanguageProtocol 0.19.7 - MIT - - -Copyright OmniSharp and contributors -Copyright OmniSharp and contributors (c) 2018 -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) .NET Foundation and Contributors -All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Extensions.LanguageServer 0.19.7 - MIT - - -Copyright OmniSharp and contributors -Copyright OmniSharp and contributors (c) 2018 -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) .NET Foundation and Contributors -All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Extensions.LanguageServer.Shared 0.19.7 - MIT - - -Copyright OmniSharp and contributors -Copyright OmniSharp and contributors (c) 2018 -Copyright (c) .NET Foundation and Contributors - -MIT License - -Copyright (c) .NET Foundation and Contributors -All Rights Reserved - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.MSBuild 1.37.13 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Roslyn 1.37.13 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Roslyn.CSharp 1.37.13 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -OmniSharp.Shared 1.37.13 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -path-is-absolute 1.0.1 - MIT -https://github.com/sindresorhus/path-is-absolute#readme - -(c) Sindre Sorhus (https://sindresorhus.com) -Copyright (c) Sindre Sorhus (sindresorhus.com) - -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -Perfolizer 0.2.1 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -ps-list 7.2.0 - MIT -https://github.com/sindresorhus/ps-list#readme - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -StreamJsonRpc 2.7.70 - MIT - - - -MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Buffers 4.5.1 - MIT - - -(c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.CodeDom 4.5.0 - MIT - - - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Collections.Immutable 1.7.1 - MIT - - -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.ComponentModel.Composition 4.5.0 - MIT - - - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.ComponentModel.Composition 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition.AttributedModel 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition.Convention 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition.Hosting 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition.Runtime 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Composition.TypedParts 6.0.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Configuration.ConfigurationManager 4.5.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Data.DataSetExtensions 4.5.0 - MIT - - - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.Diagnostics.PerformanceCounter 5.0.1 - MIT - - -(c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.IO.FileSystem.AccessControl 4.5.0 - MIT - - -(c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) - -Copyright (c) .NET Foundation and Contributors - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -System.IO.Packaging 4.6.0 - MIT +Microsoft.DotNet.PlatformAbstractions 3.1.6 - MIT (c) Microsoft Corporation. -Copyright (c) .NET Foundation. +Copyright (c) Andrew Arnott Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation +Copyright (c) 2012-2014, Yann Collet Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8056,7 +3730,7 @@ SOFTWARE. --------------------------------------------------------- -System.IO.Pipelines 6.0.1 - MIT +Microsoft.IO.Redist 6.0.0 - MIT (c) Microsoft Corporation. @@ -8126,105 +3800,88 @@ SOFTWARE. --------------------------------------------------------- -System.Management 4.5.0 - MIT +Microsoft.NET.StringTools 17.6.3 - MIT -(c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors +(c) Microsoft Corporation +Copyright (c) 2015 Christian Klutz Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -The MIT License (MIT) +MIT License -Copyright (c) .NET Foundation and Contributors +Copyright (c) -All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +--------------------------------------------------------- + +--------------------------------------------------------- + +Microsoft.TestPlatform.ObjectModel 17.10.0 - MIT + + +(c) Microsoft Corporation +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -System.Memory 4.5.4 - MIT +Microsoft.VisualStudio.Composition 16.1.8 - MIT (c) Microsoft Corporation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -The MIT License (MIT) +MIT License -Copyright (c) .NET Foundation and Contributors +Copyright (c) -All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +--------------------------------------------------------- + +--------------------------------------------------------- + +Microsoft.VisualStudio.Composition.NetFxAttributes 16.1.8 - MIT + + +(c) Microsoft Corporation. + +MIT License +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -System.Reactive 5.0 - MIT +Microsoft.VisualStudio.Validation 15.0.82 - MIT -Copyright (c) .NET Foundation and Contributors. -Copyright (c) .NET Foundation and Contributors. Rx Reactive Extensions Observable LINQ Events +(c) Microsoft Corporation. MIT License @@ -8240,9 +3897,46 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI --------------------------------------------------------- -System.Reflection.DispatchProxy 4.5.1 - MIT +Microsoft.Win32.SystemEvents 6.0.0 - MIT +(c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project +Copyright (c) .NET Foundation. +Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To +(c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation +Copyright (c) 2007 James Newton-King +Copyright (c) 2012-2014, Yann Collet +Copyright (c) 2013-2017, Alfred Klomp +Copyright (c) 2015-2017, Wojciech Mula +Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin +Portions (c) International Organization +Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. +Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski +Copyright (c) 2016-2017, Matthieu Darbois +Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). +Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen +Copyright (c) 2011 Novell, Inc (http://www.novell.com) +Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler +Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) +Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8273,35 +3967,107 @@ SOFTWARE. --------------------------------------------------------- -System.Reflection.Emit 4.6.0 - MIT +microsoft/vscode 8be8d96ab86ed4077df554eb62727484d454699f - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King +(c) Microsoft +copyrighted by Jordan +Copyright (c) 2008 Tim +Copyright Joyent, Inc. +Copyright (c) 2011 Jxck +Copyright (c) Microsoft +Copyright (c) 2014 Darin +Copyright (c) 2016 Waylon +Copyright (c) 2015 emilast +Copyright (c) 2018 Mozilla +Copyright (c) 2019 Borewit +Copyright (c) 2020 Borewit +Copyright (c) 2016 James Yu +Copyright (c) 2017 Emmet.io +Copyright (c) 2016 Microsoft +Copyright (c) 2017 Tim Jones +Copyright (c) 2022 Microsoft +Copyright (c) Microsoft 2018 +Copyright 2021 Trond Snekvik +Copyright (c) .NET Foundation +Copyright (c) 2008 Tim Harper +Copyright (c) 2014 Jesse Weed +Copyright (c) 2015 Permission +Copyright (c) 2016 David Rios +Copyright (c) 2019 Jeff Hykin +Copyright 2010 James Halliday +Copyright (c) 2014 GitHub Inc. +Copyright (c) 2015 David Owens +Copyright 2015 Mario Heiderich +Copyright (c) 2016 Waylon Flinn +Copyright (c) 2021 Michael Mims +Copyright (c) <2013> Permission +Copyright Microsoft Corporation +Copyright 2013-2018 Docker, Inc. +Copyright 2020, the Dart project +(c) Cure53 and other contributors +Copyright (c) 2014 Darin Morrison +Copyright (c) 2015 David Owens II +Copyright (c) 2022 REditorSupport +Copyright 2021 NVIDIA Corporation +Copyright (c) 2011 Fabrice Bellard +Copyright (c) 2016 .NET Foundation +Copyright (c) 2015 Colorsublime.com +Copyright (c) 2020 Dustin Pomerleau +Copyright (c) Microsoft Corporation +Copyright 2015 The Chromium Authors +Copyright (c) 2010- Mark McGranaghan +Copyright (c) 2015 Krzysztof Cieslak Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors +Copyright (c) 1997-2020 Jordan Russell +Copyright (c) 2018 Mozilla Corporation +Copyright Drifty Co. http://drifty.com +Copyright (c) 2009-2014 Jeremy Ashkenas +Copyright (c) 2014 The xterm.js authors +Copyright (c) daaain/Handlebars project +Copyright (c) 2008 Microsoft Corporation +Copyright (c) 2018 Takahiro Ethan Ikeuchi +Copyright (c) 2015 W3C(r) MIT, ERCIM, Keio +Copyright (c) sumneko-lua.tmbundle project +Copyright (c) textmate-ini.tmbundle project +copyrighted by the Free Software Foundation +Copyright (c) textmate-diff.tmbundle project +Copyright (c) textmate-html.tmbundle project +Copyright (c) textmate-make.tmbundle project +Copyright (c) textmate-perl.tmbundle project +Copyright (c) textmate-ruby.tmbundle project +Portions Copyright (c) 2000-2020 Martijn Laan Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS - -The MIT License (MIT) +Copyright (c) textmate-groovy.tmbundle project +Copyright (c) 1991, 1999 Free Software Foundation +Copyright (c) 2020 Free Software Foundation, Inc. +Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) 2010 Scott Kyle and Rasmus Andersson +Copyright (c) 2015 - present Microsoft Corporation +Copyright (c) 2016 - present Microsoft Corporation +Copyright (c) 2020 - present Microsoft Corporation +Copyright (c) textmate-asp.vb.net.tmbundle project +Copyright (c) textmate-javascript.tmbundle project +Copyright Joyent, Inc. and other Node contributors +Copyright (c) 2002-2020 K.Kosako +Copyright (c) 2015 W3C(r) (MIT, ERCIM, Keio, Beihang) +Copyright (c) 2012 Alex Sancho, http://alexsancho.name +Copyright (c) 2004, John Gruber http://daringfireball.net +Copyright (c) 2015 FichteFoll +Copyright (c) 2015-present MagicStack Inc. http://magic.io +Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/) +Copyright (c) 2014 - present, Travis Webb +Copyright (c) 2015 W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers +Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors +Copyright (c) 2011-2014, Christopher Jeffrey (https://github.com/chjj/) +Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/) +Copyright (c) Isaac Z. Schlueter and Contributors https://github.com/npm/node-semver +Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) https://github.com/chjj/term.js +Copyright (c) 2011-2022, Christopher Jeffrey. (MIT Licensed) https://github.com/markedjs/marked -Copyright (c) .NET Foundation and Contributors +MIT License -All rights reserved. +Copyright (c) 2015 - present Microsoft Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -8326,35 +4092,18 @@ SOFTWARE. --------------------------------------------------------- -System.Reflection.Emit 4.7.0 - MIT +MSTest.TestAdapter 2.0.0 - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +(c) Microsoft 2023 +(c) Microsoft Corporation +Copyright (c) Microsoft Corporation -The MIT License (MIT) +MSTest Framework -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation. All rights reserved. -All rights reserved. +MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -8379,35 +4128,18 @@ SOFTWARE. --------------------------------------------------------- -System.Reflection.Emit.ILGeneration 4.6.0 - MIT +MSTest.TestFramework 2.0.0 - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +(c) Microsoft 2023 +(c) Microsoft Corporation +Copyright (c) Microsoft Corporation -The MIT License (MIT) +MSTest Framework -Copyright (c) .NET Foundation and Contributors +Copyright (c) Microsoft Corporation. All rights reserved. -All rights reserved. +MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -8432,82 +4164,172 @@ SOFTWARE. --------------------------------------------------------- -System.Reflection.Emit.ILGeneration 4.7.0 - MIT +Nerdbank.Streams 2.10.69 - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors +(c) Andrew Arnott Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -The MIT License (MIT) +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------------------------- + +--------------------------------------------------------- + +Nerdbank.Streams 2.11.74 - MIT + +(c) Andrew Arnott Copyright (c) .NET Foundation and Contributors -All rights reserved. +MIT License -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------------------------- + +--------------------------------------------------------- + +Newtonsoft.Json 13.0.1 - MIT + + +Copyright James Newton-King 2008 +Copyright (c) 2007 James Newton-King +Copyright (c) James Newton-King 2008 +Copyright James Newton-King 2008 Json.NET + +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +--------------------------------------------------------- + +--------------------------------------------------------- + +Newtonsoft.Json 13.0.3 - MIT + + +Copyright James Newton-King 2008 +Copyright (c) 2007 James Newton-King +Copyright (c) James Newton-King 2008 +Copyright James Newton-King 2008 Json.NET + +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +--------------------------------------------------------- +--------------------------------------------------------- + +Perfolizer 0.2.1 - MIT + + + +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------- --------------------------------------------------------- -System.Reflection.Emit.Lightweight 4.6.0 - MIT +System.CodeDom 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8538,29 +4360,9 @@ SOFTWARE. --------------------------------------------------------- -System.Resources.Extensions 4.6.0 - MIT +System.ComponentModel.Composition 4.5.0 - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. -Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois -Copyright (c) .NET Foundation Contributors -Copyright (c) .NET Foundation and Contributors -Copyright (c) 2011 Novell, Inc (http://www.novell.com) -Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler -Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS The MIT License (MIT) @@ -8591,7 +4393,7 @@ SOFTWARE. --------------------------------------------------------- -System.Resources.Extensions 6.0.0 - MIT +System.Configuration.ConfigurationManager 6.0.0 - MIT (c) Microsoft Corporation. @@ -8661,23 +4463,79 @@ SOFTWARE. --------------------------------------------------------- -System.Runtime.CompilerServices.Unsafe 4.5.3 - MIT +System.Data.DataSetExtensions 4.5.0 - MIT + + + +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +--------------------------------------------------------- + +--------------------------------------------------------- + +System.Diagnostics.EventLog 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project +Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation +Copyright (c) 2007 James Newton-King +Copyright (c) 2012-2014, Yann Collet +Copyright (c) 2013-2017, Alfred Klomp +Copyright (c) 2015-2017, Wojciech Mula +Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski +Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8708,29 +4566,46 @@ SOFTWARE. --------------------------------------------------------- -System.Runtime.CompilerServices.Unsafe 4.7.1 - MIT +System.Drawing.Common 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8761,29 +4636,46 @@ SOFTWARE. --------------------------------------------------------- -System.Security.AccessControl 4.6.0 - MIT +System.Formats.Asn1 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8814,29 +4706,46 @@ SOFTWARE. --------------------------------------------------------- -System.Security.AccessControl 4.7.0 - MIT +System.IO.Packaging 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -8867,7 +4776,7 @@ SOFTWARE. --------------------------------------------------------- -System.Security.AccessControl 6.0.0 - MIT +System.Management 6.0.0 - MIT (c) Microsoft Corporation. @@ -8937,10 +4846,9 @@ SOFTWARE. --------------------------------------------------------- -System.Security.Cryptography.ProtectedData 4.5.0 - MIT +System.Memory 4.5.3 - MIT -(c) Microsoft Corporation. Copyright (c) 2011, Google Inc. (c) 1997-2005 Sean Eron Anderson. Copyright (c) 1991-2017 Unicode, Inc. @@ -8984,23 +4892,24 @@ SOFTWARE. --------------------------------------------------------- -System.Security.Permissions 4.5.0 - MIT +System.Memory 4.5.5 - MIT -(c) Microsoft Corporation. +(c) 2022 GitHub, Inc. +(c) Microsoft Corporation Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. +(c) 1997-2005 Sean Eron Anderson Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2015 The Chromium Authors Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. Copyright (c) 2004-2006 Intel Corporation Copyright (c) .NET Foundation Contributors Copyright (c) .NET Foundation and Contributors Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors +Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers The MIT License (MIT) @@ -9031,29 +4940,65 @@ SOFTWARE. --------------------------------------------------------- -System.Security.Principal.Windows 4.6.0 - MIT +System.Memory.Data 1.0.2 - MIT + + +(c) Microsoft Corporation. + +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------------------------- + +--------------------------------------------------------- + +System.Reflection.MetadataLoadContext 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9084,29 +5029,46 @@ SOFTWARE. --------------------------------------------------------- -System.Security.Principal.Windows 4.7.0 - MIT +System.Resources.Extensions 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet Copyright (c) 2013-2017, Alfred Klomp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9137,46 +5099,23 @@ SOFTWARE. --------------------------------------------------------- -System.Text.Encoding.CodePages 6.0.0 - MIT +System.Security.AccessControl 4.5.0 - MIT (c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin +Copyright (c) 1991-2017 Unicode, Inc. Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9207,7 +5146,7 @@ SOFTWARE. --------------------------------------------------------- -System.Threading.AccessControl 6.0.0 - MIT +System.Security.AccessControl 6.0.0 - MIT (c) Microsoft Corporation. @@ -9277,28 +5216,19 @@ SOFTWARE. --------------------------------------------------------- -System.Threading.Channels 4.7.1 - MIT +System.Security.Cryptography.ProtectedData 4.4.0 - MIT (c) Microsoft Corporation. -Copyright (c) .NET Foundation. -Copyright (c) 2011, Google Inc. (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2007 James Newton-King Copyright (c) 1991-2017 Unicode, Inc. -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors Copyright (c) .NET Foundation and Contributors Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS The MIT License (MIT) @@ -9330,29 +5260,50 @@ SOFTWARE. --------------------------------------------------------- -System.Threading.Tasks.Dataflow 4.11.1 - MIT +System.Security.Cryptography.ProtectedData 6.0.0 - MIT -(c) Microsoft Corporation. -Copyright (c) .NET Foundation. +(c) Microsoft Corporation +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright (c) .NET Foundation Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2020 Dan Shechter +(c) 1997-2005 Sean Eron Anderson +Copyright (c) 1998 Microsoft. To +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) 2005-2020 Rich Felker +Copyright (c) Microsoft Corporation Copyright (c) 2007 James Newton-King -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2012-2014, Yann Collet +Copyright (c) 1991-2020 Unicode, Inc. Copyright (c) 2013-2017, Alfred Klomp +Copyright 2012 the V8 project authors +Copyright (c) 2011-2020 Microsoft Corp Copyright (c) 2015-2017, Wojciech Mula Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2015 The Chromium Authors +Copyright (c) 2018 Alexander Chermyanin +Copyright (c) The Internet Society 1997 Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski Copyright (c) 2016-2017, Matthieu Darbois +Copyright (c) The Internet Society (2003) Copyright (c) .NET Foundation Contributors Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9383,46 +5334,23 @@ SOFTWARE. --------------------------------------------------------- -System.Threading.Tasks.Dataflow 6.0.0 - MIT +System.Security.Permissions 4.5.0 - MIT (c) Microsoft Corporation. -Copyright (c) Andrew Arnott -Copyright 2018 Daniel Lemire -Copyright 2012 the V8 project -Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. -Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 2017 Yoshifumi Kawai -Copyright (c) Microsoft Corporation -Copyright (c) 2007 James Newton-King -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2013-2017, Alfred Klomp -Copyright (c) 2015-2017, Wojciech Mula -Copyright (c) 2005-2007, Nick Galbreath -Copyright (c) 2018 Alexander Chermyanin +Copyright (c) 1991-2017 Unicode, Inc. Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. -Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation -Copyright (c) 2013-2017, Milosz Krajewski -Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors -Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors -Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com -Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. -Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS -Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. -Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9453,23 +5381,46 @@ SOFTWARE. --------------------------------------------------------- -System.Threading.Tasks.Extensions 4.5.4 - MIT +System.Security.Permissions 6.0.0 - MIT (c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project +Copyright (c) .NET Foundation. Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To (c) 1997-2005 Sean Eron Anderson. -Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation +Copyright (c) 2007 James Newton-King +Copyright (c) 2012-2014, Yann Collet +Copyright (c) 2013-2017, Alfred Klomp +Copyright (c) 2015-2017, Wojciech Mula +Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin Portions (c) International Organization Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski +Copyright (c) 2016-2017, Matthieu Darbois Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) @@ -9503,20 +5454,21 @@ SOFTWARE. System.ValueTuple 4.5.0 - MIT -(c) Microsoft Corporation. +(c) 2023 GitHub, Inc. +(c) Microsoft Corporation Copyright (c) 2011, Google Inc. -(c) 1997-2005 Sean Eron Anderson. +(c) 1997-2005 Sean Eron Anderson Copyright (c) 1991-2017 Unicode, Inc. +Copyright (c) 2015 The Chromium Authors Portions (c) International Organization -Copyright (c) 2015 The Chromium Authors. Copyright (c) 2004-2006 Intel Corporation Copyright (c) .NET Foundation Contributors Copyright (c) .NET Foundation and Contributors Copyright (c) 2011 Novell, Inc (http://www.novell.com) Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) -Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. -Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors +Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers The MIT License (MIT) @@ -9547,18 +5499,52 @@ SOFTWARE. --------------------------------------------------------- -vscode-html-languageservice 4.2.1 - MIT -https://github.com/Microsoft/vscode-html-languageservice#readme +System.Windows.Extensions 6.0.0 - MIT -Copyright (c) 2015 -Copyright (c) Microsoft -Copyright (c) Microsoft Corporation. -Copyright (c) 2007-2017 Einar Lielmanis, Liam Newman, and contributors. -Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors. + +(c) Microsoft Corporation. +Copyright (c) Andrew Arnott +Copyright 2018 Daniel Lemire +Copyright 2012 the V8 project +Copyright (c) .NET Foundation. +Copyright (c) 2011, Google Inc. +Copyright (c) 1998 Microsoft. To +(c) 1997-2005 Sean Eron Anderson. +Copyright (c) 2017 Yoshifumi Kawai +Copyright (c) Microsoft Corporation +Copyright (c) 2007 James Newton-King +Copyright (c) 2012-2014, Yann Collet +Copyright (c) 2013-2017, Alfred Klomp +Copyright (c) 2015-2017, Wojciech Mula +Copyright (c) 2005-2007, Nick Galbreath +Copyright (c) 2018 Alexander Chermyanin +Portions (c) International Organization +Copyright (c) 2015 The Chromium Authors. +Copyright (c) The Internet Society 1997. +Copyright (c) 2004-2006 Intel Corporation +Copyright (c) 2013-2017, Milosz Krajewski +Copyright (c) 2016-2017, Matthieu Darbois +Copyright (c) .NET Foundation Contributors +Copyright (c) The Internet Society (2003). +Copyright (c) .NET Foundation and Contributors +Copyright (c) 2019 Microsoft Corporation, Daan Leijen +Copyright (c) 2011 Novell, Inc (http://www.novell.com) +Copyright (c) 1995-2017 Jean-loup Gailly and Mark Adler +Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com) +Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. +Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com +Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc. +Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip. +Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang). Disclaimers THIS WORK IS PROVIDED AS +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. +Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass. To The MIT License (MIT) -Copyright (c) Microsoft +Copyright (c) .NET Foundation and Contributors + +All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9583,294 +5569,82 @@ SOFTWARE. --------------------------------------------------------- -vscode-jsonrpc 4.0.0 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-languageclient 5.2.1 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. -Copyright (c) Isaac Z. Schlueter and Contributors - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-languageserver-protocol 3.14.1 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-languageserver-textdocument 1.0.3 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-languageserver-types 3.14.0 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-languageserver-types 3.16.0 - MIT -https://github.com/Microsoft/vscode-languageserver-node#readme - -Copyright (c) Microsoft Corporation. - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-nls 5.0.0 - MIT -https://github.com/Microsoft/vscode-nls#readme - -Copyright (c) Microsoft Corporation. - -The MIT License (MIT) - -Copyright (c) Microsoft Corporation - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, -modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT -OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ---------------------------------------------------------- - ---------------------------------------------------------- - -vscode-test 1.3.0 - MIT -https://github.com/Microsoft/vscode-test#readme +Xunit.Combinatorial 1.3.2 - MS-PL -Copyright (c) Microsoft Corporation. -MIT License +Copyright Andrew Arnott +Copyright (c) Andrew Arnott +Copyright Andrew Arnott Adds -Copyright (c) Microsoft Corporation. All rights reserved. +Microsoft Public License (Ms-PL) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + 1. Definitions -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE + The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution. ---------------------------------------------------------- + 2. Grant of Rights ---------------------------------------------------------- + (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. -vscode-uri 3.0.2 - MIT -https://github.com/microsoft/vscode-uri#readme + (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. -Copyright (c) Microsoft -Copyright (c) Microsoft Corporation. -Copyright Joyent, Inc. and other Node contributors. + 3. Conditions and Limitations -The MIT License (MIT) + (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. -Copyright (c) Microsoft + (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. --------------------------------------------------------- --------------------------------------------------------- -xunit.runner.visualstudio 2.4.3 - MIT - - -Copyright (c) .NET Foundation -Copyright (c) 2015 .NET Foundation -Copyright (c) Outercurve Foundation -Copyright (c) .NET Foundation and Contributors. -Copyright (c) .NET Foundation xUnit.net Runner Utility -Copyright (c) .NET Foundation ,xUnit.net Runner Utility -Copyright (c) .NET Foundation 1xUnit.net Runner Utility -Copyright (c) .NET Foundation xUnit.net Runner Reporters -Copyright (c) .NET Foundation .xUnit.net Runner Reporters -Copyright (c) Outercurve Foundation WrapNonExceptionThrows RSDS -Copyright (c) .NET Foundation and Contributors. Visual Studio 2017 15.9+ Test Explorer +Xunit.Combinatorial 1.5.25 - MS-PL -Unless otherwise noted, the source code here is covered by the following license: - Copyright (c) .NET Foundation and Contributors - All Rights Reserved +(c) Andrew Arnott - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at +Microsoft Public License (Ms-PL) - http://www.apache.org/licenses/LICENSE-2.0 +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + 1. Definitions ------------------------ + The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution. -The code in src/xunit.runner.visualstudio/Utility/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions was imported from: - https://github.com/dotnet/core-setup/tree/v2.0.1/src/managed/Microsoft.DotNet.PlatformAbstractions + 2. Grant of Rights -The code in src/xunit.runner.visualstudio/Utility/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions was imported from: - https://github.com/dotnet/core-setup/tree/v2.0.1/src/managed/Microsoft.Extensions.DependencyModel + (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. -Both sets of code are covered by the following license: + (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. - The MIT License (MIT) + 3. Conditions and Limitations - Copyright (c) 2015 .NET Foundation + (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: + (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. + (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. + (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. --------------------------------------------------------- --------------------------------------------------------- -Xunit.Combinatorial 1.4.1 - MS-PL +Xunit.StaFact 1.2.46-alpha - MS-PL -Copyright Andrew Arnott -Copyright (c) Andrew Arnott -Copyright Andrew Arnott Adds +(c) Andrew Arnott Microsoft Public License (Ms-PL) diff --git a/NuGet.config b/NuGet.config index ad74bb028db..7a818f5f188 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + diff --git a/Razor.Slim.slnf b/Razor.Slim.slnf index 0563c409be2..0b7ce028aee 100644 --- a/Razor.Slim.slnf +++ b/Razor.Slim.slnf @@ -15,7 +15,6 @@ "src\\Compiler\\Microsoft.Net.Compilers.Razor.Toolset\\Microsoft.Net.Compilers.Razor.Toolset.csproj", "src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler.csproj", "src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler.csproj", - "src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim\\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj", "src\\Compiler\\test\\Microsoft.NET.Sdk.Razor.SourceGenerators.Tests\\Microsoft.NET.Sdk.Razor.SourceGenerators.Test.csproj", "src\\Compiler\\tools\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj", "src\\Compiler\\tools\\Microsoft.CodeAnalysis.Razor.Tooling.Internal\\Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj", diff --git a/Razor.sln b/Razor.sln index c9338fafeb3..9e4df49add7 100644 --- a/Razor.sln +++ b/Razor.sln @@ -100,10 +100,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor.Sou EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor.SourceGenerators.Test", "src\Compiler\test\Microsoft.NET.Sdk.Razor.SourceGenerators.Tests\Microsoft.NET.Sdk.Razor.SourceGenerators.Test.csproj", "{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj", "{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler.csproj", "{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler.csproj", "{A0867F6B-3DBB-4743-B241-F59878BFA15D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler.csproj", "{B040B919-D8E3-4656-BD85-88A541AA893D}" @@ -410,22 +406,6 @@ Global {BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.Release|Any CPU.Build.0 = Release|Any CPU {BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Release|Any CPU.Build.0 = Release|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Release|Any CPU.Build.0 = Release|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {A0867F6B-3DBB-4743-B241-F59878BFA15D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A0867F6B-3DBB-4743-B241-F59878BFA15D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A0867F6B-3DBB-4743-B241-F59878BFA15D}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -660,8 +640,6 @@ Global {FB7C870E-A173-4F75-BE63-4EF39C79A759} = {5B60F564-4AD7-4B70-A887-7D91496799A2} {F5017FD5-EA78-4CD2-A1B6-F534910683F8} = {AA4EE974-E765-4B97-AF35-F734BF9830F6} {BD96BB0F-84DE-4A5F-8832-C8EADA36F43A} = {AA4EE974-E765-4B97-AF35-F734BF9830F6} - {2CB7D554-49CE-45AC-97DF-7F8C597BDFA7} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3} - {9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3} {A0867F6B-3DBB-4743-B241-F59878BFA15D} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3} {B040B919-D8E3-4656-BD85-88A541AA893D} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3} {907EDA43-B4D9-40DA-BA07-8E00DD89FA33} = {FB7C870E-A173-4F75-BE63-4EF39C79A759} diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 17079041941..a9a7d5fd76a 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -66,6 +66,8 @@ extends: name: NetCore1ESPool-Svc-Internal image: 1es-windows-2022 os: windows + policheck: + enabled: true tsa: enabled: true configFile: '$(Build.SourcesDirectory)/eng/TSAConfig.gdntsa' diff --git a/docs/CollectionBestPractices.md b/docs/CollectionBestPractices.md new file mode 100644 index 00000000000..65e702dbbb6 --- /dev/null +++ b/docs/CollectionBestPractices.md @@ -0,0 +1,406 @@ +# Collection Best Practices in Razor + +- [Imperative Collections](#imperative-collections) +- [Immutable Collections](#immutable-collections) + - [Using Builders](#using-builders) + - [`ImmutableArray`](#immutablearrayt) + - [Using `ImmutableArray.Builder`](#using-immutablearraytbuilder) + - [Frozen Collections](#frozen-collections) +- [Array Pools](#array-pools) +- [Object Pools](#object-pools) +- [✨It’s Magic! `PooledArrayBuilder`](#its-magic-pooledarraybuildert) +- [Using LINQ](#using-linq) + - [Best Practices](#best-practices) +- [Meta Tips](#meta-tips) + +# Imperative Collections +- .NET provides many collection types with different characteristics for different purposes. +- The collections from the System.Collections namespace should be avoided. Never use these unless in some legacy scenario. +- The collections in System.Collections.Generic are considered the “work horse” collection types for .NET and are + suitable for most purposes. They have years of hardening that make them highly efficient choices for most work. +- Popular imperative collection types include the ones we all use on a regular basis `List`, `HashSet`, + `Dictionary`, `Stack`. +- System.Collections.Concurrent contains collections that are designed for use when thread-safety is needed. + In general, these should only be used in particular situations. + +> [!WARNING] +> **Beware of collection growth** +> +> The imperative collections generally have more internal storage than needed to allow more items to be added. (This is +> what is meant by "capacity” vs. “count”). When enough items are added, the internal storage will need to grow. This +> requires creating larger storage, releasing the previous storage for garbage collection, and copying the existing +> contents into it, which consumes CPU time. For a larger collection, this can potential happen many times, so it’s +> important to set the capacity up front to avoid unnecessary internal storage growth. + +> [!WARNING] +> **Avoid exposing collection interfaces** +> +> Avoid exposing collections directly via interfaces, such as `IReadOnlyList` and +> `IReadOnlyDictionary`. The primary reason for this is that these interfaces can result in allocations +> when they are foreach’d. In general, collections provide a struct enumerator that can be used to foreach that +> collection without allocating an `IEnumertor` on the heap. However, when going through a collection interface, +> there isn’t a struct enumerator, so an allocation is likely required to foreach. In fact, many collections, such as +> `List`, are implemented to just return their struct enumerator when accessed via collection interfaces, resulting +> in an allocation when the struct enumerator is boxed. +> - If exposing a collection is necessary, consider whether it might be better to expose a more optimal read-only +> collection. Instead of `IReadOnlyList`, consider [`ImmutableArray`](#immutablearrayt). +> - There aren’t many other options when an API calls for exposing an `IReadOnlyDictionary`. In these +> cases, consider whether it might be better to just avoid exposing the collection altogether and provide APIs that +> access it. Or, in some cases, it might be necessary to create entirely new collection types. (This is why Razor +> `TagHelperDescriptors` expose a `MetadataCollection`.) + +> [!WARNING] +> **Be mindful of ToArray()** +> +> Calling `ToArray()` on a collection will create a new array and copy content from the collection into it. So, when +> the exact capacity is known up front, it is an anti-pattern to create a `List` without that capacity, fill it +> with items and then call `ToArray()` at the end. This results in extra allocations that could be avoided by creating +> an array and filling it. + +# Immutable Collections +- The .NET immutable collections are provided by the System.Collections.Immutable NuGet package, which provides + implementations for .NET, .NET Framework, and .NET Standard 2.0. +- The collections in the System.Collections.Immutable namespace have a very specific purpose. They are intended to be + *persistent* data structures; that is, a data structure that always preserves the previous version of itself when it + is modified. Such data structures are effectively immutable, but in hindsight, maybe it would have been better for + this namespace to have been called, System.Collections.Persistent? + - The term “persistent data structure” was introduced by the 1986 paper, + “Making Data Structures Persistent” ([PDF](https://www.cs.cmu.edu/~sleator/papers/making-data-structures-persistent.pdf)). + - A highly influential book in the area of persistent data structures is “Purely Functional Data Structures” (1999) + by Chris Okasaki ([Amazon](https://www.amazon.com/Purely-Functional-Data-Structures-Okasaki/dp/0521663504)). + Okasaki’s original dissertation is available from CMU’s website ([PDF](https://www.cs.cmu.edu/~rwh/students/okasaki.pdf)). +- Because of their persistency, nearly all of the immutable collections have very different implementations than their + imperative counterparts. For example, `List` is implemented using an array, while `ImmutableList` is implemented + using a binary tree. +- Mutating methods on an immutable collection perform “non-destructive mutation”. Instead, of mutating the underlying + object, a mutating method like `Add` produces a new instance of the immutable collection. This is similar to how the + `String.Replace(...)` API is used. +- Significant effort has been made to ensure that immutable collections are as efficient as they can be. However, the + cost of persistence means that immutable collections are generally assumed to be slower than imperative counterparts. + +> [!CAUTION] +> +> Because the immutable collections are often implemented using binary trees to achieve persistence, the asymptotic +> complexity of standard operations can be very surprising. For example, `ImmutableDictionary` access is +> O(log n) rather than the usual O(1) that would be expected when accessing a hash table data structure, such as +> `Dictionary`. A similar difference in performance characteristics exists across the various collection +> types. The following table shows the complexity of accessing a few popular collections types using their indexer. +> +> | Immutable collection type | Complexity | Imperative collection type | Complexity | +> | ----------------------------------------- | ---------- | -------------------------------- | ---------- | +> | `ImmutableDictionary` | O(log n) | `Dictionary` | O(1) | +> | `ImmutableHashSet` | O(log n) | `HashSet` | O(1) | +> | `ImmutableList` | O(log n) | `List` | O(1) | +> | `ImmutableSortedDictionary` | O(log n) | `SortedDictionary` | O(log n) | + +> [!CAUTION] +> **ToImmutableX() extension methods are not “freeze” methods!** +> +> The System.Immutable.Collections package provides several extension methods that produce an immutable collection from +> an existing collection or sequence. These methods aren’t optimized to reuse the internal storage of other collections +> in any way. Because of this, the following code is an anti-pattern. In this example, each element is added to a +> `HashSet` and then the elements of that set are added to a new `ImmutableHashSet`. +> +> ```C# +> var array = new[] { "One", "Two", "Two", "One", "Three" }; +> var set = new HashSet(array).ToImmutableHashSet(); +> ``` + +## Using Builders +- When creating an immutable collection with a lot of mutation, use a builder. Builders are optimized to populate the + internal storage of an immutable collection. +- The following code achieves the expected result but inefficiently creates several intermediate `ImmutableList` + instances. + +```C# +ImmutableList CreateList() +{ + var list = ImmutableList.Empty; + for (var i = 0; i < 10; i++) + { + list = list.Add(i); + } + + return list; +} +``` + +- The version below populates an `ImmutableList.Builder` and creates just a single `ImmutableList` instance + at the end. + +```C# +ImmutableList CreateList() +{ + var builder = ImmutableList.CreateBuilder(); + + for (var i = 0; i < 10; i++) + { + builder.Add(i); + } + + return builder.ToImmutable(); +} +``` + +## `ImmutableArray` +- `ImmutableArray` is very different than the other immutable collections. It is the only struct collection type, + and is not optimized for persistence. (In hindsight, perhaps a more appropriate name would have been + `FrozenArray`?) +- `ImmutableArray` is a relatively simple struct that provides read-only access to an internal array. + +> [!WARNING] +> **Be aware of copies!** +> +> In order to maintain its immutability semantics, `ImmutableArray` *always* creates a copy of the array it is +> wrapping internally. If it didn’t, external changes to the array would be reflected in the `ImmutableArray`. +> +> Because a new array copy is created for every `ImmutableArray` it is important to be mindful of chaining methods +> that produce immutable arrays to avoid unnecessary intermediate array copies. +> +> In addition, as of System.Immutable.Collections 8.0.0, there is a new `ImmutableCollectionsMarshal` class that can +> provide access to the internal array of an `ImmutableArray` or to create an new `ImmutableArray` that wraps an +> existing array without copying. These can be used in high performance scenarios, but should be employed carefully to +> avoid introducing subtle bugs. + +- Because `ImmutableArray` is a struct that wraps a single field of a reference type, it is essentially free to copy + at runtime. However, this also leaves a bit of a usability wart because, as a struct, an `ImmutableArray` reference + can never be null, but it can has its default, zeroed-out value where the internal array reference is null. For this + reason, an `IsDefault` property is provided to check if an `ImmutableArray` is actually wrapping an array. +- `ImmutableArray` *can* be used as a persistent data structure via non-destructive mutation, but mutating methods + are generally implemented to copy the elements of the internal array. For example, `Add` will create a copy of the + internal array storage with an additional element and return it as an `ImmutableArray`. + +> [!NOTE] +> **A Little History** +> +> `ImmutableArray` was not part of System.Collections.Immutable when originally conceived. It was developed out of +> necessity by Roslyn to expose array data while avoiding the inherent problems of exposing an array. (At the time, +> .NET arrays didn’t even implement `IReadOnlyList`, which didn’t ship until .NET Framework 4.5.) +> System.Collections.Immutable itself was inspired by the many persistent data structures used internally by Roslyn and +> was intended to be used within Visual Studio for asynchronous code. However, the NuGet package became so popular that +> it was ultimately pulled into the .NET runtime. + +### Using `ImmutableArray.Builder` +- The Builder type for `ImmutableArray` provides a couple of features not provided by other immutable collection + builders. +- `ToImmutable()`: Like other builders, creates a new `ImmutableArray` that wraps a copy of the filled portion of + internal array buffer used by the builder. +- `MoveToImmutable()`: Creates a new `ImmutableArray` that wraps the internal array buffer used by the builder. Note + that this requires that the builder’s capacity is the same as its count. In other words, the builder’s internal array + buffer must be completely filled, or this will throw an `InvalidOperationException`. If the operation is successful, + the internal buffer is set to an empty array. +- `DrainToImmutable()`: This is sort of like a combination of `ToImmutable()` and `MoveToImmutable()`. This operation + “drains” the builder by checking if the capacity equals the count. If true, it returns a new `ImmutableArray` that + wraps the internal array buffer. If false, it returns a new `ImmutableArray` that wraps a copy of the filled + portion of the internal array buffer. In either case, the internal buffer is set to an empty array. + +> [!CAUTION] +> **Immutable collections as static data** +> +> Because of their performance characteristics, most of the immutable collections are *not* suitable for static +> collections. In fact, `ImmutableArray` is really the only immutable collection that should be used for static data, +> since accessing it is essentially the same as accessing an array. +> +> When creating a static lookup table it can be tempting to reach for an `ImmutableHashSet` or an +> `ImmutableDictionary`, but that temptation should be resisted! Lookup will always be slower than using +> he imperative counterpart because of the internal tree structures employed for immutable collections. +> +> There are several tricks that can be used to encapsulate imperative collections as static data. For example, a nested +> static class could hide a `HashSet` or `Dictionary` behind static methods that access the +> collections. However, a better solution available today is to use a [frozen collection](#Frozen-Collections). + +## Frozen Collections +- The System.Collections.Frozen namespace became available starting with version 8.0.0 of the + System.Collections.Immutable NuGet package. +- Currently, there are two frozen collection types: `FrozenSet` and `FrozenDictionary`. +- The frozen collections are not persistent; in fact, they can’t be mutated at all! Instead, frozen collections are + optimized for faster lookup operations — faster than their imperative counterparts. +- Frozen collections provide faster lookup by performing up-front analysis and selecting an optimal implementation for + the content. This means that they are much more expensive to create. +- Because of their higher creation cost and improved lookup performance, frozen collections are best suited for + static data. + +# Array Pools +- When a temporary array is needed to perform work and the lifetime of the array is bounded, consider acquiring a + pooled array. `ArrayPool` can be used to acquire an array of some minimum length that can be returned to the pool + when the work is done. + +> [!WARNING] +> **Be mindful of the array size!** +> +> The size of an array acquired from an `ArrayPool` is guaranteed to be at least as large as the minimum length that +> was requested. However, it is likely that a larger array will have been returned. So, care should be taken to avoid +> using the acquired array’s length, unless that’s what’s needed. + +- Razor provides a handful of helper extension methods that acquire pooled arrays and return them within the scope of a +using statement: + +```C# +var pool = ArrayPool.Shared; + +using (pool.GetPooledArray(minimumLength: 42, out var array) +{ + // When using array but be careful that array.Length >= minimumLength. +} + +using (pool.GetPooledArraySpan(minimumLength: 42, out var span) +{ + // span is array.AsSpan(0, minimumLength) to help avoid subtle bugs. +} +``` + +# Object Pools +- Razor provides object pooling facilities based on + [Microsoft.Extensions.ObjectPool](https://www.nuget.org/packages/Microsoft.Extensions.ObjectPool/) (which was + originally based on Roslyn’s `ObjectPool`) along with several premade pools for many collection types in the + [Microsoft.AspNetCore.Razor.PooledObjects](https://github.com/dotnet/razor/tree/5c0677ad275e64300b897de0f6e8856ebe13f07b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects) + namespace. These can be used to acquire temporary collections to use for work and return when finished. + +```C# +using var _ = ListPool.GetPooledObject(out var list); + +// Use list here. It'll be returned to the pool at the end of the using +// statement's scope. +``` + +- Pooled collections provide a couple of benefits. + 1. Pooled collections decrease pressure on the garbage collector by reusing collection instances. + 2. Pooled collections avoid growing a collection’s internal storage. For example, when the `List` acquired from + `ListPool` in the code sample above is returned to the pool, it will be cleared. However, the capacity of its + internal storage will only be trimmed if it is larger than 512. So, lists acquired from the pool are likely to + already have a larger capacity than needed for most work. + +> [!WARNING] +> **Don't allow pooled objects to escape their scope!** +> +> Consider the following code: +> +> ```C# +> List M() +> { +> using var _ = ListPool.GetPooledObject(out var list); +> +> // use list... +> +> return list; +> } +> ``` +> +> The compiler won't complain if a pooled `List` escapes its scope. In the code above, the `List` will be +> returned to the pool at the end of the using statement's scope but is returned from the method. This results +> several problems: +> +> 1. The list will be cleared when returned to the pool. So, the caller will find it to be empty. +> 2. If the caller adds items to the list, other code acquiring a pooled list might receive the mutated list! +> 3. Likewise, if the caller holds onto the list, other code acquiring a pooled list might receive the same list and +> mutate it! +> +> In essence, a pooled object that escapes its scope can corrupt the pool in came from. + +# ✨It’s Magic! `PooledArrayBuilder` + +- Razor’s [`PooledArrayBuilder`](https://github.com/dotnet/razor/blob/5c0677ad275e64300b897de0f6e8856ebe13f07b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder%601.cs) + is heavily inspired by Roslyn’s [`TemporaryArray`](https://github.com/dotnet/roslyn/blob/d176f9b5a7220cd95a6d5811ba1c49ac392a2fdc/src/Compilers/Core/Portable/Collections/TemporaryArray%601.cs). +- The important feature of this type (and the reason we’ve started using it all over Razor) is that it stores the first + 4 elements of the array being built inline as fields. After 4 elements have been added, it will acquire a pooled + `ImmutableArray.Builder`. This makes it extremely cheap to use for small arrays and reduces pressure on the object + pools. +- Because `PooledArrayBuilder` is a struct, it must be passed by-reference. Otherwise, any elements added by a method + it’s passed to won’t be reflected back at the call-site. +- To avoid writing buggy code that accidentally copies a `PooledArrayBuilder`, it is marked with a `[NonCopyable]` + attribute. A Roslyn analyzer tracks types decorated with that attribute and ensures that instances are never copied. +- Because `PooledArrayBuilder` _may_ acquire a pooled `ImmutableArray.Builder`, it is disposable and should + generally be created within a using statement. However, that makes it a bit more awkward to pass by reference, so a + special `AsRef()` extension method is provided. +- In the following code example, an `ImmutableArray.Builder` will never be acquired from the pool because the + `PooledArrayBuilder` only ever contains three elements. + +```C# +ImmutableArray BuildStrings() +{ + using var builder = new PooledArrayBuilder(); + AddElements(ref builder.AsRef()); + + return builder.DrainToImmutable(); +} + +void AddElements(ref PooledArrayBuilder builder) +{ + builder.Add("One"); + builder.Add("Two"); + builder.Add("Three"); +} +``` + +# Using LINQ +- LINQ (that is, LINQ to Objects) is a bit of a tricky subject. It has been used extensively throughout Razor for a long + time. It’s certainly not off limits but should be used with an understanding of the hidden costs: + - Every lambda expression represents at least one allocation — the delegate that holds it. + - A lambda that accesses variables or instance data from an outer scope will result in a closure being allocated each + time the delegate is invoked. + - Many LINQ methods allocate an iterator instance. + - Because Razor tooling runs in Visual Studio, it runs on .NET Framework and doesn’t benefit from many LINQ + optimizations made in modern .NET. + - Because LINQ methods target `IEnumerable` instances, they can trigger additional allocations depending on how + `GetEnumerator()` is implemented. For example, a simple call like `Queue.Any()` might seem innocuous—it doesn’t + even have a lambda! However, the implementation of + [`Enumerable.Any()`](https://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs,1288) on .NET + Framework doesn’t have any fast paths and simply calls `GetEnumerator()`. So, `Any()` boxes `Queue`’s struct + enumerator, resulting an allocation every time it’s called. In a tight loop, that could be disastrous! + - LINQ can obfuscate algorithmic complexity. It can be hard to see that introducing a LINQ expression has made an + algorithm O(n^2). + +## Best Practices +- Consider whether LINQ could have a negative performance impact for a particular scenario. Is this a hot path? Is it + happening in a loop? +- Always try to use static lambdas to ensure closures aren’t created and delegates are cached and reused. +- What collection type is being targeted? Do we have specialized LINQ methods that could be used? Razor provides a few + for `ImmutableArray` and `IReadOnlyList`. + +# Using Collection Expressions +- C# 12 introduced collection expressions as a language-level abstraction to generate collection-based code. It is a + goal of collection expressions to produce efficient code. +- Collection expressions are generally very good. They are especially helpful for combining collections or even query + expressions. + +```C# +int[] Combine(List list, HashSet set) +{ + return [..list, ..set]; +} + +int[] Squares(List list, HashSet set) +{ + return [ + ..from x in list select x * x, + ..from x in set select x * x + ]; +} +``` + +> [!WARNING] +> **Considerations when using collection expressions** +> +> - Sometimes, a collection expression might create a new temporary collection instance, such as a `List`. However, +> it will not acquire a temporary collection from Razor’s object pools ([SharpLab](https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0ATEBqAPgAQAYACfARhQG4BYAKHwGZSAmYgYWIG87jfSmAlgDsALgG0AusQCyACnIMAPMJEA+YgGcYARwCuMIWBgBKLjz4X8AdmJiAdHc079hmBJq0LAXzpegA=)). +> - There are pathological collection expressions to be avoided. For example, never use a collection expression to +> replace a call to `ImmutableArray.Builder.ToImmutable()` ([SharpLab](https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0ATEBqAPgAQAYACfARgDoBhCAG1pjABcBLCAOwGcKBJAWz4BXJgENgDANwBYAFD4AzKQBMxKsQDes4ttKL+Q0eJgBBKFBEBPADwt2TAHzEAsgApbTANoBdYiLOWASg0tHVCANz9iYEEWWgwYKGIAXmJ9YTEGU3MLalgRJhgAIRi4hJs7excA6RlQ0OjY+KgKYwwMACURdgBzGBc/bOqQuuJhuvwAdmIPCgookqavGtCAX1kVoA=)). +> When using a collection expression in a new scenario or with an uncommon type, it's a good idea to try it out on +> https://sharplab.io first. + +- Empty collection expression generally produces very efficient code and can be used without concern ([SharpLab](https://sharplab.io/#v2:EYLgtghglgdgPgAQEwEYCwAoBAGABAlAOgGEB7AG3IFMBjAFylJgGcBuTHfFAFnazwIkK1eoxaEAkmDABXOhGDU+nQQBlYAR2UCiAJRkwGYKkLAAHKNQBOAZSpWAblBpU2mDgGZ8SXMVwBvTFxg/C8EblwAWQAKAEoAoJCkgDkUaIBRGBljKwVqQnTzOgBPAB5YOgA+ONi+JJS0gEErXOKCorKK6tjaxPrcVOiAbQBdXox+4OSkYbG6yeSPWfGkgF8+3A2EMIjBgg9yw0rcZioNGSoYF3jAiZD1u+CtnYGZqVl5RSpm1sOq3AgLQgxRuGweSWe+F2S2IMmYdFIYF0VAgABMAPIwcjFdTw3DkKDw0GPXAPB6YIZkSi0BhMABCMksqPs0RKZiopAAZtFYfDEci0Zjsbi6LEADS4ABExCsKLoVElsRGnhOKOoqO8vjhCKRKIxWJxhLo0TMgIgYGYuAF+uxNlNMD+xwcEHIF2Y8RAuAk1qFhvhjswtySZisUGd8twsrRTGxuAqo1wAH1na7XLgALy4FNuwgAFVIP2BcT4kIquDoAAtCUMy7BmQAPEYZ47Jl1umswBsjebBbZxwy+UgGOjNpPZ1yEVSXADmlZLJL7Eky2XsEARVkduAA4lQ6MucmvSFY4hsg5NOUeUTQK7hos6rFm21R+2On+6Nkkz5MQgQUPgAOyPqmPb1OC9zuCSS5ZAe65cB4hA7nu0GruuJ4kkk6bHIh+4oUexYQUkfYEAAbFqfK6oKBoir4UbytEPoGnaEAOl0Jz2rEH4hJhuAwFQADu0TMOxfCrEAA=)). +- It is expected that collection expressions will improve over time. At the time of writing, there are + [several open issues](https://github.com/dotnet/roslyn/issues?q=is%3Aissue+is%3Aopen+%22collection+expression%22+label%3AArea-Compilers+label%3A%22Code+Gen+Quality%22) + tracking collection expression enhancements. + +# Meta Tips + +- Always be aware of the memory layout, features, and performance characteristics of the data structure you are using. +- If you have an implementation question for a .NET collection type, check out the source code using the + [.NET Source Browser](https://source.dot.net/) for modern .NET, or the + [.NET Framework Reference Source](https://referencesource.microsoft.com/). And of course, the .NET runtime repo is + available at [dotnet/runtime](https://github.com/dotnet/runtime). +- Several reflection-based tools exist for exploring .NET assemblies, such as + [ILSpy](https://github.com/icsharpcode/ILSpy) or dotPeek (from JetBrains). +- Use https://sharplab.io to see how code will be compiled. This can be especially useful for collection expressions, + which are usually very efficient do have pathological cases to avoid. \ No newline at end of file diff --git a/docs/Parsing.md b/docs/Parsing.md index a5208c9e525..ead3c502d21 100644 --- a/docs/Parsing.md +++ b/docs/Parsing.md @@ -58,4 +58,6 @@ CSharpCode Literal: ^^^\r\n ``` -In this way we keep the whitespace as belonging to the overall CSharpCode node, but don't make it part of the directive itself, ensuring the editor sees the correct length for the directive. \ No newline at end of file +In this way we keep the whitespace as belonging to the overall CSharpCode node, but don't make it part of the directive itself, ensuring the editor sees the correct length for the directive. + +We apply a very similar fix to `@using` directives, to ensure that the newline is treated as metacode of the overall block, rather than being a part of the `using` itself. \ No newline at end of file diff --git a/docs/ProjectsAndLayering.md b/docs/ProjectsAndLayering.md index 29c85730d64..e95f1b8efbe 100644 --- a/docs/ProjectsAndLayering.md +++ b/docs/ProjectsAndLayering.md @@ -119,7 +119,7 @@ target the broadest set of frameworks. - Microsoft.AspNetCore.Razor.Test.MvcShim (`net8.0`;`net472`) - Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib (`netstandard2.0`) - Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X (`net8.0`;`net472`) -- Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X (`net8.0`;`net4720`) +- Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X (`net8.0`;`net472`) ### Tooling Core Tests diff --git a/eng/AfterSigning.targets b/eng/AfterSigning.targets index e334d9498ec..68095f7bcf0 100644 --- a/eng/AfterSigning.targets +++ b/eng/AfterSigning.targets @@ -1,6 +1,6 @@  - + $(ArtifactsDir)VSSetup\ Microsoft.VisualStudio.RazorExtension.vsix @@ -27,7 +27,7 @@ AfterTargets="GenerateVisualStudioInsertionManifests" Inputs="$(_RazorAssemblyVersion)" Outputs="$(_DependentAssemblyVersionsFile)" - Condition="'$(OS)'=='WINDOWS_NT' AND '$(ArcadeBuildFromSource)' != 'true'"> + Condition="'$(OS)'=='WINDOWS_NT' AND '$(DotNetBuildSourceOnly)' != 'true'"> <_AssemblyVersionEntry Include="RazorRuntimeAssembly" /> <_AssemblyVersionEntry Include="RazorToolingAssembly" /> diff --git a/eng/Publishing.props b/eng/Publishing.props index 3df1479c419..9344f044ddc 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -27,7 +27,7 @@ - + false diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 88ed2343575..233097c5be7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,87 +6,87 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 9ae78a4e6412926d19ba97cfed159bf9de70b538 + 0b091fc31f5379aa6f70be1436c17fc24d4416fe - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 - + https://github.com/dotnet/roslyn - cf82d399c36008e7936d545cde24141f8d3790fa + 7b7951aa13c50ad768538e58ed3805898b058928 @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + 04b9022eba9c184a8036328af513c22e6949e8b6 - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + 04b9022eba9c184a8036328af513c22e6949e8b6 diff --git a/eng/Versions.props b/eng/Versions.props index 17f66d15c16..35cef04b537 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,8 +30,8 @@ imported. This OK because we want to just have an obvious salt for a local build. --> - 17.12.2 - 17.12 + 17.13.1 + 17.13 $(AddinMajorVersion) $(AddinVersion).$(OfficialBuildId) $(AddinVersion).42424242.42 @@ -49,29 +49,29 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24352.2 + 10.0.0-alpha.1.24473.1 + 9.0.0-beta.24466.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 - 4.12.0-1.24379.11 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 + 4.12.0-3.24466.4 diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 62900e12b21..9a0e1f2b456 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -19,11 +19,9 @@ case "$compiler" in # clangx.y or clang-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" - if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then - minorVersion=0; - fi + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" compiler=clang ;; @@ -31,7 +29,9 @@ case "$compiler" in # gccx.y or gcc-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" compiler=gcc ;; esac @@ -49,12 +49,10 @@ check_version_exists() { desired_version=-1 # Set up the environment to be used for building with the desired compiler. - if command -v "$compiler-$1.$2" > /dev/null; then - desired_version="-$1.$2" - elif command -v "$compiler$1$2" > /dev/null; then - desired_version="$1$2" - elif command -v "$compiler-$1$2" > /dev/null; then - desired_version="-$1$2" + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" fi echo "$desired_version" @@ -75,7 +73,7 @@ set_compiler_version_from_CC() { fi # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. - IFS=. read -r majorVersion minorVersion _ < /dev/null; then - echo "Error: No usable version of $compiler found." + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." exit 1 fi CC="$(command -v "$compiler" 2> /dev/null)" CXX="$(command -v "$cxxCompiler" 2> /dev/null)" set_compiler_version_from_CC - else - if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ] && { [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; }; then - # If a major version was provided explicitly, and it was too old, find a newer compiler instead - if ! command -v "$compiler" > /dev/null; then - echo "Error: Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." - exit 1 - fi - - CC="$(command -v "$compiler" 2> /dev/null)" - CXX="$(command -v "$cxxCompiler" 2> /dev/null)" - set_compiler_version_from_CC - fi fi else - desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" + desired_version="$(check_version_exists "$majorVersion")" if [ "$desired_version" = "-1" ]; then - echo "Error: Could not find specific version of $compiler: $majorVersion $minorVersion." + echo "Error: Could not find specific version of $compiler: $majorVersion." exit 1 fi fi diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 4ff587ca46a..90b58e32a87 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -42,6 +42,7 @@ try { --azdev-pat "$AzdoToken" ` --bar-uri "$MaestroApiEndPoint" ` --ci ` + --verbose ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 0c2928d5c79..3d16b41c78c 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,8 +1,22 @@ +parameters: +# Sbom related params + enableSbom: true + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + jobs: - template: /eng/common/core-templates/job/job.yml parameters: is1ESPipeline: true + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + publishArtifacts: false + # publish artifacts # for 1ES managed templates, use the templateContext.output to handle multiple outputs. templateContext: diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8da477dd69f..07d317bf8f9 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -19,71 +19,63 @@ jobs: steps: - ${{ each step in parameters.steps }}: - ${{ step }} - + componentGovernanceSteps: - - template: /eng/common/templates/steps/component-governance.yml - parameters: - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/templates/steps/generate-sbom.yml - parameters: - PackageVersion: ${{ parameters.packageVersion }} - BuildDropPath: ${{ parameters.buildDropPath }} - publishArtifacts: false - + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} artifactPublishSteps: - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: false - args: - displayName: Publish pipeline artifacts - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - publishLocation: Container - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml - parameters: - is1ESPipeline: false - args: - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' - artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: 'Publish logs' - continueOnError: true - condition: always() - sbomEnabled: false # we don't need SBOM for logs - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: false args: - displayName: Publish Logs - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' publishLocation: Container - artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} continueOnError: true condition: always() - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml parameters: is1ESPipeline: false args: - targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' - artifactName: 'BuildConfiguration' - displayName: 'Publish build retry configuration' + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' continueOnError: true - sbomEnabled: false # we don't need SBOM for BuildConfiguration + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 0430b2b4e1f..a6e0ca56f8e 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -28,8 +28,8 @@ ], "vsBranch": "main", "vsMajorVersion": 17, - "insertionCreateDraftPR": false, - "insertionTitlePrefix": "[d17.12 P2]" + "insertionCreateDraftPR": true, + "insertionTitlePrefix": "[d17.13 P1]" }, "release/dev17.6": { "nugetKind": [ @@ -92,10 +92,10 @@ "Shipping", "NonShipping" ], - "vsBranch": "rel/d17.12", + "vsBranch": "main", "vsMajorVersion": 17, "insertionCreateDraftPR": false, - "insertionTitlePrefix": "[d17.12 P1]" + "insertionTitlePrefix": "[d17.12 P3]" } } } diff --git a/eng/configure-toolset.sh b/eng/configure-toolset.sh index ea92acd6a37..d2960729c45 100644 --- a/eng/configure-toolset.sh +++ b/eng/configure-toolset.sh @@ -2,6 +2,6 @@ # We could potentially try to find an existing installation that has all the required runtimes, # but it's unlikely one will be available. -if [ "${DotNetBuildFromSource:-false}" = false ]; then +if [ "${DotNetBuildSourceOnly:-false}" = false ]; then use_installed_dotnet_cli="false" fi diff --git a/eng/scripts/ci-source-build.sh b/eng/scripts/ci-source-build.sh index e5a239038f2..ab089ab3804 100755 --- a/eng/scripts/ci-source-build.sh +++ b/eng/scripts/ci-source-build.sh @@ -9,7 +9,7 @@ set -euo pipefail scriptroot="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" reporoot="$(dirname "$(dirname "$scriptroot")")" -export DotNetBuildFromSource='true' +export DotNetBuildSourceOnly='true' # Build repo tasks "$reporoot/eng/common/build.sh" --restore --build --ci --configuration Release /p:ProjectToBuild=$reporoot/eng/tools/RepoTasks/RepoTasks.csproj "$@" diff --git a/eng/targets/Services.props b/eng/targets/Services.props index e4ce786f254..0501df0e116 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -25,6 +25,13 @@ + + + + + + + diff --git a/global.json b/global.json index dc713863c68..ee427b672b0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "9.0.100-preview.5.24307.3", + "dotnet": "9.0.100-rc.1.24452.12", "runtimes": { "dotnet": [ "2.1.30", @@ -17,12 +17,12 @@ } }, "sdk": { - "version": "9.0.100-preview.5.24307.3", + "version": "9.0.100-rc.1.24452.12", "allowPrerelease": false, "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24352.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24466.2", "Microsoft.Build.NoTargets": "3.7.0" } } diff --git a/src/Analyzers/Directory.Build.props b/src/Analyzers/Directory.Build.props index 6bcdb3f9857..d27caa04acd 100644 --- a/src/Analyzers/Directory.Build.props +++ b/src/Analyzers/Directory.Build.props @@ -14,7 +14,7 @@ LatestMajor - + diff --git a/src/Analyzers/Razor.Diagnostics.Analyzers/Razor.Diagnostics.Analyzers.csproj b/src/Analyzers/Razor.Diagnostics.Analyzers/Razor.Diagnostics.Analyzers.csproj index 44ae5fb263a..345b7c9363f 100644 --- a/src/Analyzers/Razor.Diagnostics.Analyzers/Razor.Diagnostics.Analyzers.csproj +++ b/src/Analyzers/Razor.Diagnostics.Analyzers/Razor.Diagnostics.Analyzers.csproj @@ -4,7 +4,7 @@ netstandard2.0 false true - false + false false diff --git a/src/Compiler/Directory.Build.props b/src/Compiler/Directory.Build.props index 763964e802d..a88dd817d68 100644 --- a/src/Compiler/Directory.Build.props +++ b/src/Compiler/Directory.Build.props @@ -37,7 +37,7 @@ $(WarningsNotAsErrors);xUnit1004 - + diff --git a/src/Compiler/Directory.Packages.props b/src/Compiler/Directory.Packages.props index 7154276a074..d451245fac9 100644 --- a/src/Compiler/Directory.Packages.props +++ b/src/Compiler/Directory.Packages.props @@ -1,7 +1,7 @@  <_RoslynPackageVersion>4.9.2 - <_RoslynPackageVersion Condition="'$(DotNetBuildFromSource)' == 'true'">$(MicrosoftCodeAnalysisCommonPackageVersion) + <_RoslynPackageVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(MicrosoftCodeAnalysisCommonPackageVersion) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectDirectiveTest.cs index 7e6aa260415..979fa3ed96a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectDirectiveTest.cs @@ -181,6 +181,9 @@ private RazorEngine CreateEngine() // Notice we're not registering the InjectDirective.Pass here so we can run it on demand. b.AddDirective(InjectDirective.Directive); b.AddDirective(ModelDirective.Directive); + + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); }).Engine; } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectTargetExtensionTest.cs index 539b9e8779d..24f1b3856ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/InjectTargetExtensionTest.cs @@ -19,7 +19,7 @@ public void InjectDirectiveTargetExtension_WritesProperty() { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: false); var node = new InjectIntermediateNode() { TypeName = "PropertyType", @@ -43,7 +43,7 @@ public void InjectDirectiveTargetExtension_WritesPropertyWithLinePragma_WhenSour { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: true); var node = new InjectIntermediateNode() { TypeName = "PropertyType", diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 045fc2ee3af..88bd6ed87e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -66,7 +66,31 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); + } + + [Fact] + public void IncompleteDirectives_Runtime() + { + // Arrange + AddCSharpSyntaxTree(@" +public class MyService +{ + public string Html { get; set; } +}"); + + var projectItem = CreateProjectItemFromFile(); + + // Act + var compiled = CompileToCSharp(projectItem, designTime: false); + + // Assert + AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertSourceMappingsMatchBaseline(compiled.CodeDocument); + + // We expect this test to generate a bunch of errors. + Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Length > 0); } [Fact] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelDirectiveTest.cs index a5463295fc4..a25aa7a61c3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelDirectiveTest.cs @@ -250,11 +250,14 @@ private RazorEngine CreateEngineCore(bool designTime = false) { return CreateProjectEngine(b => { - // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. - b.AddDirective(ModelDirective.Directive); + // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. + b.AddDirective(ModelDirective.Directive); - // There's some special interaction with the inherits directive - InheritsDirective.Register(b); + // There's some special interaction with the inherits directive + InheritsDirective.Register(b); + + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); b.Features.Add(new DesignTimeOptionsFeature(designTime)); }).Engine; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs index 86ac59f29a5..65cf0356c4b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/ModelExpressionPassTest.cs @@ -156,6 +156,8 @@ private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers) return RazorProjectEngine.Create(b => { b.Features.Add(new TestTagHelperFeature(tagHelpers)); + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); }).Engine; } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index 253d706c049..df783862963 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -60,3 +60,6 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index c87e4aaf402..65462825454 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,9 +1,10 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "844eb91b909a14b78feddd5e6866563b5a75e021" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c83d1c26cf039a87fc6aedc860fd9d28a34d96dfb2e405e6af3918602ca27755" // #pragma warning disable 1591 +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] namespace AspNetCore { - #line hidden + #line default using System; using System.Collections.Generic; using System.Linq; @@ -11,31 +12,38 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + #line default + #line hidden + [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"Sha256", @"c83d1c26cf039a87fc6aedc860fd9d28a34d96dfb2e405e6af3918602ca27755", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage { #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { - BeginContext(83, 4, true); - WriteLiteral("\r\n\r\n"); - EndContext(); - BeginContext(93, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(102, 4, true); + WriteLiteral("\r\n"); WriteLiteral("\r\n\r\n"); - EndContext(); - BeginContext(113, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(123, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(150, 2, true); WriteLiteral("\r\n"); - EndContext(); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#line (8,9)-(8,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden + Member___UniqueIdSuppressedForTesting__ { get; private set; } +#line (7,9)-(7,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#line (6,8)-(6,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt index 34210018b66..d70ab96ce6e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt @@ -1,6 +1,6 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ9999: The 'model' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ9999: The 'model' directive may only occur once per document. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ9999: The 'model' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ9999: The 'inject' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ9999: The 'inject' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ9999: The 'inject' directive expects an identifier. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ1013: The 'model' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ2001: The 'model' directive may only occur once per document. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ1013: The 'model' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ1013: The 'inject' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ1013: The 'inject' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ1015: The 'inject' directive expects an identifier. diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index e1132db9c42..b7aa37e1698 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,56 +1,43 @@ Document - + RazorCompiledItemAttribute - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + RazorSourceChecksumAttribute - + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync - CSharpCode - - IntermediateToken - - CSharp - BeginContext(83, 4, true); - HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml) - IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) + LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (87:2,0 [6] IncompleteDirectives.cshtml) - model - CSharpCode - - IntermediateToken - - CSharp - BeginContext(93, 2, true); + CSharpCode - (93:2,6 [0] IncompleteDirectives.cshtml) + LazyIntermediateToken - (93:2,6 [0] IncompleteDirectives.cshtml) - CSharp - HtmlContent - (93:2,6 [2] IncompleteDirectives.cshtml) - IntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (95:3,0 [7] IncompleteDirectives.cshtml) - model - CSharpCode - - IntermediateToken - - CSharp - BeginContext(102, 4, true); + DirectiveToken - (102:3,7 [0] IncompleteDirectives.cshtml) - HtmlContent - (102:3,7 [4] IncompleteDirectives.cshtml) - IntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n MalformedDirective - (106:5,0 [7] IncompleteDirectives.cshtml) - inject - CSharpCode - - IntermediateToken - - CSharp - BeginContext(113, 2, true); + CSharpCode - (113:5,7 [0] IncompleteDirectives.cshtml) + LazyIntermediateToken - (113:5,7 [0] IncompleteDirectives.cshtml) - CSharp - HtmlContent - (113:5,7 [2] IncompleteDirectives.cshtml) - IntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (115:6,0 [8] IncompleteDirectives.cshtml) - inject - CSharpCode - - IntermediateToken - - CSharp - BeginContext(123, 2, true); + DirectiveToken - (123:6,8 [0] IncompleteDirectives.cshtml) - HtmlContent - (123:6,8 [2] IncompleteDirectives.cshtml) - IntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (125:7,0 [25] IncompleteDirectives.cshtml) - inject DirectiveToken - (133:7,8 [17] IncompleteDirectives.cshtml) - MyService - CSharpCode - - IntermediateToken - - CSharp - BeginContext(150, 2, true); HtmlContent - (150:7,25 [2] IncompleteDirectives.cshtml) - IntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n + Inject - + Inject - + Inject - Inject - Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt new file mode 100644 index 00000000000..8fa27285b80 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt @@ -0,0 +1,15 @@ +Source Location: (133:7,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|MyService| +Generated Location: (1895:33,0 [9] ) +|MyService| + +Source Location: (123:6,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|| +Generated Location: (2124:39,0 [0] ) +|| + +Source Location: (113:5,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|| +Generated Location: (2261:43,0 [0] ) +|| + diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt index d5b4619212a..5e900403c4c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt @@ -1,13 +1,13 @@ Document - RazorCompiledItemAttribute - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt index 95f1b3114ee..615ba7cccaf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt @@ -1,13 +1,13 @@ Document - RazorCompiledItemAttribute - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt index ebc3d5ac1a4..023c02254e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt @@ -1,13 +1,13 @@ Document - RazorCompiledItemAttribute - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs index 7ea5db9a39c..431c1ffef9a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs @@ -19,7 +19,7 @@ public void Execute_NoOps_IfNamespaceNodeIsMissing() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new AssemblyAttributeInjectionPass @@ -40,7 +40,7 @@ public void Execute_NoOps_IfNamespaceNodeHasEmptyContent() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode() { Content = string.Empty }; @@ -66,7 +66,7 @@ public void Execute_NoOps_IfClassNameNodeIsMissing() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); @@ -93,7 +93,7 @@ public void Execute_NoOps_IfClassNameIsEmpty() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -134,7 +134,7 @@ public void Execute_NoOps_IfDocumentIsNotViewOrPage() var irDocument = new DocumentIntermediateNode { DocumentKind = "Default", - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "SomeNamespace" }; @@ -170,7 +170,7 @@ public void Execute_NoOps_ForDesignTime() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDesignTimeDefault(), + Options = RazorCodeGenerationOptions.DesignTimeDefault, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -217,7 +217,7 @@ public void Execute_AddsRazorViewAttribute_ToViews() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -270,7 +270,7 @@ public void Execute_EscapesViewPathWhenAddingAttributeToViews() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -323,7 +323,7 @@ public void Execute_AddsRazorPagettribute_ToPage() var irDocument = new DocumentIntermediateNode { DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var pageDirective = new DirectiveIntermediateNode @@ -383,7 +383,7 @@ public void Execute_EscapesViewPathAndRouteWhenAddingAttributeToPage() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectDirectiveTest.cs index effa4c063c9..b7047f670eb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectDirectiveTest.cs @@ -180,6 +180,9 @@ private RazorEngine CreateEngine() // Notice we're not registering the InjectDirective.Pass here so we can run it on demand. b.AddDirective(InjectDirective.Directive); b.AddDirective(ModelDirective.Directive); + + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); }).Engine; } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectTargetExtensionTest.cs index 261c65ddb8a..b6ea922e104 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InjectTargetExtensionTest.cs @@ -17,7 +17,7 @@ public void InjectDirectiveTargetExtension_WritesProperty() { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: false); var node = new InjectIntermediateNode() { TypeName = "PropertyType", @@ -41,7 +41,7 @@ public void InjectDirectiveTargetExtension_WritesPropertyWithLinePragma_WhenSour { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: false); var node = new InjectIntermediateNode() { TypeName = "PropertyType", diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs index d5ac8364cc5..40723f0f28f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs @@ -18,7 +18,7 @@ public void InstrumentationPass_NoOps_ForDesignTime() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDesignTimeDefault(), + Options = RazorCodeGenerationOptions.DesignTimeDefault, }; var builder = IntermediateNodeBuilder.Create(document); @@ -50,7 +50,7 @@ public void InstrumentationPass_InstrumentsHtml() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -89,7 +89,7 @@ public void InstrumentationPass_SkipsHtml_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -121,7 +121,7 @@ public void InstrumentationPass_InstrumentsCSharpExpression() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -157,7 +157,7 @@ public void InstrumentationPass_SkipsCSharpExpression_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -188,7 +188,7 @@ public void InstrumentationPass_SkipsCSharpExpression_InsideTagHelperAttribute() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -239,7 +239,7 @@ public void InstrumentationPass_SkipsCSharpExpression_InsideTagHelperProperty() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -290,7 +290,7 @@ public void InstrumentationPass_InstrumentsTagHelper() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -321,7 +321,7 @@ public void InstrumentationPass_SkipsTagHelper_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs index bc3aa19c9c1..4f0c1e71fab 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -85,7 +85,7 @@ public class MyService AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] @@ -536,7 +536,7 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelDirectiveTest.cs index 7933b1306cc..2072edc3f10 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelDirectiveTest.cs @@ -250,11 +250,14 @@ private RazorEngine CreateEngineCore(bool designTime = false) { return CreateProjectEngine(b => { - // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. - b.AddDirective(ModelDirective.Directive); + // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. + b.AddDirective(ModelDirective.Directive); - // There's some special interaction with the inherits directive - InheritsDirective.Register(b); + // There's some special interaction with the inherits directive + InheritsDirective.Register(b); + + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); b.Features.Add(new DesignTimeOptionsFeature(designTime)); }).Engine; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelExpressionPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelExpressionPassTest.cs index 0d31134cc5d..6e73dad9cde 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelExpressionPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/ModelExpressionPassTest.cs @@ -154,6 +154,8 @@ private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers) return RazorProjectEngine.Create(b => { b.Features.Add(new TestTagHelperFeature(tagHelpers)); + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); }).Engine; } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt index a6d32e3df08..6a6d15050ed 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index dd224f999b7..8831c20bbbc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -76,6 +76,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 7c3e56d4eb1..9760efcc988 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -50,6 +50,22 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete EndContext(); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#line (12,9)-(12,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden + Member___UniqueIdSuppressedForTesting__ { get; private set; } +#line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#line (10,8)-(10,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index e19bd0c0c47..d545eb7abd8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync @@ -91,6 +91,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt index 9ad5ce18472..e40f593eea4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt index e8de5419468..895b487c4ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt index 20f170ad27e..0c8279e61fb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt index 1ff05218558..07b5f5631f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt index 510d1b3f9bd..802e3724b7f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt index 46048ea0442..91c685e14a9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt index b4023f0b6d3..4bd837546da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs index af9cb84cea6..65503cb77d7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs @@ -49,7 +49,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre WriteLiteral("\r\n"); EndContext(); BeginContext(66, 25, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre WriteLiteral("\r\n"); EndContext(); BeginContext(93, 27, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt index 41aa60b9d18..483624f29d5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt index 80688598805..c060edad9c3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt index 026e6ab7e32..82fd3a2d299 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml", typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace), null)] NamespaceDeclaration - - Test.Namespace - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt index 17420a85865..c40b55ec971 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs index 766dbb8c493..fe6f956bd90 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs @@ -13,7 +13,7 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; -#line (4,2)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" +#line (4,2)-(4,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt index ff0716d0aca..369288d914a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt @@ -3,14 +3,14 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"/About")] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (36:3,1 [43] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (36:3,1 [41] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - (6:0,6 [8] RazorPagesWithRouteTemplate.cshtml) RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs index 0b2b650d335..01dda34441a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs @@ -13,7 +13,7 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; -#line (4,2)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" +#line (4,2)-(4,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n

New Customer

\r\n
\r\n "); EndContext(); BeginContext(456, 31, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -78,7 +78,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(493, 237, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(517, 48, true); WriteLiteral("\r\n \r\n "); EndContext(); BeginContext(588, 130, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(611, 101, true); WriteLiteral("\r\n \r\n \r\n "); EndContext(); @@ -132,12 +132,12 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(736, 174, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(760, 10, true); WriteLiteral("\r\n "); EndContext(); BeginContext(770, 128, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(809, 83, true); WriteLiteral("\r\n \r\n "); EndContext(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt index bd3781c03dc..a3af5743af6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt @@ -3,14 +3,14 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (38:3,1 [43] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (38:3,1 [41] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs index 417e4c21079..688b61d131b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs @@ -13,7 +13,7 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; -#line (5,2)-(6,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" +#line (5,2)-(5,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n

New Customer

\r\n\r\n "); EndContext(); BeginContext(551, 31, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -78,7 +78,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(588, 243, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(612, 48, true); WriteLiteral("\r\n \r\n "); EndContext(); BeginContext(689, 130, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(712, 101, true); WriteLiteral("\r\n \r\n \r\n "); EndContext(); @@ -132,12 +132,12 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(837, 174, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(861, 10, true); WriteLiteral("\r\n "); EndContext(); BeginContext(871, 128, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(910, 83, true); WriteLiteral("\r\n \r\n "); EndContext(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt index 59eb0ecd802..2cf46b20ae8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt @@ -3,14 +3,14 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.RazorPageAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), null)] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (55:4,1 [43] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (55:4,1 [41] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index 9544b7fdd5f..d6cda67f0f4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -63,7 +63,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : WriteLiteral("\r\n
This is in Section 1
\r\n "); EndContext(); BeginContext(205, 25, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index d366a5f7893..b6730ae5c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs index 78b1e284f6f..00396700c81 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs @@ -12,15 +12,15 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; -#line (1,2)-(2,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (1,2)-(1,29) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System.ComponentModel ; -#line (2,2)-(3,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (2,2)-(2,26) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System.Collections ; -#line (3,2)-(4,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (3,2)-(3,14) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System ; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt index 4df34b01323..7449f1e8780 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt @@ -3,15 +3,15 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives))] NamespaceDeclaration - - AspNetCore - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (1:0,1 [29] UsingDirectives.cshtml) - System.ComponentModel - UsingDirective - (31:1,1 [26] UsingDirectives.cshtml) - System.Collections - UsingDirective - (58:2,1 [14] UsingDirectives.cshtml) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [27] UsingDirectives.cshtml) - System.ComponentModel + UsingDirective - (31:1,1 [24] UsingDirectives.cshtml) - System.Collections + UsingDirective - (58:2,1 [12] UsingDirectives.cshtml) - System UsingDirective - (73:3,1 [12] UsingDirectives.cshtml) - System RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs index acca84c3a07..ed19fdfc28c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs @@ -55,7 +55,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon WriteLiteral("\r\n"); EndContext(); BeginContext(61, 50, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt index 770b7ed3709..0f04b4efca3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt index 200920f2f55..7dbac6ae2cd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml", typeof(Test.Namespace.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace))] NamespaceDeclaration - - Test.Namespace - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt index 74029bf6ff0..ec050e07875 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs index 6812ca87c29..be031f1c937 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_Basic EndContext(); BeginContext(71, 87, false); BeginContext(71, 87, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(91, 6, true); BeginContext(91, 6, true); WriteLiteral("\r\n "); @@ -77,7 +77,7 @@ public class TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_Basic EndContext(); BeginContext(97, 52, false); BeginContext(97, 52, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt index 3b6caff3fce..56e4c130be3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.ir.txt @@ -3,13 +3,13 @@ CSharpCode - IntermediateToken - - CSharp - [assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.cshtml", typeof(AspNetCore.TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_BasicTest))] NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [14] ) - System - UsingDirective - (16:1,1 [34] ) - System.Collections.Generic - UsingDirective - (51:2,1 [19] ) - System.Linq - UsingDirective - (71:3,1 [30] ) - System.Threading.Tasks - UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc - UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] ) - System + UsingDirective - (16:1,1 [32] ) - System.Collections.Generic + UsingDirective - (51:2,1 [17] ) - System.Linq + UsingDirective - (71:3,1 [28] ) - System.Threading.Tasks + UsingDirective - (102:4,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingDirective - (135:5,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (178:6,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - ClassDeclaration - - public - TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_BasicTest - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectDirectiveTest.cs index a50555c0ff3..a09f6282549 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectDirectiveTest.cs @@ -179,6 +179,9 @@ protected override void ConfigureProjectEngine(RazorProjectEngineBuilder builder // Notice we're not registering the InjectDirective.Pass here so we can run it on demand. builder.AddDirective(InjectDirective.Directive); builder.AddDirective(ModelDirective.Directive); + + builder.Features.Add(new RazorPageDocumentClassifierPass()); + builder.Features.Add(new MvcViewDocumentClassifierPass()); } private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeDocument codeDocument) @@ -193,9 +196,7 @@ private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeD } } - var irDocument = codeDocument.GetDocumentIntermediateNode(); - irDocument.DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind; - return irDocument; + return codeDocument.GetDocumentIntermediateNode(); } private class ClassNodeVisitor : IntermediateNodeWalker diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectTargetExtensionTest.cs index 7470d0e6c60..1aa1a561457 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/InjectTargetExtensionTest.cs @@ -19,7 +19,7 @@ public void InjectDirectiveTargetExtension_WritesProperty() { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: true); var node = new InjectIntermediateNode() { TypeName = "PropertyType", @@ -45,7 +45,7 @@ public void InjectDirectiveTargetExtension_WritesPropertyWithLinePragma_WhenSour { // Arrange using var context = TestCodeRenderingContext.CreateRuntime(); - var target = new InjectTargetExtension(); + var target = new InjectTargetExtension(considerNullabilityEnforcement: true); var node = new InjectIntermediateNode() { TypeName = "PropertyType", diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs index de4dd521d8e..49dbbb3f985 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -6,7 +6,6 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.IntegrationTests; -using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Test.Utilities; @@ -17,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests; public class CodeGenerationIntegrationTest : IntegrationTestBase { - private static readonly CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode"); + private static readonly CSharpCompilation DefaultBaseCompilation = TestCompilation.Create().WithAssemblyName("AppCode"); private RazorConfiguration _configuration; @@ -92,7 +91,7 @@ public class MyService AssertLinePragmas(compiled.CodeDocument, designTime: false); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] @@ -239,11 +238,11 @@ public void BasicComponent_Runtime() public void Sections_Runtime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class InputTestTagHelper : {{typeof(TagHelper).FullName}} + public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public ModelExpression For { get; set; } } @@ -389,10 +388,10 @@ public void Model_Runtime() public void ModelExpressionTagHelper_Runtime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class InputTestTagHelper : {{typeof(TagHelper).FullName}} + public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public ModelExpression For { get; set; } } @@ -413,8 +412,8 @@ public class InputTestTagHelper : {{typeof(TagHelper).FullName}} public void RazorPages_Runtime() { // Arrange - AddCSharpSyntaxTree($$""" - public class DivTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } @@ -450,8 +449,8 @@ public void RazorPagesWithRouteTemplate_Runtime() public void RazorPagesWithoutModel_Runtime() { // Arrange - AddCSharpSyntaxTree($$""" - public class DivTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } @@ -502,7 +501,7 @@ public void ViewWithNamespace_Runtime() public void ViewComponentTagHelper_Runtime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" public class TestViewComponent { public string Invoke(string firstName) @@ -511,8 +510,8 @@ public string Invoke(string firstName) } } - [{{typeof(HtmlTargetElementAttribute).FullName}}] - public class AllTagHelper : {{typeof(TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute] + public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public string Bar { get; set; } } @@ -599,15 +598,15 @@ public void RazorPageWithNoLeadingPageDirective_Runtime() public void RazorPage_WithCssScope() { // Arrange - AddCSharpSyntaxTree($$""" - [{{typeof(HtmlTargetElementAttribute).FullName}}("all")] - public class AllTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")] + public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public string Bar { get; set; } } - [{{typeof(HtmlTargetElementAttribute).FullName}}("form")] - public class FormTagHelper : {{typeof(TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")] + public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """); @@ -643,15 +642,15 @@ public class FormTagHelper : {{typeof(TagHelper).FullName}} public void RazorView_WithCssScope() { // Arrange - AddCSharpSyntaxTree($$""" - [{{typeof(HtmlTargetElementAttribute).FullName}}("all")] - public class AllTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")] + public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public string Bar { get; set; } } - [{{typeof(HtmlTargetElementAttribute).FullName}}("form")] - public class FormTagHelper : {{typeof(TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")] + public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """); @@ -686,14 +685,14 @@ public class FormTagHelper : {{typeof(TagHelper).FullName}} public void RazorView_Layout_WithCssScope() { // Arrange - AddCSharpSyntaxTree($$""" - [{{typeof(HtmlTargetElementAttribute).FullName}}("all")] - public class AllTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")] + public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public string Bar { get; set; } } - [{{typeof(HtmlTargetElementAttribute).FullName}}("form")] - public class FormTagHelper : {{typeof(TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")] + public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """); @@ -949,7 +948,7 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] @@ -1109,10 +1108,10 @@ public void BasicComponent_DesignTime() public void Sections_DesignTime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class InputTestTagHelper : {{typeof(TagHelper).FullName}} + public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public ModelExpression For { get; set; } } @@ -1294,10 +1293,10 @@ public class ThisShouldBeGenerated public void ModelExpressionTagHelper_DesignTime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class InputTestTagHelper : {{typeof(TagHelper).FullName}} + public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public ModelExpression For { get; set; } } @@ -1320,8 +1319,8 @@ public class InputTestTagHelper : {{typeof(TagHelper).FullName}} public void RazorPages_DesignTime() { // Arrange - AddCSharpSyntaxTree($$""" - public class DivTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } @@ -1361,8 +1360,8 @@ public void RazorPagesWithRouteTemplate_DesignTime() public void RazorPagesWithoutModel_DesignTime() { // Arrange - AddCSharpSyntaxTree($$""" - public class DivTagHelper : {{typeof(TagHelper).FullName}} + AddCSharpSyntaxTree(""" + public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } @@ -1419,7 +1418,7 @@ public void ViewWithNamespace_DesignTime() public void ViewComponentTagHelper_DesignTime() { // Arrange - AddCSharpSyntaxTree($$""" + AddCSharpSyntaxTree(""" public class TestViewComponent { public string Invoke(string firstName) @@ -1428,8 +1427,8 @@ public string Invoke(string firstName) } } - [{{typeof(HtmlTargetElementAttribute).FullName}}] - public class AllTagHelper : {{typeof(TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute] + public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { public string Bar { get; set; } } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj index 1bcc1a603d1..10e94b55c0d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj @@ -1,4 +1,4 @@ - + $(DefaultNetCoreTargetFrameworks) @@ -18,7 +18,6 @@ - @@ -30,20 +29,4 @@ - - - - - - - - - - - - - - - - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelDirectiveTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelDirectiveTest.cs index 212e8ff0ef2..eaf2eebeb8f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelDirectiveTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelDirectiveTest.cs @@ -249,8 +249,8 @@ private RazorEngine CreateEngineCore(bool designTime = false) { return CreateProjectEngine(b => { - // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. - b.AddDirective(ModelDirective.Directive); + // Notice we're not registering the ModelDirective.Pass here so we can run it on demand. + b.AddDirective(ModelDirective.Directive); b.Features.Add(new RazorPageDocumentClassifierPass()); b.Features.Add(new MvcViewDocumentClassifierPass()); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelExpressionPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelExpressionPassTest.cs index f97fab6b120..908948ad38f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelExpressionPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ModelExpressionPassTest.cs @@ -154,6 +154,8 @@ private RazorEngine CreateEngine(params TagHelperDescriptor[] tagHelpers) return RazorProjectEngine.Create(b => { b.Features.Add(new TestTagHelperFeature(tagHelpers)); + b.Features.Add(new RazorPageDocumentClassifierPass()); + b.Features.Add(new MvcViewDocumentClassifierPass()); }).Engine; } @@ -169,10 +171,7 @@ private DocumentIntermediateNode CreateIRDocument(RazorEngine engine, RazorCodeD } } - var irNode = codeDocument.GetDocumentIntermediateNode(); - irNode.DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind; - - return irNode; + return codeDocument.GetDocumentIntermediateNode(); } private TagHelperIntermediateNode FindTagHelperNode(IntermediateNode node) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/MvcShim.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/MvcShim.cs deleted file mode 100644 index cfd89e43690..00000000000 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/MvcShim.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.IO; -using System.Reflection; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions; - -internal static class MvcShim -{ - public static readonly string AssemblyName = "Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler"; - - private static Assembly _assembly; - private static CSharpCompilation _baseCompilation; - - public static Assembly Assembly - { - get - { - if (_assembly == null) - { - var filePath = Path.Combine(Directory.GetCurrentDirectory(), AssemblyName + ".dll"); - _assembly = Assembly.LoadFrom(filePath); - } - - return _assembly; - } - } - - public static CSharpCompilation BaseCompilation - { - get - { - if (_baseCompilation == null) - { - _baseCompilation = TestCompilation.Create(Assembly); - } - - return _baseCompilation; - } - } -} diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs index 72ea10cfae3..3094fa0145d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -34,7 +34,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html index 5d66b1d977c..31b236ec01c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~ \ No newline at end of file +/*~~~~~~*/ /*~~~~~~~~~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt index f74d046c984..42fe022cab0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -14,7 +14,7 @@ IntermediateToken - (11:0,11 [14] AttributeDirectiveWithViewImports.cshtml) - CSharp - [Serializable] RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt index d4c610e7d5d..1122df5abb6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (11:0,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml) |[Serializable]| -Generated Location: (903:28,11 [14] ) +Generated Location: (920:28,11 [14] ) |[Serializable]| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs index 1b6e023a63f..8f85c2ade57 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9a963ab17d89a7739e64cf5d94e1dc35aa41cf1004222067bca2328b832666d9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -12,7 +12,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (1,2)-(2,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml" +#line (1,2)-(1,14) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml" using System #line default @@ -40,7 +40,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt index 74fee171927..9ec9d499d38 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt @@ -1,13 +1,13 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (1:0,1 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) - System + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [12] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) - System CSharpCode - (26:1,11 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) IntermediateToken - (26:1,11 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\_ViewImports.cshtml) - CSharp - [Serializable] CSharpCode - (11:0,11 [14] AttributeDirectiveWithViewImports.cshtml) @@ -16,7 +16,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html index 29671e2e94e..d50f0aa7edc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html @@ -1,9 +1,9 @@ -~~~~~~~~~~~ ~~~~~~~~~~~ -
+/*~~~~~~~*/ /*~~~~~~~*/ +
Hello world - ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + /*~~~~~~~~~~~~~~~~~*/ /*~~~~*/
-~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~ ~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~*/ ~ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.ir.txt index 970d4c4e3c6..b1196e1363c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_Runtime.ir.txt @@ -1,9 +1,9 @@ Document - NamespaceDeclaration - - TestFiles.IntegrationTests.CodeGenerationIntegrationTest - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks UsingDirective - (134:4,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - BasicComponent - global::Microsoft.AspNetCore.Components.ComponentBase - IDisposable MethodDeclaration - - protected override - void - BuildRenderTree diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs index 4db1c047ed4..a50c79314f4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html index 24e2e736663..5ed5d03cb0a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html @@ -1,8 +1,8 @@ -
+
Hello world - ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + /*~~~~~~~~~~~~~~~~~*/ /*~~~~*/
~~ - ~~~ ~~~ ~ ~~~~~~ + ~~~ ~~~ ~ /*~~*/ ~ -

+

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt index 7cb303a862a..3adfb0244ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt index dae7e6e57f7..5648379bb4d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt @@ -1,34 +1,34 @@ Source Location: (13:0,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |this.ToString()| -Generated Location: (1437:33,13 [15] ) +Generated Location: (1463:33,13 [15] ) |this.ToString()| Source Location: (54:2,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |string.Format("{0}", "Hello")| -Generated Location: (1611:40,6 [29] ) +Generated Location: (1637:40,6 [29] ) |string.Format("{0}", "Hello")| Source Location: (95:4,2 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) | var cls = "foo"; | -Generated Location: (1795:47,2 [25] ) +Generated Location: (1821:47,2 [25] ) | var cls = "foo"; | Source Location: (134:7,11 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |if(cls != null) { | -Generated Location: (1981:55,11 [18] ) +Generated Location: (2007:55,11 [18] ) |if(cls != null) { | Source Location: (153:7,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |cls| -Generated Location: (2181:62,30 [3] ) +Generated Location: (2207:62,30 [3] ) |cls| Source Location: (156:7,33 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) | }| -Generated Location: (2370:69,33 [2] ) +Generated Location: (2396:69,33 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs index 3d2e93a3ba8..6b3e145e2c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3b732a30f94dc763cbd74d150cca70825dbddec2bddfba4e4d82547d5ced9a82" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt index 56e9bc2e1c6..ac9187d63b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [4] Basic.cshtml) LazyIntermediateToken - (0:0,0 [4] Basic.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html index 3b4d82ad8bf..b7aa7c9942e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -1,15 +1,15 @@ -~~ ~~~~~ ~~~~ ~~~~~ ~~~~~~~~ ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~ ~~ +~~ /*~*/ /**/ /*~*/ /*~~~~*/ /**/ /*~~~~~~~*/ /*~~~~~~*/ /*~~~~~~*/ /*~*/ /*~~*/ ~~ -~~~~~ -~~~~~ -~~~~~ " +/*~*/ +/*~*/ +/*~*/ " -~~~~~~ -~~~~~~ +/*~~*/ +/*~~*/ -~~~~~~~ -~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ +/*~~~*/ +/*~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ -~~~~~~~~~~ -~~~~~~~~~~ +/*~~~~~~*/ +/*~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index 1c2c8770560..8a46de8392f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html @@ -78,6 +78,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - #nullable restore\npublic global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData!;\n#nullable disable CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 68b99fa9b03..fc357d92584 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -1,35 +1,35 @@ Source Location: (128:7,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1204:26,0 [0] ) +Generated Location: (1230:26,0 [0] ) || Source Location: (149:10,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1441:36,0 [0] ) +Generated Location: (1467:36,0 [0] ) || Source Location: (159:11,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |MyService| -Generated Location: (1678:46,0 [17] ) +Generated Location: (1704:46,0 [17] ) |MyService| Source Location: (203:14,11 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1956:56,0 [0] ) +Generated Location: (1982:56,0 [0] ) || Source Location: (119:6,6 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2454:73,6 [0] ) +Generated Location: (2480:73,6 [0] ) || Source Location: (139:9,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2629:80,7 [0] ) +Generated Location: (2655:80,7 [0] ) || Source Location: (190:13,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2807:87,10 [0] ) +Generated Location: (2833:87,10 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 7ec2b156f5d..20999cb1add 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7afd23f4d24de7b2bec1fb06d0a708e2d98adee36c510f65d3424dfda5445dca" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 @@ -35,6 +35,29 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete WriteLiteral("\r\n"); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#nullable restore +#line (12,9)-(12,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden +#nullable disable + Member___UniqueIdSuppressedForTesting__ { get; private set; } + = default!; +#nullable restore +#line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#nullable disable +#nullable restore +#line (10,8)-(10,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#nullable disable #nullable restore [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index 3ebf9018448..41a10f5292e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n @@ -55,6 +55,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - #nullable restore\npublic global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData!;\n#nullable disable CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs index e97b456f33a..7bcc7e4db5d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html index d4a60595cdc..91063890b07 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~ +/*~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt index 33b5e760949..53cd7044111 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt index 49ab8159e50..23d8691b5e8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyBasePageForViews| -Generated Location: (1174:26,0 [26] ) +Generated Location: (1200:26,0 [26] ) |MyBasePageForViews| Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyModel| -Generated Location: (1457:36,0 [7] ) +Generated Location: (1483:36,0 [7] ) |MyModel| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs index 158b2dc8916..7d5e59cc7ec 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1ca5ae8e569aefa6575a68e8d8b2d375ed79deec6565fb893b72b89423f55abd" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt index 6a2103779ca..e7cf6a81f9a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs index 2797f550402..c288744ec5a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html index 496639ef56f..3bd4c5872cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~ -~~~~~~ ~~~~~~~ +/*~*/ +/*~~*/ /*~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt index 02331d9ea15..1abea22138a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt index ad901af4382..eb4779efcf4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml) |MyModel| -Generated Location: (1185:26,0 [7] ) +Generated Location: (1211:26,0 [7] ) |MyModel| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs index 68eeb760030..2615dac991c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a652fac42d6a27ace9b45de079bd1bd21d47f29255b96899785aaa55a4a8e354" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -19,7 +19,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt index 80d7c75bf5d..e7cc91dcb2c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs index c522f09d73f..507fdf59594 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html index 981eb0e1f2f..cfb2e63f00b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~ ~~~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~ +/*~~*/ /*~~~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ /**/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt index 333382ac822..64e0602a5c2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt index 2aef24850cd..ead29c02167 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyModel| -Generated Location: (1198:26,0 [7] ) +Generated Location: (1224:26,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (1460:36,0 [5] ) +Generated Location: (1486:36,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (1742:46,22 [14] ) +Generated Location: (1768:46,22 [14] ) |MyPropertyName| Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (1995:56,0 [17] ) +Generated Location: (2021:56,0 [17] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (2289:66,22 [4] ) +Generated Location: (2315:66,22 [4] ) |Html| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs index 0b56e2be1e9..be636240d3d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "319d5fa6f848e64d19bf7eab2f5e3339cdfc75b02a9bc6f2773eed1a40f5e9d0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt index ea79180b0e6..79e29c00989 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt index 74596acbc18..a8d413833d9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (54:2,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (2037:32,0 [9] ) +Generated Location: (2080:32,0 [9] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (2240:40,0 [4] ) +Generated Location: (2283:40,0 [4] ) |Html| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (2568:51,0 [5] ) +Generated Location: (2611:51,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (2758:59,0 [14] ) +Generated Location: (2801:59,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs index 0a785bf0448..325edc73996 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html index ceeac4385ba..d9302bcff03 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~ ~~~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~ ~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~ ~ +/*~~*/ /*~~~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ /*~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~~*/ ~ +/*~~~*/ /*~~~~~~~~~~~~~*/ /*~*/ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt index 8cecee2bc1a..82b67dbaac8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt index 296b4548b4e..cb492a0fcca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt @@ -1,45 +1,45 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyModel| -Generated Location: (1210:26,0 [7] ) +Generated Location: (1236:26,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (1476:36,0 [5] ) +Generated Location: (1502:36,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (1762:46,22 [14] ) +Generated Location: (1788:46,22 [14] ) |MyPropertyName| Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (2019:56,0 [17] ) +Generated Location: (2045:56,0 [17] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (2317:66,22 [4] ) +Generated Location: (2343:66,22 [4] ) |Html| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (2564:76,0 [5] ) +Generated Location: (2590:76,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (2850:86,22 [15] ) +Generated Location: (2876:86,22 [15] ) |MyPropertyName2| Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (3108:96,0 [17] ) +Generated Location: (3134:96,0 [17] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (3406:106,22 [5] ) +Generated Location: (3432:106,22 [5] ) |Html2| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs index 8a9e54e83ec..26d47a76b27 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "771acb56660727ab6e4ca50e95bde0cf2a72af8de3e9ec1cd4b72969645cb9af" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt index bde5ff49094..4aa107d8d2d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt index 8bdc56783f5..56b60c17d77 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt @@ -1,40 +1,40 @@ Source Location: (129:4,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (2065:32,0 [9] ) +Generated Location: (2108:32,0 [9] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (2272:40,0 [5] ) +Generated Location: (2315:40,0 [5] ) |Html2| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (2605:51,0 [5] ) +Generated Location: (2648:51,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (2799:59,0 [15] ) +Generated Location: (2842:59,0 [15] ) |MyPropertyName2| Source Location: (58:2,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (3142:70,0 [9] ) +Generated Location: (3185:70,0 [9] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (3349:78,0 [4] ) +Generated Location: (3392:78,0 [4] ) |Html| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (3681:89,0 [5] ) +Generated Location: (3724:89,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (3875:97,0 [14] ) +Generated Location: (3918:97,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs index 6b3b1d6fe0a..95b744435dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html index 0dc8f50e6be..f4385cddb0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ +/*~~~*/ /*~*/ /*~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt index 9ddf119a56e..94f6f2ad15b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt index c6395a4a74a..4e939233544 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (1171:26,0 [5] ) +Generated Location: (1197:26,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (1444:36,22 [14] ) +Generated Location: (1470:36,22 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs index 2aac70d02e7..96e2a2f1399 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f0ec78e6ab6def57bd9067e564edaa84059a8ecb9a3c1766a148a7df3096b7b0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt index 847d8453977..53af91db89c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt index 1922c8947a9..d8c4bcd952e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (1974:32,0 [5] ) +Generated Location: (2017:32,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (2155:40,0 [14] ) +Generated Location: (2198:40,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs index a8ea985c411..f6e3da8b232 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html index 626e2018bdd..76e928baf80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~ Test. \ No newline at end of file +/*~~~~~~*/ Test. \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt index ebfd3e3876e..2fb419b34aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs index ac456620445..e698918c05c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3b8355e6c17c9dc5d6062d64a789a8b5a81db5adec1e9913ff7a7c1565682765" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt index 0ecb4011503..bf3ef34295f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [11] InvalidNamespaceAtEOF.cshtml) - namespace HtmlContent - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs index c1d814c2471..17e66eaa399 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html index df04496106b..a7889e3c07e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~ "foo +/*~*/ "foo

About Us

We are awesome.

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt index 9512f8a1070..2ee3e356b92 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs index c9689a971e2..1fd1127e0d6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "189450bf29773af1b743c49fb8b24230b292c19db0334d587f0e094856e5218f" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt index fa1d7b2efe5..6c6d17fcac8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs index d87a23e0538..3bf6b202b36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html index 9ac477264fa..d960ab45c14 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~ ~~~~~~~~ +/*~~*/ /*~~~~*/ -~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ +/*~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ /*~~~~*/ - - + + diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt index 433f38b5a28..008decced62 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt index 9e03dac2d9d..a80f0177844 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |DateTime| -Generated Location: (1700:32,0 [8] ) +Generated Location: (1726:32,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (2009:42,37 [29] ) +Generated Location: (2035:42,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Date| -Generated Location: (2719:60,102 [4] ) +Generated Location: (2745:60,102 [4] ) |Date| Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Model| -Generated Location: (3149:69,94 [5] ) +Generated Location: (3175:69,94 [5] ) |Model| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs index 737f6dc2ace..5bc6b0d3352 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b96e944bd86a2acecd5a176708eedb3cdc8eef05122fd51aa5c4fe58d4069af7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre { WriteLiteral("\r\n"); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); @@ -70,7 +70,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt index f83f43c30c1..1bcffac69cd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs index 2c3a262eed2..8a984eb787c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html index a35472a2d2f..2d38dc6a64c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt index c7b21ddcf3b..f486553c060 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt index 7394637419a..bb47d519adf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (7:0,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml) |System.Collections.IEnumerable| -Generated Location: (1191:26,0 [30] ) +Generated Location: (1217:26,0 [30] ) |System.Collections.IEnumerable| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs index 9fd9006a420..e789c5db091 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "36b79708f36f3606c2eb7c7eaf383853df55ab030280d5deb8f762fac54fd1c0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt index 2334402e431..68af78c1203 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs index 74a617a6104..5d852cb1555 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html index a707958a381..cdc19a67ddf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt index a7e32184d01..211de3d9ff0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt index 20d5397ea6c..71c30fcdb10 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |ThisShouldBeGenerated| -Generated Location: (1209:26,0 [21] ) +Generated Location: (1235:26,0 [21] ) |ThisShouldBeGenerated| Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |System.Collections.IEnumerable| -Generated Location: (1484:36,0 [30] ) +Generated Location: (1510:36,0 [30] ) |System.Collections.IEnumerable| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs index 6c494c79c74..f81e5637974 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html index 62560e0be27..6e90b5c956b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~ +/*~*/ +/*~~~~~~*/ /*~~~~~~~~~~*/

Hi There!

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt index b8bd6238d8c..ed9a464951c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt index 89f6b504abe..6ddb439deb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:1,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml) |Test.Namespace| -Generated Location: (1243:26,44 [14] ) +Generated Location: (1252:26,44 [14] ) |Test.Namespace| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs index 88fcd2f08a3..60084b62428 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs @@ -18,7 +18,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt index 6fa07da4f1c..ddd4d92f4a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - NamespaceDeclaration - - Test.Namespace - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) LazyIntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html index 236c4e85314..0266c6d5a88 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html @@ -1,2 +1,2 @@ 
Some text here.
-~~~~~ +/*~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt index 4982f6e4002..cae87bb1f87 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs index 2732e3630be..d842ee826ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5eaf8fb8900db86500f29c357a6119d29d8639ae7b054b4cc5e00bbdf4882c2d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt index e45af51cdc0..23b1c3cd03c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) LazyIntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Bar", "Foo", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo #nullable disable WriteLiteral("
\r\n

Welcome

\r\n

Learn about building Web apps with ASP.NET Core.

\r\n
\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n"); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt index 9f0866f81cf..3f31496efc8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - Bar - Foo - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - asp-route - register - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - method - post - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs index 1a6c001424e..5b240502e36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt index 42c3c1e4cd8..e87172ba9ca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt index aea33d2ab95..e9450d8ef26 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [9] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel| -Generated Location: (1290:31,0 [9] ) +Generated Location: (1316:31,0 [9] ) |TestModel| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1805:48,6 [10] ) +Generated Location: (1831:48,6 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1973:55,6 [14] ) +Generated Location: (1999:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs index 52d2439f36d..837e9efb8c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "938aa77e05d0524687967a4964c7424054e2f7b837772fe19895341aa7ef5bda" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt index 5179d0b1e19..994c560a814 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (47:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (47:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt index b1ede97e6be..52ff1c93a63 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt @@ -1,17 +1,15 @@ -Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) -|using TestNamespace -| -Generated Location: (971:16,0 [21] ) -|using TestNamespace -| +Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) +|using TestNamespace| +Generated Location: (1006:16,0 [19] ) +|using TestNamespace| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2064:36,0 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2320:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs index 74b01482d43..70d2d84399c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt index 63b5fb776d7..33c19ce8797 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt index aea33d2ab95..e9450d8ef26 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [9] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel| -Generated Location: (1290:31,0 [9] ) +Generated Location: (1316:31,0 [9] ) |TestModel| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1805:48,6 [10] ) +Generated Location: (1831:48,6 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1973:55,6 [14] ) +Generated Location: (1999:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs index 60fb805e412..b67bacef721 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "938aa77e05d0524687967a4964c7424054e2f7b837772fe19895341aa7ef5bda" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt index eaf0f2f9770..46a777cd2d6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (47:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (47:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt index b1ede97e6be..52ff1c93a63 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt @@ -1,17 +1,15 @@ -Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) -|using TestNamespace -| -Generated Location: (971:16,0 [21] ) -|using TestNamespace -| +Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) +|using TestNamespace| +Generated Location: (1006:16,0 [19] ) +|using TestNamespace| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2064:36,0 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2320:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs index 56e4cec6181..a0592546ba4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt index b13cccfd3eb..caecaef2084 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt index 4ab42af6467..580d99371c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel?| -Generated Location: (1290:31,0 [10] ) +Generated Location: (1316:31,0 [10] ) |TestModel?| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1806:48,6 [10] ) +Generated Location: (1832:48,6 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1974:55,6 [14] ) +Generated Location: (2000:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs index c743e8ac9c4..10fd07393ce 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a0b3df03ac7b0b582a2924ed8f2f85f3df8f906c37a1aa7f1f8255290fbf29a9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt index 1f0b68a5737..67090281469 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (48:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (48:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt index a2df4b7677c..b51e5531cba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt @@ -1,17 +1,15 @@ -Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) -|using TestNamespace -| -Generated Location: (971:16,0 [21] ) -|using TestNamespace -| +Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) +|using TestNamespace| +Generated Location: (1006:16,0 [19] ) +|using TestNamespace| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2064:36,0 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2320:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs index 7c147f6f243..fa4833099f7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt index 70413ed61f7..d6dfdd62fd1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt index 4ab42af6467..580d99371c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel?| -Generated Location: (1290:31,0 [10] ) +Generated Location: (1316:31,0 [10] ) |TestModel?| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1806:48,6 [10] ) +Generated Location: (1832:48,6 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1974:55,6 [14] ) +Generated Location: (2000:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs index eadcffb5342..b405118a3ba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a0b3df03ac7b0b582a2924ed8f2f85f3df8f906c37a1aa7f1f8255290fbf29a9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt index dc30fcf3e66..08da2eb191f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (48:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (48:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt index a2df4b7677c..b51e5531cba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt @@ -1,17 +1,15 @@ -Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) -|using TestNamespace -| -Generated Location: (971:16,0 [21] ) -|using TestNamespace -| +Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) +|using TestNamespace| +Generated Location: (1006:16,0 [19] ) +|using TestNamespace| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2064:36,0 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2320:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs index 6d226f0fd46..2984cf4987b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -22,7 +22,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html index 02367c51f7e..ed8901a2a44 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html @@ -1,13 +1,13 @@ -~~~~~ ~~~~~~~~ +/*~*/ /*~~~~*/ -~~~~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ ~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~*/ ~ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ -

New Customer ~~~~~~~~~~~

+

New Customer /*~~~~~~~*/

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt index dd03351f6cb..5350ef031e8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -12,7 +12,7 @@ RazorCompiledItemMetadataAttribute - (6:0,6 [8] RazorPagesWithRouteTemplate.cshtml) RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt index f350890e212..eb719e203ff 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (36:3,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (568:15,0 [41] ) +Generated Location: (585:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (6:0,6 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |"/About"| -Generated Location: (1572:33,37 [8] ) +Generated Location: (1598:33,37 [8] ) |"/About"| Source Location: (25:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |NewModel| -Generated Location: (1823:43,0 [8] ) +Generated Location: (1849:43,0 [8] ) |NewModel| Source Location: (213:12,18 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |Model.Name| -Generated Location: (2373:60,18 [10] ) +Generated Location: (2399:60,18 [10] ) |Model.Name| Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) @@ -25,7 +25,7 @@ Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrat public string Name { get; set; } } | -Generated Location: (2619:69,12 [97] ) +Generated Location: (2645:69,12 [97] ) | public class NewModel : PageModel { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs index 26803a7ec1d..635057a1f50 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "da9a31551104c58f287a17de26f4a3aa316e7e17fb9ed06e39692c4f45fb133a" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (4,2)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" +#line (4,2)-(4,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default @@ -34,7 +34,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt index 54fb257212b..fa61c8a7cb2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt @@ -1,19 +1,19 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (36:3,1 [43] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (36:3,1 [41] RazorPagesWithRouteTemplate.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - (6:0,6 [8] RazorPagesWithRouteTemplate.cshtml) RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) LazyIntermediateToken - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs index c4fa3465aee..2d7527b1211 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html index daab158b7d1..56b48a10d01 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html @@ -1,20 +1,20 @@ -~~~~~ +/*~*/ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~~~~~~~~~*/ /*~~~~~~~~~~~*/ /*~~~~~*/ ~ - ~~~~ ~ ~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /**/ ~ /*~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ + /*~~*/ /*~*/ /*~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ @@ -22,7 +22,7 @@

New Customer

- +
diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt index eec7011d9bb..50cd6d68233 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (38:3,1 [41] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt index e335c60c42a..139ede15cf8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt @@ -1,16 +1,16 @@ Source Location: (38:3,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (563:15,0 [41] ) +Generated Location: (580:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (23:2,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |"*, AppCode"| -Generated Location: (1902:38,37 [12] ) +Generated Location: (1928:38,37 [12] ) |"*, AppCode"| Source Location: (566:24,47 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |Name| -Generated Location: (2603:57,47 [4] ) +Generated Location: (2629:57,47 [4] ) |Name| Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) @@ -28,7 +28,7 @@ Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegra public string Name { get; set; } } | -Generated Location: (3426:74,12 [283] ) +Generated Location: (3452:74,12 [283] ) | public IActionResult OnPost(Customer customer) { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs index 22f235cc89d..cdbb3dcea6d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4d4352438ec54cff935ed10c73f4fb4ce0ea8ffc7c46b467007618dead77f960" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (4,2)-(5,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" +#line (4,2)-(4,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n"); WriteLiteral("\r\n"); WriteLiteral("\r\n

New Customer

\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -72,7 +72,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n \r\n "); } ); @@ -112,9 +112,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt index e3d717690e5..03efb641386 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (38:3,1 [43] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (38:3,1 [41] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs index a7e228168eb..34f4321738d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html index 64f7eac8c2a..deaa4ef67ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html @@ -1,24 +1,24 @@ -~~~~~ +/*~*/ -~~~~~~ ~~~~~~~~ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~*/ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ ~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~*/ ~ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~ + /*~~*/ /*~~~~~~~~~*/ /*~~~~~~~~~~~*/ /*~~~~~*/ ~ - ~~~~ ~ ~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /**/ ~ /*~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ + /*~~*/ /*~*/ /*~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ @@ -26,7 +26,7 @@

New Customer

- +
diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt index 0395753efcf..b60fec33036 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (55:4,1 [41] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt index 6d58723a403..461dfa9e38b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (55:4,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (551:15,0 [41] ) +Generated Location: (568:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (16:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |NewModel| -Generated Location: (1798:37,0 [8] ) +Generated Location: (1824:37,0 [8] ) |NewModel| Source Location: (40:3,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |"*, AppCode"| -Generated Location: (2112:48,37 [12] ) +Generated Location: (2138:48,37 [12] ) |"*, AppCode"| Source Location: (661:28,47 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |Model.Name| -Generated Location: (2801:67,47 [10] ) +Generated Location: (2827:67,47 [10] ) |Model.Name| Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) @@ -36,7 +36,7 @@ Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegr public string Name { get; set; } } | -Generated Location: (3618:84,12 [360] ) +Generated Location: (3644:84,12 [360] ) | public class NewModel : PageModel { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs index a029a343a45..970ed0b25cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "676265931c358e22efce0fe9ebd76cc3a7d2a5c12d37384e13aec92aa7667663" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (5,2)-(6,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" +#line (5,2)-(5,43) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" using Microsoft.AspNetCore.Mvc.RazorPages #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n"); WriteLiteral("\r\n"); WriteLiteral("\r\n

New Customer

\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -72,7 +72,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n \r\n "); } ); @@ -112,9 +112,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt index 711a257e33e..c1b6a5175e1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (55:4,1 [43] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (55:4,1 [41] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs index 6b5942c13ae..225e3b44bee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ae0459eafa91f6ae24fb2b349577f0dfb20a0e269a8a48888a1285a725191322" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,14 +18,38 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { + #line hidden + #pragma warning disable 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; + #pragma warning restore 0649 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); + #pragma warning disable 0169 + private string __tagHelperStringValueBuffer; + #pragma warning restore 0169 + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; + private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager + { + get + { + if (__backed__tagHelperScopeManager == null) + { + __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); + } + return __backed__tagHelperScopeManager; + } + } + private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper; + private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { - WriteLiteral("\r\n\r\n\r\n\r\n \r\n \r\n "); - Write( + WriteLiteral("\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { + WriteLiteral("\r\n <meta charset=\"utf-8\" />\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n <title>"); + Write( #nullable restore #line (7,13)-(7,30) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" ViewData["Title"] @@ -33,8 +57,34 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo #line default #line hidden #nullable disable + ); + WriteLiteral(" - Test layout component\r\n"); + } + ); + __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n"); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { + WriteLiteral("\r\n

This is a body.

\r\n"); + } ); - WriteLiteral(" - Test layout component\r\n\r\n\r\n

This is a body.

\r\n\r\n\r\n"); + __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + if (!__tagHelperExecutionContext.Output.IsContentModified) + { + await __tagHelperExecutionContext.SetOutputContentAsync(); + } + Write(__tagHelperExecutionContext.Output); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + WriteLiteral("\r\n\r\n"); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt index da0ffc7897f..792145b6ea2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt @@ -1,60 +1,68 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DefaultTagHelperRuntime - + FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper + FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync - HtmlContent - (0:0,0 [164] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) + HtmlContent - (0:0,0 [37] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n LazyIntermediateToken - (2:1,0 [17] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n LazyIntermediateToken - (19:2,0 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - LazyIntermediateToken - (35:2,16 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (37:3,0 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - LazyIntermediateToken - (43:3,6 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (49:4,4 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - LazyIntermediateToken - (73:4,28 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (79:5,4 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - LazyIntermediateToken - (151:5,76 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (157:6,4 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - CSharpExpression - (165:6,12 [17] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - LazyIntermediateToken - (165:6,12 [17] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - CSharp - ViewData["Title"] - HtmlContent - (182:6,29 [97] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - LazyIntermediateToken - (182:6,29 [24] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \-Test layout component - LazyIntermediateToken - (206:6,53 [8] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - LazyIntermediateToken - (214:6,61 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (216:7,0 [7] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + TagHelper - (37:3,0 [186] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - head - TagMode.StartTagAndEndTag + DefaultTagHelperBody - + HtmlContent - (43:3,6 [121] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) + LazyIntermediateToken - (43:3,6 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (49:4,4 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (73:4,28 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (79:5,4 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (151:5,76 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (157:6,4 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + CSharpExpression - (165:6,12 [17] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) + LazyIntermediateToken - (165:6,12 [17] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - CSharp - ViewData["Title"] + HtmlContent - (182:6,29 [34] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) + LazyIntermediateToken - (182:6,29 [24] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \-Test layout component + LazyIntermediateToken - (206:6,53 [8] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + LazyIntermediateToken - (214:6,61 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + DefaultTagHelperCreate - - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper + DefaultTagHelperExecute - + HtmlContent - (223:7,7 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (223:7,7 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (225:8,0 [5] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - - LazyIntermediateToken - (231:8,6 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (237:9,4 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -

- LazyIntermediateToken - (240:9,7 [15] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - This is a body. - LazyIntermediateToken - (255:9,22 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -

- LazyIntermediateToken - (259:9,26 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n - LazyIntermediateToken - (261:10,0 [7] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - + TagHelper - (225:8,0 [43] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - body - TagMode.StartTagAndEndTag + DefaultTagHelperBody - + HtmlContent - (231:8,6 [30] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) + LazyIntermediateToken - (231:8,6 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + LazyIntermediateToken - (237:9,4 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -

+ LazyIntermediateToken - (240:9,7 [15] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - This is a body. + LazyIntermediateToken - (255:9,22 [4] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html -

+ LazyIntermediateToken - (259:9,26 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n + DefaultTagHelperCreate - - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper + DefaultTagHelperExecute - + HtmlContent - (268:10,7 [11] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (268:10,7 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n LazyIntermediateToken - (270:11,0 [7] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - LazyIntermediateToken - (277:11,7 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs index cd3b23a0f11..6c0d17adf77 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "693e482257fa9ef37bc202b83d2bd2e6f8475e8f4d328f07e18a689f4f68c917" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Bar", "Foo", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo #nullable disable WriteLiteral("
\r\n

Welcome

\r\n

Learn about building Web apps with ASP.NET Core.

\r\n
\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n"); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt index c17f79100e0..7a19c739bda 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - Bar - Foo - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - asp-route - register - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - method - post - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs index 6b9da69c452..3528aafa6ab 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d0420b910fa2a6f0119a96ffb534fee225ca66e96b3b1741cf04c7ebd9525f62" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt index 5368db952de..66ab2b49cbc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (3:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (3:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs index e7eb993196d..a65b1147d4e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "714936b16425e1b5a49883c3e910ed43c30422ebc564f54651880695133a3b4b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : MyBasePage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : MyBasePage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt index 4c81d1f15e7..8ce1cc8864c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (3:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (3:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - MyBasePage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - MyBasePage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs index 78af829efa1..a59acf74f5a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b354ee3595811e9701f9c464ddf35ccb31360a3799b7bb4279192f084591a4fe" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt index 38a57ff69d2..4ac841da705 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (3:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (3:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs index 78af829efa1..a59acf74f5a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b354ee3595811e9701f9c464ddf35ccb31360a3799b7bb4279192f084591a4fe" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -13,7 +13,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (2,2)-(3,1) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" +#line (2,2)-(2,21) "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" using TestNamespace #line default @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt index 38a57ff69d2..4ac841da705 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (3:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (3:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index 81077af8977..8c7dd05d49e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html index dde1bb31217..9e7818b9ab4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html @@ -1,14 +1,14 @@ -~~~~~~ ~~~~~~~~ +/*~~*/ /*~~~~*/ -~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ +/*~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ /*~~~~*/ ~~ - ~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /*~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~
Some body
-~~~~~~~~ ~~~~~~~~ ~ +/*~~~~*/ /*~~~~*/ ~
This is in Section 1
- + ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt index cc0aa1a3871..04d308dc6fe 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index cb8e50488d6..744d86e6e84 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |DateTime| -Generated Location: (1652:32,0 [8] ) +Generated Location: (1678:32,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (1945:42,37 [29] ) +Generated Location: (1971:42,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (152:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (2221:52,22 [8] ) +Generated Location: (2247:52,22 [8] ) |Section1| Source Location: (68:4,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml"; | -Generated Location: (2719:69,2 [46] ) +Generated Location: (2745:69,2 [46] ) | Layout = "_SectionTestLayout.cshtml"; | Source Location: (222:12,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Date| -Generated Location: (3182:79,102 [4] ) +Generated Location: (3208:79,102 [4] ) |Date| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index dacf79c54db..78ca6fbaf55 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1ed96a957fe000fd0c80cc511def19ab692563eb64f3349a4c87c524e2ecbd60" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : WriteLiteral("\r\n
Some body
\r\n\r\n"); DefineSection("Section1", async() => { WriteLiteral("\r\n
This is in Section 1
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index 53f5abfb6ee..60b1d92c046 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs index 624e21b46c6..e6ee941687c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -35,7 +35,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html index ade006860ec..0764100ac8d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~ -~~~~~~ ~~~~~~ \ No newline at end of file +/*~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~*/ +/*~~*/ /*~~*/ +/*~~*/ /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt index f3331e380a8..fcf408db474 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -13,7 +13,7 @@ UsingDirective - (73:3,1 [12] UsingDirectives.cshtml) - System RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt index a22a7e8ae05..406be5361cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (1:0,1 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System.ComponentModel| -Generated Location: (529:14,0 [27] ) +Generated Location: (546:14,0 [27] ) |using System.ComponentModel| Source Location: (31:1,1 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System.Collections| -Generated Location: (690:19,0 [24] ) +Generated Location: (707:19,0 [24] ) |using System.Collections| Source Location: (58:2,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System| -Generated Location: (848:24,0 [12] ) +Generated Location: (865:24,0 [12] ) |using System| Source Location: (73:3,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System| -Generated Location: (994:29,0 [12] ) +Generated Location: (1011:29,0 [12] ) |using System| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs index 8a8ffe366b1..446661ec6ce 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9194971d2fb7908a02b02841f18655ccc0908a204c2fa948e8dc7e947269da86" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -12,19 +12,19 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (1,2)-(2,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (1,2)-(1,29) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System.ComponentModel #nullable disable ; #nullable restore -#line (2,2)-(3,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (2,2)-(2,26) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System.Collections #nullable disable ; #nullable restore -#line (3,2)-(4,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" +#line (3,2)-(3,14) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" using System #nullable disable @@ -41,7 +41,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt index a679c25ed02..0c334a6af39 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt @@ -1,20 +1,20 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (1:0,1 [29] UsingDirectives.cshtml) - System.ComponentModel - UsingDirective - (31:1,1 [26] UsingDirectives.cshtml) - System.Collections - UsingDirective - (58:2,1 [14] UsingDirectives.cshtml) - System + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [27] UsingDirectives.cshtml) - System.ComponentModel + UsingDirective - (31:1,1 [24] UsingDirectives.cshtml) - System.Collections + UsingDirective - (58:2,1 [12] UsingDirectives.cshtml) - System UsingDirective - (73:3,1 [12] UsingDirectives.cshtml) - System RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs index 377646cfe7d..13b832b91d3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "83aa72bbe254ff67d9ee42878d80c6403361bcbb777a50d8b3d718cba176d15c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -41,17 +41,17 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon return __backed__tagHelperScopeManager; } } - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper __OptionalTestViewComponentTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper __OptionalTestWithParamViewComponentTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper __OptionalWithMultipleTypesViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper __OptionalTestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper __OptionalTestWithParamViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper __OptionalWithMultipleTypesViewComponentTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalTestViewComponentTagHelper = CreateTagHelper(); + __OptionalTestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestViewComponentTagHelper); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -61,10 +61,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalTestViewComponentTagHelper = CreateTagHelper(); + __OptionalTestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestViewComponentTagHelper); __OptionalTestViewComponentTagHelper.showSecret = #nullable restore @@ -84,10 +84,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); + __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestWithParamViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("mysecret"); @@ -102,10 +102,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); + __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestWithParamViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("mysecret"); @@ -130,10 +130,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -143,10 +143,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -186,10 +186,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -219,10 +219,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -262,10 +262,10 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt index 4f08e19b817..d6a1104947b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt @@ -1,33 +1,33 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper - __OptionalTestViewComponentTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper - __OptionalTestWithParamViewComponentTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper - __OptionalWithMultipleTypesViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper - __OptionalTestViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper - __OptionalTestWithParamViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper - __OptionalWithMultipleTypesViewComponentTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (28:1,0 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (28:1,0 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (30:2,0 [37] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper DefaultTagHelperExecute - HtmlContent - (67:2,37 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (67:2,37 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (69:3,0 [57] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper DefaultTagHelperProperty - (100:3,31 [5] ViewComponentTagHelperOptionalParam.cshtml) - show-secret - bool OptionalTestViewComponentTagHelper.showSecret - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (101:3,32 [4] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (101:3,32 [4] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - true @@ -36,7 +36,7 @@ LazyIntermediateToken - (126:3,57 [4] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n\n TagHelper - (130:5,0 [77] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test-with-param - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper DefaultTagHelperProperty - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - secret - string OptionalTestWithParamViewComponentTagHelper.secret - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - Html - mysecret @@ -45,7 +45,7 @@ LazyIntermediateToken - (207:5,77 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (209:6,0 [97] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test-with-param - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper DefaultTagHelperProperty - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - secret - string OptionalTestWithParamViewComponentTagHelper.secret - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - Html - mysecret @@ -57,13 +57,13 @@ LazyIntermediateToken - (306:6,97 [4] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n\n TagHelper - (310:8,0 [67] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperExecute - HtmlContent - (377:8,67 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (377:8,67 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (379:9,0 [122] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (417:9,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (417:9,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (439:9,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -75,7 +75,7 @@ LazyIntermediateToken - (501:9,122 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (503:10,0 [100] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (541:10,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (541:10,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (563:10,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -85,7 +85,7 @@ LazyIntermediateToken - (603:10,100 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (605:11,0 [126] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (643:11,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (643:11,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (665:11,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -97,7 +97,7 @@ LazyIntermediateToken - (731:11,126 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (733:12,0 [126] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (771:12,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (771:12,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (793:12,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs index eb19091d31e..3ff1d5ee76c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -25,7 +25,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon #pragma warning restore 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); private global::AllTagHelper __AllTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((global::System.Action)(() => { @@ -55,7 +55,7 @@ private void __RazorDirectiveTokenHelpers__() { #line hidden #nullable disable __AllTagHelper = CreateTagHelper(); - __TestViewComponentTagHelper = CreateTagHelper(); + __TestViewComponentTagHelper = CreateTagHelper(); #nullable restore #line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" __o = foo; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html index 8027d8fb1b8..772a14b598b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ ~~ - ~~~ ~~~ ~ ~~~~~~~~ + ~~~ ~~~ ~ /*~~~~*/ ~ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt index ef059352dae..a9c80f4be8b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,10 +10,10 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html @@ -45,7 +45,7 @@ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag DefaultTagHelperBody - DefaultTagHelperCreate - - AllTagHelper - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml) LazyIntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt index 057088936b2..2a460b44375 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (14:0,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |"*, AppCode"| -Generated Location: (1904:33,37 [12] ) +Generated Location: (1947:33,37 [12] ) |"*, AppCode"| Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) | var foo = "Hello"; | -Generated Location: (2412:50,2 [26] ) +Generated Location: (2455:50,2 [26] ) | var foo = "Hello"; | Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |foo| -Generated Location: (2901:60,22 [3] ) +Generated Location: (2961:60,22 [3] ) |foo| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs index 56a0795ba61..ab77dcdc253 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9ef17a17b6e1fedefe92b2dd4e87273d3ae73d9b1f8b2ad44ce57c5611f991d3" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,10 +18,10 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("bar", " World", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0649 @@ -57,12 +57,12 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon #nullable disable WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__AllTagHelper); - __TestViewComponentTagHelper = CreateTagHelper(); + __TestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral( diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt index 3a580f4bcfd..6b8ac1dd7b8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt @@ -1,18 +1,18 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - bar - World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper @@ -24,7 +24,7 @@ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag DefaultTagHelperBody - DefaultTagHelperCreate - - AllTagHelper - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml) LazyIntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs index 7b7b1d9c1d8..cf9a098e8f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html index 63bfdf58d91..1c4043833a8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~ +/*~~~~~~*/ /*~~~~~~~~~~*/

Hi There!

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt index f3b8c4bf6a0..127368efc61 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt index 9bc576597c0..e262a3df658 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (11:0,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml) |Test.Namespace| -Generated Location: (1252:26,44 [14] ) +Generated Location: (1261:26,44 [14] ) |Test.Namespace| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs index 9f90d820011..703910bc92e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs @@ -18,7 +18,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt index 08028a66683..6dffca77d36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - NamespaceDeclaration - - Test.Namespace - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) LazyIntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html index a9823b39aac..b5872a65558 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~ \ No newline at end of file +/*~~~*/ /*~~~~~~~~~~~~~~~*/ /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt index de86e512705..ba2f901ea93 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt index 157f736942d..3462c072be6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |IHtmlHelper| -Generated Location: (1189:26,0 [19] ) +Generated Location: (1215:26,0 [19] ) |IHtmlHelper| Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |Helper| -Generated Location: (1482:36,22 [6] ) +Generated Location: (1508:36,22 [6] ) |Helper| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs index e1b5f94bf16..a59ed4b4c39 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d62f98eaaf5b78af8d93afeee3b564ac056a55d715d72361969351a6dd2ca3b2" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt index 5fb9225a6c9..9f7b1838608 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorFactoryTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorFactoryTest.cs index 353309d3551..44d33525422 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorFactoryTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorFactoryTest.cs @@ -3,11 +3,9 @@ #nullable disable -using System.Collections.Generic; -using System.Reflection; -using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; using Xunit; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; @@ -15,20 +13,20 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions; public class ViewComponentTagHelperDescriptorFactoryTest { - private static readonly Assembly _assembly = typeof(ViewComponentTagHelperDescriptorFactoryTest).GetTypeInfo().Assembly; + private static readonly Compilation _compilation = TestCompilation.Create(syntaxTrees: [CSharpSyntaxTree.ParseText(AdditionalCode)], references: []); [Fact] public void CreateDescriptor_UnderstandsStringParameters() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(StringParameterViewComponent).FullName); + var testCompilation = _compilation; + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.StringParameterViewComponent"); var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); var expectedDescriptor = TagHelperDescriptorBuilder.Create( ViewComponentTagHelperConventions.Kind, "__Generated__StringParameterViewComponentTagHelper", - typeof(StringParameterViewComponent).GetTypeInfo().Assembly.GetName().Name) + TestCompilation.AssemblyName) .Metadata( TypeName("__Generated__StringParameterViewComponentTagHelper"), new(ViewComponentTagHelperMetadata.Name, "StringParameter")) @@ -63,14 +61,14 @@ public void CreateDescriptor_UnderstandsStringParameters() public void CreateDescriptor_UnderstandsVariousParameterTypes() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(VariousParameterViewComponent).FullName); + var testCompilation = _compilation; + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.VariousParameterViewComponent"); var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); var expectedDescriptor = TagHelperDescriptorBuilder.Create( ViewComponentTagHelperConventions.Kind, "__Generated__VariousParameterViewComponentTagHelper", - typeof(VariousParameterViewComponent).GetTypeInfo().Assembly.GetName().Name) + TestCompilation.AssemblyName) .Metadata( TypeName("__Generated__VariousParameterViewComponentTagHelper"), new(ViewComponentTagHelperMetadata.Name, "VariousParameter")) @@ -84,9 +82,9 @@ public void CreateDescriptor_UnderstandsVariousParameterTypes() attribute .Name("test-enum") .Metadata(PropertyName("testEnum")) - .TypeName(typeof(VariousParameterViewComponent).FullName + "." + nameof(VariousParameterViewComponent.TestEnum)) + .TypeName("TestNamespace.VariousParameterViewComponent.TestEnum") .AsEnum() - .DisplayName(typeof(VariousParameterViewComponent).FullName + "." + nameof(VariousParameterViewComponent.TestEnum) + " VariousParameterViewComponentTagHelper.testEnum")) + .DisplayName("TestNamespace.VariousParameterViewComponent.TestEnum VariousParameterViewComponentTagHelper.testEnum")) .BoundAttributeDescriptor(attribute => attribute .Name("test-string") @@ -112,14 +110,14 @@ public void CreateDescriptor_UnderstandsVariousParameterTypes() public void CreateDescriptor_UnderstandsGenericParameters() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(GenericParameterViewComponent).FullName); + var testCompilation = _compilation; + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.GenericParameterViewComponent"); var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); var expectedDescriptor = TagHelperDescriptorBuilder.Create( ViewComponentTagHelperConventions.Kind, "__Generated__GenericParameterViewComponentTagHelper", - typeof(GenericParameterViewComponent).GetTypeInfo().Assembly.GetName().Name) + TestCompilation.AssemblyName) .Metadata( TypeName("__Generated__GenericParameterViewComponentTagHelper"), new(ViewComponentTagHelperMetadata.Name, "GenericParameter")) @@ -154,13 +152,13 @@ public void CreateDescriptor_UnderstandsGenericParameters() public void CreateDescriptor_ForSyncViewComponentWithInvokeInBaseType_Works() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); var expectedDescriptor = TagHelperDescriptorBuilder.Create( ViewComponentTagHelperConventions.Kind, "__Generated__SyncDerivedViewComponentTagHelper", - typeof(SyncDerivedViewComponent).GetTypeInfo().Assembly.GetName().Name) + TestCompilation.AssemblyName) .Metadata( TypeName("__Generated__SyncDerivedViewComponentTagHelper"), new(ViewComponentTagHelperMetadata.Name, "SyncDerived")) @@ -184,7 +182,7 @@ public void CreateDescriptor_ForSyncViewComponentWithInvokeInBaseType_Works() .DisplayName("string SyncDerivedViewComponentTagHelper.bar")) .Build(); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncDerivedViewComponent).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.SyncDerivedViewComponent"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -197,13 +195,13 @@ public void CreateDescriptor_ForSyncViewComponentWithInvokeInBaseType_Works() public void CreateDescriptor_ForAsyncViewComponentWithInvokeInBaseType_Works() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); var expectedDescriptor = TagHelperDescriptorBuilder.Create( ViewComponentTagHelperConventions.Kind, "__Generated__AsyncDerivedViewComponentTagHelper", - typeof(AsyncDerivedViewComponent).Assembly.GetName().Name) + TestCompilation.AssemblyName) .Metadata( TypeName("__Generated__AsyncDerivedViewComponentTagHelper"), new(ViewComponentTagHelperMetadata.Name, "AsyncDerived")) @@ -211,7 +209,7 @@ public void CreateDescriptor_ForAsyncViewComponentWithInvokeInBaseType_Works() .TagMatchingRuleDescriptor(rule => rule.RequireTagName("vc:async-derived")) .Build(); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncDerivedViewComponent).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.AsyncDerivedViewComponent"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -224,10 +222,10 @@ public void CreateDescriptor_ForAsyncViewComponentWithInvokeInBaseType_Works() public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoInvokeMethod() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(ViewComponentWithoutInvokeMethod).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.ViewComponentWithoutInvokeMethod"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -241,10 +239,10 @@ public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoInvokeMethod() public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoInstanceInvokeMethod() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(StaticInvokeAsyncViewComponent).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.StaticInvokeAsyncViewComponent"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -258,10 +256,10 @@ public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoInstanceInvoke public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoPublicInvokeMethod() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(NonPublicInvokeAsyncViewComponent).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.NonPublicInvokeAsyncViewComponent"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -275,10 +273,10 @@ public void CreateDescriptor_AddsDiagnostic_ForViewComponentWithNoPublicInvokeMe public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsGenericTask() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithGenericTask).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.AsyncViewComponentWithGenericTask"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -291,10 +289,10 @@ public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsGenericT public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsNonGenericTask() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithNonGenericTask).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.AsyncViewComponentWithNonGenericTask"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -307,10 +305,10 @@ public void CreateDescriptor_ForViewComponentWithInvokeAsync_UnderstandsNonGener public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandVoid() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithString).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.AsyncViewComponentWithString"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -324,10 +322,10 @@ public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandVo public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandString() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(AsyncViewComponentWithString).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.AsyncViewComponentWithString"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -341,10 +339,10 @@ public void CreateDescriptor_ForViewComponentWithInvokeAsync_DoesNotUnderstandSt public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandVoid() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithVoid).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.SyncViewComponentWithVoid"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -358,10 +356,10 @@ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandVoid() public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandNonGenericTask() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithNonGenericTask).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.SyncViewComponentWithNonGenericTask"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -375,10 +373,10 @@ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandNonGene public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandGenericTask() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(SyncViewComponentWithGenericTask).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.SyncViewComponentWithGenericTask"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -392,10 +390,10 @@ public void CreateDescriptor_ForViewComponentWithInvoke_DoesNotUnderstandGeneric public void CreateDescriptor_ForViewComponent_WithAmbiguousMethods() { // Arrange - var testCompilation = TestCompilation.Create(_assembly); + var testCompilation = _compilation; var factory = new ViewComponentTagHelperDescriptorFactory(testCompilation); - var viewComponent = testCompilation.GetTypeByMetadataName(typeof(DerivedViewComponentWithAmbiguity).FullName); + var viewComponent = testCompilation.GetTypeByMetadataName("TestNamespace.DerivedViewComponentWithAmbiguity"); // Act var descriptor = factory.CreateDescriptor(viewComponent); @@ -404,88 +402,96 @@ public void CreateDescriptor_ForViewComponent_WithAmbiguousMethods() var diagnostic = Assert.Single(descriptor.GetAllDiagnostics()); Assert.Equal(RazorExtensionsDiagnosticFactory.ViewComponent_AmbiguousMethods.Id, diagnostic.Id); } -} - -public class StringParameterViewComponent -{ - public string Invoke(string foo, string bar) => null; -} - -public class VariousParameterViewComponent -{ - public string Invoke(TestEnum testEnum, string testString, int baz = 5) => null; - - public enum TestEnum - { - A = 1, - B = 2, - C = 3 - } -} - -public class GenericParameterViewComponent -{ - public string Invoke(List Foo, Dictionary Bar) => null; -} - -public class ViewComponentWithoutInvokeMethod -{ -} - -public class AsyncViewComponentWithGenericTask -{ - public Task InvokeAsync() => null; -} - -public class AsyncViewComponentWithNonGenericTask -{ - public Task InvokeAsync() => null; -} - -public class AsyncViewComponentWithVoid -{ - public void InvokeAsync() { } -} -public class AsyncViewComponentWithString -{ - public string InvokeAsync() => null; -} - -public class SyncViewComponentWithVoid -{ - public void Invoke() { } -} - -public class SyncViewComponentWithNonGenericTask -{ - public Task Invoke() => null; -} - -public class SyncViewComponentWithGenericTask -{ - public Task Invoke() => null; -} - -public class SyncDerivedViewComponent : StringParameterViewComponent -{ -} - -public class AsyncDerivedViewComponent : AsyncViewComponentWithNonGenericTask -{ -} - -public class DerivedViewComponentWithAmbiguity : AsyncViewComponentWithNonGenericTask -{ - public string Invoke() => null; -} - -public class StaticInvokeAsyncViewComponent -{ - public static Task InvokeAsync() => null; -} - -public class NonPublicInvokeAsyncViewComponent -{ - protected Task InvokeAsync() => null; + public const string AdditionalCode = """ + using System.Collections.Generic; + using System.Threading.Tasks; + + namespace TestNamespace + { + public class StringParameterViewComponent + { + public string Invoke(string foo, string bar) => null; + } + + public class VariousParameterViewComponent + { + public string Invoke(TestEnum testEnum, string testString, int baz = 5) => null; + + public enum TestEnum + { + A = 1, + B = 2, + C = 3 + } + } + + public class GenericParameterViewComponent + { + public string Invoke(List Foo, Dictionary Bar) => null; + } + + public class ViewComponentWithoutInvokeMethod + { + } + + public class AsyncViewComponentWithGenericTask + { + public Task InvokeAsync() => null; + } + + public class AsyncViewComponentWithNonGenericTask + { + public Task InvokeAsync() => null; + } + + public class AsyncViewComponentWithVoid + { + public void InvokeAsync() { } + } + + public class AsyncViewComponentWithString + { + public string InvokeAsync() => null; + } + + public class SyncViewComponentWithVoid + { + public void Invoke() { } + } + + public class SyncViewComponentWithNonGenericTask + { + public Task Invoke() => null; + } + + public class SyncViewComponentWithGenericTask + { + public Task Invoke() => null; + } + + public class SyncDerivedViewComponent : StringParameterViewComponent + { + } + + public class AsyncDerivedViewComponent : AsyncViewComponentWithNonGenericTask + { + } + + public class DerivedViewComponentWithAmbiguity : AsyncViewComponentWithNonGenericTask + { + public string Invoke() => null; + } + + public class StaticInvokeAsyncViewComponent + { + public static Task InvokeAsync() => null; + } + + public class NonPublicInvokeAsyncViewComponent + { + protected Task InvokeAsync() => null; + } + } + """; } diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorProviderTest.cs index e4712707c84..340e4e1b4e4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/ViewComponentTagHelperDescriptorProviderTest.cs @@ -25,7 +25,7 @@ public class StringParameterViewComponent } "; - var compilation = MvcShim.BaseCompilation.AddSyntaxTrees(CSharpSyntaxTree.ParseText(code)); + var compilation = TestCompilation.Create().AddSyntaxTrees(CSharpSyntaxTree.ParseText(code)); var context = new TagHelperDescriptorProviderContext(compilation); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/TagHelperParseTreeRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/TagHelperParseTreeRewriterTest.cs index bb63bdf4da3..762361f23ba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/TagHelperParseTreeRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/TagHelperParseTreeRewriterTest.cs @@ -52,7 +52,7 @@ public void GetAttributeNameValuePairs_ParsesPairsCorrectly( IEnumerable> expectedPairs) { // Arrange - var errorSink = new ErrorSink(); + using var errorSink = new ErrorSink(); var parseResult = ParseDocument(documentContent); var document = parseResult.Root; @@ -61,7 +61,7 @@ public void GetAttributeNameValuePairs_ParsesPairsCorrectly( var rootMarkup = Assert.IsType(rootBlock.Document); var childBlock = Assert.Single(rootMarkup.Children); var element = Assert.IsType(childBlock); - Assert.Empty(errorSink.Errors); + Assert.Empty(errorSink.GetErrorsAndClear()); // Act var pairs = TagHelperParseTreeRewriter.Rewriter.GetAttributeNameValuePairs(element.StartTag); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs index 18837bc17b7..34adfc50ce9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs @@ -32,7 +32,7 @@ public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() var rewritten = rewriter.Visit(parsed.Root); // Assert - var rewrittenTree = RazorSyntaxTree.Create(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); + var rewrittenTree = new RazorSyntaxTree(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); BaselineTest(rewrittenTree); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt index 9862748b6a1..7bb1eed998e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt @@ -1,4 +1,4 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [12] ) -Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [12] ) -Code span at (1:0,1 [11] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [12] ) -Markup span at (12:1,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [12] ) +Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [10] ) +Code span at (1:0,1 [9] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [10] ) +MetaCode span at (10:0,10 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [12] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt index 86dcaea4807..d2bea112cb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt @@ -3,15 +3,14 @@ MarkupTextLiteral - [0..0)::0 - [] - Gen - SpanEditHandler;Accepts:Any Marker;[]; CSharpCodeBlock - [0..12)::12 - RazorDirective - [0..12)::12 + RazorDirective - [0..10)::10 CSharpTransition - [0..1)::1 - Gen - SpanEditHandler;Accepts:None Transition;[@]; - RazorDirectiveBody - [1..12)::11 - CSharpStatementLiteral - [1..12)::11 - [using FooLF] - Gen - SpanEditHandler;Accepts:AnyExceptNewline + RazorDirectiveBody - [1..10)::9 + CSharpStatementLiteral - [1..10)::9 - [using Foo] - Gen - SpanEditHandler;Accepts:AnyExceptNewline Keyword;[using]; Whitespace;[ ]; Identifier;[Foo]; - NewLine;[LF]; - MarkupTextLiteral - [12..12)::0 - [] - Gen - SpanEditHandler;Accepts:Any - Marker;[]; + RazorMetaCode - [10..12)::2 - Gen - SpanEditHandler;Accepts:Any + NewLine;[LF]; EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt deleted file mode 100644 index bd189123b2f..00000000000 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt +++ /dev/null @@ -1,5 +0,0 @@ -(1,14): Error RZ1009: The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example: - -@if(isLoggedIn) { -

Hello, @user!

-} diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt index 92e7344e94e..9f8276b72d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt @@ -17,7 +17,7 @@ Transition;[@]; CSharpStatementLiteral - [12..28)::16 - [@@@class.Foo() }] - Gen - SpanEditHandler;Accepts:Any Transition;[@]; - Identifier;[@]; + Transition;[@]; Identifier;[@class]; Dot;[.]; Identifier;[Foo]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt index 674020e0368..77685bb6951 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt @@ -18,8 +18,7 @@ Whitespace;[ ]; NullCoalesce;[??]; Whitespace;[ ]; - Transition;[@]; - Identifier;[photo]; + Identifier;[@photo]; Dot;[.]; Identifier;[Description]; RazorMetaCode - [46..47)::1 - Gen - SpanEditHandler;Accepts:None diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt index 57850417909..fe9d19cced0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt @@ -34,8 +34,7 @@ LessThan;[<]; Identifier;[h3]; GreaterThan;[>]; - Transition;[@]; - Identifier;[message]; + Identifier;[@message]; LessThan;[<]; Slash;[/]; Identifier;[h3]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs index 8d7c6ff83c3..39604a88965 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs @@ -402,7 +402,7 @@ public void CSharpCodeWriter_RespectTabSetting() o.IndentSize = 4; }); - using var writer = new CodeWriter(Environment.NewLine, options); + using var writer = new CodeWriter(options); // Act writer.BuildClassDeclaration(Array.Empty(), "C", "", Array.Empty(), Array.Empty(), context: null); @@ -428,7 +428,7 @@ public void CSharpCodeWriter_RespectSpaceSetting() o.IndentSize = 4; }); - using var writer = new CodeWriter(Environment.NewLine, options); + using var writer = new CodeWriter(options); // Act writer.BuildClassDeclaration(Array.Empty(), "C", "", Array.Empty(), Array.Empty(), context: null); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs index 8d6f8d7f170..29ffd24e1f8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs @@ -15,7 +15,7 @@ public void CreateDefault_CreatesDefaultCodeTarget() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act var target = CodeTarget.CreateDefault(codeDocument, options); @@ -32,7 +32,7 @@ public void CreateDefault_CallsDelegate() Action @delegate = (b) => { wasCalled = true; }; var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, @delegate); @@ -46,7 +46,7 @@ public void CreateDefault_AllowsNullDelegate() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, configure: null); @@ -59,7 +59,7 @@ public void CreateEmpty_AllowsNullDelegate() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, configure: null); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs index c2fc301395f..654d44608a0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs @@ -14,7 +14,7 @@ public void Build_CreatesDefaultCodeTarget() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var builder = new DefaultCodeTargetBuilder(codeDocument, options); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs index 50624d004e4..a8dbc432063 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs @@ -14,7 +14,7 @@ public class DefaultCodeTargetTest public void Constructor_CreatesDefensiveCopy() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -33,7 +33,7 @@ public void Constructor_CreatesDefensiveCopy() public void CreateWriter_DesignTime_CreatesDesignTimeNodeWriter() { // Arrange - var options = RazorCodeGenerationOptions.CreateDesignTimeDefault(); + var options = RazorCodeGenerationOptions.DesignTimeDefault; var target = new DefaultCodeTarget(options, Enumerable.Empty()); // Act @@ -47,7 +47,7 @@ public void CreateWriter_DesignTime_CreatesDesignTimeNodeWriter() public void CreateWriter_Runtime_CreatesRuntimeNodeWriter() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = new DefaultCodeTarget(options, Enumerable.Empty()); // Act @@ -61,7 +61,7 @@ public void CreateWriter_Runtime_CreatesRuntimeNodeWriter() public void HasExtension_ReturnsTrue_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -82,7 +82,7 @@ public void HasExtension_ReturnsTrue_WhenExtensionFound() public void HasExtension_ReturnsFalse_WhenExtensionNotFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -103,7 +103,7 @@ public void HasExtension_ReturnsFalse_WhenExtensionNotFound() public void GetExtension_ReturnsExtension_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -124,7 +124,7 @@ public void GetExtension_ReturnsExtension_WhenExtensionFound() public void GetExtension_ReturnsFirstMatch_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -148,7 +148,7 @@ public void GetExtension_ReturnsFirstMatch_WhenExtensionFound() public void GetExtension_ReturnsNull_WhenExtensionNotFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs index 1351dc789ff..9a9ad5d22b3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs @@ -20,7 +20,7 @@ public void WriteDocument_EndToEnd_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -51,7 +51,7 @@ public void WriteDocument_SHA1_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = RazorCodeDocument.Create(sourceDocument); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -82,7 +82,7 @@ public void WriteDocument_SHA256_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = RazorCodeDocument.Create(sourceDocument); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -110,7 +110,7 @@ public void WriteDocument_Empty_SuppressChecksumTrue_DoesnotWriteChecksum() var document = new DocumentIntermediateNode(); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var optionsBuilder = new DefaultRazorCodeGenerationOptionsBuilder(designTime: false) + var optionsBuilder = new RazorCodeGenerationOptionsBuilder(designTime: false) { SuppressChecksum = true }; @@ -144,7 +144,7 @@ public void WriteDocument_WritesNamespace() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -192,7 +192,7 @@ public void WriteDocument_WritesClass() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -243,7 +243,7 @@ public void WriteDocument_WithNullableContext_WritesClass() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -292,7 +292,7 @@ public void WriteDocument_WritesClass_ConstrainedGenericTypeParameters() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -355,7 +355,7 @@ public void WriteDocument_WritesMethod() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -399,7 +399,7 @@ public void WriteDocument_WritesField() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -439,7 +439,7 @@ public void WriteDocument_WritesProperty() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs index 1724a5ad318..d34c08ea4b9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs @@ -58,7 +58,7 @@ public void WriteUsingDirective_WithSource_WritesContentWithLinePragmaAndMapping writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + var mapping = Assert.Single(context.GetSourceMappings()); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -94,7 +94,7 @@ public void WriteUsingDirective_WithSourceAndLineDirectives_WritesContentWithLin writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + var mapping = Assert.Single(context.GetSourceMappings()); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -587,7 +587,7 @@ public void LinePragma_Enhanced_Is_Adjusted_On_Windows(string fileName, string e csharp, ignoreLineEndingDifferences: true); - Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + Assert.Single(context.GetSourceMappings()); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs index 34743b31272..c542ab950b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs @@ -141,7 +141,7 @@ public void Execute_FindDuplicate_Multiple() var diagnostics = documentNode.GetAllDiagnostics(); var nodes = documentNode.FindDescendantNodes().Where(n => n.HasDiagnostics).ToArray(); - Assert.Equal(2, diagnostics.Count); + Assert.Equal(2, diagnostics.Length); Assert.Equal(2, nodes.Length); for (var i = 0; i < 2; i++) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs index 6936b9451e1..2b1a4822e1d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs @@ -23,7 +23,7 @@ public void Execute_IgnoresDocumentsWithDocumentKind() var documentNode = new DocumentIntermediateNode() { DocumentKind = "ignore", - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new DefaultDocumentClassifierPass(); @@ -43,7 +43,7 @@ public void Execute_CreatesClassStructure() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new DefaultDocumentClassifierPass(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs index 4a535879206..b8efdb27514 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs @@ -66,7 +66,7 @@ public void Execute_CollatesIRDocumentDiagnosticsFromSourceDocument() var phase = new DefaultRazorCSharpLoweringPhase(); var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase)); var codeDocument = TestRazorCodeDocument.Create("

([initialError, expectedRewritingError], outputTree.Diagnostics); } private static string AssemblyA => "TestAssembly"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DocumentClassifierPassBaseTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DocumentClassifierPassBaseTest.cs index 7f8bee38519..d2dfc510a10 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DocumentClassifierPassBaseTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DocumentClassifierPassBaseTest.cs @@ -26,7 +26,7 @@ public void Execute_HasDocumentKind_IgnoresDocument() var documentNode = new DocumentIntermediateNode() { DocumentKind = "ignore", - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new TestDocumentClassifierPass(); @@ -46,7 +46,7 @@ public void Execute_NoMatch_IgnoresDocument() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new TestDocumentClassifierPass() @@ -69,7 +69,7 @@ public void Execute_Match_AddsGlobalTargetExtensions() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var expected = new ICodeTargetExtension[] @@ -104,7 +104,7 @@ public void Execute_Match_SetsDocumentType_AndCreatesStructure() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new TestDocumentClassifierPass(); @@ -129,7 +129,7 @@ public void Execute_AddsUsingsToNamespace() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(documentNode); @@ -155,7 +155,7 @@ public void Execute_AddsTheRestToMethod() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(documentNode); @@ -184,7 +184,7 @@ public void Execute_CanInitializeDefaults() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(documentNode); @@ -219,7 +219,7 @@ public void Execute_AddsPrimaryAnnotations() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(documentNode); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs index b4db68fecc6..b7095e5c7dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs @@ -370,7 +370,7 @@ public void RenderTagHelperAttributeInline_NonString_StatementInAttribute_Errors extension.RenderTagHelperAttributeInline(context, node, new CSharpCodeIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -392,7 +392,7 @@ public void RenderTagHelperAttributeInline_NonStringIndexerMatch_TemplateInAttri extension.RenderTagHelperAttributeInline(context, node, new TemplateIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -416,7 +416,7 @@ public void RenderTagHelperAttributeInline_NonString_TemplateInAttribute_Errors( extension.RenderTagHelperAttributeInline(context, node, new TemplateIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -1148,7 +1148,7 @@ public void GetDeterministicId_IsDeterministic() private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - ((DefaultCodeRenderingContext)context).AncestorsInternal.Push(node); + context.PushAncestor(node); } private static TagHelperDescriptor CreateTagHelperDescriptor( diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs index 4dc46aa39d1..6981ece7703 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs @@ -273,6 +273,6 @@ public void WriteSetPreallocatedTagHelperProperty_IndexerAttribute_MultipleValue private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - ((DefaultCodeRenderingContext)context).AncestorsInternal.Push(node); + context.PushAncestor(node); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 2f7df193acd..b7c4984ce27 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -2336,9 +2336,9 @@ public class MyComponent : ComponentBase : [// x:\dir\subdir\Test\TestComponent.cshtml(1,27): error CS1503: Argument 1: cannot convert from 'string' to 'int' // ParentValue Diagnostic(ErrorCode.ERR_BadArgType, "ParentValue").WithArguments("1", "string", "int").WithLocation(1, 27), - // (38,158): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(2, "ValueChanged", (global::System.Action)(__value => ParentValue = __value)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 158)]); + // (38,166): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 166)]); } [IntegrationTestFact] @@ -2616,18 +2616,18 @@ public class MyComponent : ComponentBase CompileToAssembly(generated, DesignTime - ? [// (31,179): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 179), - // (31,179): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 179)] - : [// (39,258): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 258), - // (39,258): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 258) + ? [// (38,195): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 195), + // (38,195): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type + // __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 195)] + : [// (39,274): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 274), + // (39,274): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type + // __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 274) ]); } @@ -2743,6 +2743,36 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10609")] + public void BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +public class MyComponent : ComponentBase +{ + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + [IntegrationTestFact] public void BindToElement_WritesAttributes() { @@ -5520,6 +5550,87 @@ @inherits BaseComponent ]); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10863")] + public void PageDirective_NoForwardSlash() + { + // Act + var generated = CompileToCSharp(""" + @page "MyPage" + + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10863")] + public void PageDirective_NoForwardSlash_WithComment() + { + // Act + var generated = CompileToCSharp(""" + @page /* comment */ "MyPage" + + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10863")] + public void PageDirective_MissingRoute() + { + // Act + var generated = CompileToCSharp(""" + @page + + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + + // Design time writer doesn't correctly emit pragmas for missing tokens, so don't validate them in design time + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument, verifyLinePragmas: !DesignTime); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10863")] + public void PageDirective_MissingRoute_WithComment() + { + // Act + var generated = CompileToCSharp(""" + @page /* comment */ + + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + + // Design time writer doesn't correctly emit pragmas for missing tokens, so don't validate them in design time + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument, verifyLinePragmas: !DesignTime); + CompileToAssembly(generated); + } + + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10863")] + public void UsingDirective() + { + // Act + var generated = CompileToCSharp(""" + @using System.Collections + + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + #endregion #region EventCallback @@ -8713,6 +8824,31 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10827")] + public void GenericTypeCheck() + { + var generated = CompileToCSharp(""" + + + @code { + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } + } + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + #endregion #region Key @@ -11055,6 +11191,21 @@ public void AtTransitions() CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/sdk/issues/42730")] + public void AtAtHandled() + { + var generated = CompileToCSharp(""" + @{ var validationMessage = @Html.ValidationMessage("test", "", new { @@class = "invalid-feedback" }, "div"); } + """); + + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated, + // x:\dir\subdir\Test\TestComponent.cshtml(1,28): error CS0103: The name 'Html' does not exist in the current context + // var validationMessage = @Html.ValidationMessage("test", "", new { @@class = "invalid-feedback" }, "div"); + Diagnostic(ErrorCode.ERR_NameNotInContext, "@Html").WithArguments("Html").WithLocation(1, 28)); + } + #endregion #region LinePragmas diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs index 703bf8dffb7..3c9f0249c0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs @@ -100,6 +100,23 @@ public void SupportsInjectDirective() s => AssertEx.Equal("private TestNamespace.IMyService2 Test.TestComponent.MyService2 { get; set; }", s.ToTestDisplayString())); } + [Fact] + public void SupportsIncompleteInjectDirectives() + { + var component = CompileToComponent(""" + @inject + @inject DateTime + @inject DateTime Value + """); + + // Assert 1: Compiled type has correct properties + var injectableProperties = component.GetMembers().OfType() + .Where(p => p.GetAttributes().Any(a => a.AttributeClass.Name == "InjectAttribute")); + Assert.Collection(injectableProperties.OrderBy(p => p.Name), + s => AssertEx.Equal("private System.DateTime Test.TestComponent.Member___UniqueIdSuppressedForTesting__ { get; set; }", s.ToTestDisplayString()), + s => AssertEx.Equal("private System.DateTime Test.TestComponent.Value { get; set; }", s.ToTestDisplayString())); + } + private const string AdditionalCode = """ using Microsoft.AspNetCore.Components; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpBlockTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpBlockTest.cs index cdf7bb2aa6c..e1fa97a2bcf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpBlockTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpBlockTest.cs @@ -3,6 +3,7 @@ #nullable disable +using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy; @@ -880,6 +881,31 @@ public void EscapedIdentifiers_10() """); } + [Fact, WorkItem("https://github.com/dotnet/sdk/issues/42730")] + public void EscapedIdentifiers_11() + { + ParseDocumentTest(""" + @{ var validationMessage = @Html.ValidationMessage(Model.Binding, "", new { @@class = "invalid-feedback" }, "div"); } + """); + } + + [Fact, WorkItem("https://github.com/dotnet/sdk/issues/42730")] + public void EscapedIdentifiers_12() + { + ParseDocumentTest(""" + @{ + @@ + """); + } + + [Fact, WorkItem("https://github.com/dotnet/sdk/issues/42730")] + public void EscapedIdentifiers_13() + { + ParseDocumentTest(""" + @{ var validationMessage = new { @@ + """); + } + private void RunRazorCommentBetweenClausesTest(string preComment, string postComment, AcceptedCharactersInternal acceptedCharacters = AcceptedCharactersInternal.Any) { ParseDocumentTest(preComment + "@* Foo *@ @* Bar *@" + postComment); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpCodeParserTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpCodeParserTest.cs index 8db5b1133b6..f9b9fc2fab8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpCodeParserTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/CSharpCodeParserTest.cs @@ -215,13 +215,15 @@ public void MapDirectives_HandlesDuplicates() // Arrange var source = TestRazorSourceDocument.Create(); var options = RazorParserOptions.CreateDefault(); - var context = new ParserContext(source, options); + using var context = new ParserContext(source, options); // Act & Assert (Does not throw) - var directiveDescriptors = new[] { + var directiveDescriptors = new[] + { DirectiveDescriptor.CreateDirective("test", DirectiveKind.SingleLine), DirectiveDescriptor.CreateDirective("test", DirectiveKind.SingleLine), }; + _ = new CSharpCodeParser(directiveDescriptors, context); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs index 95c251ec005..8c3989c0d0a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs @@ -53,7 +53,7 @@ public void IsHyphen_ReturnsTrueForADashToken() public void AcceptAllButLastDoubleHypens_ReturnsTheOnlyDoubleHyphenToken() { // Arrange - var sut = CreateTestParserForContent("-->"); + using var sut = CreateTestParserForContent("-->"); // Act var token = sut.AcceptAllButLastDoubleHyphens(); @@ -68,7 +68,7 @@ public void AcceptAllButLastDoubleHypens_ReturnsTheOnlyDoubleHyphenToken() public void AcceptAllButLastDoubleHypens_ReturnsTheDoubleHyphenTokenAfterAcceptingTheDash() { // Arrange - var sut = CreateTestParserForContent("--->"); + using var sut = CreateTestParserForContent("--->"); // Act var token = sut.AcceptAllButLastDoubleHyphens(); @@ -83,7 +83,7 @@ public void AcceptAllButLastDoubleHypens_ReturnsTheDoubleHyphenTokenAfterAccepti public void IsHtmlCommentAhead_ReturnsTrueForEmptyCommentTag() { // Arrange - var sut = CreateTestParserForContent(""); + using var sut = CreateTestParserForContent(""); // Act & Assert Assert.True(sut.IsHtmlCommentAhead()); @@ -93,7 +93,7 @@ public void IsHtmlCommentAhead_ReturnsTrueForEmptyCommentTag() public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTag() { // Arrange - var sut = CreateTestParserForContent(""); + using var sut = CreateTestParserForContent(""); // Act & Assert Assert.True(sut.IsHtmlCommentAhead()); @@ -103,7 +103,7 @@ public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTag() public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTagWithExtraDashesAtClosingTag() { // Arrange - var sut = CreateTestParserForContent(""); + using var sut = CreateTestParserForContent(""); // Act & Assert Assert.True(sut.IsHtmlCommentAhead()); @@ -113,7 +113,7 @@ public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTagWithExtraDashesAtClo public void IsHtmlCommentAhead_ReturnsFalseForContentWithBadEndingAndExtraDash() { // Arrange - var sut = CreateTestParserForContent(""); + using var sut = CreateTestParserForContent(""); // Act & Assert Assert.False(sut.IsHtmlCommentAhead()); @@ -123,7 +123,7 @@ public void IsHtmlCommentAhead_ReturnsFalseForContentWithBadEndingAndExtraDash() public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTagWithExtraInfoAfter() { // Arrange - var sut = CreateTestParserForContent(" the first part is a valid comment without the Open angle and bang tokens"); + using var sut = CreateTestParserForContent(" the first part is a valid comment without the Open angle and bang tokens"); // Act & Assert Assert.True(sut.IsHtmlCommentAhead()); @@ -133,7 +133,7 @@ public void IsHtmlCommentAhead_ReturnsTrueForValidCommentTagWithExtraInfoAfter() public void IsHtmlCommentAhead_ReturnsFalseForNotClosedComment() { // Arrange - var sut = CreateTestParserForContent(""); + using var sut = CreateTestParserForContent(""); // Act & Assert Assert.True(sut.IsHtmlCommentAhead()); @@ -195,8 +195,19 @@ public void IsCommentContentEndingInvalid_ReturnsFalseForEmptyContent() Assert.False(HtmlMarkupParser.IsCommentContentEndingInvalid(sequence)); } - private class TestHtmlMarkupParser : HtmlMarkupParser + private class TestHtmlMarkupParser : HtmlMarkupParser, IDisposable { + public TestHtmlMarkupParser(ParserContext context) + : base(context) + { + EnsureCurrent(); + } + + public void Dispose() + { + Context.Dispose(); + } + public new SyntaxToken PreviousToken { get => base.PreviousToken; @@ -207,11 +218,6 @@ private class TestHtmlMarkupParser : HtmlMarkupParser return base.IsHtmlCommentAhead(); } - public TestHtmlMarkupParser(ParserContext context) : base(context) - { - EnsureCurrent(); - } - public new SyntaxToken AcceptAllButLastDoubleHyphens() { return base.AcceptAllButLastDoubleHyphens(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperParseTreeRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperParseTreeRewriterTest.cs index 27296791cc6..162a1f35c31 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperParseTreeRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TagHelperParseTreeRewriterTest.cs @@ -52,7 +52,7 @@ public void GetAttributeNameValuePairs_ParsesPairsCorrectly( IEnumerable> expectedPairs) { // Arrange - var errorSink = new ErrorSink(); + using var errorSink = new ErrorSink(); var parseResult = ParseDocument(documentContent); var document = parseResult.Root; @@ -61,7 +61,7 @@ public void GetAttributeNameValuePairs_ParsesPairsCorrectly( var rootMarkup = Assert.IsType(rootBlock.Document); var childBlock = Assert.Single(rootMarkup.Children); var element = Assert.IsType(childBlock); - Assert.Empty(errorSink.Errors); + Assert.Empty(errorSink.GetErrorsAndClear()); // Act var pairs = TagHelperParseTreeRewriter.Rewriter.GetAttributeNameValuePairs(element.StartTag); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs index fe2015c88e4..60e5ff14be7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs @@ -63,7 +63,7 @@ public void Lookahead_MaintainsExistingBufferWhenSuccessfulAndTakeIfMatchIsFalse public void LookaheadUntil_PassesThePreviousTokensInTheSameOrder() { // Arrange - var tokenizer = CreateContentTokenizer("asdf--fvd--<"); + using var tokenizer = CreateContentTokenizer("asdf--fvd--<"); // Act var i = 3; @@ -89,7 +89,7 @@ public void LookaheadUntil_PassesThePreviousTokensInTheSameOrder() public void LookaheadUntil_ReturnsFalseAfterIteratingOverAllTokensIfConditionIsNotMet() { // Arrange - var tokenizer = CreateContentTokenizer("asdf--fvd"); + using var tokenizer = CreateContentTokenizer("asdf--fvd"); // Act var tokens = new Stack(); @@ -111,7 +111,7 @@ public void LookaheadUntil_ReturnsFalseAfterIteratingOverAllTokensIfConditionIsN public void LookaheadUntil_ReturnsTrueAndBreaksIteration() { // Arrange - var tokenizer = CreateContentTokenizer("asdf--fvd"); + using var tokenizer = CreateContentTokenizer("asdf--fvd"); // Act var tokens = new Stack(); @@ -134,8 +134,7 @@ private static TestTokenizerBackedParser CreateContentTokenizer(string content) var options = RazorParserOptions.CreateDefault(); var context = new ParserContext(source, options); - var tokenizer = new TestTokenizerBackedParser(HtmlLanguageCharacteristics.Instance, context); - return tokenizer; + return new TestTokenizerBackedParser(HtmlLanguageCharacteristics.Instance, context); } private static void AssertTokenEqual(SyntaxToken expected, SyntaxToken actual) @@ -204,12 +203,18 @@ protected override StateResult Dispatch() } } - private class TestTokenizerBackedParser : TokenizerBackedParser + private class TestTokenizerBackedParser : TokenizerBackedParser, IDisposable { - internal TestTokenizerBackedParser(LanguageCharacteristics language, ParserContext context) : base(language, context) + internal TestTokenizerBackedParser(LanguageCharacteristics language, ParserContext context) + : base(language, context) { } + public void Dispose() + { + Context.Dispose(); + } + internal new bool LookaheadUntil(Func, bool> condition) { return base.LookaheadUntil(condition); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs index 7f19eb246f9..6d7a461dbc3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs @@ -32,7 +32,7 @@ public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() var rewritten = rewriter.Visit(parsed.Root); // Assert - var rewrittenTree = RazorSyntaxTree.Create(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); + var rewrittenTree = new RazorSyntaxTree(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); BaselineTest(rewrittenTree); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs index 8c73fda2e9e..73f439931e0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs @@ -113,7 +113,7 @@ public void GetCSharpDocument_ReturnsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), Array.Empty()); + var expected = new RazorCSharpDocument(codeDocument, "", RazorCodeGenerationOptions.Default, diagnostics: []); codeDocument.Items[typeof(RazorCSharpDocument)] = expected; // Act @@ -129,7 +129,7 @@ public void SetCSharpDocument_SetsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), Array.Empty()); + var expected = new RazorCSharpDocument(codeDocument, "", RazorCodeGenerationOptions.Default, diagnostics: []); // Act codeDocument.SetCSharpDocument(expected); @@ -206,7 +206,7 @@ public void GetCodeGenerationOptions_ReturnsSuccessfully() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCodeGenerationOptions.CreateDefault(); + var expected = RazorCodeGenerationOptions.Default; codeDocument.Items[typeof(RazorCodeGenerationOptions)] = expected; // Act @@ -222,7 +222,7 @@ public void SetCodeGenerationOptions_SetsSuccessfully() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCodeGenerationOptions.CreateDefault(); + var expected = RazorCodeGenerationOptions.Default; // Act codeDocument.SetCodeGenerationOptions(expected); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs index 6f587dfcbe1..8cde3aae0e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html index 36ca9ed4def..c29aeeb42f8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt index e071424669a..9a44b9c2446 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt index 07c4a5e920b..35a8de78307 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml) |"*, TestAssembly"| -Generated Location: (1253:26,37 [17] ) +Generated Location: (1279:26,37 [17] ) |"*, TestAssembly"| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs index d8ffd3b95f5..243ebcf2aa9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "acb2e9438f3250e99764ff47299ab6f5503f0ade0c3b94cd2fc81bc2e2506a59" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt index 405b5c6d5c4..ea9aa764b03 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs index b75ad02d02d..70f39b825c2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -44,7 +44,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html index b0994b12416..4538c8e34a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~*/ Hello World \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt index bac57b386b6..f4414203409 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -18,7 +18,7 @@ IntermediateToken - (223:3,11 [44] AttributeDirective.cshtml) - CSharp - [Conditional("DEBUG"), Conditional("TEST1")] RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt index 006aec03078..299aedb346b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (11:0,11 [56] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[System.Runtime.InteropServices.DllImport("user32.dll")]| -Generated Location: (607:17,11 [56] ) +Generated Location: (624:17,11 [56] ) |[System.Runtime.InteropServices.DllImport("user32.dll")]| Source Location: (80:1,11 [51] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[assembly: AssemblyTitleAttribute("Some assembly")]| -Generated Location: (839:24,11 [51] ) +Generated Location: (856:24,11 [51] ) |[assembly: AssemblyTitleAttribute("Some assembly")]| Source Location: (144:2,11 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]| -Generated Location: (1066:31,11 [66] ) +Generated Location: (1083:31,11 [66] ) |[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]| Source Location: (223:3,11 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[Conditional("DEBUG"), Conditional("TEST1")]| -Generated Location: (1308:38,11 [44] ) +Generated Location: (1325:38,11 [44] ) |[Conditional("DEBUG"), Conditional("TEST1")]| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs index dc610f6d6d0..24e72f5cd86 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "182a864a99c94c5a3bbb535723dfb08ad1a97865628ed562e8f2c949e7098074" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -50,7 +50,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt index b6d17d80ca9..e07d2661f37 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt @@ -1,13 +1,13 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures CSharpCode - (11:0,11 [56] AttributeDirective.cshtml) IntermediateToken - (11:0,11 [56] AttributeDirective.cshtml) - CSharp - [System.Runtime.InteropServices.DllImport("user32.dll")] CSharpCode - (80:1,11 [51] AttributeDirective.cshtml) @@ -19,7 +19,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (269:4,0 [13] AttributeDirective.cshtml) LazyIntermediateToken - (269:4,0 [13] AttributeDirective.cshtml) - Html - \nHello World diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs index ccb654f6366..ea08f7afb36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html index 29fdc470b4e..94086a0e60e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html @@ -1,8 +1,8 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/

HelloWorld

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt index 2242a48e869..229a19759b0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt index 3b747b7422b..7643f998ef9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (2027:35,38 [15] ) +Generated Location: (2053:35,38 [15] ) |*, TestAssembly| Source Location: (187:5,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (3130:58,42 [4] ) +Generated Location: (3156:58,42 [4] ) |true| Source Location: (233:6,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (3897:71,42 [4] ) +Generated Location: (3923:71,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs index d5cabab89c3..0650f69025d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a43c77165a8cc48045af412fa05ad51a01a7ac7693152e08d46013b3fe119376" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchAll", new global::Microsoft.AspNetCore.Html.HtmlString("hi"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -52,9 +52,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("strong", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("strong", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Hello"); } ); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("World

\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -98,7 +98,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt index 0add2b2b0b7..f42d3410087 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - catchAll - hi - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - btn - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs index 5408bce08b8..0dfdaadb33b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html index 2cd2f153d8a..39991e0bcb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html @@ -1,26 +1,26 @@ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~~~~~ ~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~~~~~*/ /*~*/ ~ - ~~~~~~ ~~~~~~ + /*~~*/ /*~~*/ ~ ~

Basic Asynchronous Expression Test

-

Basic Asynchronous Expression: ~~~~~~ ~~~~~

-

Basic Asynchronous Template: ~~~~~~~ ~~~~~~

-

Basic Asynchronous Statement: ~~ ~~~~~ ~~~~~~ ~

-

Basic Asynchronous Statement Nested: ~~ ~~~~~~ ~~~~~ ~

-

Basic Incomplete Asynchronous Statement: ~~~~~~

+

Basic Asynchronous Expression: /*~~*/ /*~*/

+

Basic Asynchronous Template: /*~~~*/ /*~~*/

+

Basic Asynchronous Statement: ~~ /*~*/ /*~~*/ ~

+

Basic Asynchronous Statement Nested: ~~ /*~~*/ /*~*/ ~

+

Basic Incomplete Asynchronous Statement: /*~~*/

Advanced Asynchronous Expression Test

-

Advanced Asynchronous Expression: ~~~~~~ ~~~~~~ ~~

-

Advanced Asynchronous Expression Extended: ~~~~~~ ~~~~~~~~~~ ~~

-

Advanced Asynchronous Template: ~~~~~~~ ~~~~~~~~~~ ~~~~~~

-

Advanced Asynchronous Statement: ~~ ~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~

-

Advanced Asynchronous Statement Extended: ~~ ~~~~~ ~~~~~~~~~~ ~~ ~

-

Advanced Asynchronous Statement Nested: ~~ ~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~

-

Advanced Incomplete Asynchronous Statement: ~~~~~~ ~~~~~~~~~~~~~

+

Advanced Asynchronous Expression: /*~~*/ /*~~*/ ~~

+

Advanced Asynchronous Expression Extended: /*~~*/ /*~~~~~~*/ ~~

+

Advanced Asynchronous Template: /*~~~*/ /*~~~~~~*/ /*~~*/

+

Advanced Asynchronous Statement: ~~ /*~*/ /*~~~~~~~~~~*/ /*~~*/ /*~~~~~*/ ~

+

Advanced Asynchronous Statement Extended: ~~ /*~*/ /*~~~~~~*/ ~~ ~

+

Advanced Asynchronous Statement Nested: ~~ /*~~*/ /*~~~~~~~~~~*/ /*~~*/ ~

+

Advanced Incomplete Asynchronous Statement: /*~~*/ /*~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt index a513815d442..17925588265 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt @@ -9,7 +9,7 @@ Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(1 Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(19, 49), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(20,58): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // __o = await Foo.Bar(1, 2); -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(21,48): error CS1501: No overload for method 'Foo' takes 2 arguments // __o = await Foo("bob", true); Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(21, 48), @@ -18,7 +18,7 @@ Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocat Diagnostic(ErrorCode.ERR_NameNotInContext, "something").WithArguments("something").WithLocation(22, 54), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,59): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,72): error CS1002: ; expected // await Foo.Bar(1, 2) Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(23, 72), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt index bc12cfc2123..fb37c7848d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt index f982a971eb6..6af791b25a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt @@ -1,81 +1,81 @@ Source Location: (192:9,39 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (1464:33,39 [11] ) +Generated Location: (1490:33,39 [11] ) |await Foo()| Source Location: (247:10,38 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (1667:40,38 [11] ) +Generated Location: (1693:40,38 [11] ) |await Foo()| Source Location: (304:11,39 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo(); | -Generated Location: (1871:47,39 [14] ) +Generated Location: (1897:47,39 [14] ) | await Foo(); | Source Location: (371:12,46 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (2084:54,46 [1] ) +Generated Location: (2110:54,46 [1] ) | | Source Location: (376:12,51 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (2289:61,51 [11] ) +Generated Location: (2315:61,51 [11] ) |await Foo()| Source Location: (391:12,66 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (2520:68,66 [1] ) +Generated Location: (2546:68,66 [1] ) | | Source Location: (448:13,49 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await| -Generated Location: (2723:75,49 [5] ) +Generated Location: (2749:75,49 [5] ) |await| Source Location: (578:18,42 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo(1, 2)| -Generated Location: (2924:82,42 [15] ) +Generated Location: (2950:82,42 [15] ) |await Foo(1, 2)| Source Location: (650:19,51 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo.Bar(1, 2)| -Generated Location: (3144:89,51 [19] ) +Generated Location: (3170:89,51 [19] ) |await Foo.Bar(1, 2)| Source Location: (716:20,41 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo("bob", true)| -Generated Location: (3358:96,41 [22] ) +Generated Location: (3384:96,41 [22] ) |await Foo("bob", true)| Source Location: (787:21,42 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo(something, hello: "world"); | -Generated Location: (3576:103,42 [39] ) +Generated Location: (3602:103,42 [39] ) | await Foo(something, hello: "world"); | Source Location: (884:22,51 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo.Bar(1, 2) | -Generated Location: (3819:110,51 [21] ) +Generated Location: (3845:110,51 [21] ) | await Foo.Bar(1, 2) | Source Location: (961:23,49 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (4042:117,49 [1] ) +Generated Location: (4068:117,49 [1] ) | | Source Location: (966:23,54 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo(boolValue: false)| -Generated Location: (4250:124,54 [27] ) +Generated Location: (4276:124,54 [27] ) |await Foo(boolValue: false)| Source Location: (997:23,85 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (4516:131,85 [1] ) +Generated Location: (4542:131,85 [1] ) | | Source Location: (1057:24,52 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await ("wrrronggg")| -Generated Location: (4722:138,52 [19] ) +Generated Location: (4748:138,52 [19] ) |await ("wrrronggg")| Source Location: (12:0,12 [76] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) @@ -85,7 +85,7 @@ Source Location: (12:0,12 [76] TestFiles/IntegrationTests/CodeGenerationIntegrat return "Bar"; } | -Generated Location: (4955:147,12 [76] ) +Generated Location: (4981:147,12 [76] ) | public async Task Foo() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs index b14ba777995..1c0297867fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "347cf5b257c3885845256697175dd94c0ef0bef29e4fca7e4ec1a009ff29d9a6" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt index 689f9027e75..2a1cc187c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt @@ -9,7 +9,7 @@ Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments(")").WithLocation(14 Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(19, 49), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(20,58): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(21,48): error CS1501: No overload for method 'Foo' takes 2 arguments // await Foo("bob", true) Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(21, 48), @@ -18,7 +18,7 @@ Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocat Diagnostic(ErrorCode.ERR_NameNotInContext, "something").WithArguments("something").WithLocation(22, 54), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,59): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,72): error CS1002: ; expected // await Foo.Bar(1, 2) Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(23, 72), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt index dc8a7217ddb..974acc13a18 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (91:6,0 [100] Await.cshtml) LazyIntermediateToken - (91:6,0 [2] Await.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs index 813abd42c27..4cedf81e7ad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html index a7977c2f3eb..a1b48a80492 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html @@ -1,9 +1,9 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt index dd8c964d897..e0c5eb50cef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt index 1e0fdaa5abf..e1decd1dc69 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1895:34,37 [17] ) +Generated Location: (1921:34,37 [17] ) |"*, TestAssembly"| Source Location: (220:5,38 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |ViewBag.DefaultInterval| -Generated Location: (2816:55,38 [23] ) +Generated Location: (2842:55,38 [23] ) |ViewBag.DefaultInterval| Source Location: (303:6,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |true| -Generated Location: (3628:69,42 [4] ) +Generated Location: (3654:69,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs index bce2a46e832..a59d14a5a71 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html index 83791946e75..64cc9386aad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html @@ -1,10 +1,10 @@ -~~~~~~~~~~~~~~~~ ~~~~~ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~~~~*/ /*~*/ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- +
\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt index 616179e17be..0c8fd38c72d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt index b31f7e030d7..b853caca4ce 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (17:0,17 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"THS"| -Generated Location: (1922:34,37 [5] ) +Generated Location: (1948:34,37 [5] ) |"THS"| Source Location: (38:1,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"*, TestAssembly"| -Generated Location: (2204:44,37 [17] ) +Generated Location: (2230:44,37 [17] ) |"*, TestAssembly"| Source Location: (226:7,43 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |true| -Generated Location: (3120:65,43 [4] ) +Generated Location: (3146:65,43 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs index 0221050c13c..979535a78e0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e26ec84b1a01b76c3d10ce2cba2205ab75c8b761b2507c37a6efbfe65c779b33" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "checkbox", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -50,9 +50,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt index 5328116dfee..779f8bfd67d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs index 567029faed2..7fd152a6938 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html index 241c86f381f..ed4d8edb834 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html @@ -1,10 +1,10 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ /*~~~~~~~~~~*/ /*~*/

- +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt index 0b5c468e147..a99dc8eff04 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt index 293d9af037a..a9fdd47debb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1943:34,37 [17] ) +Generated Location: (1969:34,37 [17] ) |"*, TestAssembly"| Source Location: (50:1,17 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |"doesntmatter, nice"| -Generated Location: (2244:44,37 [20] ) +Generated Location: (2270:44,37 [20] ) |"doesntmatter, nice"| Source Location: (234:7,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |true| -Generated Location: (3772:72,42 [4] ) +Generated Location: (3798:72,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs index 1393a8a5025..43e1f672387 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3c3f70086ebb07abc64ab51a5ec8d70be530fb87bb11790ef3989464e5532b55" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -51,9 +51,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -66,7 +66,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -85,7 +85,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt index 786f4e2e2c1..a0fd8ab6788 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs index 402316266c1..ded20f85fd2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c8793c171f4a151a33e212951ef178accfcfb85800b349fdef9ce896e61f314e" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -53,9 +53,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -102,7 +102,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt index 5285dd66289..e46dca883cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - data - -delay1000 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_2 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs index a35459d6ee6..eb50361ca56 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html index c8e3d6d849d..eb6ccef7af1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html @@ -2,36 +2,36 @@ ~~~ ~ ~ ~~ ~ -~~~~~~~~ ~~ ~~~ ~ -

Hello from C#, #~~~~

+/*~~~~*/ ~~ ~~~ ~ +

Hello from C#, #/**/

~ ~~ ~~ ~ -~~~~~ ~~ ~~~ ~ +/*~*/ ~~ ~~~ ~

We wrote 10 lines!

~ -~~~~~~~~~~ ~ - ~~~~ ~~~ +/*~~~~~~*/ ~ + /**/ ~~~

No really, we wrote 10 lines!

- ~~~~~~ - ~~~~~~~~ + /*~~*/ + /*~~~~*/

Actually, we didn't...

- ~~~~~~ + /*~~*/ ~ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ -

Hello again from C#, #~~~~

+/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ +

Hello again from C#, #/**/

~ -~~~~ ~ +/**/ ~

That time, we wrote 5 lines!

-~ ~~~~~~~~~~~~~~~ ~~~ ~ -

Oh no! An error occurred: ~~~~~~~~~~~~~

+~ /*~~~~~~~~~~~*/ ~~~ ~ +

Oh no! An error occurred: /*~~~~~~~~~*/

~

i is now ~~

-~~~~~~~~~ ~~~~~~~~~ ~ +/*~~~~~*/ /*~~~~~*/ ~

This block is locked, for your security!

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt index 1f837ad032c..b9a6925378a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt index aaa647893d2..4210dc29750 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt @@ -2,7 +2,7 @@ | int i = 1; | -Generated Location: (1429:33,2 [18] ) +Generated Location: (1455:33,2 [18] ) | int i = 1; | @@ -10,20 +10,20 @@ Generated Location: (1429:33,2 [18] ) Source Location: (26:4,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |while(i <= 10) { | -Generated Location: (1599:41,1 [22] ) +Generated Location: (1625:41,1 [22] ) |while(i <= 10) { | Source Location: (69:5,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |i| -Generated Location: (1799:49,25 [1] ) +Generated Location: (1825:49,25 [1] ) |i| Source Location: (75:5,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | i += 1; }| -Generated Location: (1985:56,31 [16] ) +Generated Location: (2011:56,31 [16] ) | i += 1; }| @@ -31,14 +31,14 @@ Generated Location: (1985:56,31 [16] ) Source Location: (96:9,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |if(i == 11) { | -Generated Location: (2156:65,1 [19] ) +Generated Location: (2182:65,1 [19] ) |if(i == 11) { | Source Location: (140:10,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (2358:73,29 [3] ) +Generated Location: (2384:73,29 [3] ) | }| @@ -46,7 +46,7 @@ Source Location: (148:13,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegra |switch(i) { case 11: | -Generated Location: (2516:81,1 [35] ) +Generated Location: (2542:81,1 [35] ) |switch(i) { case 11: | @@ -56,7 +56,7 @@ Source Location: (219:15,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegr break; default: | -Generated Location: (2749:90,44 [40] ) +Generated Location: (2775:90,44 [40] ) | break; default: @@ -66,7 +66,7 @@ Source Location: (288:18,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegr | break; }| -Generated Location: (2980:100,37 [19] ) +Generated Location: (3006:100,37 [19] ) | break; }| @@ -74,26 +74,26 @@ Generated Location: (2980:100,37 [19] ) Source Location: (312:22,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |for(int j = 1; j <= 10; j += 2) { | -Generated Location: (3154:109,1 [39] ) +Generated Location: (3180:109,1 [39] ) |for(int j = 1; j <= 10; j += 2) { | Source Location: (378:23,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |j| -Generated Location: (3378:117,31 [1] ) +Generated Location: (3404:117,31 [1] ) |j| Source Location: (384:23,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (3571:124,37 [3] ) +Generated Location: (3597:124,37 [3] ) | }| Source Location: (392:26,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |try { | -Generated Location: (3729:132,1 [11] ) +Generated Location: (3755:132,1 [11] ) |try { | @@ -101,39 +101,39 @@ Source Location: (438:27,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegr | } catch(Exception ex) { | -Generated Location: (3933:140,39 [31] ) +Generated Location: (3959:140,39 [31] ) | } catch(Exception ex) { | Source Location: (500:29,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |ex.Message| -Generated Location: (4153:149,35 [10] ) +Generated Location: (4179:149,35 [10] ) |ex.Message| Source Location: (515:29,50 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (4368:156,50 [3] ) +Generated Location: (4394:156,50 [3] ) | }| Source Location: (535:32,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |i| -Generated Location: (4538:164,13 [1] ) +Generated Location: (4564:164,13 [1] ) |i| Source Location: (545:34,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |lock(new object()) { | -Generated Location: (4695:171,1 [26] ) +Generated Location: (4721:171,1 [26] ) |lock(new object()) { | Source Location: (618:35,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (4926:179,51 [3] ) +Generated Location: (4952:179,51 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs index 4c9c14d6453..152f3fba272 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7fc1108b4536c02783f218bd311d6a6202c6f3c6e438a6840e22e53a2efde68d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt index 229a4bc4796..9245271c800 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [18] Blocks.cshtml) LazyIntermediateToken - (2:0,2 [18] Blocks.cshtml) - CSharp - \n int i = 1;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs index 3cc09bc5ca0..0097ccd496b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html index bbfa490f37a..a3f50faa4ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html @@ -1,43 +1,43 @@  ~~ - ~~~ ~~~~~~~~~~ ~ ~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~ ~~~~~~~~~ + ~~~ /*~~~~~~*/ ~ ~~~ /*~~~~~~~~~~~~~~*/ /*~~~*/ /*~~~~~~*/ /*~~*/ /*~~~~~*/ /*~~*/ /*~~~~~*/ ~ - ~~~~~~ ~~~~~ ~ ~~~~~~~~ ~~~~~~ ~~~~~ + /*~~*/ /*~*/ ~ /*~~~~*/ /*~~*/ /*~*/ ~~ - ~~ ~~~~ ~~ ~~~ ~~ ~ ~~~~ ~~~~ ~~~~~~ ~~~~~ ~~ + ~~ /**/ ~~ ~~~ ~~ ~ /**/ /**/ /*~~*/ /*~*/ ~~ - ~~~ ~~~~~~~ ~ ~~~~~~~~~~~~ - ~~~~ ~~~~~~~~~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~ ~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ /*~~~*/ ~ /*~~~~~~~~*/ + /**/ /*~~~~~~~~~~~~~~~*/ ~ /*~~~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~*/ + /*~~~*/ /*~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ ~~~ ~~~ ~~~~~~~ + ~~~ /*~~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~*/ ~~~ ~~~ /*~~~*/ ~ - ~~ ~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~ + ~~ /*~~~~~~~~*/ ~~ /**/ /*~~*/ ~ - ~~ ~~ ~~~~~~~~~ + ~~ ~~ /*~~~~~*/ ~ ~

- Here's a very unique number: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Here's a very unique number: /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

- ~~~~~~~~~ ~~~~~~~ ~~~~~ ~~~~~~~~~~~~~ ~~ ~~~~~ ~~~~~~ ~~ + /*~~~~~*/ /*~~~*/ /*~*/ /*~~~~~~~~~*/ ~~ /*~*/ /*~~*/ ~~
- ~~~~~~~ ~~~~~~~~~~~~~ + /*~~~*/ /*~~~~~~~~~*/ ~ - ~~~~ ~~~ ~~~~ - ~~ ~~ ~~~~~~~~~ - ~~~~~~ - ~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ - ~~ ~~ ~~~~ ~~~~~~~~~ - ~~~~~~ - ~~~~ ~~~~~ - ~~ ~~ ~~~~ ~~~~ ~~ ~~~~~~~~~ - ~~~~~~ + /**/ ~~~ /**/ + ~~ ~~ /*~~~~~*/ + /*~~*/ + /**/ /*~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~*/ + ~~ ~~ /**/ /*~~~~~*/ + /*~~*/ + /**/ /*~*/ + ~~ ~~ /**/ /**/ ~~ /*~~~~~*/ + /*~~*/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt index 8308b1d58cd..c5bbb5cf5fd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt index e9fbf19e162..19c393663d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt @@ -6,7 +6,7 @@ }; | -Generated Location: (1984:39,6 [187] ) +Generated Location: (2010:39,6 [187] ) | var nameLookup = new Dictionary() { @@ -23,7 +23,7 @@ Source Location: (246:7,53 [253] TestFiles/IntegrationTests/CodeGenerationIntegr double AvogadroConstant = 6.022_140_857_747_474e23; decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; | -Generated Location: (2378:52,53 [253] ) +Generated Location: (2404:52,53 [253] ) | int Sixteen = 0b0001_0000; @@ -40,7 +40,7 @@ Source Location: (509:15,5 [159] TestFiles/IntegrationTests/CodeGenerationIntegr // Do Something } }| -Generated Location: (2791:65,5 [159] ) +Generated Location: (2817:65,5 [159] ) |if (nameLookup.TryGetValue("John Doe", out var entry)) { if (entry.Extra is bool alive) @@ -51,12 +51,12 @@ Generated Location: (2791:65,5 [159] ) Source Location: (718:23,39 [62] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) |1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| -Generated Location: (3144:78,39 [62] ) +Generated Location: (3170:78,39 [62] ) |1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| Source Location: (816:27,10 [34] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) |(First: "John", Last: "Doe").First| -Generated Location: (3372:85,10 [34] ) +Generated Location: (3398:85,10 [34] ) |(First: "John", Last: "Doe").First| Source Location: (891:30,5 [291] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) @@ -72,7 +72,7 @@ Source Location: (891:30,5 [291] TestFiles/IntegrationTests/CodeGenerationIntegr // Do even more of something break; }| -Generated Location: (3567:92,5 [291] ) +Generated Location: (3593:92,5 [291] ) |switch (entry.Extra) { case int age: diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs index 95477dd0bdb..f329d3347af 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a2b132455b8159d1094743b389f41b79cabc421ed6d5972456b799596f28f035" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -45,7 +45,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n"); #nullable restore #line (2,7)-(8,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt index 648473989c3..421089a7f43 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs index f969d0fd6c2..7ffd58a7ca1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -20,7 +20,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html index b2ada4d5846..aa7e750f48d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html @@ -1,67 +1,67 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~*/ ~~ - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + /*~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~ + /*~~*/ /*~*/ ~ - ~~~~~ ~~~~~~~ ~~~~ ~~~ ~~ ~~~~~~~~~~~~~~~~~~~~~ + /*~*/ /*~~~*/ /**/ ~~~ ~~ /*~~~~~~~~~~~~~~~~~*/ ~ ~ - ~~~~~ ~~~~~ ~ ~~~~~ - ~~~~~ ~~~ ~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /*~*/ /*~*/ ~ /*~*/ + /*~*/ ~~~ /*~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - ~~~ ~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~ - ~~~ ~~~~~~~~ ~ ~~~~~~~~~~ - ~~~~~~ ~~~~~~~~ ~~~~~~~~~ + ~~~ /*~*/ ~ /*~~~~~~~~~~~~~~~~~~*/ + ~~~ /*~~~~*/ ~ /*~~~~~~*/ + /*~~*/ /*~~~~*/ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~*/ ~ ~ -~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ +/*~~~~~~~~*/ +/*~~~~~~~~~~~~*/ -~~~~~~~~~~ ~~~~~~ +/*~~~~~~*/ /*~~*/ ~ - ~~~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~~~ - ~~~~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~~~~ - ~ ~~ ~~~~ ~~~~~~~~ + /*~~~~~~~~~~*/ ~~ /**/ /*~~~~*/ + /*~~~~~~~~~~~*/ ~~ /**/ /*~~~~~*/ + ~ ~~ /**/ /*~~~~*/ ~~ -~~~~~~ ~~~~~~~ ~~~~ ~~~ ~~ ~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~*/ /**/ ~~~ ~~ /*~~~~~~~~~~~~~~~~~*/ ~ - ~~~~ + /**/ ~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~~~~*/ +/*~~~~~~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~*/ ~ - ~~~~~~ - ~~~~~~ + /*~~*/ + /*~~*/ ~ - ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + /*~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~~*/ ~ - ~~~ ~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ /*~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~~ ~~~~~~ ~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~*/ /*~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~~~~~ ~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~~~~*/ /*~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~ ~~~~~~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~~~~~~*/ /*~~~~*/ /*~~~~~~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~ ~~~~~ + /*~~~*/ /*~*/ /*~*/ ~ - ~~~~~~ ~~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~~*/ /**/ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt index b373f7b031a..f48c4d06729 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -10,7 +10,7 @@ UsingDirective - (1:0,1 [32] CSharp8.cshtml) - System.Collections.Generic RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt index 4f44d6d810c..25a1fcb62ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (1:0,1 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |using System.Collections.Generic| -Generated Location: (501:14,0 [32] ) +Generated Location: (518:14,0 [32] ) |using System.Collections.Generic| Source Location: (39:2,2 [396] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -25,7 +25,7 @@ Source Location: (39:2,2 [396] TestFiles/IntegrationTests/CodeGenerationIntegrat return TestEnum.First; } | -Generated Location: (1535:37,2 [396] ) +Generated Location: (1561:37,2 [396] ) | IAsyncEnumerable GetAsyncEnumerable() { @@ -50,12 +50,12 @@ Generated Location: (1535:37,2 [396] ) Source Location: (441:24,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |words[1..2]| -Generated Location: (2090:63,6 [11] ) +Generated Location: (2116:63,6 [11] ) |words[1..2]| Source Location: (456:25,2 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |words[^2..^0]| -Generated Location: (2263:70,6 [13] ) +Generated Location: (2289:70,6 [13] ) |words[^2..^0]| Source Location: (476:27,2 [121] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -65,7 +65,7 @@ Source Location: (476:27,2 [121] TestFiles/IntegrationTests/CodeGenerationIntegr TestEnum.Second => "The Second!", _ => "The others", }| -Generated Location: (2438:77,6 [121] ) +Generated Location: (2464:77,6 [121] ) |testEnum switch { TestEnum.First => "The First!", @@ -77,36 +77,36 @@ Source Location: (603:34,1 [56] TestFiles/IntegrationTests/CodeGenerationIntegra |await foreach (var val in GetAsyncEnumerable()) { | -Generated Location: (2716:89,1 [56] ) +Generated Location: (2742:89,1 [56] ) |await foreach (var val in GetAsyncEnumerable()) { | Source Location: (660:36,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |val| -Generated Location: (2933:98,6 [3] ) +Generated Location: (2959:98,6 [3] ) |val| Source Location: (663:36,8 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) | }| -Generated Location: (3100:105,8 [3] ) +Generated Location: (3126:105,8 [3] ) | }| Source Location: (671:39,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |Person!.Name| -Generated Location: (3264:113,6 [12] ) +Generated Location: (3290:113,6 [12] ) |Person!.Name| Source Location: (686:40,1 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |People![0]!.Name![1]| -Generated Location: (3438:120,6 [20] ) +Generated Location: (3464:120,6 [20] ) |People![0]!.Name![1]| Source Location: (709:41,1 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |DoSomething!(Person!)| -Generated Location: (3620:127,6 [21] ) +Generated Location: (3646:127,6 [21] ) |DoSomething!(Person!)| Source Location: (746:43,12 [480] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -134,7 +134,7 @@ Source Location: (746:43,12 [480] TestFiles/IntegrationTests/CodeGenerationInteg public string? Name { get; set; } } | -Generated Location: (3858:136,12 [480] ) +Generated Location: (3884:136,12 [480] ) | enum TestEnum { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs index f8268b0cd78..772e19c2e75 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4c55c366b179d82f3d2800004985646e9bf0edbf993e2f4a94cbb70079823905" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -12,7 +12,7 @@ namespace AspNetCore using global::Microsoft.AspNetCore.Mvc.Rendering; using global::Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore -#line (1,2)-(2,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml" +#line (1,2)-(1,34) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml" using System.Collections.Generic #line default @@ -23,7 +23,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt index 07cef4d143d..81c7c77d5eb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures - UsingDirective - (1:0,1 [34] CSharp8.cshtml) - System.Collections.Generic + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + UsingDirective - (1:0,1 [32] CSharp8.cshtml) - System.Collections.Generic RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (35:1,0 [2] CSharp8.cshtml) LazyIntermediateToken - (35:1,0 [2] CSharp8.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs index 55930c96a43..ac3817a6e41 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt index 92a30b69fac..f9f02115c98 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt index 6e5397874cf..69db1115a6a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (2:0,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml) || -Generated Location: (1453:33,2 [0] ) +Generated Location: (1479:33,2 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs index 43761ebc530..1ea22d8d369 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f1213d84263417aa717c6a0a201077dbb0fede3e19230a7ca231bc16735c7119" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt index 46ed83af606..9f8753dc101 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [0] CodeBlockAtEOF.cshtml) LazyIntermediateToken - (2:0,2 [0] CodeBlockAtEOF.cshtml) - CSharp - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs index 1dce3d1b292..116237cce97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html index bc136f506a6..03876c01edf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html @@ -1,4 +1,4 @@ ~~ ~~~ ~ ~ ~~ foo - ~~~ ~ ~ ~~ bar ~~~~~~ + ~~~ ~ ~ ~~ bar /*~~*/ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt index 0b3b55dff00..bf304bf85e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt index 3199ac454f0..4cec43ff035 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt @@ -1,26 +1,26 @@ Source Location: (2:0,2 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | var a = 1; | -Generated Location: (1483:33,2 [17] ) +Generated Location: (1509:33,2 [17] ) | var a = 1; | Source Location: (35:1,31 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | var b = 1; | -Generated Location: (1702:41,31 [22] ) +Generated Location: (1728:41,31 [22] ) | var b = 1; | Source Location: (69:2,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) |a+b| -Generated Location: (1924:49,29 [3] ) +Generated Location: (1950:49,29 [3] ) |a+b| Source Location: (80:2,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | | -Generated Location: (2139:56,40 [2] ) +Generated Location: (2165:56,40 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs index 7f668787152..217b68c331c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e8683fb69fb02cf452dac1db41d32e64f144a321993e7b85cd64971a7791cbc6" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt index 8f487442e4c..870367e5162 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [17] CodeBlockWithTextElement.cshtml) LazyIntermediateToken - (2:0,2 [17] CodeBlockWithTextElement.cshtml) - CSharp - \n var a = 1; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs index 96aef18f567..4684c3b37fc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html index f9dbfc45c01..0a78d260923 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html @@ -1,5 +1,5 @@ ~~ - ~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~~~~~~~~~~~~ ~ ~~~~~~~~ + /*~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~ + /*~~~~~~~~~~~~~~~~~~*/ /**/ ~~~ ~~ ~ /*~~~~~~~~*/ ~ /*~~~~*/ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt index 288c22a3821..dcfcf916fca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt index 3f70eea5943..55124aae89b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt @@ -4,7 +4,7 @@ Output.Write("

Hello from C#, #" + i.ToString() + "

"); } | -Generated Location: (1438:33,2 [115] ) +Generated Location: (1464:33,2 [115] ) | for(int i = 1; i <= 10; i++) { Output.Write("

Hello from C#, #" + i.ToString() + "

"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs index 2ff6258f254..a4af83b4488 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "71c9e37483da0d198df8bd194ad927f8340b7cfe40ab63cf3ce1dcd9d2a2904d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt index 863496486a1..30c5a468373 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [115] CodeBlock.cshtml) LazyIntermediateToken - (2:0,2 [115] CodeBlock.cshtml) - CSharp - \n for(int i = 1; i <= 10; i++) {\n Output.Write("

Hello from C#, #" + i.ToString() + "

");\n }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs index 0764134d992..9ee02ac7722 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html index a8544403c47..e3c4cd8dade 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html @@ -1,38 +1,38 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ -~~~ ~~~~~~ +~~~ /*~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~~~~~~~~ + ~~~ /*~~~~*/ ~ /*~~~~~~~*/
-

-

+

+

Set Time:

- ~~~ ~~~~~~~ + ~~~ /*~~~*/ ~

New Time:

~ - ~~~~ + /**/ ~ -

Current Time:

- - +

Current Time:

+ + ~

-

- ~~ ~~~ ~~~~~~~ ~ ~~~~~~~ - +

+ ~~ ~~~ /*~~~*/ ~ /*~~~*/ +

-

- +

+

-

- +

+

-

- +

+

- ~~~~~~~~~~~~~

~ + /*~~~~~~~~~*/

~

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt index 5629bcc9adb..37adc76a699 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt index 084d1f475d6..1e00f4f822d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1901:34,37 [17] ) +Generated Location: (1927:34,37 [17] ) |"*, TestAssembly"| Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) @@ -9,7 +9,7 @@ Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrati var checkbox = "checkbox"; | -Generated Location: (2408:51,1 [52] ) +Generated Location: (2434:51,1 [52] ) |if (true) { var checkbox = "checkbox"; @@ -18,39 +18,39 @@ Generated Location: (2408:51,1 [52] ) Source Location: (147:7,16 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (2752:63,33 [1] ) +Generated Location: (2778:63,33 [1] ) |@| Source Location: (149:7,18 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) || -Generated Location: (2753:63,34 [0] ) +Generated Location: (2779:63,34 [0] ) || Source Location: (149:7,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (2753:63,34 [1] ) +Generated Location: (2779:63,34 [1] ) |@| Source Location: (150:7,19 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (2754:63,35 [1] ) +Generated Location: (2780:63,35 [1] ) |(| Source Location: (151:7,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |1+2| -Generated Location: (2755:63,36 [3] ) +Generated Location: (2781:63,36 [3] ) |1+2| Source Location: (154:7,23 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (2758:63,39 [1] ) +Generated Location: (2784:63,39 [1] ) |)| Source Location: (273:10,13 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if (false) { | -Generated Location: (3014:71,13 [43] ) +Generated Location: (3040:71,13 [43] ) |if (false) { | @@ -61,7 +61,7 @@ Source Location: (399:12,99 [66] TestFiles/IntegrationTests/CodeGenerationIntegr else { | -Generated Location: (3924:87,99 [66] ) +Generated Location: (3950:87,99 [66] ) | } else @@ -70,159 +70,159 @@ Generated Location: (3924:87,99 [66] ) Source Location: (495:16,46 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checkbox| -Generated Location: (4409:100,46 [8] ) +Generated Location: (4435:100,46 [8] ) |checkbox| Source Location: (512:16,63 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true| -Generated Location: (4800:109,63 [4] ) +Generated Location: (4826:109,63 [4] ) |true| Source Location: (523:16,74 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (5291:119,74 [18] ) +Generated Location: (5317:119,74 [18] ) | | Source Location: (556:17,31 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true ? "checkbox" : "anything"| -Generated Location: (5713:129,31 [30] ) +Generated Location: (5739:129,31 [30] ) |true ? "checkbox" : "anything"| Source Location: (591:17,66 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (6205:139,66 [18] ) +Generated Location: (6231:139,66 [18] ) | | Source Location: (623:18,30 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if(true) { | -Generated Location: (6626:149,30 [11] ) +Generated Location: (6652:149,30 [11] ) |if(true) { | Source Location: (655:18,62 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | } else { | -Generated Location: (6864:156,62 [10] ) +Generated Location: (6890:156,62 [10] ) | } else { | Source Location: (686:18,93 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (7132:163,93 [2] ) +Generated Location: (7158:163,93 [2] ) | }| Source Location: (690:18,97 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (7626:173,97 [15] ) +Generated Location: (7652:173,97 [15] ) | }| Source Location: (212:8,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTime.Now| -Generated Location: (7932:182,32 [12] ) +Generated Location: (7958:182,32 [12] ) |DateTime.Now| Source Location: (832:22,14 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | var @object = false;| -Generated Location: (8200:190,14 [21] ) +Generated Location: (8226:190,14 [21] ) | var @object = false;| Source Location: (885:23,29 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (8636:199,42 [1] ) +Generated Location: (8662:199,42 [1] ) |(| Source Location: (886:23,30 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@object| -Generated Location: (8637:199,43 [7] ) +Generated Location: (8663:199,43 [7] ) |@object| Source Location: (893:23,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (8644:199,50 [1] ) +Generated Location: (8670:199,50 [1] ) |)| Source Location: (760:21,39 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| -Generated Location: (9020:208,38 [30] ) +Generated Location: (9046:208,38 [30] ) |DateTimeOffset.Now.Year - 1970| Source Location: (1025:26,61 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (9560:218,60 [1] ) +Generated Location: (9586:218,60 [1] ) |(| Source Location: (1026:26,62 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (9561:218,61 [30] ) +Generated Location: (9587:218,61 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1056:26,92 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (9591:218,91 [1] ) +Generated Location: (9617:218,91 [1] ) |)| Source Location: (928:25,16 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |-1970 + @DateTimeOffset.Now.Year| -Generated Location: (9962:227,33 [32] ) +Generated Location: (9988:227,33 [32] ) |-1970 + @DateTimeOffset.Now.Year| Source Location: (1155:29,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (10486:237,42 [30] ) +Generated Location: (10512:237,42 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1093:28,16 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| -Generated Location: (10886:246,33 [30] ) +Generated Location: (10912:246,33 [30] ) |DateTimeOffset.Now.Year - 1970| Source Location: (1283:32,28 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | @( DateTimeOffset.Now.Year ) > 2014 | -Generated Location: (11408:256,42 [43] ) +Generated Location: (11434:256,42 [43] ) | @( DateTimeOffset.Now.Year ) > 2014 | Source Location: (1220:31,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (11821:265,33 [1] ) +Generated Location: (11847:265,33 [1] ) |(| Source Location: (1221:31,18 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"My age is this long.".Length| -Generated Location: (11822:265,34 [29] ) +Generated Location: (11848:265,34 [29] ) |"My age is this long.".Length| Source Location: (1250:31,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (11851:265,63 [1] ) +Generated Location: (11877:265,63 [1] ) |)| Source Location: (1355:34,9 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |someMethod(| -Generated Location: (12103:273,9 [11] ) +Generated Location: (12129:273,9 [11] ) |someMethod(| Source Location: (1410:34,64 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checked| -Generated Location: (12583:278,63 [7] ) +Generated Location: (12609:278,63 [7] ) |checked| Source Location: (1375:34,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |123| -Generated Location: (12944:287,33 [3] ) +Generated Location: (12970:287,33 [3] ) |123| Source Location: (1424:34,78 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (13072:294,1 [1] ) +Generated Location: (13098:294,1 [1] ) |)| Source Location: (1469:36,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (13619:310,10 [3] ) +Generated Location: (13645:310,10 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 513c0353eae..f2bf25f6746 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1f3b8300659fe8a9bf41b8b1b87fbc9ea296962d88df30817150779b3823b339" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -68,7 +68,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral("
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -130,7 +130,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

Set Time:

\r\n"); #nullable restore #line (11,14)-(13,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" @@ -142,9 +142,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("New Time: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -187,9 +187,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Current Time: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -239,7 +239,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -268,7 +268,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -348,7 +348,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n"); #nullable restore #line (23,15)-(23,36) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" @@ -359,7 +359,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -422,9 +422,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -487,9 +487,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -536,9 +536,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -609,8 +609,8 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable item => new global::Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_template_writer) => { PushWriter(__razor_template_writer); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -668,7 +668,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable ); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt index 43dfcf928a3..058f36affc3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - value - - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - placeholder - Enter in a new time... - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs index d91b68b31f0..d8e2ad4f31a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html index 3981b69f586..afb7b659f30 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html @@ -1,22 +1,22 @@ ~~ - ~~~ ~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~~~~ - ~~~ ~ ~ ~~~~~~ + ~~~ ~~ ~ /*~*/ + ~~~ ~~~ ~ /*~~*/ + ~~~ ~ ~ /*~~*/ -

-

-

+

+

+

-

+

- -

-

+ +

+

-

x

+

x

-

x

-

x

-

x

+

x

+

x

+

x

~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt index 1e6a91531c1..652d1a3c1a8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt index 6351ea88ec2..d5cd59517f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt @@ -4,7 +4,7 @@ var cls = "bar"; var s = "str"; | -Generated Location: (2043:39,2 [68] ) +Generated Location: (2069:39,2 [68] ) | var ch = true; var cls = "bar"; @@ -13,260 +13,260 @@ Generated Location: (2043:39,2 [68] ) Source Location: (74:4,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (2288:50,8 [1] ) +Generated Location: (2314:50,8 [1] ) |s| Source Location: (87:4,21 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (2480:57,21 [6] ) +Generated Location: (2506:57,21 [6] ) | | Source Location: (97:5,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (2663:65,8 [1] ) +Generated Location: (2689:65,8 [1] ) |s| Source Location: (107:5,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (2852:72,18 [3] ) +Generated Location: (2878:72,18 [3] ) |cls| Source Location: (114:5,25 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (3050:79,25 [6] ) +Generated Location: (3076:79,25 [6] ) | | Source Location: (124:6,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (3233:87,8 [1] ) +Generated Location: (3259:87,8 [1] ) |s| Source Location: (136:6,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (3424:94,20 [3] ) +Generated Location: (3450:94,20 [3] ) |cls| Source Location: (143:6,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (3624:101,27 [6] ) +Generated Location: (3650:101,27 [6] ) | | Source Location: (153:7,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (3807:109,8 [1] ) +Generated Location: (3833:109,8 [1] ) |s| Source Location: (163:7,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (3996:116,18 [3] ) +Generated Location: (4022:116,18 [3] ) |cls| Source Location: (172:7,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (4196:123,27 [6] ) +Generated Location: (4222:123,27 [6] ) | | Source Location: (202:8,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (4399:131,28 [1] ) +Generated Location: (4425:131,28 [1] ) |s| Source Location: (214:8,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |ch| -Generated Location: (4610:138,40 [2] ) +Generated Location: (4636:138,40 [2] ) |ch| Source Location: (220:8,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (4828:145,46 [6] ) +Generated Location: (4854:145,46 [6] ) | | Source Location: (250:9,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (5032:153,28 [1] ) +Generated Location: (5058:153,28 [1] ) |s| Source Location: (264:9,42 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |ch| -Generated Location: (5246:160,42 [2] ) +Generated Location: (5272:160,42 [2] ) |ch| Source Location: (270:9,48 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (5467:167,48 [6] ) +Generated Location: (5493:167,48 [6] ) | | Source Location: (280:10,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (5651:175,8 [1] ) +Generated Location: (5677:175,8 [1] ) |s| Source Location: (290:10,18 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |if(cls != null) { | -Generated Location: (5841:182,18 [18] ) +Generated Location: (5867:182,18 [18] ) |if(cls != null) { | Source Location: (309:10,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (6066:189,37 [3] ) +Generated Location: (6092:189,37 [3] ) |cls| Source Location: (312:10,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | }| -Generated Location: (6280:196,40 [2] ) +Generated Location: (6306:196,40 [2] ) | }| Source Location: (318:10,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (6498:203,46 [6] ) +Generated Location: (6524:203,46 [6] ) | | Source Location: (343:11,23 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (6948:213,23 [6] ) +Generated Location: (6974:213,23 [6] ) | | Source Location: (358:12,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (7137:221,13 [1] ) +Generated Location: (7163:221,13 [1] ) |s| Source Location: (366:12,21 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| -Generated Location: (7330:228,21 [44] ) +Generated Location: (7356:228,21 [44] ) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| Source Location: (444:12,99 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (7644:235,99 [6] ) +Generated Location: (7670:235,99 [6] ) | | Source Location: (454:13,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (7828:243,8 [1] ) +Generated Location: (7854:243,8 [1] ) |s| Source Location: (464:13,18 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (8018:250,18 [4] ) +Generated Location: (8044:250,18 [4] ) |null| Source Location: (472:13,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (8219:257,26 [6] ) +Generated Location: (8245:257,26 [6] ) | | Source Location: (489:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (8410:265,15 [4] ) +Generated Location: (8436:265,15 [4] ) |null| Source Location: (496:14,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (8607:272,22 [1] ) +Generated Location: (8633:272,22 [1] ) |s| Source Location: (500:14,26 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (8805:279,26 [8] ) +Generated Location: (8831:279,26 [8] ) | | Source Location: (526:16,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (9005:288,22 [1] ) +Generated Location: (9031:288,22 [1] ) |s| Source Location: (536:16,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (9209:295,32 [4] ) +Generated Location: (9235:295,32 [4] ) |null| Source Location: (547:16,43 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (9427:302,43 [8] ) +Generated Location: (9453:302,43 [8] ) | | Source Location: (560:18,9 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s + s| -Generated Location: (9614:311,9 [5] ) +Generated Location: (9640:311,9 [5] ) |s + s| Source Location: (575:18,24 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (9814:318,24 [4] ) +Generated Location: (9840:318,24 [4] ) |null| Source Location: (586:18,35 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (10024:325,35 [6] ) +Generated Location: (10050:325,35 [6] ) | | Source Location: (597:19,9 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |if (s.Length != 0) { | -Generated Location: (10209:333,9 [21] ) +Generated Location: (10235:333,9 [21] ) |if (s.Length != 0) { | Source Location: (619:19,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (10431:340,31 [1] ) +Generated Location: (10457:340,31 [1] ) |s| Source Location: (620:19,32 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | }| -Generated Location: (10635:347,32 [2] ) +Generated Location: (10661:347,32 [2] ) | }| Source Location: (632:19,44 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (10851:354,44 [4] ) +Generated Location: (10877:354,44 [4] ) |null| Source Location: (643:19,55 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (11081:361,55 [6] ) +Generated Location: (11107:361,55 [6] ) | | Source Location: (664:20,19 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (11276:369,19 [4] ) +Generated Location: (11302:369,19 [4] ) |null| Source Location: (675:20,30 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (11481:376,30 [2] ) +Generated Location: (11507:376,30 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs index bfdfcbda387..4d8507fa345 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ee976c57374bafda343bd6b2086b223381f842016566d5a83498a6d0cbec2f54" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -215,7 +215,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Conditiona ), 289, 25, false); EndWriteAttribute(); WriteLiteral(" />\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt index a3910916ddd..b913a39e9d6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs index 569b502fc05..4718cc66817 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html index 323da7fe613..15d9955bf53 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html @@ -1,16 +1,16 @@ ~~ - ~~~ ~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~~~~ + ~~~ ~~ ~ /*~*/ + ~~~ ~~~ ~ /*~~*/
-

-

-

+

+

+

-

+

- - + + -

+

~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt index bcdf748d694..a4919b59b3c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt index 46e2d14236f..5f732519386 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt @@ -3,7 +3,7 @@ var ch = true; var cls = "bar"; | -Generated Location: (2040:39,2 [48] ) +Generated Location: (2066:39,2 [48] ) | var ch = true; var cls = "bar"; @@ -12,139 +12,139 @@ Generated Location: (2040:39,2 [48] ) Source Location: (66:3,20 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (2276:49,20 [6] ) +Generated Location: (2302:49,20 [6] ) | | Source Location: (83:4,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (2465:57,15 [3] ) +Generated Location: (2491:57,15 [3] ) |cls| Source Location: (90:4,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (2659:64,22 [6] ) +Generated Location: (2685:64,22 [6] ) | | Source Location: (111:5,19 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (2852:72,19 [3] ) +Generated Location: (2878:72,19 [3] ) |cls| Source Location: (118:5,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3050:79,26 [6] ) +Generated Location: (3076:79,26 [6] ) | | Source Location: (135:6,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (3239:87,15 [3] ) +Generated Location: (3265:87,15 [3] ) |cls| Source Location: (146:6,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3437:94,26 [6] ) +Generated Location: (3463:94,26 [6] ) | | Source Location: (185:7,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |ch| -Generated Location: (3648:102,37 [2] ) +Generated Location: (3674:102,37 [2] ) |ch| Source Location: (191:7,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3862:109,43 [6] ) +Generated Location: (3888:109,43 [6] ) | | Source Location: (234:8,41 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |ch| -Generated Location: (4077:117,41 [2] ) +Generated Location: (4103:117,41 [2] ) |ch| Source Location: (240:8,47 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (4295:124,47 [6] ) +Generated Location: (4321:124,47 [6] ) | | Source Location: (257:9,15 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |if(cls != null) { | -Generated Location: (4485:132,15 [18] ) +Generated Location: (4511:132,15 [18] ) |if(cls != null) { | Source Location: (276:9,34 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (4706:139,34 [3] ) +Generated Location: (4732:139,34 [3] ) |cls| Source Location: (279:9,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | }| -Generated Location: (4916:146,37 [2] ) +Generated Location: (4942:146,37 [2] ) | }| Source Location: (285:9,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (5130:153,43 [6] ) +Generated Location: (5156:153,43 [6] ) | | Source Location: (309:10,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (5578:163,22 [6] ) +Generated Location: (5604:163,22 [6] ) | | Source Location: (329:11,18 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| -Generated Location: (5771:171,18 [44] ) +Generated Location: (5797:171,18 [44] ) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| Source Location: (407:11,96 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6081:178,96 [6] ) +Generated Location: (6107:178,96 [6] ) | | Source Location: (427:12,18 [60] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| -Generated Location: (6274:186,18 [60] ) +Generated Location: (6300:186,18 [60] ) |Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| Source Location: (521:12,112 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6616:193,112 [6] ) +Generated Location: (6642:193,112 [6] ) | | Source Location: (638:13,115 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6906:201,115 [6] ) +Generated Location: (6932:201,115 [6] ) | | Source Location: (655:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |null| -Generated Location: (7096:209,15 [4] ) +Generated Location: (7122:209,15 [4] ) |null| Source Location: (663:14,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (7293:216,23 [2] ) +Generated Location: (7319:216,23 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs index c1bbb67fd09..7b8d53cd2ff 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ea68cb71b106404af0072bb70c04f6d73d165cf4aabc5d838b668d681625b53c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/Foo"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -151,7 +151,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Conditiona ), 256, 25, false); EndWriteAttribute(); WriteLiteral(" />\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt index 5e343b65339..fcc544820c1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - href - ~/Foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs index 6b8b6332059..460df69b0ac 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html index d4f55031d2f..8e21e54367e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html @@ -1,13 +1,13 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ 2 TagHelpers. 1 TagHelper. 2 TagHelpers -2 TagHelpers +2 TagHelpers 0 TagHelpers. 1 TagHelper 1 TagHelper -1 TagHelper +1 TagHelper \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt index d1e1b7b2bbb..a41230d2a4c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.ATagHelper - __TestNamespace_ATagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt index c9ac98daec0..45c8500c3a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (2238:37,37 [17] ) +Generated Location: (2264:37,37 [17] ) |"*, TestAssembly"| Source Location: (156:5,12 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (3786:64,12 [5] ) +Generated Location: (3812:64,12 [5] ) |false| Source Location: (237:7,11 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (4165:73,11 [5] ) +Generated Location: (4191:73,11 [5] ) |false| Source Location: (333:9,25 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (4744:84,25 [5] ) +Generated Location: (4770:84,25 [5] ) |false| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs index 42a9dffd1e3..9f51ce1d294 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b0b4eb8b8ddbffa2284ca831845a2ffaacd3d0599bf4242794848b4210903a3b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers."); } ); @@ -77,7 +77,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper."); } ); @@ -92,7 +92,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers"); } ); @@ -109,7 +109,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers"); } ); @@ -138,7 +138,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n0 TagHelpers.\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -164,7 +164,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -179,7 +179,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -205,7 +205,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -227,7 +227,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper2 = CreateTagHelper(); @@ -245,7 +245,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper2 = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt index 3468d006363..ac5094f3727 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - href - ~/ - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - href - ~/hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - href - ~/?hello=world - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs index 0cee17ac0f8..dd6691489c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html index d4fa4e75c16..006ecf00a0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html @@ -1,15 +1,15 @@ 

- ~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ + /*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~

This is item #~~

~

-~~~~~~~~~~~~~~~ -~~~~~~

Bar ~~~~ Biz

~ +/*~~~~~~~~~~~*/ +/*~~*/

Bar /**/ Biz

~

-~~~~~~~~ ~~~~~~ ~ +/*~~~~*/ /*~~*/ ~

Foo

- ~~~~ + /**/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt index 869b681ff3f..8f81b39d924 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt index 90e59b7be2d..e2c5e7cf3dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (173:11,9 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Footer| -Generated Location: (1206:26,22 [6] ) +Generated Location: (1232:26,22 [6] ) |Footer| Source Location: (20:1,13 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |for(int i = 1; i <= 10; i++) { | -Generated Location: (1715:43,13 [36] ) +Generated Location: (1741:43,13 [36] ) |for(int i = 1; i <= 10; i++) { | Source Location: (74:2,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |i| -Generated Location: (1930:51,22 [1] ) +Generated Location: (1956:51,22 [1] ) |i| Source Location: (79:2,27 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) | }| -Generated Location: (2116:58,27 [15] ) +Generated Location: (2142:58,27 [15] ) | }| Source Location: (113:7,2 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(Bar.Baz)| -Generated Location: (2294:66,6 [12] ) +Generated Location: (2320:66,6 [12] ) |Foo(Bar.Baz)| Source Location: (129:8,1 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(| -Generated Location: (2470:73,6 [4] ) +Generated Location: (2496:73,6 [4] ) |Foo(| Source Location: (142:8,14 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |baz| -Generated Location: (2694:76,14 [3] ) +Generated Location: (2720:76,14 [3] ) |baz| Source Location: (153:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |)| -Generated Location: (2754:82,1 [1] ) +Generated Location: (2780:82,1 [1] ) |)| Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |bar| -Generated Location: (2992:90,6 [3] ) +Generated Location: (3018:90,6 [3] ) |bar| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs index 3e4d5adae63..38d5316861c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "81bc9372da7d25ed6342dfd5b1067004013e6b4791921ce725e71f4c9eb90f85" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt index bcade08ec7c..eadaa8728b6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [7] DesignTime.cshtml) LazyIntermediateToken - (0:0,0 [4] DesignTime.cshtml) - Html -
#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html index 790e3bed02b..a84297901e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt index d9f2bbc2f60..0c716bae0fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt index 9fa8793cc23..8f0e77bc16c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1934:34,37 [17] ) +Generated Location: (1960:34,37 [17] ) |"*, TestAssembly"| Source Location: (146:4,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (3285:60,42 [4] ) +Generated Location: (3311:60,42 [4] ) |true| Source Location: (222:5,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (3941:72,42 [4] ) +Generated Location: (3967:72,42 [4] ) |true| Source Location: (43:2,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |3| -Generated Location: (4325:81,33 [1] ) +Generated Location: (4351:81,33 [1] ) |3| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs index 02d1285c41e..3c423b720a5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d45c3cbf5538f23158a297cf78d066fb3d191fc8c062d4e8879f387591564a6b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "button", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -57,9 +57,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -79,7 +79,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -110,7 +110,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt index 574b02ba84b..2f4aff040c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - button - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - TYPE - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs index a943f1ac1d7..1a68fb4fde6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html index ffcfa6aa75b..07b52c13950 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt index c152eb2adf9..fb07d41cd6c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt index 484e1c1bd98..ed02bd13a35 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1848:33,37 [17] ) +Generated Location: (1874:33,37 [17] ) |"*, TestAssembly"| Source Location: (67:2,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |true| -Generated Location: (2768:54,41 [4] ) +Generated Location: (2794:54,41 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs index 9187b068bd6..398faa66831 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "739b3bb42f48ad64d3010068758f57fb6fd25db64a98ab4b4ebd02099e856a56" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "checkbox", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -48,7 +48,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt index 4c64ca624b4..c2bdfd5285a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs index ec0a31f34c0..e705fa17878 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html index 2ec57a6f889..21503f3ffb2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html @@ -1,14 +1,14 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - + - + - + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt index 446cdaa397b..df9640abd44 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt index fbb4920baee..82ee2fb1c8a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt @@ -1,155 +1,155 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1762:32,37 [17] ) +Generated Location: (1788:32,37 [17] ) |"*, TestAssembly"| Source Location: (59:2,24 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2404:50,24 [12] ) +Generated Location: (2430:50,24 [12] ) |DateTime.Now| Source Location: (96:4,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (2786:59,17 [12] ) +Generated Location: (2812:59,17 [12] ) |if (true) { | Source Location: (109:4,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (3001:66,30 [12] ) +Generated Location: (3027:66,30 [12] ) |string.Empty| Source Location: (121:4,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (3229:73,42 [10] ) +Generated Location: (3255:73,42 [10] ) | } else { | Source Location: (132:4,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (3465:80,53 [5] ) +Generated Location: (3491:80,53 [5] ) |false| Source Location: (137:4,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (3702:87,58 [2] ) +Generated Location: (3728:87,58 [2] ) | }| Source Location: (176:6,22 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (4078:96,22 [12] ) +Generated Location: (4104:96,22 [12] ) |DateTime.Now| Source Location: (214:6,60 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (4390:104,60 [12] ) +Generated Location: (4416:104,60 [12] ) |DateTime.Now| Source Location: (256:8,15 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (4770:113,15 [13] ) +Generated Location: (4796:113,15 [13] ) |long.MinValue| Source Location: (271:8,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (4987:120,30 [12] ) +Generated Location: (5013:120,30 [12] ) |if (true) { | Source Location: (284:8,43 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (5215:127,43 [12] ) +Generated Location: (5241:127,43 [12] ) |string.Empty| Source Location: (296:8,55 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (5456:134,55 [10] ) +Generated Location: (5482:134,55 [10] ) | } else { | Source Location: (307:8,66 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (5705:141,66 [5] ) +Generated Location: (5731:141,66 [5] ) |false| Source Location: (312:8,71 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (5955:148,71 [2] ) +Generated Location: (5981:148,71 [2] ) | }| Source Location: (316:8,75 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (6205:155,75 [12] ) +Generated Location: (6231:155,75 [12] ) |int.MaxValue| Source Location: (348:9,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (6475:163,17 [13] ) +Generated Location: (6501:163,17 [13] ) |long.MinValue| Source Location: (363:9,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (6695:170,32 [12] ) +Generated Location: (6721:170,32 [12] ) |if (true) { | Source Location: (376:9,45 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (6926:177,45 [12] ) +Generated Location: (6952:177,45 [12] ) |string.Empty| Source Location: (388:9,57 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (7170:184,57 [10] ) +Generated Location: (7196:184,57 [10] ) | } else { | Source Location: (399:9,68 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (7422:191,68 [5] ) +Generated Location: (7448:191,68 [5] ) |false| Source Location: (404:9,73 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (7675:198,73 [2] ) +Generated Location: (7701:198,73 [2] ) | }| Source Location: (408:9,77 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (7928:205,77 [12] ) +Generated Location: (7954:205,77 [12] ) |int.MaxValue| Source Location: (445:11,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (8311:214,17 [13] ) +Generated Location: (8337:214,17 [13] ) |long.MinValue| Source Location: (460:11,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (8531:221,32 [12] ) +Generated Location: (8557:221,32 [12] ) |DateTime.Now| Source Location: (492:11,64 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (8782:228,64 [12] ) +Generated Location: (8808:228,64 [12] ) |int.MaxValue| Source Location: (529:13,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (9165:237,17 [12] ) +Generated Location: (9191:237,17 [12] ) |if (true) { | Source Location: (542:13,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (9381:244,30 [12] ) +Generated Location: (9407:244,30 [12] ) |string.Empty| Source Location: (554:13,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (9610:251,42 [10] ) +Generated Location: (9636:251,42 [10] ) | } else { | Source Location: (565:13,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (9847:258,53 [5] ) +Generated Location: (9873:258,53 [5] ) |false| Source Location: (570:13,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (10085:265,58 [2] ) +Generated Location: (10111:265,58 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs index 151e828a910..cb8e7394833 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4c214203eb338caf0f877accd57cbda70c9002c9f35b3b48b9bdecc4811fdc6b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -46,7 +46,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -71,7 +71,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -131,7 +131,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -172,7 +172,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -315,7 +315,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -359,7 +359,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt index b7fcc6f58bf..93c73bff7c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs index 226b64fc72f..28908b71ba5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html index 1d1a1dccf6e..abb4af9f7da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt index 904b2f9d7c2..4dbc2c08726 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt index 958efd00e64..76535bef739 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1923:34,38 [15] ) +Generated Location: (1949:34,38 [15] ) |*, TestAssembly| Source Location: (66:3,26 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (2829:55,42 [0] ) +Generated Location: (2855:55,42 [0] ) || Source Location: (126:5,30 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (3471:67,42 [0] ) +Generated Location: (3497:67,42 [0] ) || Source Location: (92:4,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (3847:76,33 [0] ) +Generated Location: (3873:76,33 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs index 172586535bc..3c856f08dad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c4d761efb25f1145e3bafb0566e5b4889a0d28f01dcbeaa9f36bce4ee9cc026d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -50,7 +50,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttri public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -79,9 +79,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttri Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt index 8576c78b969..d7d4e6ece66 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs index 5bea3a23350..550c145c6a2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt index 461556fa047..93e01fddb1b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt index e6735cb40f1..e636f88cf1c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml) || -Generated Location: (1453:33,2 [0] ) +Generated Location: (1479:33,2 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs index e4108a2bec7..2c439670fa6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "16b0a230405bddf39e1d1cb49449db91ec2b2ebc7f619f5f3ae013391cc2307f" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt index 01291b49098..0a7e699a421 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyCodeBlock.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyCodeBlock.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs index 6cab863c365..639b66b487d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt index 8e71bfcab23..29bcd1fe25f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt index 3819be7ae9e..71c7b3da6cd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs index 3885320435c..5da11f24b59 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "004fdbe7564de7fa0982c2502bef8fedcb3d887b445c425221784d3402ab9a19" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt index 9f1792bdc67..4f98be73b69 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyExplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyExplicitExpression.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs index 54002fc43c8..9d5c0d4c77a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt index 5cd13e99059..22ad9da3b97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt index 9147bf1a63d..a3e71fbcd1b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) | | -Generated Location: (1498:33,2 [6] ) +Generated Location: (1524:33,2 [6] ) | | Source Location: (9:1,5 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) || -Generated Location: (1686:41,6 [0] ) +Generated Location: (1712:41,6 [0] ) || Source Location: (9:1,5 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) | | -Generated Location: (1868:48,5 [2] ) +Generated Location: (1894:48,5 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs index 05789d9df8d..caec95f7a73 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "af161186fc847e3b1cff0dd7b9c1f0535ff384409c6559dbf0799a8c3407d342" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt index 0b72a52b1b2..d667609d267 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) LazyIntermediateToken - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs index 2d5fcca8d19..92fafd86bd2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt index d2e8477cebc..f328d60f2e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt index faf46353bbc..618f7b466d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (19:2,1 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs index 40120aee815..195230c8308 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9af7ee6893210f3b4ab21bd93a76eaed1540b45b34c6ccbef4c980fd5f3c9f8c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt index 35e11fc00c0..6eace06f0a5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyImplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyImplicitExpression.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs index 9e17c235572..c3faf60048d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html index 502b2ba29ce..459ec2118cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~~~~~ ~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~~~~~~~~~~~*/ ~ - - - - - + + + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt index 682576e5ec7..3bd1127535b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt index 6784cb1636d..723af2531c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1818:33,37 [17] ) +Generated Location: (1844:33,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) | var enumValue = MyEnum.MyValue; | -Generated Location: (2323:50,2 [39] ) +Generated Location: (2349:50,2 [39] ) | var enumValue = MyEnum.MyValue; | Source Location: (96:6,15 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MyValue| -Generated Location: (2772:60,39 [14] ) +Generated Location: (2798:60,39 [14] ) |MyEnum.MyValue| Source Location: (131:7,15 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MySecondValue| -Generated Location: (3251:70,15 [20] ) +Generated Location: (3277:70,15 [20] ) |MyEnum.MySecondValue| Source Location: (171:8,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (3853:80,132 [7] ) +Generated Location: (3879:80,132 [7] ) |MyValue| Source Location: (198:9,14 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MySecondValue| -Generated Location: (4443:90,132 [13] ) +Generated Location: (4469:90,132 [13] ) |MySecondValue| Source Location: (224:9,40 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (4757:97,138 [7] ) +Generated Location: (4783:97,138 [7] ) |MyValue| Source Location: (251:10,15 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (5254:107,39 [9] ) +Generated Location: (5280:107,39 [9] ) |enumValue| Source Location: (274:10,38 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (5471:114,45 [9] ) +Generated Location: (5497:114,45 [9] ) |enumValue| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs index 34161e8ccd5..d0ef142223b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "77f2d2a6c05eb6fd6b50ca4e425c887ee527eddaca21ae01f7c0288ab53bff45" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -57,7 +57,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel #nullable disable WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -82,7 +82,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -108,7 +108,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -133,7 +133,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -168,7 +168,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt index 8a79d57bf54..b4cafd4b16d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs index 19702e4b4d3..51eea673edd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html index ec43fd7f175..c9f6298277c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - - - + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt index 3ee270e2db6..5906dc0ac97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt index 83511484f63..ede2743a1c6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |"*, TestAssembly"| -Generated Location: (1707:32,37 [17] ) +Generated Location: (1733:32,37 [17] ) |"*, TestAssembly"| Source Location: (48:2,13 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |new string("1, 2")| -Generated Location: (2315:50,27 [18] ) +Generated Location: (2341:50,27 [18] ) |new string("1, 2")| Source Location: (84:3,12 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |new string("1, 2")| -Generated Location: (2676:59,27 [18] ) +Generated Location: (2702:59,27 [18] ) |new string("1, 2")| Source Location: (120:4,12 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |"0" + new @String("1 2")| -Generated Location: (3037:68,27 [24] ) +Generated Location: (3063:68,27 [24] ) |"0" + new @String("1 2")| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs index c752c653108..ad651d65723 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e4df6041980536333164e3380678ce837699cd137aff68cc9358167dcaafba83" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -46,7 +46,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -92,7 +92,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt index edd8d1f9c18..6f7816a341a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs index cf4e5e36ebf..a419af478f5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html index 37e0121757a..a423d0868e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~ ~ ~~~~ - ~~~ ~~~~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~ ~ ~~~ ~ ~~~~~~~~~ ~~ - ~~~ ~~~~ ~ ~~~ ~ ~~~~~ ~ ~~~ ~~~~~~~~~~~~~~~~~~~~~ ~ ~~~~~~ ~~~~~ ~ ~~ + ~~~ /*~*/ ~ /**/ + ~~~ /*~*/ ~ /*~*/ + ~~~ ~~~ ~ ~~~ ~ ~~~ ~ /*~~~~~*/ ~~ + ~~~ /**/ ~ ~~~ ~ /*~*/ ~ ~~~ /*~~~~~~~~~~~~~~~~~*/ ~ /*~~*/ /*~*/ ~ ~~ ~ - - - + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt index c6046b8773f..3d40be628b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt index f32e9f0cae4..22d6efb6abf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |"*, TestAssembly"| -Generated Location: (1707:32,37 [17] ) +Generated Location: (1733:32,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [163] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) @@ -10,7 +10,7 @@ Source Location: (37:2,2 [163] TestFiles/IntegrationTests/CodeGenerationIntegrat var obj = new { age = (object)1 }; var item = new { Items = new System.List() { "one", "two" } }; | -Generated Location: (2215:49,2 [163] ) +Generated Location: (2241:49,2 [163] ) | var count = "1"; var alive = true; @@ -20,26 +20,26 @@ Generated Location: (2215:49,2 [163] ) Source Location: (215:8,12 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |Convert.ToInt32(@count)| -Generated Location: (2642:61,27 [23] ) +Generated Location: (2668:61,27 [23] ) |Convert.ToInt32(@count)| Source Location: (247:8,44 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |!@alive| -Generated Location: (2874:68,44 [7] ) +Generated Location: (2900:68,44 [7] ) |!@alive| Source Location: (272:9,12 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |(int)@obj.age| -Generated Location: (3225:77,27 [13] ) +Generated Location: (3251:77,27 [13] ) |(int)@obj.age| Source Location: (292:9,32 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |new { @params = 1 }| -Generated Location: (3436:84,32 [19] ) +Generated Location: (3462:84,32 [19] ) |new { @params = 1 }| Source Location: (343:10,26 [124] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))| -Generated Location: (3838:93,66 [124] ) +Generated Location: (3864:93,66 [124] ) |(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs index b97277b2108..27c5fea7b4c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8fc172b55ced462a1746f1082869701d161cf36fd24dacd8d9fa98cc66d744ad" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde #line hidden #nullable disable - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -91,7 +91,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -124,7 +124,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt index c8898d923fe..9c82737feb9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs index c71d28813bd..9e69f9f5952 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html index 5a7ee1c8e99..330c5968da2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html @@ -1,8 +1,8 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/ - Not a TagHelper: + Not a TagHelper: \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt index 81c25965b2f..7e66b754497 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt index 17ed97342eb..c6a1605a4ef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1824:33,38 [15] ) +Generated Location: (1850:33,38 [15] ) |*, TestAssembly| Source Location: (106:3,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2358:50,29 [12] ) +Generated Location: (2384:50,29 [12] ) |DateTime.Now| Source Location: (204:5,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2794:59,51 [12] ) +Generated Location: (2820:59,51 [12] ) |DateTime.Now| Source Location: (227:5,74 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |true| -Generated Location: (3199:68,74 [4] ) +Generated Location: (3225:68,74 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs index e2a818c275d..cbe7e0a6166 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "602b63a03b7490d9350a834c628e36b03134479ea417de4aca379f59b8089f35" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -62,7 +62,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTag WriteLiteral("input type=\"text\" />\r\n <"); WriteLiteral("em>Not a TagHelper: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt index 340e6c5aae1..81a9e89c902 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs index 414aec818d3..2c34634b8da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt index 40a90bb5cdf..fbef1cc35bc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt index 3e3ed234a2c..d5137abad3b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs index c89b963cd18..3e5132077de 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "32bee45d8028059ac44a7f812a2749196ee1be1683ed25d4e21d8d13f47da75c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt index 3ec37e6097b..f7b7ac59152 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) LazyIntermediateToken - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs index 2ac3883efaa..8dcdd3620af 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt index 374999b63c4..d3c672320d5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt index e571b69ca9f..97e36eed7ba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml) || -Generated Location: (1606:35,1 [0] ) +Generated Location: (1632:35,1 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs index 980633f89fd..280ffcd6db8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d6b6b46422180a2d5485fc829481edf617295af5ea333631211aa0c2c472d178" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt index c5be1147976..0206aef1614 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [5] ExplicitExpressionWithMarkup.cshtml) LazyIntermediateToken - (0:0,0 [4] ExplicitExpressionWithMarkup.cshtml) - Html -
#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html index de64a85c025..1968612c862 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html @@ -1 +1 @@ -1 + 1 = ~~~~~~ \ No newline at end of file +1 + 1 = /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt index ae7b489a819..a90513cbdf7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt index 4a36f0b924f..d20d160807b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (10:0,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml) |1+1| -Generated Location: (1473:33,10 [3] ) +Generated Location: (1499:33,10 [3] ) |1+1| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs index d3b33f67196..3676d6ece1f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "127c2e4532452a01cb38d7d47d12b143d778f204179f089dd1851ea16c19af0a" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt index 1eeaa7edc17..ad32b2e0ca4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [8] ExplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [8] ExplicitExpression.cshtml) - Html - 1 + 1 = diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs index fd65c220d47..4e180f5a809 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html index 6705095c5a8..7cc8aafa571 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html @@ -1,16 +1,16 @@ ~~ - ~~~~~~ ~~~ ~ ~~~~~ - ~~~~~~ ~~~ ~ ~~~~~~ + /*~~*/ ~~~ ~ /*~*/ + /*~~*/ ~~~ ~ /*~~*/ ~ -~~~~~~~ ~~ ~~~~~ ~ - ~~~~ -~ ~~~~ ~ +/*~~~*/ ~~ /*~*/ ~ + /**/ +~ /**/ ~

Foo is Null!

~

-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ - ~~~~~~~~~~~~~~~~~~ ~~~~~ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ + /*~~~~~~~~~~~~~~*/ /*~*/ ~

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt index 2872b891b6e..337df7737a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt index 844305443a9..6a6ea24f261 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt @@ -3,7 +3,7 @@ object foo = null; string bar = "Foo"; | -Generated Location: (1462:33,2 [51] ) +Generated Location: (1488:33,2 [51] ) | object foo = null; string bar = "Foo"; @@ -12,20 +12,20 @@ Generated Location: (1462:33,2 [51] ) Source Location: (59:5,1 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |if(foo != null) { | -Generated Location: (1676:42,1 [23] ) +Generated Location: (1702:42,1 [23] ) |if(foo != null) { | Source Location: (83:6,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |foo| -Generated Location: (1869:50,6 [3] ) +Generated Location: (1895:50,6 [3] ) |foo| Source Location: (86:6,8 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | } else { | -Generated Location: (2045:57,8 [16] ) +Generated Location: (2071:57,8 [16] ) | } else { | @@ -33,26 +33,26 @@ Generated Location: (2045:57,8 [16] ) Source Location: (121:8,23 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | }| -Generated Location: (2248:66,23 [3] ) +Generated Location: (2274:66,23 [3] ) | }| Source Location: (134:12,1 [38] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |if(!String.IsNullOrEmpty(bar)) { | -Generated Location: (2417:74,1 [38] ) +Generated Location: (2443:74,1 [38] ) |if(!String.IsNullOrEmpty(bar)) { | Source Location: (174:13,6 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |bar.Replace("F", "B")| -Generated Location: (2626:82,6 [21] ) +Generated Location: (2652:82,6 [21] ) |bar.Replace("F", "B")| Source Location: (196:13,28 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | }| -Generated Location: (2841:89,28 [3] ) +Generated Location: (2867:89,28 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs index 9ec272bb776..5033d43fda0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c9cc7d097735e4074bc4f71cd46101fc821fdb0592f90d491f09fdecddf3caf3" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt index d5677645b4e..fc5e2f7292b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [51] ExpressionsInCode.cshtml) LazyIntermediateToken - (2:0,2 [51] ExpressionsInCode.cshtml) - CSharp - \n object foo = null;\n string bar = "Foo";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs index 8c747a197f2..dea191752cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html index 3b426fe7e50..482708e173a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html @@ -1,7 +1,7 @@  - ~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ ~~~~~~ ~ - ~~~~~~ ~~~~~ ~ ~~~~ + /*~~~~~~~*/ +/*~~*/ /*~~~~~~*/ /*~~*/ ~ + /*~~*/ /*~*/ ~ /**/ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt index 6c4a32046c5..30b7218368c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt index 9c3dce835be..e0f664757d1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt @@ -4,7 +4,7 @@ string foo(string input) { return input + "!"; } | -Generated Location: (1533:35,12 [55] ) +Generated Location: (1559:35,12 [55] ) | string foo(string input) { return input + "!"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs index f1d1aa5a210..820f83e5671 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "efea5780300288b4c0a438cb8dbd885088680963b3e2ceab4416264993e99884" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt index 67bc1c2d297..deee0e85d86 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [4] FunctionsBlockMinimal.cshtml) LazyIntermediateToken - (0:0,0 [4] FunctionsBlockMinimal.cshtml) - Html - \n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs index ee2143678a2..349f53a914b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html index 6486d498a3d..78f2d99505b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html @@ -1,12 +1,12 @@ -~~~~~~~~~~ ~ +/*~~~~~~*/ ~ ~ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~ ~~~ ~~~~~~~~~ - ~~~~~~~ ~~~ ~~~~~~~~~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ ~ ~~~ /*~~~~~*/ + /*~~~*/ ~~~ /*~~~~~~~*/ ~ + /*~~*/ /*~~~~~~~~~*/ ~ ~ -Here's a random number: ~~~~~~~~~~~~ \ No newline at end of file +Here's a random number: /*~~~~~~~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt index 3c830d841ec..8fa7fe03939 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt index 42c5eeb452c..5dd526ec510 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt @@ -1,13 +1,13 @@ Source Location: (167:11,25 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml) |RandomInt()| -Generated Location: (1477:33,25 [11] ) +Generated Location: (1503:33,25 [11] ) |RandomInt()| Source Location: (12:0,12 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml) | | -Generated Location: (1711:42,12 [4] ) +Generated Location: (1737:42,12 [4] ) | | @@ -19,7 +19,7 @@ Source Location: (33:4,12 [104] TestFiles/IntegrationTests/CodeGenerationIntegra return _rand.Next(); } | -Generated Location: (1886:50,12 [104] ) +Generated Location: (1912:50,12 [104] ) | Random _rand = new Random(); private int RandomInt() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs index 31228bf1917..d82a603126e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "87718d380117c487f66665bd4c191fcab3bbf6821e64caa809bf2fd1ad6af664" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt index ec88a1948dd..f49ba49e18e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (19:3,0 [2] FunctionsBlock.cshtml) LazyIntermediateToken - (19:3,0 [2] FunctionsBlock.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs index e82bc796b51..d6ad1397883 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html index 994e8efc2cc..3cd74d11b6f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html @@ -1,3 +1,3 @@ ~~ - ~~~~ + /**/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt index 959e6765dd3..55a0f83aa61 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt index 6ef7c1f39ba..608aac72830 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt @@ -1,14 +1,14 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml) | | -Generated Location: (1462:33,2 [6] ) +Generated Location: (1488:33,2 [6] ) | | Source Location: (9:1,5 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml) |@Da | -Generated Location: (1637:41,5 [5] ) +Generated Location: (1663:41,5 [5] ) |@Da | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs index 687f861d929..ab0bc0232aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f28b1d44c575d208cd85ccdfcbacce93cf352fed0b4626a5450b19c7aee40d04" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt index 263870234ea..dcf3272a106 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] HiddenSpansInCode.cshtml) LazyIntermediateToken - (2:0,2 [6] HiddenSpansInCode.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs index 9b1cfc015e5..16d6ef39aa7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt index 2d897baddc7..e78cd9b7063 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs index 81126e4108e..09d02bce32f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "27a85171d5a386c4f1b5ff7df75346b702207bfa961bbf3b5418584132a09c45" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/images/submit.png"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommen public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt index 1b51c61a054..9b39e382345 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - src - ~/images/submit.png - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs index e61df7570d9..3e18757d068 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt index 9ed95001eae..8d278471394 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs index b88b00e29fe..0be03656e48 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "88d08131b744c1b898ea33808f9b0ed6339ccaab3836730b144161c70d193e61" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/images/submit.png"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommen public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt index 2ab5c3cbf12..852366b746b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - src - ~/images/submit.png - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs index 4a0caf4adb8..0cfe4b54156 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html index 86e588c23bd..7490626ee6d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~~~~~~ ~~~~~~~~~~~ +/*~~~~~~~*/ /*~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~ ~ ~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~*/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt index 66b9e8d4bf6..cab993cd2a3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt index d35dc5551cb..5bb82ae1446 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt @@ -1,13 +1,13 @@ Source Location: (12:0,12 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml) |IDisposable| -Generated Location: (1196:26,0 [11] ) +Generated Location: (1222:26,0 [11] ) |IDisposable| Source Location: (39:2,12 [38] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml) | void IDisposable.Dispose() { } | -Generated Location: (1774:45,12 [38] ) +Generated Location: (1800:45,12 [38] ) | void IDisposable.Dispose() { } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs index 78674d755a5..32c9e48e122 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "668986313132d43ea69290e3a9fa026efcdd9b84e34b0fe6ef95f8096bd84385" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt index 2ef71d6d5cf..4027bd1b1d5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (25:1,0 [2] Implements.cshtml) LazyIntermediateToken - (25:1,0 [2] Implements.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs index 1342f541587..b3ec3672d80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt index f48c7b4e954..94746ecc0c6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt index ab19a0ce624..a1f0e38e90c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (19:2,1 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs index 7bb72dc5082..c065446ece7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c51c63579e91e34ccd7908daa20ee621d57df811c127c4675d2c49479e67358c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt index 309d0b5718e..cd9f949fc78 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) LazyIntermediateToken - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs index 51fd4390be3..efab73b7b9f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html index 11d9506a659..575be17a330 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ +/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~

This is item #~~

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt index 2e6a3381dfd..39c19dcb1ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt index da632e401d2..eea01762490 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (1:0,1 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) |for(int i = 1; i <= 10; i++) { | -Generated Location: (1464:33,1 [36] ) +Generated Location: (1490:33,1 [36] ) |for(int i = 1; i <= 10; i++) { | Source Location: (55:1,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) |i| -Generated Location: (1687:41,22 [1] ) +Generated Location: (1713:41,22 [1] ) |i| Source Location: (60:1,27 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) | }| -Generated Location: (1881:48,27 [3] ) +Generated Location: (1907:48,27 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs index 92a056800f6..a5c779d4f19 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a9ffb11684d26004cfb4c9d3c57f6e1b1ecfce9046379ae96dc044b20960a06c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt index 1ffcfd3f3ea..7693cf998ab 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [32] ImplicitExpression.cshtml) LazyIntermediateToken - (1:0,1 [32] ImplicitExpression.cshtml) - CSharp - for(int i = 1; i <= 10; i++) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs index 2f78e9c6151..27f3a9b0858 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html index d8a9146ac9b..b8e8517b76c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -1,25 +1,25 @@ -~~ ~~~~~ ~~~~ ~~~~~ ~~~~~~~~ ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~ ~~ +~~ /*~*/ /**/ /*~*/ /*~~~~*/ /**/ /*~~~~~~~*/ /*~~~~~~*/ /*~~~~~~*/ /*~*/ /*~~*/ ~~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~ ~ +/*~~~~~~~~~*/ +/*~~~~~~~~~*/ +/*~~~~~~~~~*/ ~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ ~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ ~ -~~~~~~~~~ -~~~~~~~~~ +/*~~~~~*/ +/*~~~~~*/ -~~~~~~~~~~ -~~~~~~~~~~ +/*~~~~~~*/ +/*~~~~~~*/ -~~~~~~~~ -~~~~~~~~ +/*~~~~*/ +/*~~~~*/ -~~~~~~~~ { -~~~~~~~~~~ ~ \ No newline at end of file +/*~~~~*/ { +/*~~~~~~*/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index e5c52cc4a0f..5748fd781a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 3592e35d473..df9147119c3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -1,70 +1,70 @@ Source Location: (100:2,13 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1251:26,38 [0] ) +Generated Location: (1277:26,38 [0] ) || Source Location: (116:3,14 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1526:36,38 [0] ) +Generated Location: (1552:36,38 [0] ) || Source Location: (132:4,14 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (1800:46,37 [1] ) +Generated Location: (1826:46,37 [1] ) |"| Source Location: (153:6,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2075:56,38 [0] ) +Generated Location: (2101:56,38 [0] ) || Source Location: (172:7,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2350:66,38 [0] ) +Generated Location: (2376:66,38 [0] ) || Source Location: (191:8,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (2624:76,37 [1] ) +Generated Location: (2650:76,37 [1] ) |"| Source Location: (212:10,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2900:86,38 [0] ) +Generated Location: (2926:86,38 [0] ) || Source Location: (231:11,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3176:96,38 [0] ) +Generated Location: (3202:96,38 [0] ) || Source Location: (250:12,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (3451:106,37 [1] ) +Generated Location: (3477:106,37 [1] ) |"| Source Location: (276:15,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3689:116,0 [0] ) +Generated Location: (3715:116,0 [0] ) || Source Location: (326:21,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3926:126,0 [0] ) +Generated Location: (3952:126,0 [0] ) || Source Location: (264:14,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4428:143,9 [0] ) +Generated Location: (4454:143,9 [0] ) || Source Location: (315:20,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4604:150,8 [0] ) +Generated Location: (4630:150,8 [0] ) || Source Location: (354:24,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4784:157,12 [0] ) +Generated Location: (4810:157,12 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index a76c039ab73..c9c21931222 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "eb06c7c88327837013a4b8bbc01e69455dd31e066c651c88da5da9887b37f4d9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index a4a712b6eaa..7274c0398a5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs index b1665ab5c50..6d762434b2f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html index 40b68fd5b19..ba70622d969 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString(""), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt index fd71f41bf09..b8f46001e5a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs index 037caca0dec..4ecd293dd78 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html index f82a274fc96..29d7e0814da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~*/ /*~~~~~~~~~~~~~~~~~*/ -~~~~~~ \ No newline at end of file +/*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt index b8a831fb568..aa306a32a06 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt @@ -10,12 +10,12 @@ Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").Wit // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(3,7): error CS0103: The name 'foo' does not exist in the current context // __o = foo(); Diagnostic(ErrorCode.ERR_NameNotInContext, "foo").WithArguments("foo").WithLocation(3, 7), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,86): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(19, 86), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,94): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(19, 94), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,98): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(19, 98) \ No newline at end of file +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,95): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(19, 95), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,103): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(19, 103), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,107): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(19, 107) \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt index 0befe19386a..92d236e6f5e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt index 37840d94cda..d40e6fc3abc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo.bar>.boz| -Generated Location: (1141:26,0 [21] ) +Generated Location: (1167:26,0 [21] ) |foo.bar>.boz| Source Location: (36:2,1 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo()| -Generated Location: (1672:43,6 [5] ) +Generated Location: (1698:43,6 [5] ) |foo()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs index 02607f6274f..7894a068a68 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f2e8261f6a1dc47ca6ea0cb9335f0a2b8b0b18bc9f1fc43b6c3a7764e3ac7f75" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt index cfba402fdec..bf21394ac74 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt @@ -1,15 +1,15 @@ // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(3,2): error CS0103: The name 'foo' does not exist in the current context // foo() Diagnostic(ErrorCode.ERR_NameNotInContext, "foo").WithArguments("foo").WithLocation(3, 2), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,86): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(21, 86), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,94): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(21, 94), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,98): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(21, 98), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,95): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(21, 95), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,103): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(21, 103), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,107): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(21, 107), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(27,13): error CS0103: The name 'WriteLiteral' does not exist in the current context // WriteLiteral("\r\n"); Diagnostic(ErrorCode.ERR_NameNotInContext, "WriteLiteral").WithArguments("WriteLiteral").WithLocation(27, 13), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt index bcda0ccbb52..8f7bcf659b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (33:1,0 [2] Inherits.cshtml) LazyIntermediateToken - (33:1,0 [2] Inherits.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs index 09e8c2776b4..d2eafe6c0dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html index c6bc472d4e8..7bc8b199750 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~ ~~~~(string link) { - +/*~~~~*/ /**/(string link) { + } \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt index 5f61fc6cb42..7fe620ea765 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt index 2e328813770..c32278526e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (9:0,9 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |Link| -Generated Location: (1211:26,22 [4] ) +Generated Location: (1237:26,22 [4] ) |Link| Source Location: (44:1,14 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |if(link != null) { | -Generated Location: (1721:43,14 [19] ) +Generated Location: (1747:43,14 [19] ) |if(link != null) { | Source Location: (64:1,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |link| -Generated Location: (1933:50,34 [4] ) +Generated Location: (1959:50,34 [4] ) |link| Source Location: (68:1,38 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | } else { | -Generated Location: (2135:57,38 [10] ) +Generated Location: (2161:57,38 [10] ) | } else { | Source Location: (92:1,62 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | }| -Generated Location: (2366:64,62 [2] ) +Generated Location: (2392:64,62 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs index e8192805b25..35ab012a071 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d7855bb65d3e6db02c3a0fb02972366eb41151f780bf5b52f5c72a44a4591587" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt index 7d92d9337a1..5fb43452b2c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [13] InlineBlocks.cshtml) - section DirectiveToken - (9:0,9 [4] InlineBlocks.cshtml) - Link diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs index fcc56226630..a03a3a7522b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html index 523f914f69d..a89de497f3e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html @@ -5,34 +5,34 @@

Hello, World

~ -~~~~~~~~ ~~ ~~~ ~ -

Hello from C#, #~~~~

+/*~~~~*/ ~~ ~~~ ~ +

Hello from C#, #/**/

~ ~~ ~~ ~ -~~~~~ ~~ ~~~ ~ +/*~*/ ~~ ~~~ ~

We wrote 10 lines!

~ -~~~~~~~~~~ ~ - ~~~~ ~~~ +/*~~~~~~*/ ~ + /**/ ~~~

No really, we wrote 10 lines!

- ~~~~~~ - ~~~~~~~~ + /*~~*/ + /*~~~~*/

Actually, we didn't...

- ~~~~~~ + /*~~*/ ~ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ -

Hello again from C#, #~~~~

+/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ +

Hello again from C#, #/**/

~ -~~~~ ~ +/**/ ~

That time, we wrote 5 lines!

-~ ~~~~~~~~~~~~~~~ ~~~ ~ -

Oh no! An error occurred: ~~~~~~~~~~~~~

+~ /*~~~~~~~~~~~*/ ~~~ ~ +

Oh no! An error occurred: /*~~~~~~~~~*/

~ -~~~~~~~~~ ~~~~~~~~~ ~ +/*~~~~~*/ /*~~~~~*/ ~

This block is locked, for your security!

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt index 3bc691ae609..a2ae4a6f8b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt index cd2fb2f7173..20095dd1784 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt @@ -2,7 +2,7 @@ | int i = 1; var foo = | -Generated Location: (1447:33,2 [32] ) +Generated Location: (1473:33,2 [32] ) | int i = 1; var foo = | @@ -10,39 +10,39 @@ Generated Location: (1447:33,2 [32] ) Source Location: (45:2,25 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |; | -Generated Location: (1806:45,25 [7] ) +Generated Location: (1832:45,25 [7] ) |; | Source Location: (68:4,0 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | | -Generated Location: (1972:53,0 [4] ) +Generated Location: (1998:53,0 [4] ) | | Source Location: (91:4,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | | -Generated Location: (2158:60,23 [2] ) +Generated Location: (2184:60,23 [2] ) | | Source Location: (99:7,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |while(i <= 10) { | -Generated Location: (2318:67,1 [22] ) +Generated Location: (2344:67,1 [22] ) |while(i <= 10) { | Source Location: (142:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |i| -Generated Location: (2524:75,25 [1] ) +Generated Location: (2550:75,25 [1] ) |i| Source Location: (148:8,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | i += 1; }| -Generated Location: (2716:82,31 [16] ) +Generated Location: (2742:82,31 [16] ) | i += 1; }| @@ -50,14 +50,14 @@ Generated Location: (2716:82,31 [16] ) Source Location: (169:12,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |if(i == 11) { | -Generated Location: (2893:91,1 [19] ) +Generated Location: (2919:91,1 [19] ) |if(i == 11) { | Source Location: (213:13,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (3101:99,29 [3] ) +Generated Location: (3127:99,29 [3] ) | }| @@ -65,7 +65,7 @@ Source Location: (221:16,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegra |switch(i) { case 11: | -Generated Location: (3265:107,1 [35] ) +Generated Location: (3291:107,1 [35] ) |switch(i) { case 11: | @@ -75,7 +75,7 @@ Source Location: (292:18,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegr break; default: | -Generated Location: (3504:116,44 [40] ) +Generated Location: (3530:116,44 [40] ) | break; default: @@ -85,7 +85,7 @@ Source Location: (361:21,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegr | break; }| -Generated Location: (3741:126,37 [19] ) +Generated Location: (3767:126,37 [19] ) | break; }| @@ -93,26 +93,26 @@ Generated Location: (3741:126,37 [19] ) Source Location: (385:25,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |for(int j = 1; j <= 10; j += 2) { | -Generated Location: (3921:135,1 [39] ) +Generated Location: (3947:135,1 [39] ) |for(int j = 1; j <= 10; j += 2) { | Source Location: (451:26,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |j| -Generated Location: (4151:143,31 [1] ) +Generated Location: (4177:143,31 [1] ) |j| Source Location: (457:26,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (4350:150,37 [3] ) +Generated Location: (4376:150,37 [3] ) | }| Source Location: (465:29,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |try { | -Generated Location: (4514:158,1 [11] ) +Generated Location: (4540:158,1 [11] ) |try { | @@ -120,34 +120,34 @@ Source Location: (511:30,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegr | } catch(Exception ex) { | -Generated Location: (4724:166,39 [31] ) +Generated Location: (4750:166,39 [31] ) | } catch(Exception ex) { | Source Location: (573:32,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |ex.Message| -Generated Location: (4950:175,35 [10] ) +Generated Location: (4976:175,35 [10] ) |ex.Message| Source Location: (588:32,50 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (5171:182,50 [3] ) +Generated Location: (5197:182,50 [3] ) | }| Source Location: (596:35,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |lock(new object()) { | -Generated Location: (5335:190,1 [26] ) +Generated Location: (5361:190,1 [26] ) |lock(new object()) { | Source Location: (669:36,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (5572:198,51 [3] ) +Generated Location: (5598:198,51 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs index 40e2e0643f1..ab9a0c410f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "995eb60d7343e6b2916ae503c3fc313ad9fc919ca39dcd50b386d27d2b53f80e" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt index 0a87315d8ce..472ccdcbb4b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [32] Instrumented.cshtml) LazyIntermediateToken - (2:0,2 [32] Instrumented.cshtml) - CSharp - \n int i = 1;\n var foo = diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs index c179a22082f..75a4260c698 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html index cab63f7d85e..c267bf19829 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html @@ -1,5 +1,5 @@ ~~ - ~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ -

Hello from C#, #~~~~~~~~~~~~~~~

+ /*~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~ +

Hello from C#, #/*~~~~~~~~~~~*/

~ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt index c7c6de0377f..1913a74d92a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt index f0a2f64bc89..eaf9d729129 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt @@ -2,21 +2,21 @@ | for(int i = 1; i <= 10; i++) { | -Generated Location: (1462:33,2 [46] ) +Generated Location: (1488:33,2 [46] ) | for(int i = 1; i <= 10; i++) { | Source Location: (69:2,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml) |i.ToString()| -Generated Location: (1701:42,29 [12] ) +Generated Location: (1727:42,29 [12] ) |i.ToString()| Source Location: (86:2,46 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml) | } | -Generated Location: (1924:49,46 [9] ) +Generated Location: (1950:49,46 [9] ) | } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs index 88b8940ba0b..d3c5f67937b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8d4533fb0fc90f8228aa0b0c9ec2d1cb53d3ef9b2018884e3e906a63b2e7ec39" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt index 05d608baca2..466ca6777a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [38] MarkupInCodeBlock.cshtml) LazyIntermediateToken - (2:0,2 [38] MarkupInCodeBlock.cshtml) - CSharp - \n for(int i = 1; i <= 10; i++) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs index 9e4ce6fb3f3..2dde3aac494 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html index 94cb1ec258d..d8704691b59 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html @@ -1,47 +1,47 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~~ ~ ~~~ ~~~~~~~~ + ~~~ /*~~*/ ~ ~~~ /*~~~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~ ~ ~~~~~~~~~ ~~~ ~ ~~~ ~~ + ~~~ /*~~~~*/ ~ /**/ ~ /*~~~~~*/ ~~~ ~ ~~~ ~~ ~~ - ~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~ + /**/ /*~~~~~~~~~~~~*/ /*~~~*/ ~ -
~~~~~~~~~~~~
+
/*~~~~~~~~*/
~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~~ ~ -~~ ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ +~~ /*~~~~~~~~~~~~~~~~~*/ ~ +~~ /*~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~~*/ /*~~~*/ ~ - ~~~ ~~~~~~~~~ ~ ~~~~~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~*/ /*~~~~~~~~~~~*/
-

Happy birthday ~~~~~~~~~~~~!

+

Happy birthday /*~~~~~~~~*/!

    - ~~~~ ~~~~ ~ ~ ~~ ~ ~ ~~~~~~~~~~ ~ ~~~ ~~~~ + /**/ /**/ ~ ~ ~~ ~ ~ /*~~~~~~*/ ~ ~~~ /**/ ~ -
  • ~~~~ Happy birthday!
  • +
  • /**/ Happy birthday!
  • ~
- ~~ ~~~~~~~~~~~ ~ ~~~ + ~~ /*~~~~~~~*/ ~ ~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~~~~~*/ ~

Secret message

- ~~~~~~ ~~~~~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~~~~~*/ ~ - ~~~~~ ~~~~~~ + /*~*/ /*~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ - ~~~~~~ ~~~ ~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ + /*~~*/ ~~~ ~~~ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt index 9d3e37d7020..e9de58a8aba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt index 2aa9e3b440a..9077efe7449 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1748:32,37 [17] ) +Generated Location: (1774:32,37 [17] ) |"*, TestAssembly"| Source Location: (35:1,2 [154] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) @@ -13,7 +13,7 @@ Source Location: (35:1,2 [154] TestFiles/IntegrationTests/CodeGenerationIntegrat void PrintName(Person person) { | -Generated Location: (2271:49,2 [154] ) +Generated Location: (2297:49,2 [154] ) | var people = new Person[] { @@ -26,26 +26,26 @@ Generated Location: (2271:49,2 [154] ) Source Location: (195:9,14 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |person.Name| -Generated Location: (2619:64,14 [11] ) +Generated Location: (2645:64,14 [11] ) |person.Name| Source Location: (212:9,31 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | } | -Generated Location: (2989:73,31 [9] ) +Generated Location: (3015:73,31 [9] ) | } | Source Location: (228:13,2 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | PrintName(people[0]); | -Generated Location: (3178:81,2 [23] ) +Generated Location: (3204:81,2 [23] ) | PrintName(people[0]); | Source Location: (256:14,2 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | await AnnounceBirthday(people[0]); | -Generated Location: (3383:88,2 [36] ) +Generated Location: (3409:88,2 [36] ) | await AnnounceBirthday(people[0]); | Source Location: (309:16,12 [106] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) @@ -54,7 +54,7 @@ Source Location: (309:16,12 [106] TestFiles/IntegrationTests/CodeGenerationInteg { var formatted = $"Mr. {person.Name}"; | -Generated Location: (3660:97,12 [106] ) +Generated Location: (3686:97,12 [106] ) | Task AnnounceBirthday(Person person) { @@ -63,14 +63,14 @@ Generated Location: (3660:97,12 [106] ) Source Location: (455:21,33 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |formatted| -Generated Location: (3979:108,33 [9] ) +Generated Location: (4005:108,33 [9] ) |formatted| Source Location: (487:22,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | | -Generated Location: (4322:117,14 [12] ) +Generated Location: (4348:117,14 [12] ) | | @@ -79,20 +79,20 @@ Source Location: (514:25,9 [66] TestFiles/IntegrationTests/CodeGenerationIntegra |for (var i = 0; i < person.Age / 10; i++) { | -Generated Location: (4523:126,9 [66] ) +Generated Location: (4549:126,9 [66] ) |for (var i = 0; i < person.Age / 10; i++) { | Source Location: (586:27,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |i| -Generated Location: (4787:135,18 [1] ) +Generated Location: (4813:135,18 [1] ) |i| Source Location: (609:27,41 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | }| -Generated Location: (5010:142,41 [11] ) +Generated Location: (5036:142,41 [11] ) | }| @@ -105,7 +105,7 @@ Source Location: (635:29,13 [106] TestFiles/IntegrationTests/CodeGenerationInteg } | -Generated Location: (5214:150,13 [106] ) +Generated Location: (5240:150,13 [106] ) | if (person.Age < 20) @@ -127,7 +127,7 @@ Source Location: (764:36,31 [161] TestFiles/IntegrationTests/CodeGenerationInteg public int Age { get; set; } } | -Generated Location: (5531:164,31 [161] ) +Generated Location: (5557:164,31 [161] ) | return Task.CompletedTask; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs index 5731be96cfe..ddfa8bc2e4f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1d96ed32230877fcfe7acc2e22d4b1c519eb0ccd0599053409543ce8c5f65fa7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -61,7 +61,7 @@ void PrintName(Person person) #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { Write( #nullable restore #line (10,15)-(10,26) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml" @@ -123,7 +123,7 @@ Task AnnounceBirthday(Person person) #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

Happy birthday "); Write( #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt index 14a65a3b3ed..8abdb160933 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt @@ -4,9 +4,9 @@ Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await __tagHelperRunne // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(81,17): error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // await __tagHelperExecutionContext.SetOutputContentAsync(); Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await __tagHelperExecutionContext.SetOutputContentAsync()").WithLocation(81, 17), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(126,165): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. -// __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { -Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(126, 165), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(126,193): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. +// __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { +Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(126, 193), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(142,9): error CS4032: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Diagnostic(ErrorCode.ERR_BadAwaitWithoutAsyncMethod, "await __tagHelperRunner.RunAsync(__tagHelperExecutionContext)").WithArguments("System.Threading.Tasks.Task").WithLocation(142, 9), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt index 675776b967d..33a1786321a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs index cd0e88519d9..674c1816c46 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html index ffd8006a48e..557deb22dc2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html @@ -1,45 +1,45 @@  ~~ - ~~~ ~~~~~~ ~ ~~~ ~~~~~~~~ + ~~~ /*~~*/ ~ ~~~ /*~~~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~ ~ ~~~~~~~~~ ~~~ ~ ~~~ ~ + ~~~ /*~~~~*/ ~ /**/ ~ /*~~~~~*/ ~~~ ~ ~~~ ~ ~~ - ~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~ + /**/ /*~~~~~~~~~~~~*/ /*~~~*/ ~ -
~~~~~~~~~~~~
+
/*~~~~~~~~*/
~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ +~~ /*~~~~~~~~~~~~~~~~*/ ~ +~~ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~~*/ /*~~~*/ ~ - ~~~ ~~~~~~~~~ ~ ~~~~~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~*/ /*~~~~~~~~~~~*/
-

Happy birthday ~~~~~~~~~~~~!

+

Happy birthday /*~~~~~~~~*/!

    - ~~~~ ~~~~ ~ ~ ~~ ~ ~ ~~~~~~~~~~ ~ ~~~ ~~~~ + /**/ /**/ ~ ~ ~~ ~ ~ /*~~~~~~*/ ~ ~~~ /**/ ~ -
  • ~~~~ Happy birthday!
  • +
  • /**/ Happy birthday!
  • ~
- ~~ ~~~~~~~~~~~ ~ ~~~ + ~~ /*~~~~~~~*/ ~ ~~~ ~ - ~~~~~~~ + /*~~~*/ ~

Secret message

~ - ~~~~~ ~~~~~~ + /*~*/ /*~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ - ~~~~~~ ~~~ ~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ + /*~~*/ ~~~ ~~~ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt index 4848082fc28..d10664be4af 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt index 113696b3432..aab1dffa975 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt @@ -8,7 +8,7 @@ void PrintName(Person person) { | -Generated Location: (1468:33,2 [153] ) +Generated Location: (1494:33,2 [153] ) | var people = new Person[] { @@ -21,26 +21,26 @@ Generated Location: (1468:33,2 [153] ) Source Location: (163:9,14 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |person.Name| -Generated Location: (1802:48,14 [11] ) +Generated Location: (1828:48,14 [11] ) |person.Name| Source Location: (180:9,31 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | } | -Generated Location: (2012:55,31 [9] ) +Generated Location: (2038:55,31 [9] ) | } | Source Location: (196:13,2 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | PrintName(people[0]) | -Generated Location: (2188:63,2 [22] ) +Generated Location: (2214:63,2 [22] ) | PrintName(people[0]) | Source Location: (223:14,2 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | AnnounceBirthday(people[0]); | -Generated Location: (2379:70,2 [30] ) +Generated Location: (2405:70,2 [30] ) | AnnounceBirthday(people[0]); | Source Location: (270:16,12 [106] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) @@ -49,7 +49,7 @@ Source Location: (270:16,12 [106] TestFiles/IntegrationTests/CodeGenerationInteg { var formatted = $"Mr. {person.Name}"; | -Generated Location: (2637:79,12 [106] ) +Generated Location: (2663:79,12 [106] ) | void AnnounceBirthday(Person person) { @@ -58,14 +58,14 @@ Generated Location: (2637:79,12 [106] ) Source Location: (416:21,33 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |formatted| -Generated Location: (2943:90,33 [9] ) +Generated Location: (2969:90,33 [9] ) |formatted| Source Location: (448:22,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | | -Generated Location: (3134:97,14 [12] ) +Generated Location: (3160:97,14 [12] ) | | @@ -74,20 +74,20 @@ Source Location: (475:25,9 [66] TestFiles/IntegrationTests/CodeGenerationIntegra |for (var i = 0; i < person.Age / 10; i++) { | -Generated Location: (3322:106,9 [66] ) +Generated Location: (3348:106,9 [66] ) |for (var i = 0; i < person.Age / 10; i++) { | Source Location: (547:27,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |i| -Generated Location: (3573:115,18 [1] ) +Generated Location: (3599:115,18 [1] ) |i| Source Location: (570:27,41 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | }| -Generated Location: (3783:122,41 [11] ) +Generated Location: (3809:122,41 [11] ) | }| @@ -100,7 +100,7 @@ Source Location: (596:29,13 [87] TestFiles/IntegrationTests/CodeGenerationIntegr } | -Generated Location: (3974:130,13 [87] ) +Generated Location: (4000:130,13 [87] ) | if (person.Age < 20) @@ -120,7 +120,7 @@ Source Location: (706:36,31 [123] TestFiles/IntegrationTests/CodeGenerationInteg public int Age { get; set; } } | -Generated Location: (4259:144,31 [123] ) +Generated Location: (4285:144,31 [123] ) | } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs index 77cd0a8c861..c3477be6c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c38f4efc9c710292c9fc20d2f5c4cc6e8a91f4fa3ee60ec96c16617f506312b8" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt index 02571af85bf..9ff2c5ed532 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] Markup_InCodeBlocks.cshtml) LazyIntermediateToken - (0:0,0 [2] Markup_InCodeBlocks.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs index 873e8ac6fe6..aab5e594d80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html index 1a6335ea467..7e2de8666d2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt index 0d7a5cd634a..a3cdb435212 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt index 5a601c794e1..ae8ed32dc80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1887:34,37 [17] ) +Generated Location: (1913:34,37 [17] ) |"*, TestAssembly"| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs index b50b06f40ef..0c1ee233427 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "87fe59d78f3e03370f30b0eb9f80c503873502b116dbdb3beff6cd9fc190f718" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); @@ -55,9 +55,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -98,7 +98,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -124,7 +124,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -147,7 +147,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -168,7 +168,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Tag helper with unmatched bound boolean attributes."); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt index 625051d43ca..d75d976d8ed 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - btn - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - input-bound-required-string - hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_2 - catchall-bound-string - world - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs index e15283b1037..cc83672596c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html index eed8d5cc3f0..a97a9dfd6bd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html @@ -1,8 +1,8 @@ ~~ - ~~~~~~~~ ~~~~ ~~~~~~ ~~ ~~~~~~~~~~~~~ + /*~~~~*/ /**/ /*~~*/ ~~ /*~~~~~~~~~*/ ~

- ~~~~~~~~~~~~~~~~~. + /*~~~~~~~~~~~~~*/.
~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt index 7c34b7cedbb..259ae720db2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt index 62f2a807b71..0aee8a2131f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt @@ -1,7 +1,7 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | | -Generated Location: (1447:33,2 [6] ) +Generated Location: (1473:33,2 [6] ) | | @@ -9,27 +9,27 @@ Source Location: (9:1,5 [53] TestFiles/IntegrationTests/CodeGenerationIntegratio |foreach (var result in (dynamic)Url) { | -Generated Location: (1617:41,5 [53] ) +Generated Location: (1643:41,5 [53] ) |foreach (var result in (dynamic)Url) { | Source Location: (82:4,13 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) |result.SomeValue| -Generated Location: (1842:50,13 [16] ) +Generated Location: (1868:50,13 [16] ) |result.SomeValue| Source Location: (115:5,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | }| -Generated Location: (2032:57,14 [7] ) +Generated Location: (2058:57,14 [7] ) | }| Source Location: (122:6,5 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | | -Generated Location: (2203:65,5 [2] ) +Generated Location: (2229:65,5 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs index e15cf32a54d..4f7e209358b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c1273eb7fee44c32ab00da03db6ac9a1bf83c1c3b09f32fb242db42978fc4d17" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt index 9bc4e74122e..d13c53adb97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] NestedCSharp.cshtml) LazyIntermediateToken - (2:0,2 [6] NestedCSharp.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs index d8e34503130..5471dc97123 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html index 8c9dd15aba7..1307d485615 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~ ~ - ~~~~~~~~ ~ +/*~~~~*/ ~ + /*~~~~*/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt index 479d622b168..1f5dcd77898 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt index b39b05aa8b1..aa75a4345e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (1:0,1 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) |if(foo) { | -Generated Location: (1458:33,1 [15] ) +Generated Location: (1484:33,1 [15] ) |if(foo) { | Source Location: (17:1,5 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) |if(bar) { }| -Generated Location: (1641:41,5 [16] ) +Generated Location: (1667:41,5 [16] ) |if(bar) { }| Source Location: (33:2,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) | }| -Generated Location: (1825:49,5 [3] ) +Generated Location: (1851:49,5 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs index c842d7e180b..55a466d78b1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "13a85602fed2597baf956e658c5cf96a52e1734ae6cd4674854366bf90b84fb7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt index 03dfaeb62a8..b6ce6f55630 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt @@ -1,17 +1,17 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore - UsingDirective - (1:0,1 [22] ) - global::System - UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic - UsingDirective - (67:2,1 [27] ) - global::System.Linq - UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (134:4,1 [40] ) - global::Microsoft.AspNetCore.Mvc - UsingDirective - (175:5,1 [50] ) - global::Microsoft.AspNetCore.Mvc.Rendering - UsingDirective - (226:6,1 [53] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures + NamespaceDeclaration - - AspNetCoreGeneratedDocument + UsingDirective - (1:0,1 [20] ) - global::System + UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic + UsingDirective - (67:2,1 [25] ) - global::System.Linq + UsingDirective - (95:3,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (134:4,1 [38] ) - global::Microsoft.AspNetCore.Mvc + UsingDirective - (175:5,1 [48] ) - global::Microsoft.AspNetCore.Mvc.Rendering + UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [15] NestedCodeBlocks.cshtml) LazyIntermediateToken - (1:0,1 [15] NestedCodeBlocks.cshtml) - CSharp - if(foo) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs index 1186f4f7467..13d75ef1727 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html index 86dd6dcdf7c..de7ee0ff7f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs index fe2b829e67a..355f3ed0f79 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.codegen.cs @@ -9,7 +9,7 @@ namespace Test using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; #nullable restore -#line (1,2)-(2,1) "x:\dir\subdir\Test\TestComponent.cshtml" +#line (1,2)-(1,51) "x:\dir\subdir\Test\TestComponent.cshtml" using Microsoft.AspNetCore.Components.RenderTree; #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.ir.txt index ebfa7e6853c..3837f185560 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.ir.txt @@ -1,11 +1,11 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components - UsingDirective - (1:0,1 [51] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.RenderTree + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (1:0,1 [49] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.RenderTree ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree CSharpCode - (56:2,2 [134] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.mappings.txt index dcfa3a6c1fd..61a58d6a776 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeBlock/TestComponent.mappings.txt @@ -1,9 +1,7 @@ -Source Location: (1:0,1 [51] x:\dir\subdir\Test\TestComponent.cshtml) -|using Microsoft.AspNetCore.Components.RenderTree; -| -Generated Location: (371:12,0 [51] ) -|using Microsoft.AspNetCore.Components.RenderTree; -| +Source Location: (1:0,1 [49] x:\dir\subdir\Test\TestComponent.cshtml) +|using Microsoft.AspNetCore.Components.RenderTree;| +Generated Location: (372:12,0 [49] ) +|using Microsoft.AspNetCore.Components.RenderTree;| Source Location: (56:2,2 [134] x:\dir\subdir\Test\TestComponent.cshtml) | @@ -11,7 +9,7 @@ Source Location: (56:2,2 [134] x:\dir\subdir\Test\TestComponent.cshtml) if (__builder == null) output = "Builder is null!"; else output = "Builder is not null!"; | -Generated Location: (878:26,0 [134] ) +Generated Location: (879:26,0 [134] ) | var output = string.Empty; if (__builder == null) output = "Builder is null!"; @@ -20,6 +18,6 @@ Generated Location: (878:26,0 [134] ) Source Location: (206:6,16 [6] x:\dir\subdir\Test\TestComponent.cshtml) |output| -Generated Location: (1278:40,0 [6] ) +Generated Location: (1279:40,0 [6] ) |output| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs index b528dbb920d..1def7e27bb0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.codegen.cs @@ -9,7 +9,7 @@ namespace Test using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; #nullable restore -#line (1,2)-(2,1) "x:\dir\subdir\Test\TestComponent.cshtml" +#line (1,2)-(1,50) "x:\dir\subdir\Test\TestComponent.cshtml" using Microsoft.AspNetCore.Components.Rendering; #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.ir.txt index bedac9ed24a..7ab293e5e14 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.ir.txt @@ -1,11 +1,11 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components - UsingDirective - (1:0,1 [50] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.Rendering + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (1:0,1 [48] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.Rendering ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree CSharpCode - (60:2,7 [213] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt index da108d9bf35..7db48c0a2e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/SingleLineControlFlowStatements_InCodeDirective/TestComponent.mappings.txt @@ -1,9 +1,7 @@ -Source Location: (1:0,1 [50] x:\dir\subdir\Test\TestComponent.cshtml) -|using Microsoft.AspNetCore.Components.Rendering; -| -Generated Location: (371:12,0 [50] ) -|using Microsoft.AspNetCore.Components.Rendering; -| +Source Location: (1:0,1 [48] x:\dir\subdir\Test\TestComponent.cshtml) +|using Microsoft.AspNetCore.Components.Rendering;| +Generated Location: (372:12,0 [48] ) +|using Microsoft.AspNetCore.Components.Rendering;| Source Location: (60:2,7 [213] x:\dir\subdir\Test\TestComponent.cshtml) | @@ -13,7 +11,7 @@ Source Location: (60:2,7 [213] x:\dir\subdir\Test\TestComponent.cshtml) if (__builder == null) output = "Builder is null!"; else output = "Builder is not null!"; | -Generated Location: (926:28,0 [213] ) +Generated Location: (927:28,0 [213] ) | void RenderChildComponent(RenderTreeBuilder __builder) { @@ -24,13 +22,13 @@ Generated Location: (926:28,0 [213] ) Source Location: (293:8,20 [6] x:\dir\subdir\Test\TestComponent.cshtml) |output| -Generated Location: (1393:44,0 [6] ) +Generated Location: (1394:44,0 [6] ) |output| Source Location: (305:9,0 [7] x:\dir\subdir\Test\TestComponent.cshtml) | } | -Generated Location: (1580:53,0 [7] ) +Generated Location: (1581:53,0 [7] ) | } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt index 8189bb5c36d..e8fb6a07984 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithCSharpExpression/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree MarkupBlock - -

Hello

\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt index 951c25ead13..b46e0e229ad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithComponent/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree MarkupBlock - -

Hello

\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt index 64df818cdf9..56dfcad72bc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/TrailingWhiteSpace_WithDirective/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components RouteAttributeExtensionNode - (24:2,6 [9] x:\dir\subdir\Test\TestComponent.cshtml) - "/my/url" ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.codegen.cs new file mode 100644 index 00000000000..d290615815c --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.codegen.cs @@ -0,0 +1,30 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; +#nullable restore +#line (1,2)-(1,26) "x:\dir\subdir\Test\TestComponent.cshtml" +using System.Collections + +#line default +#line hidden +#nullable disable + ; + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + } + #pragma warning restore 1998 + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.ir.txt new file mode 100644 index 00000000000..82936a37369 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.ir.txt @@ -0,0 +1,10 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (1:0,1 [24] x:\dir\subdir\Test\TestComponent.cshtml) - System.Collections + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.mappings.txt new file mode 100644 index 00000000000..e6df1c46964 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/UsingDirective/TestComponent.mappings.txt @@ -0,0 +1,5 @@ +Source Location: (1:0,1 [24] x:\dir\subdir\Test\TestComponent.cshtml) +|using System.Collections| +Generated Location: (372:12,0 [24] ) +|using System.Collections| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs index de81c1af865..bded15e4243 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.codegen.cs @@ -9,7 +9,7 @@ namespace Test using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; #nullable restore -#line (1,2)-(2,1) "x:\dir\subdir\Test\TestComponent.cshtml" +#line (1,2)-(1,49) "x:\dir\subdir\Test\TestComponent.cshtml" using Microsoft.AspNetCore.Components.Rendering #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.ir.txt index c3f32137afc..fecfc392280 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.ir.txt @@ -1,11 +1,11 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components - UsingDirective - (1:0,1 [49] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.Rendering + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (1:0,1 [47] x:\dir\subdir\Test\TestComponent.cshtml) - Microsoft.AspNetCore.Components.Rendering ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree CSharpCode - (57:1,7 [57] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt index dceca48858a..0e98d84d087 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InMarkupInFunctionsBlock/TestComponent.mappings.txt @@ -1,16 +1,14 @@ -Source Location: (1:0,1 [49] x:\dir\subdir\Test\TestComponent.cshtml) -|using Microsoft.AspNetCore.Components.Rendering -| -Generated Location: (371:12,0 [49] ) -|using Microsoft.AspNetCore.Components.Rendering -| +Source Location: (1:0,1 [47] x:\dir\subdir\Test\TestComponent.cshtml) +|using Microsoft.AspNetCore.Components.Rendering| +Generated Location: (372:12,0 [47] ) +|using Microsoft.AspNetCore.Components.Rendering| Source Location: (57:1,7 [57] x:\dir\subdir\Test\TestComponent.cshtml) | void MyMethod(RenderTreeBuilder __builder) { | -Generated Location: (932:29,0 [57] ) +Generated Location: (933:29,0 [57] ) | void MyMethod(RenderTreeBuilder __builder) { @@ -20,27 +18,27 @@ Source Location: (141:5,13 [46] x:\dir\subdir\Test\TestComponent.cshtml) |for (var i = 0; i < 100; i++) { | -Generated Location: (1163:40,0 [46] ) +Generated Location: (1164:40,0 [46] ) |for (var i = 0; i < 100; i++) { | Source Location: (230:8,21 [1] x:\dir\subdir\Test\TestComponent.cshtml) |i| -Generated Location: (1418:51,0 [1] ) +Generated Location: (1419:51,0 [1] ) |i| Source Location: (256:10,0 [15] x:\dir\subdir\Test\TestComponent.cshtml) | } | -Generated Location: (1600:60,0 [15] ) +Generated Location: (1601:60,0 [15] ) | } | Source Location: (286:12,0 [7] x:\dir\subdir\Test\TestComponent.cshtml) | } | -Generated Location: (1784:69,0 [7] ) +Generated Location: (1785:69,0 [7] ) | } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InsideAttribute_InMarkupBlock/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InsideAttribute_InMarkupBlock/TestComponent.ir.txt index b1ca68f46e7..be5a67155f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InsideAttribute_InMarkupBlock/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_InsideAttribute_InMarkupBlock/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree MarkupBlock - -
Hello
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_WithPreserveWhitespace/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_WithPreserveWhitespace/TestComponent.ir.txt index 9243ead7636..3cea6758d01 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_WithPreserveWhitespace/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/WhiteSpace_WithPreserveWhitespace/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree HtmlContent - (26:1,0 [6] x:\dir\subdir\Test\TestComponent.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.ir.txt index c0f63215ea7..d83045213d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Whitespace_BetweenElementAndFunctions/TestComponent.ir.txt @@ -1,10 +1,10 @@ Document - NamespaceDeclaration - - Test - UsingDirective - (3:1,1 [22] ) - global::System - UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic - UsingDirective - (69:3,1 [27] ) - global::System.Linq - UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks - UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - MethodDeclaration - - protected override - void - BuildRenderTree MarkupElement - (0:0,0 [18] x:\dir\subdir\Test\TestComponent.cshtml) - elem diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt index 7165fe9a595..5440310b2ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.cspans.txt @@ -1,4 +1,4 @@ Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [12] ) -Transition span at (0:0,0 [1] ) - Parent: Directive block at (0:0,0 [12] ) -Code span at (1:0,1 [11] ) - Parent: Directive block at (0:0,0 [12] ) -Markup span at (12:1,0 [0] ) - Parent: Markup block at (0:0,0 [12] ) +Transition span at (0:0,0 [1] ) - Parent: Directive block at (0:0,0 [10] ) +Code span at (1:0,1 [9] ) - Parent: Directive block at (0:0,0 [10] ) +MetaCode span at (10:0,10 [2] ) - Parent: Statement block at (0:0,0 [12] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt index 98fb7aebce3..ef3ce4005fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt @@ -3,15 +3,14 @@ MarkupTextLiteral - [0..0)::0 - [] - Gen Marker;[]; CSharpCodeBlock - [0..12)::12 - RazorDirective - [0..12)::12 + RazorDirective - [0..10)::10 CSharpTransition - [0..1)::1 - Gen Transition;[@]; - RazorDirectiveBody - [1..12)::11 - CSharpStatementLiteral - [1..12)::11 - [using FooLF] - Gen + RazorDirectiveBody - [1..10)::9 + CSharpStatementLiteral - [1..10)::9 - [using Foo] - Gen Keyword;[using]; Whitespace;[ ]; Identifier;[Foo]; - NewLine;[LF]; - MarkupTextLiteral - [12..12)::0 - [] - Gen - Marker;[]; + RazorMetaCode - [10..12)::2 - Gen + NewLine;[LF]; EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_01.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_01.stree.txt index f00da6ee152..1d6cb7d5a50 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_01.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_01.stree.txt @@ -37,8 +37,7 @@ LeftParenthesis;[(]; CSharpCodeBlock - [38..45)::7 CSharpExpressionLiteral - [38..45)::7 - [@string] - Gen - Transition;[@]; - Keyword;[string]; + Identifier;[@string]; RazorMetaCode - [45..46)::1 - Gen RightParenthesis;[)]; MarkupTextLiteral - [46..46)::0 - [] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.diag.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.diag.txt deleted file mode 100644 index 73ab857191a..00000000000 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.diag.txt +++ /dev/null @@ -1,10 +0,0 @@ -(2,9): Error RZ1009: The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example: - -@if(isLoggedIn) { -

Hello, @user!

-} -(3,13): Error RZ1009: The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example: - -@if(isLoggedIn) { -

Hello, @user!

-} diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.stree.txt index 121bf6fed21..d981280da8c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_03.stree.txt @@ -15,7 +15,7 @@ Whitespace;[ ]; Identifier;[var]; Whitespace;[ ]; - Identifier;[@]; + Transition;[@]; Identifier;[@class]; Whitespace;[ ]; Assign;[=]; @@ -30,7 +30,7 @@ Whitespace;[ ]; Assign;[=]; Whitespace;[ ]; - Identifier;[@]; + Transition;[@]; Identifier;[@class]; Semicolon;[;]; NewLine;[LF]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_04.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_04.stree.txt index 264730983f5..925ba941821 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_04.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_04.stree.txt @@ -53,8 +53,7 @@ LeftParenthesis;[(]; CSharpCodeBlock - [74..81)::7 CSharpExpressionLiteral - [74..81)::7 - [@string] - Gen - Transition;[@]; - Keyword;[string]; + Identifier;[@string]; RazorMetaCode - [81..82)::1 - Gen RightParenthesis;[)]; MarkupTextLiteral - [82..82)::0 - [] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_05.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_05.stree.txt index 084ec8ffed9..01f88cdc7c3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_05.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_05.stree.txt @@ -49,8 +49,7 @@ LeftParenthesis;[(]; CSharpCodeBlock - [75..82)::7 CSharpExpressionLiteral - [75..82)::7 - [@string] - Gen - Transition;[@]; - Keyword;[string]; + Identifier;[@string]; RazorMetaCode - [82..83)::1 - Gen RightParenthesis;[)]; MarkupTextLiteral - [83..83)::0 - [] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_06.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_06.stree.txt index df0971af655..455c1823c53 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_06.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_06.stree.txt @@ -75,8 +75,7 @@ LeftParenthesis;[(]; CSharpCodeBlock - [115..122)::7 CSharpExpressionLiteral - [115..122)::7 - [@string] - Gen - Transition;[@]; - Keyword;[string]; + Identifier;[@string]; RazorMetaCode - [122..123)::1 - Gen RightParenthesis;[)]; MarkupTextLiteral - [123..123)::0 - [] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_07.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_07.stree.txt index 11a0d918c07..6a50645544d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_07.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_07.stree.txt @@ -67,8 +67,7 @@ LeftParenthesis;[(]; CSharpCodeBlock - [117..124)::7 CSharpExpressionLiteral - [117..124)::7 - [@string] - Gen - Transition;[@]; - Keyword;[string]; + Identifier;[@string]; RazorMetaCode - [124..125)::1 - Gen RightParenthesis;[)]; MarkupTextLiteral - [125..125)::0 - [] - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.cspans.txt new file mode 100644 index 00000000000..73091dcf9f5 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.cspans.txt @@ -0,0 +1,9 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [118] ) +Code span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [118] ) +Transition span at (1:0,1 [1] ) - Parent: Statement block at (1:0,1 [117] ) +MetaCode span at (2:0,2 [1] ) - Parent: Statement block at (1:0,1 [117] ) +Code span at (3:0,3 [74] ) - Parent: Statement block at (1:0,1 [117] ) +Code span at (77:0,77 [1] ) - Parent: Statement block at (1:0,1 [117] ) +Code span at (78:0,78 [39] ) - Parent: Statement block at (1:0,1 [117] ) +MetaCode span at (117:0,117 [1] ) - Parent: Statement block at (1:0,1 [117] ) +Markup span at (118:0,118 [0] ) - Parent: Markup block at (0:0,0 [118] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.stree.txt new file mode 100644 index 00000000000..c4820879c0d --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_11.stree.txt @@ -0,0 +1,59 @@ +RazorDocument - [0..118)::118 - [ @{ var validationMessage = @Html.ValidationMessage(Model.Binding, "", new { @@class = "invalid-feedback" }, "div"); }] + MarkupBlock - [0..118)::118 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..118)::118 + CSharpStatementLiteral - [0..1)::1 - [ ] - Gen + Whitespace;[ ]; + CSharpStatement - [1..118)::117 + CSharpTransition - [1..2)::1 - Gen + Transition;[@]; + CSharpStatementBody - [2..118)::116 + RazorMetaCode - [2..3)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [3..117)::114 + CSharpStatementLiteral - [3..77)::74 - [ var validationMessage = @Html.ValidationMessage(Model.Binding, "", new { ] - Gen + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[validationMessage]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Identifier;[@Html]; + Dot;[.]; + Identifier;[ValidationMessage]; + LeftParenthesis;[(]; + Identifier;[Model]; + Dot;[.]; + Identifier;[Binding]; + Comma;[,]; + Whitespace;[ ]; + StringLiteral;[""]; + Comma;[,]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpEphemeralTextLiteral - [77..78)::1 - [@] - Gen + Transition;[@]; + CSharpStatementLiteral - [78..117)::39 - [@class = "invalid-feedback" }, "div"); ] - Gen + Identifier;[@class]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + StringLiteral;["invalid-feedback"]; + Whitespace;[ ]; + RightBrace;[}]; + Comma;[,]; + Whitespace;[ ]; + StringLiteral;["div"]; + RightParenthesis;[)]; + Semicolon;[;]; + Whitespace;[ ]; + RazorMetaCode - [117..118)::1 - Gen + RightBrace;[}]; + MarkupTextLiteral - [118..118)::0 - [] - Gen + Marker;[]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.cspans.txt new file mode 100644 index 00000000000..b14c838247e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.cspans.txt @@ -0,0 +1,6 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [10] ) +Transition span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [10] ) +MetaCode span at (1:0,1 [1] ) - Parent: Statement block at (0:0,0 [10] ) +Code span at (2:0,2 [6] ) - Parent: Statement block at (0:0,0 [10] ) +Code span at (8:1,4 [1] ) - Parent: Statement block at (0:0,0 [10] ) +Code span at (9:1,5 [1] ) - Parent: Statement block at (0:0,0 [10] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.diag.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.diag.txt new file mode 100644 index 00000000000..bcd37730bb1 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.diag.txt @@ -0,0 +1 @@ +(1,2): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.stree.txt new file mode 100644 index 00000000000..f125c4283f7 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_12.stree.txt @@ -0,0 +1,22 @@ +RazorDocument - [0..10)::10 - [@{LF @@] + MarkupBlock - [0..10)::10 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..10)::10 + CSharpStatement - [0..10)::10 + CSharpTransition - [0..1)::1 - Gen + Transition;[@]; + CSharpStatementBody - [1..10)::9 + RazorMetaCode - [1..2)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [2..10)::8 + CSharpStatementLiteral - [2..8)::6 - [LF ] - Gen + NewLine;[LF]; + Whitespace;[ ]; + CSharpEphemeralTextLiteral - [8..9)::1 - [@] - Gen + Transition;[@]; + CSharpStatementLiteral - [9..10)::1 - [@] - Gen + Transition;[@]; + RazorMetaCode - [10..10)::0 - Gen + RightBrace;[]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.cspans.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.cspans.txt new file mode 100644 index 00000000000..6a88f160a69 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.cspans.txt @@ -0,0 +1,7 @@ +Markup span at (0:0,0 [0] ) - Parent: Markup block at (0:0,0 [36] ) +Code span at (0:0,0 [1] ) - Parent: Statement block at (0:0,0 [36] ) +Transition span at (1:0,1 [1] ) - Parent: Statement block at (1:0,1 [35] ) +MetaCode span at (2:0,2 [1] ) - Parent: Statement block at (1:0,1 [35] ) +Code span at (3:0,3 [31] ) - Parent: Statement block at (1:0,1 [35] ) +Code span at (34:0,34 [1] ) - Parent: Statement block at (1:0,1 [35] ) +Code span at (35:0,35 [1] ) - Parent: Statement block at (1:0,1 [35] ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.diag.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.diag.txt new file mode 100644 index 00000000000..196c59fd122 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.diag.txt @@ -0,0 +1 @@ +(1,3): Error RZ1006: The code block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.stree.txt new file mode 100644 index 00000000000..fcb53c9dd50 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/EscapedIdentifiers_13.stree.txt @@ -0,0 +1,33 @@ +RazorDocument - [0..36)::36 - [ @{ var validationMessage = new { @@] + MarkupBlock - [0..36)::36 + MarkupTextLiteral - [0..0)::0 - [] - Gen + Marker;[]; + CSharpCodeBlock - [0..36)::36 + CSharpStatementLiteral - [0..1)::1 - [ ] - Gen + Whitespace;[ ]; + CSharpStatement - [1..36)::35 + CSharpTransition - [1..2)::1 - Gen + Transition;[@]; + CSharpStatementBody - [2..36)::34 + RazorMetaCode - [2..3)::1 - Gen + LeftBrace;[{]; + CSharpCodeBlock - [3..36)::33 + CSharpStatementLiteral - [3..34)::31 - [ var validationMessage = new { ] - Gen + Whitespace;[ ]; + Identifier;[var]; + Whitespace;[ ]; + Identifier;[validationMessage]; + Whitespace;[ ]; + Assign;[=]; + Whitespace;[ ]; + Keyword;[new]; + Whitespace;[ ]; + LeftBrace;[{]; + Whitespace;[ ]; + CSharpEphemeralTextLiteral - [34..35)::1 - [@] - Gen + Transition;[@]; + CSharpStatementLiteral - [35..36)::1 - [@] - Gen + Transition;[@]; + RazorMetaCode - [36..36)::0 - Gen + RightBrace;[]; + EndOfFile;[]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt deleted file mode 100644 index bd189123b2f..00000000000 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.diag.txt +++ /dev/null @@ -1,5 +0,0 @@ -(1,14): Error RZ1009: The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example: - -@if(isLoggedIn) { -

Hello, @user!

-} diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt index 89ff4c9b8bc..e6fc333bcc1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt @@ -17,7 +17,7 @@ Transition;[@]; CSharpStatementLiteral - [12..28)::16 - [@@@class.Foo() }] - Gen Transition;[@]; - Identifier;[@]; + Transition;[@]; Identifier;[@class]; Dot;[.]; Identifier;[Foo]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt index 7b35848f649..2ead9519b58 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt @@ -18,8 +18,7 @@ Whitespace;[ ]; NullCoalesce;[??]; Whitespace;[ ]; - Transition;[@]; - Identifier;[photo]; + Identifier;[@photo]; Dot;[.]; Identifier;[Description]; RazorMetaCode - [46..47)::1 - Gen diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt index af91a84ac2f..eacb5cfc6c2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/CSharpFunctionsTest/MarkupInFunctionsBlock_DoesNotParseWhenNotSupported.stree.txt @@ -34,8 +34,7 @@ LessThan;[<]; Identifier;[h3]; GreaterThan;[>]; - Transition;[@]; - Identifier;[message]; + Identifier;[@message]; LessThan;[<]; Slash;[/]; Identifier;[h3]; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpans_EscapedExpression_08.stree.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpans_EscapedExpression_08.stree.txt index abe13766e5d..9a7c790bf0f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpans_EscapedExpression_08.stree.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/ParserTests/TagHelperBlockRewriterTest/CreatesMarkupCodeSpans_EscapedExpression_08.stree.txt @@ -27,8 +27,7 @@ Whitespace;[ ]; Keyword;[string]; LeftParenthesis;[(]; - Transition;[@]; - Identifier;[x]; + Identifier;[@x]; LeftParenthesis;[(]; StringLiteral;["1 2"]; RightParenthesis;[)]; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/CompilationExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/CompilationExtensions.cs new file mode 100644 index 00000000000..dc5dcd44c86 --- /dev/null +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/CompilationExtensions.cs @@ -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. + +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.CodeAnalysis.Razor.Compiler.CSharp; + +internal static class CompilationExtensions +{ + public static bool HasAddComponentParameter(this Compilation compilation) + { + return compilation.GetTypesByMetadataName("Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder") + .Any(static t => + t.DeclaredAccessibility == Accessibility.Public && + t.GetMembers("AddComponentParameter") + .Any(static m => m.DeclaredAccessibility == Accessibility.Public)); + } +} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs index 99c6e5e6943..7edbd71fb75 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs @@ -55,14 +55,22 @@ protected override void Collect(ISymbol symbol, ICollection var shortNameMatchingDescriptor = CreateShortNameMatchingDescriptor(type, properties); results.Add(shortNameMatchingDescriptor); - var fullyQualifiedNameMatchingDescriptor = CreateFullyQualifiedNameMatchingDescriptor(type, properties); - results.Add(fullyQualifiedNameMatchingDescriptor); + // If the component is in the global namespace, skip adding this descriptor which will be the same as the short name one. + TagHelperDescriptor? fullyQualifiedNameMatchingDescriptor = null; + if (!type.ContainingNamespace.IsGlobalNamespace) + { + fullyQualifiedNameMatchingDescriptor = CreateFullyQualifiedNameMatchingDescriptor(type, properties); + results.Add(fullyQualifiedNameMatchingDescriptor); + } foreach (var childContent in shortNameMatchingDescriptor.GetChildContentProperties()) { // Synthesize a separate tag helper for each child content property that's declared. results.Add(CreateChildContentDescriptor(shortNameMatchingDescriptor, childContent)); - results.Add(CreateChildContentDescriptor(fullyQualifiedNameMatchingDescriptor, childContent)); + if (fullyQualifiedNameMatchingDescriptor is not null) + { + results.Add(CreateChildContentDescriptor(fullyQualifiedNameMatchingDescriptor, childContent)); + } } } } @@ -111,8 +119,7 @@ private static TagHelperDescriptor CreateNameMatchingDescriptor( metadata.Add(ComponentMetadata.Component.NameMatchKey, ComponentMetadata.Component.FullyQualifiedNameMatch); } - // If the component is in the global namespace, skip adding this rule which is the same as the fully qualified one. - else if (!type.ContainingNamespace.IsGlobalNamespace) + else { builder.TagMatchingRule(r => { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs index f89840fde8b..ff052c408d2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Components; @@ -54,14 +55,14 @@ protected override void Collect(ISymbol symbol, ICollection { if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, _eventHandlerAttribute)) { - if (!AttributeArgs.TryGet(attribute, out var values)) + if (!AttributeArgs.TryGet(attribute, out var args)) { - // If this occurs, the EventHandlerAttribute type has been broken. - Assumed.Unreachable(); + // If this occurs, the [EventHandler] was defined incorrectly, so we can't create a tag helper. + continue; } var (typeName, namespaceName) = displayNames.GetNames(); - results.Add(CreateTagHelper(typeName, namespaceName, type.Name, values)); + results.Add(CreateTagHelper(typeName, namespaceName, type.Name, args)); } } } @@ -70,8 +71,8 @@ protected override void Collect(ISymbol symbol, ICollection private readonly record struct AttributeArgs( string Attribute, INamedTypeSymbol EventArgsType, - bool EnableStopPropagation, - bool EnablePreventDefault) + bool EnableStopPropagation = false, + bool EnablePreventDefault = false) { public static bool TryGet(AttributeData attribute, out AttributeArgs args) { @@ -80,34 +81,49 @@ public static bool TryGet(AttributeData attribute, out AttributeArgs args) // - EventHandlerAttribute(string attributeName, Type eventArgsType); // - EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault); - args = default; - var arguments = attribute.ConstructorArguments; - if (arguments.Length is not (2 or 4)) - { - return false; - } + return TryGetFromTwoArguments(arguments, out args) || + TryGetFromFourArguments(arguments, out args); - if (arguments[0] is not { Value: string attributeName } || - arguments[1] is not { Value: INamedTypeSymbol eventArgsType }) + static bool TryGetFromTwoArguments(ImmutableArray arguments, out AttributeArgs args) { + // Ctor 1: EventHandlerAttribute(string attributeName, Type eventArgsType); + + if (arguments is [ + { Value: string attributeName }, + { Value: INamedTypeSymbol eventArgsType }]) + { + args = new(attributeName, eventArgsType); + return true; + } + + args = default; return false; } - // TODO: The enablePreventDefault and enableStopPropagation arguments are incorrectly swapped! - // However, they have been that way since the 4-argument constructor variant was introduced - // in https://github.com/dotnet/razor/commit/7635bba6ef2d3e6798d0846ceb96da6d5908e1b0. - // Fixing this is tracked be https://github.com/dotnet/razor/issues/10497 - - if (arguments is not [.., { Value: bool enablePreventDefault }, { Value: bool enableStopPropagation }]) + static bool TryGetFromFourArguments(ImmutableArray arguments, out AttributeArgs args) { - enableStopPropagation = false; - enablePreventDefault = false; - } + // Ctor 2: EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault); + + // TODO: The enablePreventDefault and enableStopPropagation arguments are incorrectly swapped! + // However, they have been that way since the 4-argument constructor variant was introduced + // in https://github.com/dotnet/razor/commit/7635bba6ef2d3e6798d0846ceb96da6d5908e1b0. + // Fixing this is tracked be https://github.com/dotnet/razor/issues/10497 + + if (arguments is [ + { Value: string attributeName }, + { Value: INamedTypeSymbol eventArgsType }, + { Value: bool enablePreventDefault }, + { Value: bool enableStopPropagation }]) + { + args = new(attributeName, eventArgsType, enableStopPropagation, enablePreventDefault); + return true; + } - args = new(attributeName, eventArgsType, enableStopPropagation, enablePreventDefault); - return true; + args = default; + return false; + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs index 790b35abe3a..4b40a41f45f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Immutable; using System.Globalization; -using System.Text; using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 4b005b08902..23cc201671f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -1,53 +1,195 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Intermediate; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; -public abstract class CodeRenderingContext : IDisposable +public sealed class CodeRenderingContext : IDisposable { - internal static readonly object NewLineString = "NewLineString"; + private readonly record struct ScopeInternal(IntermediateNodeWriter Writer); + + public RazorSourceDocument SourceDocument { get; } + public RazorCodeGenerationOptions Options { get; } + public CodeWriter CodeWriter { get; } + + private readonly DocumentIntermediateNode _documentNode; + + private readonly Stack _ancestorStack; + private readonly Stack _scopeStack; + + private readonly ImmutableArray.Builder _diagnostics; + private readonly ImmutableArray.Builder _sourceMappings; + private readonly ImmutableArray.Builder _linePragmas; + + private IntermediateNodeVisitor? _visitor; + public IntermediateNodeVisitor Visitor => _visitor.AssumeNotNull(); + + public string DocumentKind => _documentNode.DocumentKind; + + public CodeRenderingContext( + IntermediateNodeWriter nodeWriter, + RazorSourceDocument sourceDocument, + DocumentIntermediateNode documentNode, + RazorCodeGenerationOptions options) + { + ArgHelper.ThrowIfNull(nodeWriter); + ArgHelper.ThrowIfNull(sourceDocument); + ArgHelper.ThrowIfNull(documentNode); + ArgHelper.ThrowIfNull(options); + + SourceDocument = sourceDocument; + _documentNode = documentNode; + Options = options; + + _ancestorStack = StackPool.Default.Get(); + _scopeStack = StackPool.Default.Get(); + _scopeStack.Push(new(nodeWriter)); + + _diagnostics = ArrayBuilderPool.Default.Get(); + + foreach (var diagnostic in _documentNode.GetAllDiagnostics()) + { + _diagnostics.Add(diagnostic); + } + + _linePragmas = ArrayBuilderPool.Default.Get(); + _sourceMappings = ArrayBuilderPool.Default.Get(); + + CodeWriter = new CodeWriter(options); + } + + public void Dispose() + { + StackPool.Default.Return(_ancestorStack); + StackPool.Default.Return(_scopeStack); + + ArrayBuilderPool.Default.Return(_diagnostics); + ArrayBuilderPool.Default.Return(_linePragmas); + ArrayBuilderPool.Default.Return(_sourceMappings); + + CodeWriter.Dispose(); + } + + // This will be called by the document writer when the context is 'live'. + public void SetVisitor(IntermediateNodeVisitor visitor) + { + _visitor = visitor; + } - internal static readonly object SuppressUniqueIds = "SuppressUniqueIds"; + public IntermediateNodeWriter NodeWriter => _scopeStack.Peek().Writer; - public abstract IEnumerable Ancestors { get; } + public IntermediateNode? Parent + => _ancestorStack.Count == 0 ? null : _ancestorStack.Peek(); - public abstract CodeWriter CodeWriter { get; } + public void AddDiagnostic(RazorDiagnostic diagnostic) + { + _diagnostics.Add(diagnostic); + } + + public ImmutableArray GetDiagnostics() + => _diagnostics.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex); + + public void AddSourceMappingFor(IntermediateNode node) + { + ArgHelper.ThrowIfNull(node); + + if (node.Source == null) + { + return; + } + + AddSourceMappingFor(node.Source.Value); + } + + public void AddSourceMappingFor(SourceSpan source, int offset = 0) + { + if (SourceDocument.FilePath != null && + !string.Equals(SourceDocument.FilePath, source.FilePath, StringComparison.OrdinalIgnoreCase)) + { + // We don't want to generate line mappings for imports. + return; + } + + var currentLocation = CodeWriter.Location with + { + AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, + CharacterIndex = CodeWriter.Location.CharacterIndex + offset + }; + + var generatedLocation = new SourceSpan(currentLocation, source.Length); + var sourceMapping = new SourceMapping(source, generatedLocation); + + _sourceMappings.Add(sourceMapping); + } + + public ImmutableArray GetSourceMappings() + => _sourceMappings.DrainToImmutable(); - public abstract RazorDiagnosticCollection Diagnostics { get; } + public void RenderChildren(IntermediateNode node) + { + ArgHelper.ThrowIfNull(node); + + _ancestorStack.Push(node); - public abstract string DocumentKind { get; } + for (var i = 0; i < node.Children.Count; i++) + { + Visitor.Visit(node.Children[i]); + } - public abstract ItemCollection Items { get; } + _ancestorStack.Pop(); + } - public abstract IntermediateNodeWriter NodeWriter { get; } + public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) + { + ArgHelper.ThrowIfNull(node); + ArgHelper.ThrowIfNull(writer); - public abstract RazorCodeGenerationOptions Options { get; } + _scopeStack.Push(new ScopeInternal(writer)); + _ancestorStack.Push(node); - public abstract IntermediateNode Parent { get; } + for (var i = 0; i < node.Children.Count; i++) + { + Visitor.Visit(node.Children[i]); + } - public abstract RazorSourceDocument SourceDocument { get; } + _ancestorStack.Pop(); + _scopeStack.Pop(); + } - public abstract void AddSourceMappingFor(IntermediateNode node); + public void RenderNode(IntermediateNode node) + { + ArgHelper.ThrowIfNull(node); - public abstract void AddSourceMappingFor(SourceSpan node, int offset = 0); + Visitor.Visit(node); + } - public abstract void RenderNode(IntermediateNode node); + public void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) + { + ArgHelper.ThrowIfNull(node); + ArgHelper.ThrowIfNull(writer); - public abstract void RenderNode(IntermediateNode node, IntermediateNodeWriter writer); + _scopeStack.Push(new ScopeInternal(writer)); - public abstract void RenderChildren(IntermediateNode node); + Visitor.Visit(node); - public abstract void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer); + _scopeStack.Pop(); + } - public virtual void AddLinePragma(LinePragma linePragma) + public void AddLinePragma(LinePragma linePragma) { + _linePragmas.Add(linePragma); } - public abstract void Dispose(); + public ImmutableArray GetLinePragmas() + => _linePragmas.DrainToImmutable(); + + public void PushAncestor(IntermediateNode node) + { + _ancestorStack.Push(node); + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs index d2e2260ad5e..15f762cc291 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs @@ -43,13 +43,13 @@ public sealed partial class CodeWriter : IDisposable private int _currentLineCharacterIndex; public CodeWriter() - : this(Environment.NewLine, RazorCodeGenerationOptions.CreateDefault()) + : this(RazorCodeGenerationOptions.Default) { } - public CodeWriter(string newLine, RazorCodeGenerationOptions options) + public CodeWriter(RazorCodeGenerationOptions options) { - SetNewLine(newLine); + SetNewLine(options.NewLine); IndentWithTabs = options.IndentWithTabs; TabSize = options.IndentSize; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs deleted file mode 100644 index 0769b7045eb..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.Language.Intermediate; -using Microsoft.AspNetCore.Razor.PooledObjects; - -namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -internal class DefaultCodeRenderingContext : CodeRenderingContext -{ - private readonly Stack _ancestors; - private readonly RazorCodeDocument _codeDocument; - private readonly DocumentIntermediateNode _documentNode; - private readonly List _scopes; - - private readonly PooledObject.Builder> _sourceMappingsBuilder; - - public DefaultCodeRenderingContext( - IntermediateNodeWriter nodeWriter, - RazorCodeDocument codeDocument, - DocumentIntermediateNode documentNode, - RazorCodeGenerationOptions options) - { - if (nodeWriter == null) - { - throw new ArgumentNullException(nameof(nodeWriter)); - } - - if (codeDocument == null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (documentNode == null) - { - throw new ArgumentNullException(nameof(documentNode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - _codeDocument = codeDocument; - _documentNode = documentNode; - Options = options; - - _ancestors = new Stack(); - Diagnostics = new RazorDiagnosticCollection(); - Items = new ItemCollection(); - _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); - LinePragmas = new List(); - - var diagnostics = _documentNode.GetAllDiagnostics(); - for (var i = 0; i < diagnostics.Count; i++) - { - Diagnostics.Add(diagnostics[i]); - } - - // Set new line character to a specific string regardless of platform, for testing purposes. - var newLineString = codeDocument.Items[NewLineString] as string ?? Environment.NewLine; - CodeWriter = new CodeWriter(newLineString, options); - - Items[NewLineString] = codeDocument.Items[NewLineString]; - Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; - - _scopes = new List(); - _scopes.Add(new ScopeInternal(nodeWriter)); - } - - // This will be initialized by the document writer when the context is 'live'. - public IntermediateNodeVisitor Visitor { get; set; } - - public override IEnumerable Ancestors => _ancestors; - - internal Stack AncestorsInternal => _ancestors; - - public override CodeWriter CodeWriter { get; } - - public override RazorDiagnosticCollection Diagnostics { get; } - - public override string DocumentKind => _documentNode.DocumentKind; - - public override ItemCollection Items { get; } - - public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; - - internal List LinePragmas { get; } - - public override IntermediateNodeWriter NodeWriter => Current.Writer; - - public override RazorCodeGenerationOptions Options { get; } - - public override IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); - - public override RazorSourceDocument SourceDocument => _codeDocument.Source; - - private ScopeInternal Current => _scopes[_scopes.Count - 1]; - - public override void AddSourceMappingFor(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (node.Source == null) - { - return; - } - - AddSourceMappingFor(node.Source.Value); - } - - public override void AddSourceMappingFor(SourceSpan source, int offset = 0) - { - if (SourceDocument.FilePath != null && - !string.Equals(SourceDocument.FilePath, source.FilePath, StringComparison.OrdinalIgnoreCase)) - { - // We don't want to generate line mappings for imports. - return; - } - - var currentLocation = CodeWriter.Location with { AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, CharacterIndex = CodeWriter.Location.CharacterIndex + offset }; - - var generatedLocation = new SourceSpan(currentLocation, source.Length); - var sourceMapping = new SourceMapping(source, generatedLocation); - - SourceMappings.Add(sourceMapping); - } - - public override void RenderChildren(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - _ancestors.Push(node); - - for (var i = 0; i < node.Children.Count; i++) - { - Visitor.Visit(node.Children[i]); - } - - _ancestors.Pop(); - } - - public override void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - _scopes.Add(new ScopeInternal(writer)); - _ancestors.Push(node); - - for (var i = 0; i < node.Children.Count; i++) - { - Visitor.Visit(node.Children[i]); - } - - _ancestors.Pop(); - _scopes.RemoveAt(_scopes.Count - 1); - } - - public override void RenderNode(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - Visitor.Visit(node); - } - - public override void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - _scopes.Add(new ScopeInternal(writer)); - - Visitor.Visit(node); - - _scopes.RemoveAt(_scopes.Count - 1); - } - - public override void AddLinePragma(LinePragma linePragma) - { - LinePragmas.Add(linePragma); - } - - public override void Dispose() - { - _sourceMappingsBuilder.Dispose(); - CodeWriter.Dispose(); - } - - private struct ScopeInternal - { - public ScopeInternal(IntermediateNodeWriter writer) - { - Writer = writer; - } - - public IntermediateNodeWriter Writer { get; } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 72c3b39d0f1..afc161e7cc3 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Linq; using System.Security.Cryptography; @@ -10,66 +8,51 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; -internal class DefaultDocumentWriter : DocumentWriter +internal class DefaultDocumentWriter(CodeTarget codeTarget, RazorCodeGenerationOptions options) : DocumentWriter { - private readonly CodeTarget _codeTarget; - private readonly RazorCodeGenerationOptions _options; - - public DefaultDocumentWriter(CodeTarget codeTarget, RazorCodeGenerationOptions options) - { - _codeTarget = codeTarget; - _options = options; - } + private readonly CodeTarget _codeTarget = codeTarget; + private readonly RazorCodeGenerationOptions _options = options; public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) { - if (codeDocument == null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (documentNode == null) - { - throw new ArgumentNullException(nameof(documentNode)); - } + ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(documentNode); - using var context = new DefaultCodeRenderingContext( + using var context = new CodeRenderingContext( _codeTarget.CreateNodeWriter(), - codeDocument, + codeDocument.Source, documentNode, _options); - context.Visitor = new Visitor(_codeTarget, context); + + context.SetVisitor(new Visitor(_codeTarget, context)); context.Visitor.VisitDocument(documentNode); - var cSharp = context.CodeWriter.GenerateCode(); + var generatedCode = context.CodeWriter.GenerateCode(); - var allOrderedDiagnostics = context.Diagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); - return new DefaultRazorCSharpDocument( + return new RazorCSharpDocument( codeDocument, - cSharp, + generatedCode, _options, - allOrderedDiagnostics.ToArray(), - context.SourceMappings.DrainToImmutable(), - context.LinePragmas.ToArray()); + context.GetDiagnostics(), + context.GetSourceMappings(), + context.GetLinePragmas()); } - private class Visitor : IntermediateNodeVisitor + private sealed class Visitor(CodeTarget codeTarget, CodeRenderingContext context) : IntermediateNodeVisitor { - private readonly DefaultCodeRenderingContext _context; - private readonly CodeTarget _target; - - public Visitor(CodeTarget target, DefaultCodeRenderingContext context) - { - _target = target; - _context = context; - } + private readonly CodeRenderingContext _context = context; + private readonly CodeTarget _codeTarget = codeTarget; - private DefaultCodeRenderingContext Context => _context; + private CodeWriter CodeWriter => _context.CodeWriter; + private IntermediateNodeWriter NodeWriter => _context.NodeWriter; + private RazorCodeGenerationOptions Options => _context.Options; public override void VisitDocument(DocumentIntermediateNode node) { - if (!Context.Options.SuppressChecksum) + var codeWriter = CodeWriter; + + if (!Options.SuppressChecksum) { // See http://msdn.microsoft.com/en-us/library/system.codedom.codechecksumpragma.checksumalgorithmid.aspx // And https://github.com/dotnet/roslyn/blob/614299ff83da9959fa07131c6d0ffbc58873b6ae/src/Compilers/Core/Portable/PEWriter/DebugSourceDocument.cs#L67 @@ -77,7 +60,7 @@ public override void VisitDocument(DocumentIntermediateNode node) // We only support algorithms that the debugger understands, which is currently SHA1 and SHA256. string algorithmId; - var algorithm = Context.SourceDocument.Text.ChecksumAlgorithm; + var algorithm = _context.SourceDocument.Text.ChecksumAlgorithm; if (algorithm == CodeAnalysis.Text.SourceHashAlgorithm.Sha256) { algorithmId = "{8829d00f-11b8-4213-878b-770e8597ac16}"; @@ -88,80 +71,76 @@ public override void VisitDocument(DocumentIntermediateNode node) } else { - var supportedAlgorithms = string.Join(" ", new string[] - { - HashAlgorithmName.SHA1.Name, - HashAlgorithmName.SHA256.Name - }); + // CodeQL [SM02196] This is supported by the underlying Roslyn APIs and as consumers we must also support it. + string?[] supportedAlgorithms = [HashAlgorithmName.SHA1.Name, HashAlgorithmName.SHA256.Name]; var message = Resources.FormatUnsupportedChecksumAlgorithm( algorithm, - supportedAlgorithms, - nameof(RazorCodeGenerationOptions) + "." + nameof(RazorCodeGenerationOptions.SuppressChecksum), + string.Join(" ", supportedAlgorithms), + $"{nameof(RazorCodeGenerationOptions)}.{nameof(RazorCodeGenerationOptions.SuppressChecksum)}", bool.TrueString); + throw new InvalidOperationException(message); } - var sourceDocument = Context.SourceDocument; + var sourceDocument = _context.SourceDocument; var checksum = ChecksumUtilities.BytesToString(sourceDocument.Text.GetChecksum()); - if (!string.IsNullOrEmpty(checksum)) + var filePath = sourceDocument.FilePath.AssumeNotNull(); + + if (checksum.Length > 0) { - Context.CodeWriter - .Write("#pragma checksum \"") - .Write(sourceDocument.FilePath) - .Write("\" \"") - .Write(algorithmId) - .Write("\" \"") - .Write(checksum) - .WriteLine("\""); + codeWriter.WriteLine($"#pragma checksum \"{filePath}\" \"{algorithmId}\" \"{checksum}\""); } } - Context.CodeWriter + codeWriter .WriteLine("// ") .WriteLine("#pragma warning disable 1591"); VisitDefault(node); - Context.CodeWriter.WriteLine("#pragma warning restore 1591"); + codeWriter.WriteLine("#pragma warning restore 1591"); } public override void VisitUsingDirective(UsingDirectiveIntermediateNode node) { - Context.NodeWriter.WriteUsingDirective(Context, node); + NodeWriter.WriteUsingDirective(_context, node); } public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node) { - using (Context.CodeWriter.BuildNamespace(node.Content, node.Source, Context)) + var codeWriter = CodeWriter; + + using (codeWriter.BuildNamespace(node.Content, node.Source, _context)) { if (node.Children.OfType().Any()) { // Tooling needs at least one line directive before using directives, otherwise Roslyn will // not offer to create a new one. The last using in the group will output a hidden line // directive after itself. - Context.CodeWriter.WriteLine("#line default"); + codeWriter.WriteLine("#line default"); } else { // If there are no using directives, we output the hidden directive here. - Context.CodeWriter.WriteLine("#line hidden"); + codeWriter.WriteLine("#line hidden"); } + VisitDefault(node); } } public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { - using (Context.CodeWriter.BuildClassDeclaration( + using (CodeWriter.BuildClassDeclaration( node.Modifiers, node.ClassName, node.BaseType, node.Interfaces, node.TypeParameters, - Context, - useNullableContext: !Context.Options.SuppressNullabilityEnforcement && node.Annotations[CommonAnnotations.NullableContext] is not null)) + _context, + useNullableContext: !Options.SuppressNullabilityEnforcement && node.Annotations[CommonAnnotations.NullableContext] is not null)) { VisitDefault(node); } @@ -169,100 +148,99 @@ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node) { - Context.CodeWriter.WriteLine("#pragma warning disable 1998"); + var codeWriter = CodeWriter; + + codeWriter.WriteLine("#pragma warning disable 1998"); for (var i = 0; i < node.Modifiers.Count; i++) { - Context.CodeWriter.Write(node.Modifiers[i]); - Context.CodeWriter.Write(" "); + codeWriter.Write($"{node.Modifiers[i]} "); } - Context.CodeWriter.Write(node.ReturnType); - Context.CodeWriter.Write(" "); + codeWriter.Write($"{node.ReturnType} "); + codeWriter.Write($"{node.MethodName}("); - Context.CodeWriter.Write(node.MethodName); - Context.CodeWriter.Write("("); + var isFirst = true; for (var i = 0; i < node.Parameters.Count; i++) { var parameter = node.Parameters[i]; - for (var j = 0; j < parameter.Modifiers.Count; j++) + if (isFirst) { - Context.CodeWriter.Write(parameter.Modifiers[j]); - Context.CodeWriter.Write(" "); + isFirst = false; + } + else + { + codeWriter.Write(", "); } - Context.CodeWriter.Write(parameter.TypeName); - Context.CodeWriter.Write(" "); - - Context.CodeWriter.Write(parameter.ParameterName); - - if (i < node.Parameters.Count - 1) + for (var j = 0; j < parameter.Modifiers.Count; j++) { - Context.CodeWriter.Write(", "); + codeWriter.Write($"{parameter.Modifiers[j]} "); } + + codeWriter.Write($"{parameter.TypeName} {parameter.ParameterName}"); } - Context.CodeWriter.Write(")"); - Context.CodeWriter.WriteLine(); + codeWriter.WriteLine(")"); - using (Context.CodeWriter.BuildScope()) + using (codeWriter.BuildScope()) { VisitDefault(node); } - Context.CodeWriter.WriteLine("#pragma warning restore 1998"); + codeWriter.WriteLine("#pragma warning restore 1998"); } public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node) { - Context.CodeWriter.WriteField(node.SuppressWarnings, node.Modifiers, node.FieldType, node.FieldName); + CodeWriter.WriteField(node.SuppressWarnings, node.Modifiers, node.FieldType, node.FieldName); } public override void VisitPropertyDeclaration(PropertyDeclarationIntermediateNode node) { - Context.CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.PropertyType, node.PropertyName); + CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.PropertyType, node.PropertyName); } public override void VisitExtension(ExtensionIntermediateNode node) { - node.WriteNode(_target, Context); + node.WriteNode(_codeTarget, _context); } public override void VisitCSharpExpression(CSharpExpressionIntermediateNode node) { - Context.NodeWriter.WriteCSharpExpression(Context, node); + NodeWriter.WriteCSharpExpression(_context, node); } public override void VisitCSharpCode(CSharpCodeIntermediateNode node) { - Context.NodeWriter.WriteCSharpCode(Context, node); + NodeWriter.WriteCSharpCode(_context, node); } public override void VisitHtmlAttribute(HtmlAttributeIntermediateNode node) { - Context.NodeWriter.WriteHtmlAttribute(Context, node); + NodeWriter.WriteHtmlAttribute(_context, node); } public override void VisitHtmlAttributeValue(HtmlAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteHtmlAttributeValue(Context, node); + NodeWriter.WriteHtmlAttributeValue(_context, node); } public override void VisitCSharpExpressionAttributeValue(CSharpExpressionAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteCSharpExpressionAttributeValue(Context, node); + NodeWriter.WriteCSharpExpressionAttributeValue(_context, node); } public override void VisitCSharpCodeAttributeValue(CSharpCodeAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteCSharpCodeAttributeValue(Context, node); + NodeWriter.WriteCSharpCodeAttributeValue(_context, node); } public override void VisitHtml(HtmlContentIntermediateNode node) { - Context.NodeWriter.WriteHtmlContent(Context, node); + NodeWriter.WriteHtmlContent(_context, node); } public override void VisitTagHelper(TagHelperIntermediateNode node) @@ -272,67 +250,67 @@ public override void VisitTagHelper(TagHelperIntermediateNode node) public override void VisitComponent(ComponentIntermediateNode node) { - Context.NodeWriter.WriteComponent(Context, node); + NodeWriter.WriteComponent(_context, node); } public override void VisitComponentAttribute(ComponentAttributeIntermediateNode node) { - Context.NodeWriter.WriteComponentAttribute(Context, node); + NodeWriter.WriteComponentAttribute(_context, node); } public override void VisitComponentChildContent(ComponentChildContentIntermediateNode node) { - Context.NodeWriter.WriteComponentChildContent(Context, node); + NodeWriter.WriteComponentChildContent(_context, node); } public override void VisitComponentTypeArgument(ComponentTypeArgumentIntermediateNode node) { - Context.NodeWriter.WriteComponentTypeArgument(Context, node); + NodeWriter.WriteComponentTypeArgument(_context, node); } public override void VisitComponentTypeInferenceMethod(ComponentTypeInferenceMethodIntermediateNode node) { - Context.NodeWriter.WriteComponentTypeInferenceMethod(Context, node); + NodeWriter.WriteComponentTypeInferenceMethod(_context, node); } public override void VisitMarkupElement(MarkupElementIntermediateNode node) { - Context.NodeWriter.WriteMarkupElement(Context, node); + NodeWriter.WriteMarkupElement(_context, node); } public override void VisitMarkupBlock(MarkupBlockIntermediateNode node) { - Context.NodeWriter.WriteMarkupBlock(Context, node); + NodeWriter.WriteMarkupBlock(_context, node); } public override void VisitReferenceCapture(ReferenceCaptureIntermediateNode node) { - Context.NodeWriter.WriteReferenceCapture(Context, node); + NodeWriter.WriteReferenceCapture(_context, node); } public override void VisitSetKey(SetKeyIntermediateNode node) { - Context.NodeWriter.WriteSetKey(Context, node); + NodeWriter.WriteSetKey(_context, node); } public override void VisitSplat(SplatIntermediateNode node) { - Context.NodeWriter.WriteSplat(Context, node); + NodeWriter.WriteSplat(_context, node); } public override void VisitRenderMode(RenderModeIntermediateNode node) { - Context.NodeWriter.WriteRenderMode(Context, node); + NodeWriter.WriteRenderMode(_context, node); } public override void VisitFormName(FormNameIntermediateNode node) { - Context.NodeWriter.WriteFormName(Context, node); + NodeWriter.WriteFormName(_context, node); } public override void VisitDefault(IntermediateNode node) { - Context.RenderChildren(node); + _context.RenderChildren(node); } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs index 8702653d9ae..e5a7c050f4e 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs @@ -801,7 +801,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon if (canTypeCheck) { context.CodeWriter.Write("new "); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write("("); } context.CodeWriter.WriteLine(); @@ -883,15 +883,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon { context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck); context.CodeWriter.Write("<"); - var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; - if (explicitType == true) - { - context.CodeWriter.Write(node.TypeName); - } - else - { - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); - } + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(">"); context.CodeWriter.Write("("); } @@ -964,7 +956,7 @@ public override void WriteComponentChildContent(CodeRenderingContext context, Co BeginWriteAttribute(context, node.AttributeName); context.CodeWriter.WriteParameterSeparator(); context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")("); WriteComponentChildContentInnards(context, node); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs index b5e7a0afb1f..0cbf25785f7 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -25,30 +26,31 @@ protected override void ExecuteCore( for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } - classNode.Children.Add(new ComponentInjectIntermediateNode(typeName, memberName, typeSpan, memberSpan)); + classNode.Children.Add(new ComponentInjectIntermediateNode(typeName, memberName, typeSpan, memberSpan, isMalformed)); } } private class Visitor : IntermediateNodeWalker { - public IList Directives { get; } - = new List(); + public IList Directives { get; } = []; public override void VisitDirective(DirectiveIntermediateNode node) { @@ -57,5 +59,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == ComponentInjectDirective.Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs index 13812ccf59c..3642e635ce1 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Intermediate; namespace Microsoft.AspNetCore.Razor.Language.Components; @@ -18,13 +19,14 @@ internal class ComponentInjectIntermediateNode : ExtensionIntermediateNode "private" // Encapsulation is the default }; - public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan) + public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan, bool isMalformed) { TypeName = typeName; MemberName = memberName; TypeSpan = typeSpan; MemberSpan = memberSpan; - } + IsMalformed = isMalformed; + } public string TypeName { get; } @@ -34,8 +36,9 @@ public ComponentInjectIntermediateNode(string typeName, string memberName, Sourc public SourceSpan? MemberSpan { get; } - public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; + public bool IsMalformed { get; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) { @@ -59,13 +62,26 @@ public override void WriteNode(CodeTarget target, CodeRenderingContext context) throw new ArgumentNullException(nameof(context)); } - context.CodeWriter.WriteAutoPropertyDeclaration( - _injectedPropertyModifiers, - TypeName, - MemberName, - TypeSpan, - MemberSpan, - context, - defaultValue: true); + if (TypeName == string.Empty && TypeSpan.HasValue && !context.Options.DesignTime) + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(TypeSpan.Value, context).Dispose(); + } + else + { + var memberName = MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + + if (!context.Options.DesignTime || !IsMalformed) + { + context.CodeWriter.WriteAutoPropertyDeclaration( + _injectedPropertyModifiers, + TypeName, + memberName, + TypeSpan, + MemberSpan, + context, + defaultValue: true); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs index 01fc235d3ed..79b270262fb 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs @@ -58,7 +58,7 @@ public sealed override void WriteCSharpCodeAttributeValue(CodeRenderingContext c // // We provide an error for this case just to be friendly. var content = string.Join("", node.Children.OfType().Select(t => t.Content)); - context.Diagnostics.Add(ComponentDiagnosticFactory.Create_CodeBlockInAttribute(node.Source, content)); + context.AddDiagnostic(ComponentDiagnosticFactory.Create_CodeBlockInAttribute(node.Source, content)); return; } @@ -483,6 +483,36 @@ protected static void WriteAddComponentRenderMode(CodeRenderingContext context, context.CodeWriter.WriteLine(); } + protected static void WriteGloballyQualifiedTypeName(CodeRenderingContext context, ComponentAttributeIntermediateNode node) + { + var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; + if (explicitType == true) + { + context.CodeWriter.Write(node.TypeName); + } + else if (node.BoundAttribute?.GetGloballyQualifiedTypeName() is string typeName) + { + context.CodeWriter.Write(typeName); + } + else + { + TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + } + } + + protected static void WriteGloballyQualifiedTypeName(CodeRenderingContext context, ComponentChildContentIntermediateNode node) + { + if (node.BoundAttribute?.GetGloballyQualifiedTypeName() is string typeName && + !node.BoundAttribute.IsGenericTypedProperty()) + { + context.CodeWriter.Write(typeName); + } + else + { + TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + } + } + protected class TypeInferenceMethodParameter { public string SeqName { get; private set; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentPageDirectivePass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentPageDirectivePass.cs index 44b4131cb5a..5c0a2cd5a47 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentPageDirectivePass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentPageDirectivePass.cs @@ -59,15 +59,16 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte var pageDirective = (DirectiveIntermediateNode)directives[i].Node; // The parser also adds errors for invalid syntax, we just need to not crash. - var routeToken = pageDirective.Tokens.FirstOrDefault(); + var routeToken = pageDirective.Tokens.First(); - if (routeToken is { Content: ['"', '/', .., '"'] content }) + if (routeToken is not { Content: ['"', '/', .., '"'] }) { - @namespace.Children.Insert(index++, new RouteAttributeExtensionNode(content) { Source = routeToken.Source }); + pageDirective.Diagnostics.Add(ComponentDiagnosticFactory.CreatePageDirective_MustSpecifyRoute(pageDirective.Source)); } - else + + if (!codeDocument.GetCodeGenerationOptions().DesignTime || pageDirective.Diagnostics.Count == 0) { - pageDirective.Diagnostics.Add(ComponentDiagnosticFactory.CreatePageDirective_MustSpecifyRoute(pageDirective.Source)); + @namespace.Children.Insert(index++, new RouteAttributeExtensionNode(routeToken.Content) { Source = routeToken.Source }); } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs index bd0b77cab0f..8cb57354a54 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs @@ -654,7 +654,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon if (canTypeCheck) { context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")"); context.CodeWriter.Write("("); } @@ -726,15 +726,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon { context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck); context.CodeWriter.Write("<"); - var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; - if (explicitType == true) - { - context.CodeWriter.Write(node.TypeName); - } - else - { - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); - } + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(">"); context.CodeWriter.Write("("); } @@ -813,7 +805,7 @@ public override void WriteComponentChildContent(CodeRenderingContext context, Co BeginWriteAttribute(context, node.AttributeName); context.CodeWriter.WriteParameterSeparator(); context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")("); WriteComponentChildContentInnards(context, node); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs index e685e50f20f..9b9a28c28f1 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs @@ -1,10 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; -using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; @@ -26,23 +24,19 @@ public RazorSyntaxTree Execute(RazorCodeDocument codeDocument, RazorSyntaxTree s return sectionVerifier.Verify(); } - private class NestedSectionVerifier : SyntaxRewriter + private sealed class NestedSectionVerifier(RazorSyntaxTree syntaxTree) : SyntaxRewriter { - private int _nestedLevel; - private readonly RazorSyntaxTree _syntaxTree; - private readonly List _diagnostics; + private readonly RazorSyntaxTree _syntaxTree = syntaxTree; - public NestedSectionVerifier(RazorSyntaxTree syntaxTree) - { - _syntaxTree = syntaxTree; - _diagnostics = new List(syntaxTree.Diagnostics); - } + private ImmutableArray.Builder? _diagnostics; + private int _nestedLevel; public RazorSyntaxTree Verify() { var root = Visit(_syntaxTree.Root); - var rewrittenTree = new DefaultRazorSyntaxTree(root, _syntaxTree.Source, _diagnostics, _syntaxTree.Options); - return rewrittenTree; + var diagnostics = _diagnostics?.DrainToImmutable() ?? _syntaxTree.Diagnostics; + + return new RazorSyntaxTree(root, _syntaxTree.Source, diagnostics, _syntaxTree.Options); } public override SyntaxNode Visit(SyntaxNode node) @@ -55,6 +49,7 @@ public override SyntaxNode Visit(SyntaxNode node) { // We're very close to reaching the stack limit. Let's not go any deeper. // It's okay to not show nested section errors in deeply nested cases instead of crashing. + _diagnostics ??= _syntaxTree.Diagnostics.ToBuilder(); _diagnostics.Add(RazorDiagnosticFactory.CreateRewriter_InsufficientStack()); return node; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs deleted file mode 100644 index 381a092eba7..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCSharpDocument : RazorCSharpDocument -{ - private readonly string _generatedCode; - private readonly RazorDiagnostic[] _diagnostics; - private readonly ImmutableArray _sourceMappings; - private readonly LinePragma[] _linePragmas; - private readonly RazorCodeGenerationOptions _options; - private readonly RazorCodeDocument _codeDocument; - - public DefaultRazorCSharpDocument( - RazorCodeDocument codeDocument, - string generatedCode, - RazorCodeGenerationOptions options, - RazorDiagnostic[] diagnostics, - ImmutableArray sourceMappings, - LinePragma[] linePragmas) - { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - _codeDocument = codeDocument; - _generatedCode = generatedCode; - _options = options; - - _diagnostics = diagnostics ?? Array.Empty(); - _sourceMappings = sourceMappings; - _linePragmas = linePragmas ?? Array.Empty(); - } - - public override IReadOnlyList Diagnostics => _diagnostics; - - public override string GeneratedCode => _generatedCode; - - public override ImmutableArray SourceMappings => _sourceMappings; - - internal override IReadOnlyList LinePragmas => _linePragmas; - - public override RazorCodeGenerationOptions Options => _options; - - public override RazorCodeDocument CodeDocument => _codeDocument; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs deleted file mode 100644 index 76fe6018dd7..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCodeGenerationOptions : RazorCodeGenerationOptions -{ - public DefaultRazorCodeGenerationOptions( - bool indentWithTabs, - int indentSize, - bool designTime, - string rootNamespace, - bool suppressChecksum, - bool suppressMetadataAttributes, - bool suppressPrimaryMethodBody, - bool suppressNullabilityEnforcement, - bool omitMinimizedComponentAttributeValues, - bool supportLocalizedComponentNames, - bool useEnhancedLinePragma, - string suppressUniqueIds, - bool suppressAddComponentParameter, - bool remapLinePragmaPathsOnWindows) - { - IndentWithTabs = indentWithTabs; - IndentSize = indentSize; - DesignTime = designTime; - RootNamespace = rootNamespace; - SuppressChecksum = suppressChecksum; - SuppressMetadataAttributes = suppressMetadataAttributes; - SuppressPrimaryMethodBody = suppressPrimaryMethodBody; - SuppressNullabilityEnforcement = suppressNullabilityEnforcement; - OmitMinimizedComponentAttributeValues = omitMinimizedComponentAttributeValues; - SupportLocalizedComponentNames = supportLocalizedComponentNames; - UseEnhancedLinePragma = useEnhancedLinePragma; - SuppressUniqueIds = suppressUniqueIds; - SuppressAddComponentParameter = suppressAddComponentParameter; - RemapLinePragmaPathsOnWindows = remapLinePragmaPathsOnWindows; - } - - public override bool DesignTime { get; } - - public override bool IndentWithTabs { get; } - - public override int IndentSize { get; } - - public override string RootNamespace { get; } - - public override bool SuppressChecksum { get; } - - public override bool SuppressNullabilityEnforcement { get; } - - public override bool OmitMinimizedComponentAttributeValues { get; } - - public override bool UseEnhancedLinePragma { get; } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs deleted file mode 100644 index 12816f28a9a..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCodeGenerationOptionsBuilder : RazorCodeGenerationOptionsBuilder -{ - private bool _designTime; - - public DefaultRazorCodeGenerationOptionsBuilder(RazorConfiguration configuration, string fileKind) - { - if (configuration == null) - { - throw new ArgumentNullException(nameof(configuration)); - } - - Configuration = configuration; - FileKind = fileKind; - } - - public DefaultRazorCodeGenerationOptionsBuilder(bool designTime) - { - _designTime = designTime; - } - - public override RazorConfiguration Configuration { get; } - - public override bool DesignTime => _designTime; - - public override string FileKind { get; } - - public override int IndentSize { get; set; } = 4; - - public override bool IndentWithTabs { get; set; } - - public override bool SuppressChecksum { get; set; } - - public override bool SuppressNullabilityEnforcement { get; set; } - - public override bool OmitMinimizedComponentAttributeValues { get; set; } - - public override bool SupportLocalizedComponentNames { get; set; } - - public override bool UseEnhancedLinePragma { get; set; } - - public override RazorCodeGenerationOptions Build() - { - return new DefaultRazorCodeGenerationOptions( - IndentWithTabs, - IndentSize, - DesignTime, - RootNamespace, - SuppressChecksum, - SuppressMetadataAttributes, - SuppressPrimaryMethodBody, - SuppressNullabilityEnforcement, - OmitMinimizedComponentAttributeValues, - SupportLocalizedComponentNames, - UseEnhancedLinePragma, - SuppressUniqueIds, - SuppressAddComponentParameter, - RemapLinePragmaPathsOnWindows) - { - SuppressMetadataSourceChecksumAttributes = SuppressMetadataSourceChecksumAttributes, - }; - } - - public override void SetDesignTime(bool designTime) - { - _designTime = designTime; - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs index feeb5b3a12b..549411af2f7 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs @@ -17,9 +17,9 @@ protected override void OnInitialized() _configureOptions = ProjectEngine.EngineFeatures.OfType().ToArray(); } - public RazorCodeGenerationOptions Create(string fileKind, Action configure) + public RazorCodeGenerationOptions Create(Action configure) { - var builder = new DefaultRazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration, fileKind); + var builder = new RazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration); configure?.Invoke(builder); for (var i = 0; i < _configureOptions.Length; i++) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorIntermediateNodeLoweringPhase.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorIntermediateNodeLoweringPhase.cs index 33d46206b45..207bb3baa0a 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorIntermediateNodeLoweringPhase.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorIntermediateNodeLoweringPhase.cs @@ -130,18 +130,18 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) // The document should contain all errors that currently exist in the system. This involves // adding the errors from the primary and imported syntax trees. - for (var i = 0; i < syntaxTree.Diagnostics.Count; i++) + foreach (var diagnostic in syntaxTree.Diagnostics) { - document.Diagnostics.Add(syntaxTree.Diagnostics[i]); + document.Diagnostics.Add(diagnostic); } if (imports is { IsDefault: false } importsArray) { foreach (var import in importsArray) { - for (var j = 0; j < import.Diagnostics.Count; j++) + foreach (var diagnostic in import.Diagnostics) { - document.Diagnostics.Add(import.Diagnostics[j]); + document.Diagnostics.Add(diagnostic); } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs deleted file mode 100644 index 4f1b9e7adec..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorSyntaxTree : RazorSyntaxTree -{ - private readonly IReadOnlyList _diagnostics; - private IReadOnlyList _allDiagnostics; - - public DefaultRazorSyntaxTree( - SyntaxNode root, - RazorSourceDocument source, - IReadOnlyList diagnostics, - RazorParserOptions options) - { - Root = root; - Source = source; - _diagnostics = diagnostics; - Options = options; - } - - public override IReadOnlyList Diagnostics - { - get - { - if (_allDiagnostics == null) - { - var allDiagnostics = new HashSet(); - for (var i = 0; i < _diagnostics.Count; i++) - { - allDiagnostics.Add(_diagnostics[i]); - } - - var rootDiagnostics = Root.GetAllDiagnostics(); - for (var i = 0; i < rootDiagnostics.Count; i++) - { - allDiagnostics.Add(rootDiagnostics[i]); - } - - var allOrderedDiagnostics = allDiagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); - _allDiagnostics = allOrderedDiagnostics.ToArray(); - } - - return _allDiagnostics; - } - } - - public override RazorParserOptions Options { get; } - - internal override SyntaxNode Root { get; } - - public override RazorSourceDocument Source { get; } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs index 59c1dcc7619..2df263902ae 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs @@ -101,12 +101,8 @@ public void WriteTagHelperBody(CodeRenderingContext context, DefaultTagHelperBod // Assign a unique ID for this instance of the source HTML tag. This must be unique // per call site, e.g. if the tag is on the view twice, there should be two IDs. - var uniqueId = (string)context.Items[CodeRenderingContext.SuppressUniqueIds]; - if (uniqueId == null) - { - uniqueId = GetDeterministicId(context); - } - + var uniqueId = GetDeterministicId(context); + context.CodeWriter.WriteStringLiteral(node.TagName) .WriteParameterSeparator() .Write(TagModeTypeName) @@ -584,13 +580,13 @@ internal void RenderTagHelperAttributeInline( else if (node is CSharpCodeIntermediateNode) { var diagnostic = RazorDiagnosticFactory.CreateTagHelper_CodeBlocksNotSupportedInAttributes(span); - context.Diagnostics.Add(diagnostic); + context.AddDiagnostic(diagnostic); } else if (node is TemplateIntermediateNode) { var expectedTypeName = property.IsIndexerNameMatch ? property.BoundAttribute.IndexerTypeName : property.BoundAttribute.TypeName; var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(span, expectedTypeName); - context.Diagnostics.Add(diagnostic); + context.AddDiagnostic(diagnostic); } } @@ -650,10 +646,13 @@ private string GetContent(HtmlContentIntermediateNode node) // Internal for testing internal static string GetDeterministicId(CodeRenderingContext context) { - // Use the file checksum along with the absolute position in the generated code to create a unique id for each tag helper call site. - var checksum = ChecksumUtilities.BytesToString(context.SourceDocument.Text.GetChecksum()); - var uniqueId = checksum + context.CodeWriter.Location.AbsoluteIndex; - + var uniqueId = context.Options.SuppressUniqueIds; + if (uniqueId is null) + { + // Use the file checksum along with the absolute position in the generated code to create a unique id for each tag helper call site. + var checksum = ChecksumUtilities.BytesToString(context.SourceDocument.Text.GetChecksum()); + uniqueId = checksum + context.CodeWriter.Location.AbsoluteIndex; + } return uniqueId; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs index 6d831ea3587..42356425310 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs @@ -27,7 +27,6 @@ public RazorSyntaxTree Execute(RazorCodeDocument codeDocument, RazorSyntaxTree s var whitespaceRewriter = new WhitespaceRewriter(); var rewritten = whitespaceRewriter.Visit(syntaxTree.Root); - var rewrittenSyntaxTree = RazorSyntaxTree.Create(rewritten, syntaxTree.Source, syntaxTree.Diagnostics, syntaxTree.Options); - return rewrittenSyntaxTree; + return new RazorSyntaxTree(rewritten, syntaxTree.Source, syntaxTree.Diagnostics, syntaxTree.Options); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs index 9865f4d792c..3c42ef62a00 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs @@ -9,5 +9,5 @@ namespace Microsoft.AspNetCore.Razor.Language; internal interface IRazorCodeGenerationOptionsFactoryProjectFeature : IRazorProjectEngineFeature { - RazorCodeGenerationOptions Create(string fileKind, Action configure); + RazorCodeGenerationOptions Create(Action configure); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs index df5d210c550..7495f8e2995 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs @@ -34,7 +34,7 @@ protected void ReportMissingCodeTargetExtension(CodeRenderingContex } var documentKind = context.DocumentKind ?? string.Empty; - context.Diagnostics.Add( + context.AddDiagnostic( RazorDiagnosticFactory.CreateCodeTarget_UnsupportedExtension( documentKind, typeof(TDependency))); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs index 72516dd6dcb..8cc6a373a85 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs @@ -3,17 +3,15 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Components; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.Intermediate; public static class IntermediateNodeExtensions { - private static readonly IReadOnlyList EmptyDiagnostics = Array.Empty(); - public static bool IsImported(this IntermediateNode node) { return ReferenceEquals(node.Annotations[CommonAnnotations.Imported], CommonAnnotations.Imported); @@ -26,36 +24,32 @@ public static bool IsDesignTimePropertyAccessHelper(this IntermediateNode tagHel result; } - public static IReadOnlyList GetAllDiagnostics(this IntermediateNode node) + public static ImmutableArray GetAllDiagnostics(this IntermediateNode node) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - HashSet diagnostics = null; - - AddAllDiagnostics(node); + ArgHelper.ThrowIfNull(node); - var allOrderedDiagnostics = diagnostics?.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); + var diagnostics = new PooledHashSet(); + try + { + CollectDiagnostics(node, ref diagnostics); - return allOrderedDiagnostics?.ToList() ?? EmptyDiagnostics; + return diagnostics.OrderByAsArray(static d => d.Span.AbsoluteIndex); + } + finally + { + diagnostics.ClearAndFree(); + } - void AddAllDiagnostics(IntermediateNode n) + static void CollectDiagnostics(IntermediateNode node, ref PooledHashSet diagnostics) { - if (n.HasDiagnostics) + if (node.HasDiagnostics) { - if (diagnostics == null) - { - diagnostics = new HashSet(); - } - - diagnostics.UnionWith(n.Diagnostics); + diagnostics.UnionWith(node.Diagnostics); } - for (var i = 0; i < n.Children.Count; i++) + foreach (var childNode in node.Children) { - AddAllDiagnostics(n.Children[i]); + CollectDiagnostics(childNode, ref diagnostics); } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/CSharpCodeParser.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/CSharpCodeParser.cs index 851ebd29ef8..3a08b15118b 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/CSharpCodeParser.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/CSharpCodeParser.cs @@ -9,6 +9,7 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Microsoft.AspNetCore.Razor.PooledObjects; +using static Microsoft.AspNetCore.Razor.Language.Syntax.GreenNodeExtensions; using CSharpSyntaxFacts = Microsoft.CodeAnalysis.CSharp.SyntaxFacts; using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; @@ -84,22 +85,15 @@ internal class CSharpCodeParser : TokenizerBackedParser private readonly ImmutableDictionary, CSharpTransitionSyntax>> _directiveParserMap; public CSharpCodeParser(ParserContext context) - : this(directives: Enumerable.Empty(), context: context) + : this(directives: [], context) { } public CSharpCodeParser(IEnumerable directives, ParserContext context) : base(context.ParseLeadingDirectives ? FirstDirectiveCSharpLanguageCharacteristics.Instance : CSharpLanguageCharacteristics.Instance, context) { - if (directives == null) - { - throw new ArgumentNullException(nameof(directives)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } + ArgHelper.ThrowIfNull(directives); + ArgHelper.ThrowIfNull(context); var keywordsBuilder = ImmutableHashSet.Empty.ToBuilder(); var keywordParserMapBuilder = ImmutableDictionary, CSharpTransitionSyntax?>>.Empty.ToBuilder(); @@ -298,7 +292,7 @@ public HtmlMarkupParser HtmlParser { var diagnostic = RazorDiagnosticFactory.CreateParsing_HelperDirectiveNotAvailable( new SourceSpan(CurrentStart, CurrentToken.Content.Length)); - CurrentToken.SetDiagnostics(new[] { diagnostic }); + CurrentToken.SetDiagnostics([diagnostic]); Context.ErrorSink.OnError(diagnostic); } @@ -980,23 +974,28 @@ not SyntaxKind.LeftBracket and case SyntaxKind.Keyword: // We want to stitch together `@text`. Accept(in read); + Accept(NextAsEscapedIdentifier()); + continue; - var transition = CurrentToken; - NextToken(); - var identifier = CurrentToken; - NextToken(); - Debug.Assert(transition.Kind == SyntaxKind.Transition); - Debug.Assert(identifier.Kind is SyntaxKind.Identifier or SyntaxKind.Keyword); + // We special case @@identifier because the old compiler behavior was to simply accept it and treat it as if it was @identifier. While + // this isn't legal, the runtime compiler doesn't handle @identifier correctly. We'll continue to accept this for now, but will potentially + // break it in the future when we move to the roslyn lexer and the runtime/compiletime split is much greater. + case SyntaxKind.Transition: + if (Lookahead(2) is not { Kind: SyntaxKind.Identifier or SyntaxKind.Keyword }) + { + goto default; + } - var finalIdentifier = SyntaxFactory.Token(SyntaxKind.Identifier, $"{transition.Content}{identifier.Content}"); - Accept(finalIdentifier); + Accept(in read); + AcceptAndMoveNext(); + Accept(NextAsEscapedIdentifier()); continue; default: // Accept a broken identifier `@` and mark an error Accept(in read); - transition = CurrentToken; + var transition = CurrentToken; Debug.Assert(transition.Kind == SyntaxKind.Transition); @@ -1005,7 +1004,7 @@ not SyntaxKind.LeftBracket and new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); NextToken(); - finalIdentifier = SyntaxFactory.Token(SyntaxKind.Identifier, transition.Content); + var finalIdentifier = SyntaxFactory.Token(SyntaxKind.Identifier, transition.Content); Accept(finalIdentifier); continue; } @@ -1208,14 +1207,13 @@ private RazorDirectiveBodySyntax ParseTagHelperDirective( { AssertDirective(keyword); - var savedErrorSink = Context.ErrorSink; - var directiveErrorSink = new ErrorSink(); RazorMetaCodeSyntax? keywordBlock = null; - using (var pooledResult = Pool.Allocate()) - { - var directiveBuilder = pooledResult.Builder; - Context.ErrorSink = directiveErrorSink; + using var pooledResult = Pool.Allocate(); + var directiveBuilder = pooledResult.Builder; + using var directiveErrorSink = new ErrorSink(); + using (Context.PushNewErrorScope(directiveErrorSink)) + { string? directiveValue = null; SourceLocation? valueStartLocation = null; EnsureDirectiveIsAtStartOfLine(); @@ -1273,19 +1271,18 @@ private RazorDirectiveBodySyntax ParseTagHelperDirective( chunkGenerator = chunkGeneratorFactory( directiveValue, - directiveErrorSink.Errors.ToList(), + [.. directiveErrorSink.GetErrorsAndClear()], valueStartLocation ?? CurrentStart); - Context.ErrorSink = savedErrorSink; + } - // Finish the block and output the tokens - CompleteBlock(); - SetAcceptedCharacters(AcceptedCharactersInternal.AnyExceptNewline); + // Finish the block and output the tokens + CompleteBlock(); + SetAcceptedCharacters(AcceptedCharactersInternal.AnyExceptNewline); - directiveBuilder.Add(OutputTokensAsStatementLiteral()); - var directiveCodeBlock = SyntaxFactory.CSharpCodeBlock(directiveBuilder.ToList()); + directiveBuilder.Add(OutputTokensAsStatementLiteral()); + var directiveCodeBlock = SyntaxFactory.CSharpCodeBlock(directiveBuilder.ToList()); - return SyntaxFactory.RazorDirectiveBody(keywordBlock, directiveCodeBlock); - } + return SyntaxFactory.RazorDirectiveBody(keywordBlock, directiveCodeBlock); } private ParsedDirective ParseDirective( @@ -1425,17 +1422,14 @@ private void ParseExtensibleDirective(in SyntaxListBuilder buil { AssertDirective(descriptor.Directive); - var directiveErrorSink = new ErrorSink(); - var savedErrorSink = Context.ErrorSink; - Context.ErrorSink = directiveErrorSink; - using (var pooledResult = Pool.Allocate()) { var directiveBuilder = pooledResult.Builder; RazorMetaCodeSyntax? keywordBlock = null; bool shouldCaptureWhitespaceToEndOfLine = false; - try + using var directiveErrorSink = new ErrorSink(); + using (Context.PushNewErrorScope(directiveErrorSink)) { EnsureDirectiveIsAtStartOfLine(); var directiveStart = CurrentStart; @@ -1737,7 +1731,6 @@ private void ParseExtensibleDirective(in SyntaxListBuilder buil Resources.ErrorComponent_Newline)); } - // This should contain the optional whitespace after the optional semicolon and the new line. // Output as Markup as we want intellisense here. chunkGenerator = SpanChunkGenerator.Null; @@ -1806,10 +1799,6 @@ private void ParseExtensibleDirective(in SyntaxListBuilder buil break; } } - finally - { - Context.ErrorSink = savedErrorSink; - } builder.Add(BuildDirective(SyntaxKind.Identifier)); @@ -1831,7 +1820,9 @@ RazorDirectiveSyntax BuildDirective(SyntaxKind expectedTokenKindIfMissing) var directiveBody = SyntaxFactory.RazorDirectiveBody(keywordBlock, directiveCodeBlock); var directive = SyntaxFactory.RazorDirective(transition, directiveBody); - directive = (RazorDirectiveSyntax)directive.SetDiagnostics(directiveErrorSink.Errors.ToArray()); + + var diagnostics = directiveErrorSink.GetErrorsAndClear(); + directive = directive.WithDiagnosticsGreen(diagnostics); directive = directive.WithDirectiveDescriptor(descriptor); return directive; } @@ -2205,7 +2196,7 @@ private void ParseAfterIfClause(SyntaxListBuilder builder) if (At(CSharpSyntaxKind.ElseKeyword)) { Accept(in whitespace); - Assert(CSharpSyntaxKind.ElseKeyword); + Assert(CSharpSyntaxKind.ElseKeyword); ParseElseClause(builder); } else @@ -2524,11 +2515,16 @@ private void ParseUsingDeclaration(in SyntaxListBuilder builder isStatic, hasExplicitSemicolon); - CompleteBlock(); Debug.Assert(directiveBuilder.Count == 0, "We should not have built any blocks so far."); var keywordTokens = OutputTokensAsStatementLiteral(); var directiveBody = SyntaxFactory.RazorDirectiveBody(keywordTokens, null); builder.Add(SyntaxFactory.RazorDirective(transition, directiveBody)); + + if (!Context.DesignTimeMode) + { + CaptureWhitespaceToEndOfLine(); + builder.Add(OutputAsMetaCode(Output(), Context.CurrentAcceptedCharacters)); + } } } @@ -2822,8 +2818,7 @@ private bool Balance(SyntaxListBuilder builder, BalancingModes do { if (IsAtEmbeddedTransition( - (mode & BalancingModes.AllowCommentsAndTemplates) == BalancingModes.AllowCommentsAndTemplates, - (mode & BalancingModes.AllowEmbeddedTransitions) == BalancingModes.AllowEmbeddedTransitions)) + (mode & BalancingModes.AllowCommentsAndTemplates) == BalancingModes.AllowCommentsAndTemplates)) { Accept(in tokens); tokens.Clear(); @@ -2832,6 +2827,31 @@ private bool Balance(SyntaxListBuilder builder, BalancingModes // Reset backtracking since we've already outputted some spans. startPosition = CurrentStart.AbsoluteIndex; } + + if (At(SyntaxKind.Transition)) + { + // We special case @@identifier because the old compiler behavior was to simply accept it and treat it as if it was @identifier. While + // this isn't legal, the runtime compiler doesn't handle @identifier correctly. We'll continue to accept this for now, but will potentially + // break it in the future when we move to the roslyn lexer and the runtime/compiletime split is much greater. + if (NextIs(SyntaxKind.Transition) && Lookahead(2) is { Kind: SyntaxKind.Identifier or SyntaxKind.Keyword }) + { + Accept(in tokens); + tokens.Clear(); + builder.Add(OutputTokensAsStatementLiteral()); + AcceptAndMoveNext(); + builder.Add(OutputTokensAsEphemeralLiteral()); + + // Reset backtracking since we've already outputted some spans. + startPosition = CurrentStart.AbsoluteIndex; + continue; + } + else if (NextIs(SyntaxKind.Keyword, SyntaxKind.Identifier)) + { + tokens.Add(NextAsEscapedIdentifier()); + continue; + } + } + if (At(left)) { nesting++; @@ -2840,12 +2860,14 @@ private bool Balance(SyntaxListBuilder builder, BalancingModes { nesting--; } + if (nesting > 0) { tokens.Add(CurrentToken); + NextToken(); } } - while (nesting > 0 && NextToken() && !(stopAtEndOfLine && At(SyntaxKind.NewLine))); + while (nesting > 0 && EnsureCurrent() && !(stopAtEndOfLine && At(SyntaxKind.NewLine))); if (nesting > 0) { @@ -2876,9 +2898,8 @@ private bool Balance(SyntaxListBuilder builder, BalancingModes return nesting == 0; } - private bool IsAtEmbeddedTransition(bool allowTemplatesAndComments, bool allowTransitions) + private bool IsAtEmbeddedTransition(bool allowTemplatesAndComments) { - // No embedded transitions in C#, so ignore that param return allowTemplatesAndComments && ((Language.IsTransition(CurrentToken) && NextIs(SyntaxKind.LessThan, SyntaxKind.Colon, SyntaxKind.DoubleColon)) @@ -2910,6 +2931,19 @@ private void ParseEmbeddedTransition(in SyntaxListBuilder build } } + private SyntaxToken NextAsEscapedIdentifier() + { + Debug.Assert(CurrentToken.Kind == SyntaxKind.Transition); + var transition = CurrentToken; + NextToken(); + Debug.Assert(CurrentToken.Kind is SyntaxKind.Identifier or SyntaxKind.Keyword); + var identifier = CurrentToken; + NextToken(); + + var finalIdentifier = SyntaxFactory.Token(SyntaxKind.Identifier, $"{transition.Content}{identifier.Content}"); + return finalIdentifier; + } + [Conditional("DEBUG")] internal void Assert(CSharpSyntaxKind expectedKeyword) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ErrorSink.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ErrorSink.cs index be06777c9d6..90bf24e32b2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ErrorSink.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ErrorSink.cs @@ -1,35 +1,52 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using System.Collections.Generic; +using System; +using System.Collections.Immutable; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.Legacy; /// -/// Used to manage s encountered during the Razor parsing phase. +/// Used to manage RazorDiagnostics encountered during the Razor parsing phase. /// -internal class ErrorSink +internal sealed class ErrorSink : IDisposable { - private readonly List _errors; + private ImmutableArray.Builder? _errors; - /// - /// Instantiates a new instance of . - /// - public ErrorSink() + public void Dispose() { - _errors = new List(); + var errors = _errors; + + if (errors is not null) + { + ArrayBuilderPool.Default.Return(errors); + _errors = null; + } } - /// - /// s collected. - /// - public IReadOnlyList Errors => _errors; + public ImmutableArray GetErrorsAndClear() + { + var errors = _errors; + if (errors is null) + { + return []; + } + + var result = errors.DrainToImmutable(); + ArrayBuilderPool.Default.Return(errors); + _errors = null; + + return result; + } /// /// Tracks the given . /// /// The to track. - public void OnError(RazorDiagnostic error) => _errors.Add(error); + public void OnError(RazorDiagnostic error) + { + var errors = _errors ??= ArrayBuilderPool.Default.Get(); + errors.Add(error); + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs index a89e708b7b2..e38dbb96777 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/HtmlMarkupParser.cs @@ -19,10 +19,10 @@ internal class HtmlMarkupParser : TokenizerBackedParser private static readonly char[] ValidAfterTypeAttributeNameCharacters = { ' ', '\t', '\r', '\n', '\f', '=' }; private static readonly SyntaxToken[] nonAllowedHtmlCommentEnding = new[] { - SyntaxFactory.Token(SyntaxKind.Text, "-"), - SyntaxFactory.Token(SyntaxKind.Bang, "!"), - SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), - }; + SyntaxFactory.Token(SyntaxKind.Text, "-"), + SyntaxFactory.Token(SyntaxKind.Bang, "!"), + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), + }; private Stack _tagTracker = new Stack(); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserBase.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserBase.cs index 518b1c2134a..9e76b591360 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserBase.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserBase.cs @@ -3,12 +3,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy; -internal abstract class ParserBase +internal abstract class ParserBase(ParserContext context) { - public ParserBase(ParserContext context) - { - Context = context; - } - - public ParserContext Context { get; } + public ParserContext Context { get; } = context; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.ErrorScope.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.ErrorScope.cs new file mode 100644 index 00000000000..2be5332bead --- /dev/null +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.ErrorScope.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.AspNetCore.Razor.Language.Legacy; + +internal partial class ParserContext +{ + public readonly ref struct ErrorScope(ParserContext context) + { + private readonly ParserContext _context = context; + + public void Dispose() + { + _context._errorSinkStack.Pop(); + } + } +} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.cs index b96ded3d778..840dd1dea03 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/ParserContext.cs @@ -4,61 +4,73 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.Legacy; -internal partial class ParserContext +internal sealed partial class ParserContext : IDisposable { - public ParserContext(RazorSourceDocument source, RazorParserOptions options) - { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + private readonly RazorParserOptions _options; + private readonly Stack _errorSinkStack; + private readonly HashSet _seenDirectivesSet; - SourceDocument = source; + public RazorSourceDocument SourceDocument { get; } + public SeekableTextReader Source { get; } - Source = new SeekableTextReader(SourceDocument); - DesignTimeMode = options.DesignTime; - FeatureFlags = options.FeatureFlags; - ParseLeadingDirectives = options.ParseLeadingDirectives; - ErrorSink = new ErrorSink(); - SeenDirectives = new HashSet(StringComparer.Ordinal); - EnableSpanEditHandlers = options.EnableSpanEditHandlers; - } + public bool WhiteSpaceIsSignificantToAncestorBlock { get; set; } + public bool NullGenerateWhitespaceAndNewLine { get; set; } + public bool InTemplateContext { get; set; } + public bool StartOfLine { get; set; } = true; + public bool MakeMarkerNode { get; set; } = true; + public AcceptedCharactersInternal CurrentAcceptedCharacters { get; set; } = AcceptedCharactersInternal.Any; - public ErrorSink ErrorSink { get; set; } + public ParserContext(RazorSourceDocument source, RazorParserOptions options) + { + ArgHelper.ThrowIfNull(source); + ArgHelper.ThrowIfNull(options); - public RazorParserFeatureFlags FeatureFlags { get; } + SourceDocument = source; + _options = options; - public HashSet SeenDirectives { get; } + _errorSinkStack = StackPool.Default.Get(); + _errorSinkStack.Push(new ErrorSink()); - public SeekableTextReader Source { get; } + _seenDirectivesSet = StringHashSetPool.Ordinal.Get(); - public RazorSourceDocument SourceDocument { get; } + Source = new SeekableTextReader(SourceDocument); + } - public bool DesignTimeMode { get; } + public void Dispose() + { + while (_errorSinkStack.Count > 0) + { + var errorSink = _errorSinkStack.Pop(); + errorSink.Dispose(); + } - public bool ParseLeadingDirectives { get; } + StackPool.Default.Return(_errorSinkStack); + StringHashSetPool.Ordinal.Return(_seenDirectivesSet); + } - public bool EnableSpanEditHandlers { get; } + public ErrorSink ErrorSink => _errorSinkStack.Peek(); - public bool WhiteSpaceIsSignificantToAncestorBlock { get; set; } + public RazorParserFeatureFlags FeatureFlags => _options.FeatureFlags; - public bool NullGenerateWhitespaceAndNewLine { get; set; } + public HashSet SeenDirectives => _seenDirectivesSet; - public bool InTemplateContext { get; set; } + public bool DesignTimeMode => _options.DesignTime; - public bool StartOfLine { get; set; } = true; + public bool ParseLeadingDirectives => _options.ParseLeadingDirectives; - public bool MakeMarkerNode { get; set; } = true; + public bool EnableSpanEditHandlers => _options.EnableSpanEditHandlers; - public AcceptedCharactersInternal CurrentAcceptedCharacters { get; set; } = AcceptedCharactersInternal.Any; + public bool IsEndOfFile + => Source.Peek() == -1; - public bool EndOfFile + public ErrorScope PushNewErrorScope(ErrorSink errorSink) { - get { return Source.Peek() == -1; } + _errorSinkStack.Push(errorSink); + return new(this); } } @@ -68,46 +80,17 @@ public bool EndOfFile [DebuggerDisplay("{" + nameof(DebuggerToString) + "(),nq}")] internal partial class ParserContext { - private const int InfiniteLoopCountThreshold = 1000; - private int _infiniteLoopGuardCount; - private SourceLocation? _infiniteLoopGuardLocation; - - internal string Unparsed + private string Unparsed { get { - var remaining = ((TextReader)Source).ReadToEnd(); - Source.Position -= remaining.Length; + var bookmark = Source.Position; + var remaining = Source.ReadToEnd(); + Source.Position = bookmark; return remaining; } } - private bool CheckInfiniteLoop() - { - // Infinite loop guard - // Basically, if this property is accessed 1000 times in a row without having advanced the source reader to the next position, we - // cause a parser error - if (_infiniteLoopGuardLocation != null) - { - if (Source.Location.Equals(_infiniteLoopGuardLocation.Value)) - { - _infiniteLoopGuardCount++; - if (_infiniteLoopGuardCount > InfiniteLoopCountThreshold) - { - Debug.Fail("An internal parser error is causing an infinite loop at this location."); - - return true; - } - } - else - { - _infiniteLoopGuardCount = 0; - } - } - _infiniteLoopGuardLocation = Source.Location; - return false; - } - private string DebuggerToString() { return Unparsed; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs index 5c762cf1c68..8381486cd84 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs @@ -1,10 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using System; - namespace Microsoft.AspNetCore.Razor.Language.Legacy; internal class RazorParser @@ -16,10 +12,7 @@ public RazorParser() public RazorParser(RazorParserOptions options) { - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + ArgHelper.ThrowIfNull(options); Options = options; } @@ -28,23 +21,18 @@ public RazorParser(RazorParserOptions options) public virtual RazorSyntaxTree Parse(RazorSourceDocument source) { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgHelper.ThrowIfNull(source); - var context = new ParserContext(source, Options); + using var context = new ParserContext(source, Options); var codeParser = new CSharpCodeParser(Options.Directives, context); var markupParser = new HtmlMarkupParser(context); codeParser.HtmlParser = markupParser; markupParser.CodeParser = codeParser; - var diagnostics = context.ErrorSink.Errors; - var root = markupParser.ParseDocument().CreateRed(); + var diagnostics = context.ErrorSink.GetErrorsAndClear(); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, Options); - return syntaxTree; + return new RazorSyntaxTree(root, source, diagnostics, Options); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs index 4f4ac922cb3..0d5bdd0aee2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs @@ -292,7 +292,6 @@ private static TryParseResult TryParseAttribute( rewritten = rewritten.WithTagHelperAttributeInfo( new TagHelperAttributeInfo(result.AttributeName, parameterName: null, result.AttributeStructure, result.IsBoundAttribute, isDirectiveAttribute: false)); - result.RewrittenAttribute = rewritten; return result; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs index cc82532dcef..008bf977a5e 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs @@ -16,7 +16,7 @@ internal static class TagHelperParseTreeRewriter { public static RazorSyntaxTree Rewrite(RazorSyntaxTree syntaxTree, TagHelperBinder binder, out ISet usedDescriptors) { - var errorSink = new ErrorSink(); + using var errorSink = new ErrorSink(); var rewriter = new Rewriter( syntaxTree.Source, @@ -26,25 +26,26 @@ public static RazorSyntaxTree Rewrite(RazorSyntaxTree syntaxTree, TagHelperBinde var rewritten = rewriter.Visit(syntaxTree.Root); - var errorList = new List(); - errorList.AddRange(errorSink.Errors); - errorList.AddRange(binder.TagHelpers.SelectMany(d => d.GetAllDiagnostics())); + var treeDiagnostics = syntaxTree.Diagnostics; + var sinkDiagnostics = errorSink.GetErrorsAndClear(); - var diagnostics = CombineErrors(syntaxTree.Diagnostics, errorList).OrderBy(error => error.Span.AbsoluteIndex); + using var builder = new PooledArrayBuilder(capacity: treeDiagnostics.Length + sinkDiagnostics.Length); - usedDescriptors = rewriter.UsedDescriptors; + builder.AddRange(treeDiagnostics); + builder.AddRange(sinkDiagnostics); - var newSyntaxTree = RazorSyntaxTree.Create(rewritten, syntaxTree.Source, diagnostics, syntaxTree.Options); - return newSyntaxTree; - } + foreach (var tagHelper in binder.TagHelpers) + { + foreach (var diagnostic in tagHelper.GetAllDiagnostics()) + { + builder.Add(diagnostic); + } + } - private static IReadOnlyList CombineErrors(IReadOnlyList errors1, IReadOnlyList errors2) - { - var combinedErrors = new List(errors1.Count + errors2.Count); - combinedErrors.AddRange(errors1); - combinedErrors.AddRange(errors2); + var diagnostics = builder.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex); - return combinedErrors; + usedDescriptors = rewriter.UsedDescriptors; + return new RazorSyntaxTree(rewritten, syntaxTree.Source, diagnostics, syntaxTree.Options); } // Internal for testing. diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index fc16701d2f7..2a00090ac94 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -1,81 +1,38 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorCSharpDocument : IRazorGeneratedDocument +public sealed class RazorCSharpDocument : IRazorGeneratedDocument { - public abstract string GeneratedCode { get; } - - public abstract ImmutableArray SourceMappings { get; } - - public abstract IReadOnlyList Diagnostics { get; } - - public abstract RazorCodeGenerationOptions Options { get; } - - public abstract RazorCodeDocument CodeDocument { get; } - - internal virtual IReadOnlyList LinePragmas { get; } - - [Obsolete("For backwards compatibility only. Use the overload that takes a RazorCodeDocument")] - public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) - => Create(codeDocument: null, generatedCode, options, diagnostics); - - [Obsolete("For backwards compatibility only. Use the overload that takes a RazorCodeDocument")] - public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics, ImmutableArray sourceMappings, IEnumerable linePragmas) - => Create(codeDocument: null, generatedCode, options, diagnostics, sourceMappings, linePragmas); - - public static RazorCSharpDocument Create(RazorCodeDocument codeDocument, string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) - { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (diagnostics == null) - { - throw new ArgumentNullException(nameof(diagnostics)); - } - - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray.Empty, linePragmas: null); - } - - public static RazorCSharpDocument Create( + public RazorCodeDocument CodeDocument { get; } + public string GeneratedCode { get; } + public RazorCodeGenerationOptions Options { get; } + public ImmutableArray Diagnostics { get; } + public ImmutableArray SourceMappings { get; } + public ImmutableArray LinePragmas { get; } + + public RazorCSharpDocument( RazorCodeDocument codeDocument, string generatedCode, RazorCodeGenerationOptions options, - IEnumerable diagnostics, - ImmutableArray sourceMappings, - IEnumerable linePragmas) + ImmutableArray diagnostics, + ImmutableArray sourceMappings = default, + ImmutableArray linePragmas = default) { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(generatedCode); + ArgHelper.ThrowIfNull(options); - if (diagnostics == null) - { - throw new ArgumentNullException(nameof(diagnostics)); - } + CodeDocument = codeDocument; + GeneratedCode = generatedCode; + Options = options; - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas.ToArray()); + Diagnostics = diagnostics.NullToEmpty(); + SourceMappings = sourceMappings.NullToEmpty(); + LinePragmas = linePragmas.NullToEmpty(); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index a055dddf6e8..62d0985a558 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -1,94 +1,29 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorCodeGenerationOptions +public sealed class RazorCodeGenerationOptions( + RazorCodeGenerationOptionsFlags flags, + int indentSize, + string newLine, + string? rootNamespace, + string? suppressUniqueIds) { - public static RazorCodeGenerationOptions CreateDefault() - { - return new DefaultRazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: false, - suppressChecksum: false, - rootNamespace: null, - suppressMetadataAttributes: false, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: false); - } - - public static RazorCodeGenerationOptions CreateDesignTimeDefault() - { - return new DefaultRazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: true, - rootNamespace: null, - suppressChecksum: false, - suppressMetadataAttributes: true, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: true); - } - - public static RazorCodeGenerationOptions Create(Action configure) - { - if (configure == null) - { - throw new ArgumentNullException(nameof(configure)); - } - - var builder = new DefaultRazorCodeGenerationOptionsBuilder(designTime: false); - configure(builder); - var options = builder.Build(); - - return options; - } - - public static RazorCodeGenerationOptions CreateDesignTime(Action configure) - { - if (configure == null) - { - throw new ArgumentNullException(nameof(configure)); - } - - var builder = new DefaultRazorCodeGenerationOptionsBuilder(designTime: true) - { - SuppressMetadataAttributes = true, - }; - - configure(builder); - var options = builder.Build(); - - return options; - } + private readonly RazorCodeGenerationOptionsFlags _flags = flags; - public abstract bool DesignTime { get; } + public bool DesignTime => _flags.HasFlag(RazorCodeGenerationOptionsFlags.DesignTime); - public abstract bool IndentWithTabs { get; } - - public abstract int IndentSize { get; } + public bool IndentWithTabs => _flags.HasFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs); + public int IndentSize { get; } = indentSize; + public string NewLine { get; } = newLine; /// /// Gets the root namespace for the generated code. /// - public virtual string RootNamespace { get; } + public string? RootNamespace { get; } = rootNamespace; /// /// Gets a value that indicates whether to suppress the default #pragma checksum directive in the @@ -99,7 +34,8 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action#pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public abstract bool SuppressChecksum { get; } + public bool SuppressChecksum + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum); /// /// Gets a value that indicates whether to suppress the default metadata attributes in the generated @@ -117,7 +53,8 @@ public static RazorCodeGenerationOptions CreateDesignTime(ActionMicrosoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public virtual bool SuppressMetadataAttributes { get; protected set; } + public bool SuppressMetadataAttributes + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -126,45 +63,106 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action /// - internal bool SuppressMetadataSourceChecksumAttributes { get; set; } + public bool SuppressMetadataSourceChecksumAttributes + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public virtual bool SuppressPrimaryMethodBody { get; protected set; } + public bool SuppressPrimaryMethodBody + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); /// /// Gets a value that determines if nullability type enforcement should be suppressed for user code. /// - public virtual bool SuppressNullabilityEnforcement { get; } + public bool SuppressNullabilityEnforcement + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); /// /// Gets a value that determines if the components code writer may omit values for minimized attributes. /// - public virtual bool OmitMinimizedComponentAttributeValues { get; } + public bool OmitMinimizedComponentAttributeValues + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); /// /// Gets a value that determines if localized component names are to be supported. /// - public virtual bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); /// /// Gets a value that determines if enhanced line pragmas are to be utilized. /// - public virtual bool UseEnhancedLinePragma { get; } + public bool UseEnhancedLinePragma + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); /// /// Gets a value used for unique ids for testing purposes. Null for unique ids. /// - internal string SuppressUniqueIds { get; private protected init; } + public string? SuppressUniqueIds { get; } = suppressUniqueIds; /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - internal bool SuppressAddComponentParameter { get; private protected init; } + public bool SuppressAddComponentParameter + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - public bool RemapLinePragmaPathsOnWindows { get; private protected init; } + public bool RemapLinePragmaPathsOnWindows + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); + + public static RazorCodeGenerationOptions Default { get; } = new RazorCodeGenerationOptions( + flags: RazorCodeGenerationOptionsFlags.DefaultFlags, + indentSize: 4, + newLine: Environment.NewLine, + rootNamespace: null, + suppressUniqueIds: null); + + public static RazorCodeGenerationOptions DesignTimeDefault { get; } = new RazorCodeGenerationOptions( + flags: RazorCodeGenerationOptionsFlags.DefaultDesignTimeFlags, + indentSize: 4, + newLine: Environment.NewLine, + rootNamespace: null, + suppressUniqueIds: null); + + public static RazorCodeGenerationOptions Create(Action configure) + { + ArgHelper.ThrowIfNull(configure); + + var builder = new RazorCodeGenerationOptionsBuilder(designTime: false); + configure(builder); + var options = builder.Build(); + + return options; + } + + public static RazorCodeGenerationOptions CreateDesignTime(Action configure) + { + ArgHelper.ThrowIfNull(configure); + + var builder = new RazorCodeGenerationOptionsBuilder(designTime: true) + { + SuppressMetadataAttributes = true, + }; + + configure(builder); + var options = builder.Build(); + + return options; + } + + public RazorCodeGenerationOptionsBuilder ToBuilder() + { + var builder = new RazorCodeGenerationOptionsBuilder(_flags) + { + IndentSize = IndentSize, + NewLine = NewLine, + RootNamespace = RootNamespace, + SuppressUniqueIds = SuppressUniqueIds + }; + + return builder; + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs index e80598b6177..0e9caed4b26 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs @@ -1,26 +1,40 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable +using System; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorCodeGenerationOptionsBuilder +public sealed class RazorCodeGenerationOptionsBuilder { - public virtual RazorConfiguration Configuration => null; + private RazorCodeGenerationOptionsFlags _flags; + private string _newLine = Environment.NewLine; - public abstract bool DesignTime { get; } + public RazorConfiguration? Configuration { get; } - public virtual string FileKind => null; + public bool DesignTime => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.DesignTime); - public abstract int IndentSize { get; set; } + public int IndentSize { get; set; } = 4; - public abstract bool IndentWithTabs { get; set; } + public string NewLine + { + get => _newLine; + set + { + _newLine = value ?? Environment.NewLine; + } + } + + public bool IndentWithTabs + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.IndentWithTabs); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs, value); + } /// /// Gets or sets the root namespace of the generated code. /// - public virtual string RootNamespace { get; set; } + public string? RootNamespace { get; set; } /// /// Gets or sets a value that indicates whether to suppress the default #pragma checksum directive in the @@ -31,7 +45,11 @@ public abstract class RazorCodeGenerationOptionsBuilder /// The #pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public abstract bool SuppressChecksum { get; set; } + public bool SuppressChecksum + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressChecksum); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum, value); + } /// /// Gets or sets a value that indicates whether to suppress the default metadata attributes in the generated @@ -49,7 +67,11 @@ public abstract class RazorCodeGenerationOptionsBuilder /// a reference to Microsoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public virtual bool SuppressMetadataAttributes { get; set; } + public bool SuppressMetadataAttributes + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes, value); + } /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -58,51 +80,114 @@ public abstract class RazorCodeGenerationOptionsBuilder /// edit are treated as rude edits by hot reload. /// /// - internal bool SuppressMetadataSourceChecksumAttributes { get; set; } + public bool SuppressMetadataSourceChecksumAttributes + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes, value); + } /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public virtual bool SuppressPrimaryMethodBody { get; set; } + public bool SuppressPrimaryMethodBody + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody, value); + } /// /// Gets or sets a value that determines if nullability type enforcement should be suppressed for user code. /// - public virtual bool SuppressNullabilityEnforcement { get; set; } + public bool SuppressNullabilityEnforcement + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement, value); + } /// /// Gets or sets a value that determines if the components code writer may omit values for minimized attributes. /// - public virtual bool OmitMinimizedComponentAttributeValues { get; set; } + public bool OmitMinimizedComponentAttributeValues + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues, value); + } /// /// Gets or sets a value that determines if localized component names are to be supported. /// - public virtual bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames, value); + } /// /// Gets or sets a value that determines if enhanced line pragmas are to be utilized. /// - public virtual bool UseEnhancedLinePragma { get; set; } + public bool UseEnhancedLinePragma + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma, value); + } /// /// Gets or sets a value that determines if unique ids are suppressed for testing. /// - internal string SuppressUniqueIds { get; set; } + public string? SuppressUniqueIds { get; set; } /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - internal bool SuppressAddComponentParameter { get; set; } + public bool SuppressAddComponentParameter + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter, value); + } /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - internal bool RemapLinePragmaPathsOnWindows { get; set; } + public bool RemapLinePragmaPathsOnWindows + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows, value); + } + + public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration) + { + ArgHelper.ThrowIfNull(configuration); + + Configuration = configuration; + if (configuration.SuppressAddComponentParameter) + { + _flags.SetFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); + } + } + + public RazorCodeGenerationOptionsBuilder(RazorCodeGenerationOptionsFlags flags) + { + _flags = flags; + } + + public RazorCodeGenerationOptionsBuilder(bool designTime) + { + if (designTime) + { + _flags = RazorCodeGenerationOptionsFlags.DesignTime; + } + } - public abstract RazorCodeGenerationOptions Build(); + public RazorCodeGenerationOptions Build() + => new( + _flags, + IndentSize, + NewLine, + RootNamespace, + SuppressUniqueIds); - public virtual void SetDesignTime(bool designTime) + public void SetDesignTime(bool value) { + _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.DesignTime, value); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs new file mode 100644 index 00000000000..f0c651e8e40 --- /dev/null +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs @@ -0,0 +1,26 @@ +// 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 Microsoft.AspNetCore.Razor.Language; + +[Flags] +public enum RazorCodeGenerationOptionsFlags +{ + DesignTime = 1 << 0, + IndentWithTabs = 1 << 1, + SuppressChecksum = 1 << 2, + SuppressMetadataAttributes = 1 << 3, + SuppressMetadataSourceChecksumAttributes = 1 << 4, + SuppressPrimaryMethodBody = 1 << 5, + SuppressNullabilityEnforcement = 1 << 6, + OmitMinimizedComponentAttributeValues = 1 << 7, + SupportLocalizedComponentNames = 1 << 8, + UseEnhancedLinePragma = 1 << 9, + SuppressAddComponentParameter = 1 << 10, + RemapLinePragmaPathsOnWindows = 1 << 11, + + DefaultFlags = UseEnhancedLinePragma, + DefaultDesignTimeFlags = DesignTime | SuppressMetadataAttributes | UseEnhancedLinePragma | RemapLinePragmaPathsOnWindows +} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs index 33f6e744b0e..83cd64698d1 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs @@ -11,20 +11,23 @@ public sealed record class RazorConfiguration( RazorLanguageVersion LanguageVersion, string ConfigurationName, ImmutableArray Extensions, - LanguageServerFlags? LanguageServerFlags = null, - bool UseConsolidatedMvcViews = false) + bool UseConsolidatedMvcViews = true, + bool SuppressAddComponentParameter = false, + LanguageServerFlags? LanguageServerFlags = null) { public static readonly RazorConfiguration Default = new( RazorLanguageVersion.Latest, ConfigurationName: "unnamed", Extensions: [], - LanguageServerFlags: null, - UseConsolidatedMvcViews: false); + UseConsolidatedMvcViews: true, + SuppressAddComponentParameter: false, + LanguageServerFlags: null); public bool Equals(RazorConfiguration? other) => other is not null && LanguageVersion == other.LanguageVersion && ConfigurationName == other.ConfigurationName && + SuppressAddComponentParameter == other.SuppressAddComponentParameter && LanguageServerFlags == other.LanguageServerFlags && UseConsolidatedMvcViews == other.UseConsolidatedMvcViews && Extensions.SequenceEqual(other.Extensions); @@ -35,6 +38,7 @@ public override int GetHashCode() hash.Add(LanguageVersion); hash.Add(ConfigurationName); hash.Add(Extensions); + hash.Add(SuppressAddComponentParameter); hash.Add(UseConsolidatedMvcViews); hash.Add(LanguageServerFlags); return hash; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorHtmlWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorHtmlWriter.cs index 39586c97e5f..b506b8bcd95 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorHtmlWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorHtmlWriter.cs @@ -37,6 +37,12 @@ internal class RazorHtmlWriter : SyntaxWalker, IDisposable private SourceSpan _lastOriginalSourceSpan = SourceSpan.Undefined; private SourceSpan _lastGeneratedSourceSpan = SourceSpan.Undefined; + // Rather than writing out C# characters as we find them (as '~') we keep a count so that consecutive characters + // can be written as a block, allowing any block of 4 characters or more to be written as a comment (ie '/**/`) + // which takes pressure off the TypeScript/JavaScript compiler. Doing this per token means we can end up with + // "@className" being written as '~/*~~~~~*/', which means Html formatting will insert a space which breaks things. + private int _csharpCharacterCount; + private RazorHtmlWriter(RazorSourceDocument source) { if (source is null) @@ -97,6 +103,8 @@ public void Visit(RazorSyntaxTree syntaxTree) { Visit(syntaxTree.Root); + WriteDeferredCSharpContent(); + if (_lastGeneratedSourceSpan != SourceSpan.Undefined) { // If we finished up with a source mapping being tracked, then add it to the list now @@ -192,6 +200,8 @@ private void WriteToken(SyntaxToken token) var content = token.Content; if (_isHtml) { + WriteDeferredCSharpContent(); + var source = token.GetSourceSpan(Source); // No point source mapping an empty token @@ -256,12 +266,52 @@ private void WriteToken(SyntaxToken token) { if (char.IsWhiteSpace(c)) { + WriteDeferredCSharpContent(); Builder.Write(c.ToString()); } else { - Builder.Write("~"); + _csharpCharacterCount++; + } + } + } + + private void WriteDeferredCSharpContent() + { + if (_csharpCharacterCount == 0) + { + return; + } + + Builder.Write(_csharpCharacterCount switch + { + // Less than 4 chars, just use tildes. We can't do anything more fancy in a small space + 1 => "~", + 2 => "~~", + 3 => "~~~", + + // Special case for unquoted attributes that appear at the end of a tag. eg `
` + // Without this special handling, our replacement would result in `
` which differs + // from the original meaning, as the div is now self-closing. + // Note that we don't actually know if we're in an attribute here, or some other construct, but false + // positives are totally fine in this scenario. + _ when NextCharacterIsGreaterThanSymbol() => new string('~', _csharpCharacterCount), + + // All other cases, use a comment to relieve pressure on the JS/TS compiler + _ => "/*" + new string('~', _csharpCharacterCount - 4) + "*/", + }); + _csharpCharacterCount = 0; + + bool NextCharacterIsGreaterThanSymbol() + { + var sourceText = Source.Text; + var index = Builder.Location.AbsoluteIndex + _csharpCharacterCount; + if (sourceText.Length <= index) + { + return false; } + + return sourceText[index] == '>'; } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs index 81afcdf946c..3675b59bf42 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs @@ -185,7 +185,7 @@ internal RazorCodeDocument CreateCodeDocumentCore( ConfigureParserOptions(builder); configureParser?.Invoke(builder); }); - var codeGenerationOptions = GetRequiredFeature().Create(fileKind, builder => + var codeGenerationOptions = GetRequiredFeature().Create(builder => { ConfigureCodeGenerationOptions(builder); configureCodeGeneration?.Invoke(builder); @@ -261,7 +261,7 @@ private RazorCodeDocument CreateCodeDocumentDesignTimeCore( ConfigureDesignTimeParserOptions(builder); configureParser?.Invoke(builder); }); - var codeGenerationOptions = GetRequiredFeature().Create(fileKind, builder => + var codeGenerationOptions = GetRequiredFeature().Create(builder => { ConfigureDesignTimeCodeGenerationOptions(builder); configureCodeGeneration?.Invoke(builder); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs index 0796773b172..e183f617492 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs @@ -1,72 +1,80 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using System; -using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorSyntaxTree +public sealed class RazorSyntaxTree { - internal static RazorSyntaxTree Create( + internal SyntaxNode Root { get; } + public RazorParserOptions Options { get; } + public RazorSourceDocument Source { get; } + + private readonly ImmutableArray _diagnostics; + private ImmutableArray _allDiagnostics; + + internal RazorSyntaxTree( SyntaxNode root, RazorSourceDocument source, - IEnumerable diagnostics, + ImmutableArray diagnostics, RazorParserOptions options) { - if (root == null) - { - throw new ArgumentNullException(nameof(root)); - } - - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } - - if (diagnostics == null) - { - throw new ArgumentNullException(nameof(diagnostics)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - return new DefaultRazorSyntaxTree(root, source, new List(diagnostics), options); + ArgHelper.ThrowIfNull(root); + ArgHelper.ThrowIfNull(source); + ArgHelper.ThrowIfNull(options); + + Root = root; + Source = source; + _diagnostics = diagnostics.NullToEmpty(); + Options = options; } - public static RazorSyntaxTree Parse(RazorSourceDocument source) + public ImmutableArray Diagnostics { - if (source == null) + get { - throw new ArgumentNullException(nameof(source)); + if (_allDiagnostics.IsDefault) + { + ImmutableInterlocked.InterlockedInitialize(ref _allDiagnostics, ComputeAllDiagnostics(_diagnostics, Root)); + } + + return _allDiagnostics; + + static ImmutableArray ComputeAllDiagnostics(ImmutableArray treeDiagnostics, SyntaxNode root) + { + using var pooledList = ListPool.GetPooledObject(out var rootDiagnostics); + using var diagnosticSet = new PooledHashSet(); + + foreach (var diagnostic in treeDiagnostics) + { + diagnosticSet.Add(diagnostic); + } + + root.CollectAllDiagnostics(rootDiagnostics); + + if (rootDiagnostics.Count > 0) + { + foreach (var diagnostic in rootDiagnostics) + { + diagnosticSet.Add(diagnostic); + } + } + + return diagnosticSet.OrderByAsArray(static d => d.Span.AbsoluteIndex); + } } - - return Parse(source, options: null); } - public static RazorSyntaxTree Parse(RazorSourceDocument source, RazorParserOptions options) + public static RazorSyntaxTree Parse(RazorSourceDocument source, RazorParserOptions? options = null) { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgHelper.ThrowIfNull(source); - var parser = new RazorParser(options ?? RazorParserOptions.CreateDefault()); + options ??= RazorParserOptions.CreateDefault(); + var parser = new RazorParser(options); return parser.Parse(source); } - - public abstract IReadOnlyList Diagnostics { get; } - - public abstract RazorParserOptions Options { get; } - - internal abstract SyntaxNode Root { get; } - - public abstract RazorSourceDocument Source { get; } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs index 919e5fbc4b2..4686220fafa 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs @@ -108,6 +108,11 @@ internal SourceSpan With(int length, int endCharacterIndex) endCharacterIndex); } + internal readonly SourceSpan GetZeroWidthEndSpan() + { + return new SourceSpan(FilePath, AbsoluteIndex + EndCharacterIndex, LineIndex, characterIndex: EndCharacterIndex, length: 0, lineCount: 0, EndCharacterIndex); + } + public static bool operator ==(SourceSpan left, SourceSpan right) { return left.Equals(right); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/GreenNodeExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/GreenNodeExtensions.cs index 23224cd0b22..1ea13b6c678 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/GreenNodeExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/GreenNodeExtensions.cs @@ -3,9 +3,9 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; +using System.Collections.Immutable; +using System.Runtime.InteropServices; namespace Microsoft.AspNetCore.Razor.Language.Syntax; @@ -52,8 +52,16 @@ public static TNode WithAnnotationsGreen(this TNode node, params SyntaxAn } } - public static TNode WithDiagnosticsGreen(this TNode node, params RazorDiagnostic[] diagnostics) where TNode : GreenNode + public static TNode WithDiagnosticsGreen(this TNode node, RazorDiagnostic[] diagnostics) + where TNode : GreenNode { return (TNode)node.SetDiagnostics(diagnostics); } + + public static TNode WithDiagnosticsGreen(this TNode node, params ImmutableArray diagnostics) + where TNode : GreenNode + { + var array = ImmutableCollectionsMarshal.AsArray(diagnostics); + return node.WithDiagnosticsGreen(array); + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs index 679880c8c13..9e77cd660a5 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs @@ -42,14 +42,13 @@ public static TNode WithDiagnostics(this TNode node, params RazorDiagnost return (TNode)node.Green.SetDiagnostics(diagnostics).CreateRed(node.Parent, node.Position); } - public static TNode AppendDiagnostic(this TNode node, params RazorDiagnostic[] diagnostics) where TNode : SyntaxNode + public static TNode AppendDiagnostic(this TNode node, params ReadOnlySpan diagnostics) where TNode : SyntaxNode { - var existingDiagnostics = node.GetDiagnostics(); - var allDiagnostics = new RazorDiagnostic[diagnostics.Length + existingDiagnostics.Length]; - Array.Copy(existingDiagnostics, allDiagnostics, existingDiagnostics.Length); - Array.Copy(diagnostics, 0, allDiagnostics, existingDiagnostics.Length, diagnostics.Length); + RazorDiagnostic[] allDiagnostics = [ + .. node.GetDiagnostics(), + .. diagnostics]; - return (TNode)node.WithDiagnostics(allDiagnostics); + return node.WithDiagnostics(allDiagnostics); } /// @@ -57,13 +56,13 @@ public static TNode AppendDiagnostic(this TNode node, params RazorDiagnos /// /// The type of syntax node. /// The syntax node. - /// The list of s. - public static IReadOnlyList GetAllDiagnostics(this TNode node) where TNode : SyntaxNode + /// + /// The list of RazorDiagnostics. + public static void CollectAllDiagnostics(this TNode node, List list) + where TNode : SyntaxNode { - var walker = new DiagnosticSyntaxWalker(); + var walker = new DiagnosticSyntaxWalker(list); walker.Visit(node); - - return walker.Diagnostics; } public static SourceLocation GetSourceLocation(this SyntaxNode node, RazorSourceDocument source) @@ -211,16 +210,9 @@ public static string GetContent(this TNode node) where TNode : SyntaxNode return writer.ToString(); } - private class DiagnosticSyntaxWalker : SyntaxWalker + private sealed class DiagnosticSyntaxWalker(List diagnostics) : SyntaxWalker { - private readonly List _diagnostics; - - public DiagnosticSyntaxWalker() - { - _diagnostics = new List(); - } - - public IReadOnlyList Diagnostics => _diagnostics; + private readonly List _diagnostics = diagnostics ?? []; public override void Visit(SyntaxNode node) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Microsoft.CodeAnalysis.Razor.Compiler.csproj b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Microsoft.CodeAnalysis.Razor.Compiler.csproj index deca9b6930d..6f611c0c931 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Microsoft.CodeAnalysis.Razor.Compiler.csproj +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Microsoft.CodeAnalysis.Razor.Compiler.csproj @@ -3,7 +3,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor compiler. $(DefaultNetCoreTargetFramework);netstandard2.0 - false + false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - View component '{0}' must have exactly one public method named '{1}' or '{2}'. - - - Method '{0}' of view component '{1}' should be declared to return {2}&lt;T&gt;. - - - Could not find an '{0}' or '{1}' method for the view component '{2}'. - - - Method '{0}' of view component '{1}' cannot return a {2}. - - - Method '{0}' of view component '{1}' should be declared to return a value. - - \ No newline at end of file diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperConventions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperConventions.cs deleted file mode 100644 index 36209ccc35b..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperConventions.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -public static class ViewComponentTagHelperConventions -{ - public static readonly string Kind = "MVC.ViewComponent"; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperIntermediateNode.cs deleted file mode 100644 index 94bb3c5a296..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperIntermediateNode.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -public sealed class ViewComponentTagHelperIntermediateNode : ExtensionIntermediateNode -{ - public override IntermediateNodeCollection Children { get; } = IntermediateNodeCollection.ReadOnly; - - public string ClassName { get; set; } - - public TagHelperDescriptor TagHelper { get; set; } - - public override void Accept(IntermediateNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - AcceptExtensionNode(this, visitor); - } - - public override void WriteNode(CodeTarget target, CodeRenderingContext context) - { - if (target == null) - { - throw new ArgumentNullException(nameof(target)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - var extension = target.GetExtension(); - if (extension == null) - { - ReportMissingCodeTargetExtension(context); - return; - } - - extension.WriteViewComponentTagHelper(context, this); - } - - public override void FormatNode(IntermediateNodeFormatter formatter) - { - formatter.WriteContent(ClassName); - - formatter.WriteProperty(nameof(ClassName), ClassName); - formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperMetadata.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperMetadata.cs deleted file mode 100644 index e3482905abe..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperMetadata.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -public static class ViewComponentTagHelperMetadata -{ - /// - /// The key in a containing - /// the short name of a view component. - /// - public static readonly string Name = "MVC.ViewComponent.Name"; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperPass.cs deleted file mode 100644 index da44cacbf7c..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTagHelperPass.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Extensions; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -public class ViewComponentTagHelperPass : IntermediateNodePassBase, IRazorOptimizationPass -{ - // Run after the default taghelper pass - public override int Order => IntermediateNodePassBase.DefaultFeatureOrder + 2000; - - protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) - { - var @namespace = documentNode.FindPrimaryNamespace(); - var @class = documentNode.FindPrimaryClass(); - if (@namespace == null || @class == null) - { - // Nothing to do, bail. We can't function without the standard structure. - return; - } - - var context = new Context(@namespace, @class); - - // For each VCTH *usage* we need to rewrite the tag helper node to use the tag helper runtime to construct - // and set properties on the the correct field, and using the name of the type we will generate. - var nodes = documentNode.FindDescendantNodes(); - for (var i = 0; i < nodes.Count; i++) - { - var node = nodes[i]; - foreach (var tagHelper in node.TagHelpers) - { - RewriteUsage(context, node, tagHelper); - } - } - - // Then for each VCTH *definition* that we've seen we need to generate the class that implements - // ITagHelper and the field that will hold it. - foreach (var tagHelper in context.TagHelpers) - { - AddField(context, tagHelper); - AddTagHelperClass(context, tagHelper); - } - } - - private void RewriteUsage(Context context, TagHelperIntermediateNode node, TagHelperDescriptor tagHelper) - { - if (!tagHelper.IsViewComponentKind()) - { - return; - } - - context.Add(tagHelper); - - // Now we need to insert a create node using the default tag helper runtime. This is similar to - // code in DefaultTagHelperOptimizationPass. - // - // Find the body node. - var i = 0; - while (i < node.Children.Count && node.Children[i] is TagHelperBodyIntermediateNode) - { - i++; - } - while (i < node.Children.Count && node.Children[i] is DefaultTagHelperBodyIntermediateNode) - { - i++; - } - - // Now find the last create node. - while (i < node.Children.Count && node.Children[i] is DefaultTagHelperCreateIntermediateNode) - { - i++; - } - - // Now i has the right insertion point. - node.Children.Insert(i, new DefaultTagHelperCreateIntermediateNode() - { - FieldName = context.GetFieldName(tagHelper), - TagHelper = tagHelper, - TypeName = context.GetFullyQualifiedName(tagHelper), - }); - - // Now we need to rewrite any set property nodes to use the default runtime. - for (i = 0; i < node.Children.Count; i++) - { - if (node.Children[i] is TagHelperPropertyIntermediateNode propertyNode && - propertyNode.TagHelper == tagHelper) - { - // This is a set property for this VCTH - we need to replace it with a node - // that will use our field and property name. - node.Children[i] = new DefaultTagHelperPropertyIntermediateNode(propertyNode) - { - FieldName = context.GetFieldName(tagHelper), - PropertyName = propertyNode.BoundAttribute.GetPropertyName(), - }; - } - } - } - - private void AddField(Context context, TagHelperDescriptor tagHelper) - { - // We need to insert a node for the field that will hold the tag helper. We've already generated a field name - // at this time and use it for all uses of the same tag helper type. - // - // We also want to preserve the ordering of the nodes for testability. So insert at the end of any existing - // field nodes. - var i = 0; - while (i < context.Class.Children.Count && context.Class.Children[i] is DefaultTagHelperRuntimeIntermediateNode) - { - i++; - } - - while (i < context.Class.Children.Count && context.Class.Children[i] is FieldDeclarationIntermediateNode) - { - i++; - } - - context.Class.Children.Insert(i, new FieldDeclarationIntermediateNode() - { - Annotations = - { - { CommonAnnotations.DefaultTagHelperExtension.TagHelperField, bool.TrueString }, - }, - Modifiers = - { - "private", - }, - FieldName = context.GetFieldName(tagHelper), - FieldType = "global::" + context.GetFullyQualifiedName(tagHelper), - }); - } - - private void AddTagHelperClass(Context context, TagHelperDescriptor tagHelper) - { - var node = new ViewComponentTagHelperIntermediateNode() - { - ClassName = context.GetClassName(tagHelper), - TagHelper = tagHelper - }; - - context.Class.Children.Add(node); - } - - private struct Context - { - private readonly Dictionary _tagHelpers; - - public Context(NamespaceDeclarationIntermediateNode @namespace, ClassDeclarationIntermediateNode @class) - { - Namespace = @namespace; - Class = @class; - - _tagHelpers = new Dictionary(); - } - - public ClassDeclarationIntermediateNode Class { get; } - - public NamespaceDeclarationIntermediateNode Namespace { get; } - - - public IEnumerable TagHelpers => _tagHelpers.Keys; - - public bool Add(TagHelperDescriptor tagHelper) - { - if (_tagHelpers.ContainsKey(tagHelper)) - { - return false; - } - - var className = $"__Generated__{tagHelper.GetViewComponentName()}ViewComponentTagHelper"; - var namespaceSeparator = string.IsNullOrEmpty(Namespace.Content) ? string.Empty : "."; - var fullyQualifiedName = $"{Namespace.Content}{namespaceSeparator}{Class.ClassName}.{className}"; - var fieldName = GenerateFieldName(tagHelper); - - _tagHelpers.Add(tagHelper, (className, fullyQualifiedName, fieldName)); - - return true; - } - - public string GetClassName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].className; - } - - public string GetFullyQualifiedName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].fullyQualifiedName; - } - - public string GetFieldName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].fieldName; - } - - private static string GenerateFieldName(TagHelperDescriptor tagHelper) - { - return $"__{tagHelper.GetViewComponentName()}ViewComponentTagHelper"; - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypeVisitor.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypeVisitor.cs deleted file mode 100644 index 610fa47c60b..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypeVisitor.cs +++ /dev/null @@ -1,83 +0,0 @@ -// 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 Microsoft.CodeAnalysis; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -internal sealed class ViewComponentTypeVisitor : SymbolVisitor -{ - private readonly INamedTypeSymbol _viewComponentAttribute; - private readonly INamedTypeSymbol? _nonViewComponentAttribute; - private readonly List _results; - - public ViewComponentTypeVisitor( - INamedTypeSymbol viewComponentAttribute, - INamedTypeSymbol? nonViewComponentAttribute, - List results) - { - _viewComponentAttribute = viewComponentAttribute; - _nonViewComponentAttribute = nonViewComponentAttribute; - _results = results; - } - - public override void VisitNamedType(INamedTypeSymbol symbol) - { - if (IsViewComponent(symbol)) - { - _results.Add(symbol); - } - - if (symbol.DeclaredAccessibility != Accessibility.Public) - { - return; - } - - foreach (var member in symbol.GetTypeMembers()) - { - Visit(member); - } - } - - public override void VisitNamespace(INamespaceSymbol symbol) - { - foreach (var member in symbol.GetMembers()) - { - Visit(member); - } - } - - internal bool IsViewComponent(INamedTypeSymbol symbol) - { - if (symbol.DeclaredAccessibility != Accessibility.Public || - symbol.IsAbstract || - symbol.IsGenericType || - AttributeIsDefined(symbol, _nonViewComponentAttribute)) - { - return false; - } - - return symbol.Name.EndsWith(ViewComponentTypes.ViewComponentSuffix, StringComparison.Ordinal) || - AttributeIsDefined(symbol, _viewComponentAttribute); - } - - private static bool AttributeIsDefined(INamedTypeSymbol? type, INamedTypeSymbol? queryAttribute) - { - if (type == null || queryAttribute == null) - { - return false; - } - - foreach (var attribute in type.GetAttributes()) - { - if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, queryAttribute)) - { - return true; - } - } - - return AttributeIsDefined(type.BaseType, queryAttribute); - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypes.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypes.cs deleted file mode 100644 index b35773f97c3..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/ViewComponentTypes.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; - -internal static class ViewComponentTypes -{ - public const string Assembly = "Microsoft.AspNetCore.Mvc.ViewFeatures"; - - public static readonly Version AssemblyVersion = new Version(1, 1, 0, 0); - - public const string ViewComponentSuffix = "ViewComponent"; - - public const string ViewComponentAttribute = "Microsoft.AspNetCore.Mvc.ViewComponentAttribute"; - - public const string NonViewComponentAttribute = "Microsoft.AspNetCore.Mvc.NonViewComponentAttribute"; - - public const string GenericTask = "System.Threading.Tasks.Task`1"; - - public const string Task = "System.Threading.Tasks.Task"; - - public const string IDictionary = "System.Collections.Generic.IDictionary`2"; - - public const string AsyncMethodName = "InvokeAsync"; - - public const string SyncMethodName = "Invoke"; - - public static class ViewComponent - { - public const string Name = "Name"; - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IInjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IInjectTargetExtension.cs deleted file mode 100644 index 2ef6196f57d..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IInjectTargetExtension.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public interface IInjectTargetExtension : ICodeTargetExtension -{ - void WriteInjectProperty(CodeRenderingContext context, InjectIntermediateNode node); -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IViewComponentTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IViewComponentTagHelperTargetExtension.cs deleted file mode 100644 index d78f7e1d91b..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/IViewComponentTagHelperTargetExtension.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public interface IViewComponentTagHelperTargetExtension : ICodeTargetExtension -{ - void WriteViewComponentTagHelper(CodeRenderingContext context, ViewComponentTagHelperIntermediateNode node); -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs deleted file mode 100644 index 1ad821bc8a6..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public static class InjectDirective -{ - public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective( - "inject", - DirectiveKind.SingleLine, - builder => - { - builder - .AddTypeToken(Resources.InjectDirective_TypeToken_Name, Resources.InjectDirective_TypeToken_Description) - .AddMemberToken(Resources.InjectDirective_MemberToken_Name, Resources.InjectDirective_MemberToken_Description); - - builder.Usage = DirectiveUsage.FileScopedMultipleOccurring; - builder.Description = Resources.InjectDirective_Description; - }); - - public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - builder.AddTargetExtension(new InjectTargetExtension()); - return builder; - } - - internal class Pass : IntermediateNodePassBase, IRazorDirectiveClassifierPass - { - // Runs after the @model and @namespace directives - public override int Order => 10; - - protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) - { - var visitor = new Visitor(); - visitor.Visit(documentNode); - var modelType = ModelDirective.GetModelType(documentNode); - - var properties = new HashSet(StringComparer.Ordinal); - - for (var i = visitor.Directives.Count - 1; i >= 0; i--) - { - var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } - - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; - - if (!properties.Add(memberName)) - { - continue; - } - - const string tModel = ""; - if (typeName.EndsWith(tModel, StringComparison.Ordinal)) - { - typeName = typeName[..^tModel.Length] + "<" + modelType + ">"; - if (typeSpan.HasValue) - { - typeSpan = new SourceSpan(typeSpan.Value.FilePath, typeSpan.Value.AbsoluteIndex, typeSpan.Value.LineIndex, typeSpan.Value.CharacterIndex, typeSpan.Value.Length - tModel.Length, typeSpan.Value.LineCount, typeSpan.Value.EndCharacterIndex - tModel.Length); - } - } - - var injectNode = new InjectIntermediateNode() - { - TypeName = typeName, - MemberName = memberName, - TypeSource = typeSpan, - MemberSource = memberSpan - }; - - visitor.Class.Children.Add(injectNode); - } - } - } - - private class Visitor : IntermediateNodeWalker - { - public ClassDeclarationIntermediateNode Class { get; private set; } - - public IList Directives { get; } = new List(); - - public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) - { - if (Class == null) - { - Class = node; - } - - base.VisitClassDeclaration(node); - } - - public override void VisitDirective(DirectiveIntermediateNode node) - { - if (node.Directive == Directive) - { - Directives.Add(node); - } - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs deleted file mode 100644 index 9cab9ce14e5..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public class InjectIntermediateNode : ExtensionIntermediateNode -{ - public string TypeName { get; set; } - - public string MemberName { get; set; } - - public SourceSpan? TypeSource { get; set; } - - public SourceSpan? MemberSource { get; set; } - - public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; - - public override void Accept(IntermediateNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - AcceptExtensionNode(this, visitor); - } - - public override void WriteNode(CodeTarget target, CodeRenderingContext context) - { - if (target == null) - { - throw new ArgumentNullException(nameof(target)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - var extension = target.GetExtension(); - if (extension == null) - { - ReportMissingCodeTargetExtension(context); - return; - } - - extension.WriteInjectProperty(context, this); - } - - public override void FormatNode(IntermediateNodeFormatter formatter) - { - formatter.WriteContent(MemberName); - - formatter.WriteProperty(nameof(MemberName), MemberName); - formatter.WriteProperty(nameof(TypeName), TypeName); - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs deleted file mode 100644 index 64475550420..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public class InjectTargetExtension : IInjectTargetExtension -{ - private const string RazorInjectAttribute = "[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]"; - - public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediateNode node) - { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (!context.Options.DesignTime && !string.IsNullOrWhiteSpace(node.TypeSource?.FilePath)) - { - context.CodeWriter.WriteLine(RazorInjectAttribute); - context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, node.MemberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); - } - else - { - var property = $"public {node.TypeName} {node.MemberName} {{ get; private set; }}"; - - if (node.Source.HasValue) - { - using (context.CodeWriter.BuildLinePragma(node.Source.Value, context)) - { - context.CodeWriter - .WriteLine(RazorInjectAttribute) - .WriteLine(property); - } - } - else - { - context.CodeWriter - .WriteLine(RazorInjectAttribute) - .WriteLine(property); - } - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelDirective.cs deleted file mode 100644 index e3394de7553..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelDirective.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public static class ModelDirective -{ - public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective( - "model", - DirectiveKind.SingleLine, - builder => - { - builder.AddTypeToken(Resources.ModelDirective_TypeToken_Name, Resources.ModelDirective_TypeToken_Description); - builder.Usage = DirectiveUsage.FileScopedSinglyOccurring; - builder.Description = Resources.ModelDirective_Description; - }); - - public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - builder.Features.Add(new Pass()); - return builder; - } - - public static string GetModelType(DocumentIntermediateNode document) - { - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - var visitor = new Visitor(); - return GetModelType(document, visitor); - } - - private static string GetModelType(DocumentIntermediateNode document, Visitor visitor) - { - visitor.Visit(document); - - for (var i = visitor.ModelDirectives.Count - 1; i >= 0; i--) - { - var directive = visitor.ModelDirectives[i]; - - var tokens = directive.Tokens.ToArray(); - if (tokens.Length >= 1) - { - return tokens[0].Content; - } - } - - if (document.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind) - { - return visitor.Class.ClassName; - } - else - { - return "dynamic"; - } - } - - internal class Pass : IntermediateNodePassBase, IRazorDirectiveClassifierPass - { - // Runs after the @inherits directive - public override int Order => 5; - - protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) - { - var visitor = new Visitor(); - var modelType = GetModelType(documentNode, visitor); - - if (documentNode.Options.DesignTime) - { - // Alias the TModel token to a known type. - // This allows design time compilation to succeed for Razor files where the token isn't replaced. - var typeName = $"global::{typeof(object).FullName}"; - var usingNode = new UsingDirectiveIntermediateNode() - { - Content = $"TModel = {typeName}" - }; - - visitor.Namespace?.Children.Insert(0, usingNode); - } - - var baseType = visitor.Class?.BaseType?.Replace("", "<" + modelType + ">"); - visitor.Class.BaseType = baseType; - } - } - - private class Visitor : IntermediateNodeWalker - { - public NamespaceDeclarationIntermediateNode Namespace { get; private set; } - - public ClassDeclarationIntermediateNode Class { get; private set; } - - public IList ModelDirectives { get; } = new List(); - - public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node) - { - if (Namespace == null) - { - Namespace = node; - } - - base.VisitNamespaceDeclaration(node); - } - - public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) - { - if (Class == null) - { - Class = node; - } - - base.VisitClassDeclaration(node); - } - - public override void VisitDirective(DirectiveIntermediateNode node) - { - if (node.Directive == Directive) - { - ModelDirectives.Add(node); - } - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelExpressionPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelExpressionPass.cs deleted file mode 100644 index 0112b0ef53e..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ModelExpressionPass.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public class ModelExpressionPass : IntermediateNodePassBase, IRazorOptimizationPass -{ - private const string ModelExpressionTypeName = "Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression"; - - protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) - { - var visitor = new Visitor(); - visitor.Visit(documentNode); - } - - private class Visitor : IntermediateNodeWalker - { - public List TagHelpers { get; } = new List(); - - public override void VisitTagHelperProperty(TagHelperPropertyIntermediateNode node) - { - if (string.Equals(node.BoundAttribute.TypeName, ModelExpressionTypeName, StringComparison.Ordinal) || - (node.IsIndexerNameMatch && - string.Equals(node.BoundAttribute.IndexerTypeName, ModelExpressionTypeName, StringComparison.Ordinal))) - { - var expression = new CSharpExpressionIntermediateNode(); - - expression.Children.Add(new IntermediateToken() - { - Kind = TokenKind.CSharp, - Content = "ModelExpressionProvider.CreateModelExpression(ViewData, __model => ", - }); - - if (node.Children.Count == 1 && node.Children[0] is IntermediateToken token && token.IsCSharp) - { - // A 'simple' expression will look like __model => __model.Foo - - expression.Children.Add(new IntermediateToken() - { - Kind = TokenKind.CSharp, - Content = "__model." - }); - - expression.Children.Add(token); - } - else - { - for (var i = 0; i < node.Children.Count; i++) - { - if (node.Children[i] is CSharpExpressionIntermediateNode nestedExpression) - { - for (var j = 0; j < nestedExpression.Children.Count; j++) - { - if (nestedExpression.Children[j] is IntermediateToken cSharpToken && - cSharpToken.IsCSharp) - { - expression.Children.Add(cSharpToken); - } - } - - continue; - } - } - } - - expression.Children.Add(new IntermediateToken() - { - Kind = TokenKind.CSharp, - Content = ")", - }); - - node.Children.Clear(); - - node.Children.Add(expression); - } - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/PageDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/PageDirective.cs deleted file mode 100644 index ef287dfbe44..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/PageDirective.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public class PageDirective -{ - public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective( - "page", - DirectiveKind.SingleLine, - builder => - { - builder.AddOptionalStringToken(Resources.PageDirective_RouteToken_Name, Resources.PageDirective_RouteToken_Description); - builder.Usage = DirectiveUsage.FileScopedSinglyOccurring; - builder.Description = Resources.PageDirective_Description; - }); - - private PageDirective(string routeTemplate, IntermediateNode directiveNode, SourceSpan? source) - { - RouteTemplate = routeTemplate; - DirectiveNode = directiveNode; - Source = source; - } - - public string RouteTemplate { get; } - - public IntermediateNode DirectiveNode { get; } - - public SourceSpan? Source { get; } - - public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder builder) - { - if (builder == null) - { - throw new ArgumentNullException(nameof(builder)); - } - - builder.AddDirective(Directive); - return builder; - } - - public static bool TryGetPageDirective(DocumentIntermediateNode documentNode, out PageDirective pageDirective) - { - var visitor = new Visitor(); - for (var i = 0; i < documentNode.Children.Count; i++) - { - visitor.Visit(documentNode.Children[i]); - } - - if (visitor.DirectiveTokens == null) - { - pageDirective = null; - return false; - } - - var tokens = visitor.DirectiveTokens.ToList(); - string routeTemplate = null; - SourceSpan? sourceSpan = null; - if (tokens.Count > 0) - { - routeTemplate = TrimQuotes(tokens[0].Content); - sourceSpan = tokens[0].Source; - } - - pageDirective = new PageDirective(routeTemplate, visitor.DirectiveNode, sourceSpan); - return true; - } - - private static string TrimQuotes(string content) - { - // Tokens aren't captured if they're malformed. Therefore, this method will - // always be called with a valid token content. - Debug.Assert(content.Length >= 2); - Debug.Assert(content.StartsWith("\"", StringComparison.Ordinal)); - Debug.Assert(content.EndsWith("\"", StringComparison.Ordinal)); - - return content.Substring(1, content.Length - 2); - } - - private class Visitor : IntermediateNodeWalker - { - public IntermediateNode DirectiveNode { get; private set; } - - public IEnumerable DirectiveTokens { get; private set; } - - public override void VisitDirective(DirectiveIntermediateNode node) - { - if (node.Directive == Directive) - { - DirectiveNode = node; - DirectiveTokens = node.Tokens; - } - } - - public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) - { - if (DirectiveTokens == null && node.Directive == Directive) - { - DirectiveNode = node; - DirectiveTokens = node.Tokens; - } - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensions.cs index 0ce365df840..31d4a578270 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensions.cs @@ -21,7 +21,7 @@ public static void Register(RazorProjectEngineBuilder builder) } FunctionsDirective.Register(builder); - InjectDirective.Register(builder); + InjectDirective.Register(builder, considerNullabilityEnforcement: false); ModelDirective.Register(builder); NamespaceDirective.Register(builder); PageDirective.Register(builder); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensionsDiagnosticFactory.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensionsDiagnosticFactory.cs deleted file mode 100644 index 35b15f870ae..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/RazorExtensionsDiagnosticFactory.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.IO; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -internal class RazorExtensionsDiagnosticFactory -{ - private const string DiagnosticPrefix = "RZ"; - - internal static readonly RazorDiagnosticDescriptor ViewComponent_CannotFindMethod = - new($"{DiagnosticPrefix}3900", - ViewComponentResources.ViewComponent_CannotFindMethod, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreateViewComponent_CannotFindMethod(string tagHelperType) - => RazorDiagnostic.Create( - ViewComponent_CannotFindMethod, - new SourceSpan(SourceLocation.Undefined, contentLength: 0), - ViewComponentTypes.SyncMethodName, - ViewComponentTypes.AsyncMethodName, - tagHelperType); - - internal static readonly RazorDiagnosticDescriptor ViewComponent_AmbiguousMethods = - new($"{DiagnosticPrefix}3901", - ViewComponentResources.ViewComponent_AmbiguousMethods, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreateViewComponent_AmbiguousMethods(string tagHelperType) - => RazorDiagnostic.Create( - ViewComponent_AmbiguousMethods, - new SourceSpan(SourceLocation.Undefined, contentLength: 0), - tagHelperType, - ViewComponentTypes.SyncMethodName, - ViewComponentTypes.AsyncMethodName); - - internal static readonly RazorDiagnosticDescriptor ViewComponent_AsyncMethod_ShouldReturnTask = - new($"{DiagnosticPrefix}3902", - ViewComponentResources.ViewComponent_AsyncMethod_ShouldReturnTask, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreateViewComponent_AsyncMethod_ShouldReturnTask(string tagHelperType) - => RazorDiagnostic.Create( - ViewComponent_AsyncMethod_ShouldReturnTask, - new SourceSpan(SourceLocation.Undefined, contentLength: 0), - ViewComponentTypes.AsyncMethodName, - tagHelperType, - nameof(Task)); - - internal static readonly RazorDiagnosticDescriptor ViewComponent_SyncMethod_ShouldReturnValue = - new($"{DiagnosticPrefix}3903", - ViewComponentResources.ViewComponent_SyncMethod_ShouldReturnValue, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreateViewComponent_SyncMethod_ShouldReturnValue(string tagHelperType) - => RazorDiagnostic.Create( - ViewComponent_SyncMethod_ShouldReturnValue, - new SourceSpan(SourceLocation.Undefined, contentLength: 0), - ViewComponentTypes.SyncMethodName, - tagHelperType); - - internal static readonly RazorDiagnosticDescriptor ViewComponent_SyncMethod_CannotReturnTask = - new($"{DiagnosticPrefix}3904", - ViewComponentResources.ViewComponent_SyncMethod_CannotReturnTask, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreateViewComponent_SyncMethod_CannotReturnTask(string tagHelperType) - => RazorDiagnostic.Create( - ViewComponent_SyncMethod_CannotReturnTask, - new SourceSpan(SourceLocation.Undefined, contentLength: 0), - ViewComponentTypes.SyncMethodName, - tagHelperType, - nameof(Task)); - - internal static readonly RazorDiagnosticDescriptor PageDirective_CannotBeImported = - new($"{DiagnosticPrefix}3905", - Resources.PageDirectiveCannotBeImported, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) - { - var fileName = Path.GetFileName(source.FilePath); - - return RazorDiagnostic.Create(PageDirective_CannotBeImported, source, PageDirective.Directive.Directive, fileName); - } - - internal static readonly RazorDiagnosticDescriptor PageDirective_MustExistAtTheTopOfFile = - new($"{DiagnosticPrefix}3906", - Resources.PageDirectiveMustExistAtTheTopOfFile, - RazorDiagnosticSeverity.Error); - - public static RazorDiagnostic CreatePageDirective_MustExistAtTheTopOfFile(SourceSpan source) - => RazorDiagnostic.Create(PageDirective_MustExistAtTheTopOfFile, source, PageDirective.Directive.Directive); -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/Resources.resx b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/Resources.resx index 396e93a69a2..572047d77f7 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/Resources.resx +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/Resources.resx @@ -168,19 +168,4 @@ Namespace - - The '@{0}' directive specified in {1} file will not be imported. The directive must appear at the top of each Razor cshtml file. - - - The '@{0}' directive must precede all other elements defined in a Razor file. - - - Mark the page as a Razor Page. - - - An optional route template for the page. - - - RouteTemplate - \ No newline at end of file diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/TagHelperDescriptorExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/TagHelperDescriptorExtensions.cs deleted file mode 100644 index 61a73b3e228..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/TagHelperDescriptorExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public static class TagHelperDescriptorExtensions -{ - /// - /// Indicates whether a represents a view component. - /// - /// The to check. - /// Whether a represents a view component. - public static bool IsViewComponentKind(this TagHelperDescriptor tagHelper) - { - if (tagHelper == null) - { - throw new ArgumentNullException(nameof(tagHelper)); - } - - return string.Equals(ViewComponentTagHelperConventions.Kind, tagHelper.Kind, StringComparison.Ordinal); - } - - public static string GetViewComponentName(this TagHelperDescriptor tagHelper) - { - if (tagHelper == null) - { - throw new ArgumentNullException(nameof(tagHelper)); - } - - tagHelper.Metadata.TryGetValue(ViewComponentTagHelperMetadata.Name, out var result); - return result; - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentResources.resx b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentResources.resx deleted file mode 100644 index d6aad4ff3fc..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentResources.resx +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - View component '{0}' must have exactly one public method named '{1}' or '{2}'. - - - Method '{0}' of view component '{1}' should be declared to return {2}&lt;T&gt;. - - - Could not find an '{0}' or '{1}' method for the view component '{2}'. - - - Method '{0}' of view component '{1}' cannot return a {2}. - - - Method '{0}' of view component '{1}' should be declared to return a value. - - \ No newline at end of file diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperConventions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperConventions.cs deleted file mode 100644 index 058c20868e3..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperConventions.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public static class ViewComponentTagHelperConventions -{ - public static readonly string Kind = "MVC.ViewComponent"; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperIntermediateNode.cs deleted file mode 100644 index 5f08ef6be68..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperIntermediateNode.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public sealed class ViewComponentTagHelperIntermediateNode : ExtensionIntermediateNode -{ - public override IntermediateNodeCollection Children { get; } = IntermediateNodeCollection.ReadOnly; - - public string ClassName { get; set; } - - public TagHelperDescriptor TagHelper { get; set; } - - public override void Accept(IntermediateNodeVisitor visitor) - { - if (visitor == null) - { - throw new ArgumentNullException(nameof(visitor)); - } - - AcceptExtensionNode(this, visitor); - } - - public override void WriteNode(CodeTarget target, CodeRenderingContext context) - { - if (target == null) - { - throw new ArgumentNullException(nameof(target)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - var extension = target.GetExtension(); - if (extension == null) - { - ReportMissingCodeTargetExtension(context); - return; - } - - extension.WriteViewComponentTagHelper(context, this); - } - - public override void FormatNode(IntermediateNodeFormatter formatter) - { - formatter.WriteContent(ClassName); - - formatter.WriteProperty(nameof(ClassName), ClassName); - formatter.WriteProperty(nameof(TagHelper), TagHelper?.DisplayName); - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperMetadata.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperMetadata.cs deleted file mode 100644 index 88d92b8cc7b..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperMetadata.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public static class ViewComponentTagHelperMetadata -{ - /// - /// The key in a containing - /// the short name of a view component. - /// - public static readonly string Name = "MVC.ViewComponent.Name"; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperPass.cs deleted file mode 100644 index cbacadea315..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTagHelperPass.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Extensions; -using Microsoft.AspNetCore.Razor.Language.Intermediate; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -public class ViewComponentTagHelperPass : IntermediateNodePassBase, IRazorOptimizationPass -{ - // Run after the default taghelper pass - public override int Order => IntermediateNodePassBase.DefaultFeatureOrder + 2000; - - protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) - { - var @namespace = documentNode.FindPrimaryNamespace(); - var @class = documentNode.FindPrimaryClass(); - if (@namespace == null || @class == null) - { - // Nothing to do, bail. We can't function without the standard structure. - return; - } - - var context = new Context(@namespace, @class); - - // For each VCTH *usage* we need to rewrite the tag helper node to use the tag helper runtime to construct - // and set properties on the the correct field, and using the name of the type we will generate. - var nodes = documentNode.FindDescendantNodes(); - for (var i = 0; i < nodes.Count; i++) - { - var node = nodes[i]; - foreach (var tagHelper in node.TagHelpers) - { - RewriteUsage(context, node, tagHelper); - } - } - - // Then for each VCTH *definition* that we've seen we need to generate the class that implements - // ITagHelper and the field that will hold it. - foreach (var tagHelper in context.TagHelpers) - { - AddField(context, tagHelper); - AddTagHelperClass(context, tagHelper); - } - } - - private void RewriteUsage(Context context, TagHelperIntermediateNode node, TagHelperDescriptor tagHelper) - { - if (!tagHelper.IsViewComponentKind()) - { - return; - } - - context.Add(tagHelper); - - // Now we need to insert a create node using the default tag helper runtime. This is similar to - // code in DefaultTagHelperOptimizationPass. - // - // Find the body node. - var i = 0; - while (i < node.Children.Count && node.Children[i] is TagHelperBodyIntermediateNode) - { - i++; - } - while (i < node.Children.Count && node.Children[i] is DefaultTagHelperBodyIntermediateNode) - { - i++; - } - - // Now find the last create node. - while (i < node.Children.Count && node.Children[i] is DefaultTagHelperCreateIntermediateNode) - { - i++; - } - - // Now i has the right insertion point. - node.Children.Insert(i, new DefaultTagHelperCreateIntermediateNode() - { - FieldName = context.GetFieldName(tagHelper), - TagHelper = tagHelper, - TypeName = context.GetFullyQualifiedName(tagHelper), - }); - - // Now we need to rewrite any set property nodes to use the default runtime. - for (i = 0; i < node.Children.Count; i++) - { - if (node.Children[i] is TagHelperPropertyIntermediateNode propertyNode && - propertyNode.TagHelper == tagHelper) - { - // This is a set property for this VCTH - we need to replace it with a node - // that will use our field and property name. - node.Children[i] = new DefaultTagHelperPropertyIntermediateNode(propertyNode) - { - FieldName = context.GetFieldName(tagHelper), - PropertyName = propertyNode.BoundAttribute.GetPropertyName(), - }; - } - } - } - - private void AddField(Context context, TagHelperDescriptor tagHelper) - { - // We need to insert a node for the field that will hold the tag helper. We've already generated a field name - // at this time and use it for all uses of the same tag helper type. - // - // We also want to preserve the ordering of the nodes for testability. So insert at the end of any existing - // field nodes. - var i = 0; - while (i < context.Class.Children.Count && context.Class.Children[i] is DefaultTagHelperRuntimeIntermediateNode) - { - i++; - } - - while (i < context.Class.Children.Count && context.Class.Children[i] is FieldDeclarationIntermediateNode) - { - i++; - } - - context.Class.Children.Insert(i, new FieldDeclarationIntermediateNode() - { - Annotations = - { - { CommonAnnotations.DefaultTagHelperExtension.TagHelperField, bool.TrueString }, - }, - Modifiers = - { - "private", - }, - FieldName = context.GetFieldName(tagHelper), - FieldType = "global::" + context.GetFullyQualifiedName(tagHelper), - }); - } - - private void AddTagHelperClass(Context context, TagHelperDescriptor tagHelper) - { - var node = new ViewComponentTagHelperIntermediateNode() - { - ClassName = context.GetClassName(tagHelper), - TagHelper = tagHelper - }; - - context.Class.Children.Add(node); - } - - private struct Context - { - private readonly Dictionary _tagHelpers; - - public Context(NamespaceDeclarationIntermediateNode @namespace, ClassDeclarationIntermediateNode @class) - { - Namespace = @namespace; - Class = @class; - - _tagHelpers = new Dictionary(); - } - - public ClassDeclarationIntermediateNode Class { get; } - - public NamespaceDeclarationIntermediateNode Namespace { get; } - - - public IEnumerable TagHelpers => _tagHelpers.Keys; - - public bool Add(TagHelperDescriptor tagHelper) - { - if (_tagHelpers.ContainsKey(tagHelper)) - { - return false; - } - - var className = $"__Generated__{tagHelper.GetViewComponentName()}ViewComponentTagHelper"; - var namespaceSeparator = string.IsNullOrEmpty(Namespace.Content) ? string.Empty : "."; - var fullyQualifiedName = $"{Namespace.Content}{namespaceSeparator}{Class.ClassName}.{className}"; - var fieldName = GenerateFieldName(tagHelper); - - _tagHelpers.Add(tagHelper, (className, fullyQualifiedName, fieldName)); - - return true; - } - - public string GetClassName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].className; - } - - public string GetFullyQualifiedName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].fullyQualifiedName; - } - - public string GetFieldName(TagHelperDescriptor taghelper) - { - return _tagHelpers[taghelper].fieldName; - } - - private static string GenerateFieldName(TagHelperDescriptor tagHelper) - { - return $"__{tagHelper.GetViewComponentName()}ViewComponentTagHelper"; - } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypeVisitor.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypeVisitor.cs deleted file mode 100644 index 7e2b8240fb5..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypeVisitor.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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 Microsoft.CodeAnalysis; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -internal sealed class ViewComponentTypeVisitor : SymbolVisitor -{ - private readonly INamedTypeSymbol _viewComponentAttribute; - private readonly INamedTypeSymbol? _nonViewComponentAttribute; - private readonly List _results; - - public ViewComponentTypeVisitor( - INamedTypeSymbol viewComponentAttribute, - INamedTypeSymbol? nonViewComponentAttribute, - List results) - { - _viewComponentAttribute = viewComponentAttribute; - _nonViewComponentAttribute = nonViewComponentAttribute; - _results = results; - } - - public override void VisitNamedType(INamedTypeSymbol symbol) - { - if (IsViewComponent(symbol)) - { - _results.Add(symbol); - } - - if (symbol.DeclaredAccessibility != Accessibility.Public) - { - return; - } - - foreach (var member in symbol.GetTypeMembers()) - { - Visit(member); - } - } - - public override void VisitNamespace(INamespaceSymbol symbol) - { - foreach (var member in symbol.GetMembers()) - { - Visit(member); - } - } - - internal bool IsViewComponent(INamedTypeSymbol symbol) - { - if (_viewComponentAttribute == null) - { - return false; - } - - if (symbol.DeclaredAccessibility != Accessibility.Public || - symbol.IsAbstract || - symbol.IsGenericType || - AttributeIsDefined(symbol, _nonViewComponentAttribute)) - { - return false; - } - - return symbol.Name.EndsWith(ViewComponentTypes.ViewComponentSuffix, StringComparison.Ordinal) || - AttributeIsDefined(symbol, _viewComponentAttribute); - } - - private static bool AttributeIsDefined(INamedTypeSymbol? type, INamedTypeSymbol? queryAttribute) - { - if (type == null || queryAttribute == null) - { - return false; - } - - foreach (var attribute in type.GetAttributes()) - { - if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, queryAttribute)) - { - return true; - } - } - - return AttributeIsDefined(type.BaseType, queryAttribute); - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypes.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypes.cs deleted file mode 100644 index c333ca62aee..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/ViewComponentTypes.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; - -internal static class ViewComponentTypes -{ - public const string Assembly = "Microsoft.AspNetCore.Mvc.ViewFeatures"; - - public static readonly Version AssemblyVersion = new Version(1, 1, 0, 0); - - public const string ViewComponentSuffix = "ViewComponent"; - - public const string ViewComponentAttribute = "Microsoft.AspNetCore.Mvc.ViewComponentAttribute"; - - public const string NonViewComponentAttribute = "Microsoft.AspNetCore.Mvc.NonViewComponentAttribute"; - - public const string GenericTask = "System.Threading.Tasks.Task`1"; - - public const string Task = "System.Threading.Tasks.Task"; - - public const string IDictionary = "System.Collections.Generic.IDictionary`2"; - - public const string AsyncMethodName = "InvokeAsync"; - - public const string SyncMethodName = "Invoke"; - - public static class ViewComponent - { - public const string Name = "Name"; - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs index 569a83748bf..583286b24dc 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -26,7 +27,7 @@ public static class InjectDirective builder.Description = RazorExtensionsResources.InjectDirective_Description; }); - public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder builder) + public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder builder, bool considerNullabilityEnforcement) { if (builder == null) { @@ -35,7 +36,7 @@ public static RazorProjectEngineBuilder Register(RazorProjectEngineBuilder build builder.AddDirective(Directive); builder.Features.Add(new Pass()); - builder.AddTargetExtension(new InjectTargetExtension()); + builder.AddTargetExtension(new InjectTargetExtension(considerNullabilityEnforcement)); return builder; } @@ -62,18 +63,20 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } @@ -93,7 +96,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte TypeName = typeName, MemberName = memberName, TypeSource = typeSpan, - MemberSource = memberSpan + MemberSource = memberSpan, + IsMalformed = isMalformed }; visitor.Class.Children.Add(injectNode); @@ -105,7 +109,7 @@ private class Visitor : IntermediateNodeWalker { public ClassDeclarationIntermediateNode Class { get; private set; } - public IList Directives { get; } = new List(); + public IList Directives { get; } = []; public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { @@ -124,5 +128,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs index de9c29ebeac..8ef9bbbe3cc 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs @@ -20,6 +20,8 @@ public class InjectIntermediateNode : ExtensionIntermediateNode public SourceSpan? MemberSource { get; set; } + public bool IsMalformed { get; set; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) @@ -60,5 +62,6 @@ public override void FormatNode(IntermediateNodeFormatter formatter) formatter.WriteProperty(nameof(MemberName), MemberName); formatter.WriteProperty(nameof(TypeName), TypeName); + formatter.WriteProperty(nameof(IsMalformed), IsMalformed.ToString()); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs index 506483f6a84..0ea1c5ac9b0 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs @@ -5,10 +5,11 @@ using System; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; namespace Microsoft.AspNetCore.Mvc.Razor.Extensions; -public class InjectTargetExtension : IInjectTargetExtension +public class InjectTargetExtension(bool considerNullabilityEnforcement) : IInjectTargetExtension { private const string RazorInjectAttribute = "[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]"; @@ -26,13 +27,22 @@ public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediate if (!context.Options.DesignTime && !string.IsNullOrWhiteSpace(node.TypeSource?.FilePath)) { - context.CodeWriter.WriteLine(RazorInjectAttribute); - context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, node.MemberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + if (node.TypeName == "") + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(node.TypeSource.Value, context).Dispose(); + } + else + { + context.CodeWriter.WriteLine(RazorInjectAttribute); + var memberName = node.MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, memberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + } } - else + else if (!node.IsMalformed) { var property = $"public {node.TypeName} {node.MemberName} {{ get; private set; }}"; - if (!context.Options.SuppressNullabilityEnforcement) + if (considerNullabilityEnforcement && !context.Options.SuppressNullabilityEnforcement) { property += " = default!;"; } @@ -51,7 +61,7 @@ public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediate void WriteProperty() { - if (!context.Options.SuppressNullabilityEnforcement) + if (considerNullabilityEnforcement && !context.Options.SuppressNullabilityEnforcement) { context.CodeWriter.WriteLine("#nullable restore"); } @@ -60,7 +70,7 @@ void WriteProperty() .WriteLine(RazorInjectAttribute) .WriteLine(property); - if (!context.Options.SuppressNullabilityEnforcement) + if (considerNullabilityEnforcement && !context.Options.SuppressNullabilityEnforcement) { context.CodeWriter.WriteLine("#nullable disable"); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/RazorExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/RazorExtensions.cs index fa19e49ba40..317a5f387b0 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/RazorExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/RazorExtensions.cs @@ -22,7 +22,7 @@ public static void Register(RazorProjectEngineBuilder builder) throw new ArgumentNullException(nameof(builder)); } - InjectDirective.Register(builder); + InjectDirective.Register(builder, considerNullabilityEnforcement: true); ModelDirective.Register(builder); PageDirective.Register(builder); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.Helpers.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.Helpers.cs index bc0e302982d..6b789f69744 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.Helpers.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.Helpers.cs @@ -87,8 +87,7 @@ private static StaticCompilationTagHelperFeature GetStaticTagHelperFeature(Compi private static SourceGeneratorProjectEngine GetGenerationProjectEngine( SourceGeneratorProjectItem item, IEnumerable imports, - RazorSourceGenerationOptions razorSourceGeneratorOptions, - bool isAddComponentParameterAvailable) + RazorSourceGenerationOptions razorSourceGeneratorOptions) { var fileSystem = new VirtualRazorProjectFileSystem(); fileSystem.Add(item); @@ -107,7 +106,7 @@ private static SourceGeneratorProjectEngine GetGenerationProjectEngine( options.SuppressMetadataSourceChecksumAttributes = !razorSourceGeneratorOptions.GenerateMetadataSourceChecksumAttributes; options.SupportLocalizedComponentNames = razorSourceGeneratorOptions.SupportLocalizedComponentNames; options.SuppressUniqueIds = razorSourceGeneratorOptions.TestSuppressUniqueIds; - options.SuppressAddComponentParameter = !isAddComponentParameterAvailable; + options.SuppressAddComponentParameter = razorSourceGeneratorOptions.Configuration.SuppressAddComponentParameter; })); CompilerFeatures.Register(b); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs index 7daf0ba4abf..1cd315c9d28 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.RazorProviders.cs @@ -2,21 +2,24 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.IO; +using System.Linq; using System.Text; using System.Threading; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Razor.Compiler.CSharp; namespace Microsoft.NET.Sdk.Razor.SourceGenerators { public partial class RazorSourceGenerator { - private (RazorSourceGenerationOptions?, Diagnostic?) ComputeRazorSourceGeneratorOptions(((AnalyzerConfigOptionsProvider, ParseOptions), bool) pair, CancellationToken ct) + private (RazorSourceGenerationOptions?, Diagnostic?) ComputeRazorSourceGeneratorOptions((((AnalyzerConfigOptionsProvider, ParseOptions), ImmutableArray), bool) pair, CancellationToken ct) { - var ((options, parseOptions), isSuppressed) = pair; + var (((options, parseOptions), references), isSuppressed) = pair; var globalOptions = options.GlobalOptions; if (isSuppressed) @@ -42,7 +45,15 @@ public partial class RazorSourceGenerator razorLanguageVersion = RazorLanguageVersion.Latest; } - var razorConfiguration = new RazorConfiguration(razorLanguageVersion, configurationName ?? "default", Extensions: [], UseConsolidatedMvcViews: true); + var minimalReferences = references + .Where(r => r.Display is { } display && display.EndsWith("Microsoft.AspNetCore.Components.dll", StringComparison.Ordinal)) + .ToImmutableArray(); + + var isComponentParameterSupported = minimalReferences.Length == 0 + ? false + : CSharpCompilation.Create("components", references: minimalReferences).HasAddComponentParameter(); + + var razorConfiguration = new RazorConfiguration(razorLanguageVersion, configurationName ?? "default", Extensions: [], UseConsolidatedMvcViews: true, SuppressAddComponentParameter: !isComponentParameterSupported); var razorSourceGenerationOptions = new RazorSourceGenerationOptions() { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs index f7bdfb0310e..9d3eff80c26 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs @@ -6,7 +6,6 @@ using System.IO; using System.Linq; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -44,6 +43,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var razorSourceGeneratorOptions = analyzerConfigOptions .Combine(parseOptions) + .Combine(metadataRefs.Collect()) .SuppressIfNeeded(isGeneratorSuppressed) .Select(ComputeRazorSourceGeneratorOptions) .ReportDiagnostics(context); @@ -235,30 +235,16 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var razorHostOutputsEnabled = analyzerConfigOptions.CheckGlobalFlagSet("EnableRazorHostOutputs"); var withOptionsDesignTime = withOptions.EmptyOrCachedWhen(razorHostOutputsEnabled, false); - var isAddComponentParameterAvailable = metadataRefs - .Where(r => r.Display is { } display && display.EndsWith("Microsoft.AspNetCore.Components.dll", StringComparison.Ordinal)) - .Collect() - .Select((refs, _) => - { - var compilation = CSharpCompilation.Create("components", references: refs); - return compilation.GetTypesByMetadataName("Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder") - .Any(static t => - t.DeclaredAccessibility == Accessibility.Public && - t.GetMembers("AddComponentParameter") - .Any(static m => m.DeclaredAccessibility == Accessibility.Public)); - }); - IncrementalValuesProvider<(string, SourceGeneratorRazorCodeDocument)> processed(bool designTime) { return (designTime ? withOptionsDesignTime : withOptions) - .Combine(isAddComponentParameterAvailable) .Select((pair, _) => { - var (((sourceItem, imports), razorSourceGeneratorOptions), isAddComponentParameterAvailable) = pair; + var ((sourceItem, imports), razorSourceGeneratorOptions) = pair; RazorSourceGeneratorEventSource.Log.ParseRazorDocumentStart(sourceItem.RelativePhysicalPath); - var projectEngine = GetGenerationProjectEngine(sourceItem, imports, razorSourceGeneratorOptions, isAddComponentParameterAvailable); + var projectEngine = GetGenerationProjectEngine(sourceItem, imports, razorSourceGeneratorOptions); var document = projectEngine.ProcessInitialParse(sourceItem, designTime); @@ -313,7 +299,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) }) .WithLambdaComparer(static (a, b) => { - if (a.csharpDocument.Diagnostics.Count > 0 || b.csharpDocument.Diagnostics.Count > 0) + if (a.csharpDocument.Diagnostics.Length > 0 || b.csharpDocument.Diagnostics.Length > 0) { // if there are any diagnostics, treat the documents as unequal and force RegisterSourceOutput to be called uncached. return false; @@ -339,9 +325,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var hintName = GetIdentifierFromPath(filePath) + ".g.cs"; RazorSourceGeneratorEventSource.Log.AddSyntaxTrees(hintName); - for (var i = 0; i < csharpDocument.Diagnostics.Count; i++) + foreach (var razorDiagnostic in csharpDocument.Diagnostics) { - var razorDiagnostic = csharpDocument.Diagnostics[i]; var csharpDiagnostic = razorDiagnostic.AsDiagnostic(); context.ReportDiagnostic(csharpDiagnostic); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/BaseTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/BaseTagHelperDescriptorProviderTest.cs index afc107b1499..13404d95a58 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/BaseTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/BaseTagHelperDescriptorProviderTest.cs @@ -7,24 +7,39 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Razor; public abstract class TagHelperDescriptorProviderTestBase { - static TagHelperDescriptorProviderTestBase() + protected TagHelperDescriptorProviderTestBase(string additionalCodeOpt = null) { - BaseCompilation = TestCompilation.Create(typeof(ComponentTagHelperDescriptorProviderTest).Assembly); CSharpParseOptions = new CSharpParseOptions(LanguageVersion.CSharp7_3); + var testTagHelpers = CSharpCompilation.Create( + assemblyName: AssemblyName, + syntaxTrees: + [ + Parse(TagHelperDescriptorFactoryTagHelpers.Code), + ..(additionalCodeOpt != null ? [Parse(additionalCodeOpt)] : Enumerable.Empty()), + ], + references: ReferenceUtil.AspNetLatestAll, + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); + BaseCompilation = TestCompilation.Create( + syntaxTrees: [], + references: [testTagHelpers.VerifyDiagnostics().EmitToImageReference()]); } - protected static Compilation BaseCompilation { get; } + protected Compilation BaseCompilation { get; } - protected static CSharpParseOptions CSharpParseOptions { get; } + protected CSharpParseOptions CSharpParseOptions { get; } - protected static CSharpSyntaxTree Parse(string text) + protected static string AssemblyName { get; } = "Microsoft.CodeAnalysis.Razor.Test"; + + protected CSharpSyntaxTree Parse(string text) { return (CSharpSyntaxTree)CSharpSyntaxTree.ParseText(text, CSharpParseOptions); } @@ -35,9 +50,7 @@ protected static TagHelperDescriptor[] ExcludeBuiltInComponents(TagHelperDescrip { var results = context.Results - .Where(c => c.AssemblyName != "Microsoft.AspNetCore.Razor.Test.ComponentShim") - .Where(c => !c.DisplayName.StartsWith("Microsoft.AspNetCore.Components.Web", StringComparison.Ordinal)) - .Where(c => c.GetTypeName() != "Microsoft.AspNetCore.Components.Bind") + .Where(c => !c.DisplayName.StartsWith("Microsoft.AspNetCore.Components.", StringComparison.Ordinal)) .OrderBy(c => c.Name) .ToArray(); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/CompilationTagHelperFeatureTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/CompilationTagHelperFeatureTest.cs index e93e5617c6e..54acca592d6 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/CompilationTagHelperFeatureTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/CompilationTagHelperFeatureTest.cs @@ -5,7 +5,7 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.CSharp; using Moq; using Xunit; @@ -20,8 +20,8 @@ public void IsValidCompilation_ReturnsTrueIfTagHelperInterfaceCannotBeFound() // Arrange var references = new[] { - MetadataReference.CreateFromFile(typeof(string).Assembly.Location), - }; + ReferenceUtil.NetLatestSystemRuntime, + }; var compilation = CSharpCompilation.Create("Test", references: references); // Act @@ -37,8 +37,8 @@ public void IsValidCompilation_ReturnsFalseIfSystemStringCannotBeFound() // Arrange var references = new[] { - MetadataReference.CreateFromFile(typeof(ITagHelper).Assembly.Location), - }; + ReferenceUtil.AspNetLatestRazor, + }; var compilation = CSharpCompilation.Create("Test", references: references); // Act @@ -54,9 +54,9 @@ public void IsValidCompilation_ReturnsTrueIfWellKnownTypesAreFound() // Arrange var references = new[] { - MetadataReference.CreateFromFile(typeof(string).Assembly.Location), - MetadataReference.CreateFromFile(typeof(ITagHelper).Assembly.Location), - }; + ReferenceUtil.NetLatestSystemRuntime, + ReferenceUtil.AspNetLatestRazor, + }; var compilation = CSharpCompilation.Create("Test", references: references); // Act @@ -104,9 +104,9 @@ public void GetDescriptors_SetsCompilation_IfCompilationIsValid() var references = new[] { - MetadataReference.CreateFromFile(typeof(string).Assembly.Location), - MetadataReference.CreateFromFile(typeof(ITagHelper).Assembly.Location), - }; + ReferenceUtil.NetLatestSystemRuntime, + ReferenceUtil.AspNetLatestRazor, + }; var engine = RazorProjectEngine.Create( configure => diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/ComponentTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/ComponentTagHelperDescriptorProviderTest.cs index 3a37a47cd1b..b1549968c4d 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/ComponentTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/ComponentTagHelperDescriptorProviderTest.cs @@ -1620,7 +1620,7 @@ public Task SetParametersAsync(ParameterView parameters) Assert.Empty(compilation.GetDiagnostics()); var targetSymbol = (IAssemblySymbol)compilation.GetAssemblyOrModuleSymbol( - compilation.References.First(static r => r.Display.Contains("Microsoft.CodeAnalysis.Razor.Test.dll"))); + compilation.References.First(static r => r.Display.Contains("Microsoft.CodeAnalysis.Razor.Test"))); var context = new TagHelperDescriptorProviderContext(compilation, targetSymbol); var provider = new ComponentTagHelperDescriptorProvider(); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorFactoryTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorFactoryTest.cs index d76829adccb..f1a6bea4038 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorFactoryTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorFactoryTest.cs @@ -7,26 +7,21 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Reflection; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.Razor.Workspaces.Test; using Xunit; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; namespace Microsoft.CodeAnalysis.Razor.Workspaces; -public class DefaultTagHelperDescriptorFactoryTest +public class DefaultTagHelperDescriptorFactoryTest : TagHelperDescriptorProviderTestBase { - private static readonly Assembly _assembly = typeof(DefaultTagHelperDescriptorFactoryTest).GetTypeInfo().Assembly; - - protected static readonly AssemblyName TagHelperDescriptorFactoryTestAssembly = _assembly.GetName(); - - protected static readonly string AssemblyName = TagHelperDescriptorFactoryTestAssembly.Name; + public DefaultTagHelperDescriptorFactoryTest() : base(AdditionalCode) + { + Compilation = BaseCompilation; + } - private static Compilation Compilation { get; } = TestCompilation.Create(_assembly); + private Compilation Compilation { get; } public static TheoryData RequiredAttributeParserErrorData { @@ -324,66 +319,66 @@ public static TheoryData IsEnumData get { // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(EnumTagHelper), - TagHelperDescriptorBuilder.Create(typeof(EnumTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.EnumTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.EnumTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "EnumTagHelper")) .TagMatchingRuleDescriptor(ruleBuilder => ruleBuilder.RequireTagName("enum")) .BoundAttributeDescriptor(builder => builder .Name("non-enum-property") - .Metadata(PropertyName(nameof(EnumTagHelper.NonEnumProperty))) + .Metadata(PropertyName("NonEnumProperty")) .TypeName(typeof(int).FullName)) .BoundAttributeDescriptor(builder => builder .Name("enum-property") - .Metadata(PropertyName(nameof(EnumTagHelper.EnumProperty))) - .TypeName(typeof(CustomEnum).FullName) + .Metadata(PropertyName("EnumProperty")) + .TypeName("TestNamespace.CustomEnum") .AsEnum()) .Build() }, { - typeof(MultiEnumTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiEnumTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiEnumTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiEnumTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiEnumTagHelper")) .TagMatchingRuleDescriptor(ruleBuilder => ruleBuilder.RequireTagName("p")) .TagMatchingRuleDescriptor(ruleBuilder => ruleBuilder.RequireTagName("input")) .BoundAttributeDescriptor(builder => builder .Name("non-enum-property") - .Metadata(PropertyName(nameof(MultiEnumTagHelper.NonEnumProperty))) + .Metadata(PropertyName("NonEnumProperty")) .TypeName(typeof(int).FullName)) .BoundAttributeDescriptor(builder => builder .Name("enum-property") - .Metadata(PropertyName(nameof(MultiEnumTagHelper.EnumProperty))) - .TypeName(typeof(CustomEnum).FullName) + .Metadata(PropertyName("EnumProperty")) + .TypeName("TestNamespace.CustomEnum") .AsEnum()) .Build() }, { - typeof(NestedEnumTagHelper), - TagHelperDescriptorBuilder.Create(typeof(NestedEnumTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.NestedEnumTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.NestedEnumTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "NestedEnumTagHelper")) .TagMatchingRuleDescriptor(ruleBuilder => ruleBuilder.RequireTagName("nested-enum")) .BoundAttributeDescriptor(builder => builder .Name("nested-enum-property") - .Metadata(PropertyName(nameof(NestedEnumTagHelper.NestedEnumProperty))) - .TypeName($"{typeof(NestedEnumTagHelper).FullName}.{nameof(NestedEnumTagHelper.NestedEnum)}") + .Metadata(PropertyName("NestedEnumProperty")) + .TypeName("TestNamespace.NestedEnumTagHelper.NestedEnum") .AsEnum()) .BoundAttributeDescriptor(builder => builder .Name("non-enum-property") - .Metadata(PropertyName(nameof(NestedEnumTagHelper.NonEnumProperty))) + .Metadata(PropertyName("NonEnumProperty")) .TypeName(typeof(int).FullName)) .BoundAttributeDescriptor(builder => builder .Name("enum-property") - .Metadata(PropertyName(nameof(NestedEnumTagHelper.EnumProperty))) - .TypeName(typeof(CustomEnum).FullName) + .Metadata(PropertyName("EnumProperty")) + .TypeName("TestNamespace.CustomEnum") .AsEnum()) .Build() }, @@ -394,12 +389,12 @@ public static TheoryData IsEnumData [Theory] [MemberData(nameof(IsEnumData))] public void CreateDescriptor_IsEnumIsSetCorrectly( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -413,27 +408,27 @@ public static TheoryData RequiredParentData get { // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(RequiredParentTagHelper), - TagHelperDescriptorBuilder.Create(typeof(RequiredParentTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.RequiredParentTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.RequiredParentTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "RequiredParentTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("input").RequireParentTag("div")) .Build() }, { - typeof(MultiSpecifiedRequiredParentTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiSpecifiedRequiredParentTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiSpecifiedRequiredParentTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiSpecifiedRequiredParentTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiSpecifiedRequiredParentTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("p").RequireParentTag("div")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("input").RequireParentTag("section")) .Build() }, { - typeof(MultiWithUnspecifiedRequiredParentTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiWithUnspecifiedRequiredParentTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiWithUnspecifiedRequiredParentTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiWithUnspecifiedRequiredParentTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiWithUnspecifiedRequiredParentTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("p")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("input").RequireParentTag("div")) .Build() @@ -445,12 +440,12 @@ public static TheoryData RequiredParentData [Theory] [MemberData(nameof(RequiredParentData))] public void CreateDescriptor_CreatesDesignTimeDescriptorsWithRequiredParent( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -459,16 +454,14 @@ public void CreateDescriptor_CreatesDesignTimeDescriptorsWithRequiredParent( Assert.Equal(expectedDescriptor, descriptor); } - private static KeyValuePair[] GetMetadata() + private static KeyValuePair[] GetMetadata(string @namespace, string name) { - var type = typeof(T); - var name = type.Name; - var fullName = type.FullName; + var fullName = $"{@namespace}.{name}"; return new[] { TypeName(fullName), - TypeNamespace(fullName[..(fullName.Length - name.Length - 1)]), + TypeNamespace(@namespace), TypeNameIdentifier(name) }; } @@ -478,29 +471,29 @@ public static TheoryData RestrictChildrenData get { // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(RestrictChildrenTagHelper), - TagHelperDescriptorBuilder.Create(typeof(RestrictChildrenTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.RestrictChildrenTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.RestrictChildrenTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "RestrictChildrenTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("restrict-children")) .AllowChildTag("p") .Build() }, { - typeof(DoubleRestrictChildrenTagHelper), - TagHelperDescriptorBuilder.Create(typeof(DoubleRestrictChildrenTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.DoubleRestrictChildrenTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.DoubleRestrictChildrenTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "DoubleRestrictChildrenTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("double-restrict-children")) .AllowChildTag("p") .AllowChildTag("strong") .Build() }, { - typeof(MultiTargetRestrictChildrenTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiTargetRestrictChildrenTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiTargetRestrictChildrenTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiTargetRestrictChildrenTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiTargetRestrictChildrenTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("p")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("div")) .AllowChildTag("p") @@ -515,12 +508,12 @@ public static TheoryData RestrictChildrenData [Theory] [MemberData(nameof(RestrictChildrenData))] public void CreateDescriptor_CreatesDescriptorsWithAllowedChildren( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -534,21 +527,21 @@ public static TheoryData TagStructureData get { // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(TagStructureTagHelper), - TagHelperDescriptorBuilder.Create(typeof(TagStructureTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.TagStructureTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.TagStructureTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "TagStructureTagHelper")) .TagMatchingRuleDescriptor(builder => builder .RequireTagName("input") .RequireTagStructure(TagStructure.WithoutEndTag)) .Build() }, { - typeof(MultiSpecifiedTagStructureTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiSpecifiedTagStructureTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiSpecifiedTagStructureTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiSpecifiedTagStructureTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiSpecifiedTagStructureTagHelper")) .TagMatchingRuleDescriptor(builder => builder .RequireTagName("p") .RequireTagStructure(TagStructure.NormalOrSelfClosing)) @@ -558,9 +551,9 @@ public static TheoryData TagStructureData .Build() }, { - typeof(MultiWithUnspecifiedTagStructureTagHelper), - TagHelperDescriptorBuilder.Create(typeof(MultiWithUnspecifiedTagStructureTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultiWithUnspecifiedTagStructureTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace.MultiWithUnspecifiedTagStructureTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultiWithUnspecifiedTagStructureTagHelper")) .TagMatchingRuleDescriptor(builder => builder .RequireTagName("p")) .TagMatchingRuleDescriptor(builder => builder @@ -575,12 +568,12 @@ public static TheoryData TagStructureData [Theory] [MemberData(nameof(TagStructureData))] public void CreateDescriptor_CreatesDesignTimeDescriptorsWithTagStructure( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -594,174 +587,174 @@ public static TheoryData EditorBrowsableData get { // tagHelperType, designTime, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(InheritedEditorBrowsableTagHelper), + "TestNamespace.InheritedEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "inherited-editor-browsable", - typeName: typeof(InheritedEditorBrowsableTagHelper).FullName, + typeName: "TestNamespace.InheritedEditorBrowsableTagHelper", assemblyName: AssemblyName, - typeNamespace: typeof(InheritedEditorBrowsableTagHelper).FullName.Substring(0, typeof(InheritedEditorBrowsableTagHelper).FullName.Length - nameof(InheritedEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedEditorBrowsableTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedEditorBrowsableTagHelper", attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(InheritedEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, - { typeof(EditorBrowsableTagHelper), true, null }, + { "TestNamespace.EditorBrowsableTagHelper", true, null }, { - typeof(EditorBrowsableTagHelper), + "TestNamespace.EditorBrowsableTagHelper", false, CreateTagHelperDescriptor( tagName: "editor-browsable", - typeName: typeof(EditorBrowsableTagHelper).FullName, + typeName: "TestNamespace.EditorBrowsableTagHelper", assemblyName: AssemblyName, - typeNamespace: typeof(EditorBrowsableTagHelper).FullName.Substring(0, typeof(EditorBrowsableTagHelper).FullName.Length - nameof(EditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(EditorBrowsableTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "EditorBrowsableTagHelper", attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(EditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, { - typeof(HiddenPropertyEditorBrowsableTagHelper), + "TestNamespace.HiddenPropertyEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "hidden-property-editor-browsable", - typeName: typeof(HiddenPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(HiddenPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(HiddenPropertyEditorBrowsableTagHelper).FullName.Length - nameof(HiddenPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(HiddenPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.HiddenPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "HiddenPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName) }, { - typeof(HiddenPropertyEditorBrowsableTagHelper), + "TestNamespace.HiddenPropertyEditorBrowsableTagHelper", false, CreateTagHelperDescriptor( tagName: "hidden-property-editor-browsable", - typeName: typeof(HiddenPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(HiddenPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(HiddenPropertyEditorBrowsableTagHelper).FullName.Length - nameof(HiddenPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(HiddenPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.HiddenPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "HiddenPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(HiddenPropertyEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, { - typeof(OverriddenEditorBrowsableTagHelper), + "TestNamespace.OverriddenEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "overridden-editor-browsable", - typeName: typeof(OverriddenEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(OverriddenEditorBrowsableTagHelper).FullName.Substring(0, typeof(OverriddenEditorBrowsableTagHelper).FullName.Length - nameof(OverriddenEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(OverriddenEditorBrowsableTagHelper), + typeName: "TestNamespace.OverriddenEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "OverriddenEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(OverriddenEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, { - typeof(MultiPropertyEditorBrowsableTagHelper), + "TestNamespace.MultiPropertyEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "multi-property-editor-browsable", - typeName: typeof(MultiPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(MultiPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(MultiPropertyEditorBrowsableTagHelper).FullName.Length - nameof(MultiPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(MultiPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.MultiPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property2") - .Metadata(PropertyName(nameof(MultiPropertyEditorBrowsableTagHelper.Property2))) + .Metadata(PropertyName("Property2")) .TypeName(typeof(int).FullName), }) }, { - typeof(MultiPropertyEditorBrowsableTagHelper), + "TestNamespace.MultiPropertyEditorBrowsableTagHelper", false, CreateTagHelperDescriptor( tagName: "multi-property-editor-browsable", - typeName: typeof(MultiPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(MultiPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(MultiPropertyEditorBrowsableTagHelper).FullName.Length - nameof(MultiPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(MultiPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.MultiPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(MultiPropertyEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), builder => builder .Name("property2") - .Metadata(PropertyName(nameof(MultiPropertyEditorBrowsableTagHelper.Property2))) + .Metadata(PropertyName("Property2")) .TypeName(typeof(int).FullName), }) }, { - typeof(OverriddenPropertyEditorBrowsableTagHelper), + "TestNamespace.OverriddenPropertyEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "overridden-property-editor-browsable", - typeName: typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName.Length - nameof(OverriddenPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(OverriddenPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.OverriddenPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "OverriddenPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName) }, { - typeof(OverriddenPropertyEditorBrowsableTagHelper), + "TestNamespace.OverriddenPropertyEditorBrowsableTagHelper", false, CreateTagHelperDescriptor( tagName: "overridden-property-editor-browsable", - typeName: typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName.Substring(0, typeof(OverriddenPropertyEditorBrowsableTagHelper).FullName.Length - nameof(OverriddenPropertyEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(OverriddenPropertyEditorBrowsableTagHelper), + typeName: "TestNamespace.OverriddenPropertyEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "OverriddenPropertyEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property2") - .Metadata(PropertyName(nameof(OverriddenPropertyEditorBrowsableTagHelper.Property2))) + .Metadata(PropertyName("Property2")) .TypeName(typeof(int).FullName), builder => builder .Name("property") - .Metadata(PropertyName(nameof(OverriddenPropertyEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, { - typeof(DefaultEditorBrowsableTagHelper), + "TestNamespace.DefaultEditorBrowsableTagHelper", true, CreateTagHelperDescriptor( tagName: "default-editor-browsable", - typeName: typeof(DefaultEditorBrowsableTagHelper).FullName, - typeNamespace: typeof(DefaultEditorBrowsableTagHelper).FullName.Substring(0, typeof(DefaultEditorBrowsableTagHelper).FullName.Length - nameof(DefaultEditorBrowsableTagHelper).Length -1), - typeNameIdentifier: nameof(DefaultEditorBrowsableTagHelper), + typeName: "TestNamespace.DefaultEditorBrowsableTagHelper", + typeNamespace: "TestNamespace", + typeNameIdentifier: "DefaultEditorBrowsableTagHelper", assemblyName: AssemblyName, attributes: new Action[] { builder => builder .Name("property") - .Metadata(PropertyName(nameof(DefaultEditorBrowsableTagHelper.Property))) + .Metadata(PropertyName("Property")) .TypeName(typeof(int).FullName), }) }, - { typeof(MultiEditorBrowsableTagHelper), true, null } + { "TestNamespace.MultiEditorBrowsableTagHelper", true, null } }; } } @@ -769,13 +762,13 @@ public static TheoryData EditorBrowsableData [Theory] [MemberData(nameof(EditorBrowsableData))] public void CreateDescriptor_UnderstandsEditorBrowsableAttribute( - Type tagHelperType, + string tagHelperTypeFullName, bool designTime, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, designTime, designTime); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -791,29 +784,29 @@ public static TheoryData AttributeTargetData var attributes = Enumerable.Empty(); // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(AttributeTargetingTagHelper), + "TestNamespace.AttributeTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(AttributeTargetingTagHelper).FullName, + "TestNamespace.AttributeTargetingTagHelper", AssemblyName, - typeof(AttributeTargetingTagHelper).FullName.Substring(0, typeof(AttributeTargetingTagHelper).FullName.Length - nameof(AttributeTargetingTagHelper).Length -1), - nameof(AttributeTargetingTagHelper), + "TestNamespace", + "AttributeTargetingTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("class")), }) }, { - typeof(MultiAttributeTargetingTagHelper), + "TestNamespace.MultiAttributeTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(MultiAttributeTargetingTagHelper).FullName, + "TestNamespace.MultiAttributeTargetingTagHelper", AssemblyName, - typeNamespace: typeof(MultiAttributeTargetingTagHelper).FullName.Substring(0, typeof(MultiAttributeTargetingTagHelper).FullName.Length - nameof(MultiAttributeTargetingTagHelper).Length -1), - typeNameIdentifier: nameof(MultiAttributeTargetingTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiAttributeTargetingTagHelper", ruleBuilders: new Action[] { builder => @@ -825,13 +818,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(MultiAttributeAttributeTargetingTagHelper), + "TestNamespace.MultiAttributeAttributeTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(MultiAttributeAttributeTargetingTagHelper).FullName, + "TestNamespace.MultiAttributeAttributeTargetingTagHelper", AssemblyName, - typeNamespace: typeof(MultiAttributeAttributeTargetingTagHelper).FullName.Substring(0, typeof(MultiAttributeAttributeTargetingTagHelper).FullName.Length - nameof(MultiAttributeAttributeTargetingTagHelper).Length -1), - typeNameIdentifier: nameof(MultiAttributeAttributeTargetingTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiAttributeAttributeTargetingTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("custom")), @@ -844,52 +837,52 @@ public static TheoryData AttributeTargetData }) }, { - typeof(InheritedAttributeTargetingTagHelper), + "TestNamespace.InheritedAttributeTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(InheritedAttributeTargetingTagHelper).FullName, + "TestNamespace.InheritedAttributeTargetingTagHelper", AssemblyName, - typeNamespace: typeof(InheritedAttributeTargetingTagHelper).FullName.Substring(0, typeof(InheritedAttributeTargetingTagHelper).FullName.Length - nameof(InheritedAttributeTargetingTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedAttributeTargetingTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedAttributeTargetingTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("style")), }) }, { - typeof(RequiredAttributeTagHelper), + "TestNamespace.RequiredAttributeTagHelper", CreateTagHelperDescriptor( "input", - typeof(RequiredAttributeTagHelper).FullName, + "TestNamespace.RequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(RequiredAttributeTagHelper).FullName.Substring(0, typeof(RequiredAttributeTagHelper).FullName.Length - nameof(RequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(RequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "RequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("class")), }) }, { - typeof(InheritedRequiredAttributeTagHelper), + "TestNamespace.InheritedRequiredAttributeTagHelper", CreateTagHelperDescriptor( "div", - typeof(InheritedRequiredAttributeTagHelper).FullName, + "TestNamespace.InheritedRequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(InheritedRequiredAttributeTagHelper).FullName.Substring(0, typeof(InheritedRequiredAttributeTagHelper).FullName.Length - nameof(InheritedRequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedRequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedRequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("class")), }) }, { - typeof(MultiAttributeRequiredAttributeTagHelper), + "TestNamespace.MultiAttributeRequiredAttributeTagHelper", CreateTagHelperDescriptor( "div", - typeof(MultiAttributeRequiredAttributeTagHelper).FullName, + "TestNamespace.MultiAttributeRequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(MultiAttributeRequiredAttributeTagHelper).FullName.Substring(0, typeof(MultiAttributeRequiredAttributeTagHelper).FullName.Length - nameof(MultiAttributeRequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(MultiAttributeRequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiAttributeRequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder @@ -901,13 +894,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(MultiAttributeSameTagRequiredAttributeTagHelper), + "TestNamespace.MultiAttributeSameTagRequiredAttributeTagHelper", CreateTagHelperDescriptor( "input", - typeof(MultiAttributeSameTagRequiredAttributeTagHelper).FullName, + "TestNamespace.MultiAttributeSameTagRequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(MultiAttributeSameTagRequiredAttributeTagHelper).FullName.Substring(0, typeof(MultiAttributeSameTagRequiredAttributeTagHelper).FullName.Length - nameof(MultiAttributeSameTagRequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(MultiAttributeSameTagRequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiAttributeSameTagRequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder.RequireAttributeDescriptor(attribute => attribute.Name("style")), @@ -915,13 +908,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(MultiRequiredAttributeTagHelper), + "TestNamespace.MultiRequiredAttributeTagHelper", CreateTagHelperDescriptor( "input", - typeof(MultiRequiredAttributeTagHelper).FullName, + "TestNamespace.MultiRequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(MultiRequiredAttributeTagHelper).FullName.Substring(0, typeof(MultiRequiredAttributeTagHelper).FullName.Length - nameof(MultiRequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(MultiRequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiRequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder @@ -930,13 +923,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(MultiTagMultiRequiredAttributeTagHelper), + "TestNamespace.MultiTagMultiRequiredAttributeTagHelper", CreateTagHelperDescriptor( "div", - typeof(MultiTagMultiRequiredAttributeTagHelper).FullName, + "TestNamespace.MultiTagMultiRequiredAttributeTagHelper", AssemblyName, - typeNamespace: typeof(MultiTagMultiRequiredAttributeTagHelper).FullName.Substring(0, typeof(MultiTagMultiRequiredAttributeTagHelper).FullName.Length - nameof(MultiTagMultiRequiredAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(MultiTagMultiRequiredAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiTagMultiRequiredAttributeTagHelper", ruleBuilders: new Action[] { builder => builder @@ -950,13 +943,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(AttributeWildcardTargetingTagHelper), + "TestNamespace.AttributeWildcardTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(AttributeWildcardTargetingTagHelper).FullName, + "TestNamespace.AttributeWildcardTargetingTagHelper", AssemblyName, - typeNamespace: typeof(AttributeWildcardTargetingTagHelper).FullName.Substring(0, typeof(AttributeWildcardTargetingTagHelper).FullName.Length - nameof(AttributeWildcardTargetingTagHelper).Length -1), - typeNameIdentifier: nameof(AttributeWildcardTargetingTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "AttributeWildcardTargetingTagHelper", ruleBuilders: new Action[] { builder => builder @@ -966,13 +959,13 @@ public static TheoryData AttributeTargetData }) }, { - typeof(MultiAttributeWildcardTargetingTagHelper), + "TestNamespace.MultiAttributeWildcardTargetingTagHelper", CreateTagHelperDescriptor( TagHelperMatchingConventions.ElementCatchAllName, - typeof(MultiAttributeWildcardTargetingTagHelper).FullName, + "TestNamespace.MultiAttributeWildcardTargetingTagHelper", AssemblyName, - typeNamespace: typeof(MultiAttributeWildcardTargetingTagHelper).FullName.Substring(0, typeof(MultiAttributeWildcardTargetingTagHelper).FullName.Length - nameof(MultiAttributeWildcardTargetingTagHelper).Length -1), - typeNameIdentifier: nameof(MultiAttributeWildcardTargetingTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiAttributeWildcardTargetingTagHelper", ruleBuilders: new Action[] { builder => builder @@ -991,12 +984,12 @@ public static TheoryData AttributeTargetData [Theory] [MemberData(nameof(AttributeTargetData))] public void CreateDescriptor_ReturnsExpectedDescriptors( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1010,16 +1003,16 @@ public static TheoryData HtmlCaseData get { // tagHelperType, expectedTagName, expectedAttributeName - return new TheoryData + return new TheoryData { - { typeof(SingleAttributeTagHelper), "single-attribute", "int-attribute" }, - { typeof(ALLCAPSTAGHELPER), "allcaps", "allcapsattribute" }, - { typeof(CAPSOnOUTSIDETagHelper), "caps-on-outside", "caps-on-outsideattribute" }, - { typeof(capsONInsideTagHelper), "caps-on-inside", "caps-on-insideattribute" }, - { typeof(One1Two2Three3TagHelper), "one1-two2-three3", "one1-two2-three3-attribute" }, - { typeof(ONE1TWO2THREE3TagHelper), "one1two2three3", "one1two2three3-attribute" }, - { typeof(First_Second_ThirdHiTagHelper), "first_second_third-hi", "first_second_third-attribute" }, - { typeof(UNSuffixedCLASS), "un-suffixed-class", "un-suffixed-attribute" }, + { "TestNamespace.SingleAttributeTagHelper", "single-attribute", "int-attribute" }, + { "TestNamespace.ALLCAPSTAGHELPER", "allcaps", "allcapsattribute" }, + { "TestNamespace.CAPSOnOUTSIDETagHelper", "caps-on-outside", "caps-on-outsideattribute" }, + { "TestNamespace.capsONInsideTagHelper", "caps-on-inside", "caps-on-insideattribute" }, + { "TestNamespace.One1Two2Three3TagHelper", "one1-two2-three3", "one1-two2-three3-attribute" }, + { "TestNamespace.ONE1TWO2THREE3TagHelper", "one1two2three3", "one1two2three3-attribute" }, + { "TestNamespace.First_Second_ThirdHiTagHelper", "first_second_third-hi", "first_second_third-attribute" }, + { "TestNamespace.UNSuffixedCLASS", "un-suffixed-class", "un-suffixed-attribute" }, }; } } @@ -1027,13 +1020,13 @@ public static TheoryData HtmlCaseData [Theory] [MemberData(nameof(HtmlCaseData))] public void CreateDescriptor_HtmlCasesTagNameAndAttributeName( - Type tagHelperType, + string tagHelperTypeFullName, string expectedTagName, string expectedAttributeName) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1049,30 +1042,26 @@ public void CreateDescriptor_HtmlCasesTagNameAndAttributeName( public void CreateDescriptor_OverridesAttributeNameFromAttribute() { // Arrange - var validProperty1 = typeof(OverriddenAttributeTagHelper).GetProperty( - nameof(OverriddenAttributeTagHelper.ValidAttribute1)); - var validProperty2 = typeof(OverriddenAttributeTagHelper).GetProperty( - nameof(OverriddenAttributeTagHelper.ValidAttribute2)); var expectedDescriptor = CreateTagHelperDescriptor( "overridden-attribute", - typeof(OverriddenAttributeTagHelper).FullName, + "TestNamespace.OverriddenAttributeTagHelper", AssemblyName, - typeNamespace: typeof(OverriddenAttributeTagHelper).FullName.Substring(0, typeof(OverriddenAttributeTagHelper).FullName.Length - nameof(OverriddenAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(OverriddenAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "OverriddenAttributeTagHelper", new Action[] { builder => builder .Name("SomethingElse") - .Metadata(PropertyName(validProperty1.Name)) - .TypeName(validProperty1.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute1")) + .TypeName(typeof(string).FullName), builder => builder .Name("Something-Else") - .Metadata(PropertyName(validProperty2.Name)) - .TypeName(validProperty2.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute2")) + .TypeName(typeof(string).FullName), }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(OverriddenAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.OverriddenAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1085,30 +1074,26 @@ public void CreateDescriptor_OverridesAttributeNameFromAttribute() public void CreateDescriptor_DoesNotInheritOverridenAttributeName() { // Arrange - var validProperty1 = typeof(InheritedOverriddenAttributeTagHelper).GetProperty( - nameof(InheritedOverriddenAttributeTagHelper.ValidAttribute1)); - var validProperty2 = typeof(InheritedOverriddenAttributeTagHelper).GetProperty( - nameof(InheritedOverriddenAttributeTagHelper.ValidAttribute2)); var expectedDescriptor = CreateTagHelperDescriptor( "inherited-overridden-attribute", - typeof(InheritedOverriddenAttributeTagHelper).FullName, + "TestNamespace.InheritedOverriddenAttributeTagHelper", AssemblyName, - typeNamespace: typeof(InheritedOverriddenAttributeTagHelper).FullName.Substring(0, typeof(InheritedOverriddenAttributeTagHelper).FullName.Length - nameof(InheritedOverriddenAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedOverriddenAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedOverriddenAttributeTagHelper", new Action[] { builder => builder .Name("valid-attribute1") - .Metadata(PropertyName(validProperty1.Name)) - .TypeName(validProperty1.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute1")) + .TypeName(typeof(string).FullName), builder => builder .Name("Something-Else") - .Metadata(PropertyName(validProperty2.Name)) - .TypeName(validProperty2.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute2")) + .TypeName(typeof(string).FullName), }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(InheritedOverriddenAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.InheritedOverriddenAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1121,30 +1106,25 @@ public void CreateDescriptor_DoesNotInheritOverridenAttributeName() public void CreateDescriptor_AllowsOverriddenAttributeNameOnUnimplementedVirtual() { // Arrange - var validProperty1 = typeof(InheritedNotOverriddenAttributeTagHelper).GetProperty( - nameof(InheritedNotOverriddenAttributeTagHelper.ValidAttribute1)); - var validProperty2 = typeof(InheritedNotOverriddenAttributeTagHelper).GetProperty( - nameof(InheritedNotOverriddenAttributeTagHelper.ValidAttribute2)); - var expectedDescriptor = CreateTagHelperDescriptor( "inherited-not-overridden-attribute", - typeof(InheritedNotOverriddenAttributeTagHelper).FullName, + "TestNamespace.InheritedNotOverriddenAttributeTagHelper", AssemblyName, - typeNamespace: typeof(InheritedNotOverriddenAttributeTagHelper).FullName.Substring(0, typeof(InheritedNotOverriddenAttributeTagHelper).FullName.Length - nameof(InheritedNotOverriddenAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedNotOverriddenAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedNotOverriddenAttributeTagHelper", new Action[] { builder => builder .Name("SomethingElse") - .Metadata(PropertyName(validProperty1.Name)) - .TypeName(validProperty1.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute1")) + .TypeName(typeof(string).FullName), builder => builder .Name("Something-Else") - .Metadata(PropertyName(validProperty2.Name)) - .TypeName(validProperty2.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute2")) + .TypeName(typeof(string).FullName), }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(InheritedNotOverriddenAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.InheritedNotOverriddenAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1159,19 +1139,19 @@ public void CreateDescriptor_BuildsDescriptorsWithInheritedProperties() // Arrange var expectedDescriptor = CreateTagHelperDescriptor( "inherited-single-attribute", - typeof(InheritedSingleAttributeTagHelper).FullName, + "TestNamespace.InheritedSingleAttributeTagHelper", AssemblyName, - typeNamespace: typeof(InheritedSingleAttributeTagHelper).FullName.Substring(0, typeof(InheritedSingleAttributeTagHelper).FullName.Length - nameof(InheritedSingleAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedSingleAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedSingleAttributeTagHelper", new Action[] { builder => builder .Name("int-attribute") - .Metadata(PropertyName(nameof(InheritedSingleAttributeTagHelper.IntAttribute))) + .Metadata(PropertyName("IntAttribute")) .TypeName(typeof(int).FullName) }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(InheritedSingleAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.InheritedSingleAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1184,22 +1164,21 @@ public void CreateDescriptor_BuildsDescriptorsWithInheritedProperties() public void CreateDescriptor_BuildsDescriptorsWithConventionNames() { // Arrange - var intProperty = typeof(SingleAttributeTagHelper).GetProperty(nameof(SingleAttributeTagHelper.IntAttribute)); var expectedDescriptor = CreateTagHelperDescriptor( "single-attribute", - typeof(SingleAttributeTagHelper).FullName, + "TestNamespace.SingleAttributeTagHelper", AssemblyName, - typeNamespace: typeof(SingleAttributeTagHelper).FullName.Substring(0, typeof(SingleAttributeTagHelper).FullName.Length - nameof(SingleAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(SingleAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "SingleAttributeTagHelper", new Action[] { builder => builder .Name("int-attribute") - .Metadata(PropertyName(intProperty.Name)) - .TypeName(intProperty.PropertyType.FullName) + .Metadata(PropertyName("IntAttribute")) + .TypeName(typeof(int).FullName) }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(SingleAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.SingleAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1212,23 +1191,21 @@ public void CreateDescriptor_BuildsDescriptorsWithConventionNames() public void CreateDescriptor_OnlyAcceptsPropertiesWithGetAndSet() { // Arrange - var validProperty = typeof(MissingAccessorTagHelper).GetProperty( - nameof(MissingAccessorTagHelper.ValidAttribute)); var expectedDescriptor = CreateTagHelperDescriptor( "missing-accessor", - typeof(MissingAccessorTagHelper).FullName, + "TestNamespace.MissingAccessorTagHelper", AssemblyName, - typeNamespace: typeof(MissingAccessorTagHelper).FullName.Substring(0, typeof(MissingAccessorTagHelper).FullName.Length - nameof(MissingAccessorTagHelper).Length -1), - typeNameIdentifier: nameof(MissingAccessorTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MissingAccessorTagHelper", new Action[] { builder => builder .Name("valid-attribute") - .Metadata(PropertyName(validProperty.Name)) - .TypeName(validProperty.PropertyType.FullName) + .Metadata(PropertyName("ValidAttribute")) + .TypeName(typeof(string).FullName) }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(MissingAccessorTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.MissingAccessorTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1241,23 +1218,21 @@ public void CreateDescriptor_OnlyAcceptsPropertiesWithGetAndSet() public void CreateDescriptor_OnlyAcceptsPropertiesWithPublicGetAndSet() { // Arrange - var validProperty = typeof(NonPublicAccessorTagHelper).GetProperty( - nameof(NonPublicAccessorTagHelper.ValidAttribute)); var expectedDescriptor = CreateTagHelperDescriptor( "non-public-accessor", - typeof(NonPublicAccessorTagHelper).FullName, + "TestNamespace.NonPublicAccessorTagHelper", AssemblyName, - typeNamespace: typeof(NonPublicAccessorTagHelper).FullName.Substring(0, typeof(NonPublicAccessorTagHelper).FullName.Length - nameof(NonPublicAccessorTagHelper).Length -1), - typeNameIdentifier: nameof(NonPublicAccessorTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "NonPublicAccessorTagHelper", new Action[] { builder => builder .Name("valid-attribute") - .Metadata(PropertyName(validProperty.Name)) - .TypeName(validProperty.PropertyType.FullName) + .Metadata(PropertyName("ValidAttribute")) + .TypeName(typeof(string).FullName) }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(NonPublicAccessorTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.NonPublicAccessorTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1272,19 +1247,19 @@ public void CreateDescriptor_DoesNotIncludePropertiesWithNotBound() // Arrange var expectedDescriptor = CreateTagHelperDescriptor( "not-bound-attribute", - typeof(NotBoundAttributeTagHelper).FullName, + "TestNamespace.NotBoundAttributeTagHelper", AssemblyName, - typeNamespace: typeof(NotBoundAttributeTagHelper).FullName.Substring(0, typeof(NotBoundAttributeTagHelper).FullName.Length - nameof(NotBoundAttributeTagHelper).Length -1), - typeNameIdentifier: nameof(NotBoundAttributeTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "NotBoundAttributeTagHelper", new Action[] { builder => builder .Name("bound-property") - .Metadata(PropertyName(nameof(NotBoundAttributeTagHelper.BoundProperty))) + .Metadata(PropertyName("BoundProperty")) .TypeName(typeof(object).FullName) }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(NotBoundAttributeTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.NotBoundAttributeTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1300,15 +1275,15 @@ public void CreateDescriptor_ResolvesMultipleTagHelperDescriptorsFromSingleType( var expectedDescriptor = CreateTagHelperDescriptor( string.Empty, - typeof(MultiTagTagHelper).FullName, + "TestNamespace.MultiTagTagHelper", AssemblyName, - typeNamespace: typeof(MultiTagTagHelper).FullName.Substring(0, typeof(MultiTagTagHelper).FullName.Length - nameof(MultiTagTagHelper).Length -1), - typeNameIdentifier: nameof(MultiTagTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "MultiTagTagHelper", new Action[] { builder => builder .Name("valid-attribute") - .Metadata(PropertyName(nameof(MultiTagTagHelper.ValidAttribute))) + .Metadata(PropertyName("ValidAttribute")) .TypeName(typeof(string).FullName), }, new Action[] @@ -1317,7 +1292,7 @@ public void CreateDescriptor_ResolvesMultipleTagHelperDescriptorsFromSingleType( builder => builder.RequireTagName("div"), }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(MultiTagTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.MultiTagTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1330,22 +1305,21 @@ public void CreateDescriptor_ResolvesMultipleTagHelperDescriptorsFromSingleType( public void CreateDescriptor_DoesNotResolveInheritedTagNames() { // Arrange - var validProp = typeof(InheritedMultiTagTagHelper).GetProperty(nameof(InheritedMultiTagTagHelper.ValidAttribute)); var expectedDescriptor = CreateTagHelperDescriptor( "inherited-multi-tag", - typeof(InheritedMultiTagTagHelper).FullName, + "TestNamespace.InheritedMultiTagTagHelper", AssemblyName, - typeNamespace: typeof(InheritedMultiTagTagHelper).FullName.Substring(0, typeof(InheritedMultiTagTagHelper).FullName.Length - nameof(InheritedMultiTagTagHelper).Length -1), - typeNameIdentifier: nameof(InheritedMultiTagTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "InheritedMultiTagTagHelper", new Action[] { builder => builder .Name("valid-attribute") - .Metadata(PropertyName(validProp.Name)) - .TypeName(validProp.PropertyType.FullName), + .Metadata(PropertyName("ValidAttribute")) + .TypeName(typeof(string).FullName), }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(InheritedMultiTagTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.InheritedMultiTagTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1360,10 +1334,10 @@ public void CreateDescriptor_IgnoresDuplicateTagNamesFromAttribute() // Arrange var expectedDescriptor = CreateTagHelperDescriptor( string.Empty, - typeof(DuplicateTagNameTagHelper).FullName, + "TestNamespace.DuplicateTagNameTagHelper", AssemblyName, - typeNamespace: typeof(DuplicateTagNameTagHelper).FullName.Substring(0, typeof(DuplicateTagNameTagHelper).FullName.Length - nameof(DuplicateTagNameTagHelper).Length -1), - typeNameIdentifier: nameof(DuplicateTagNameTagHelper), + typeNamespace: "TestNamespace", + typeNameIdentifier: "DuplicateTagNameTagHelper", ruleBuilders: new Action[] { builder => builder.RequireTagName("p"), @@ -1371,7 +1345,7 @@ public void CreateDescriptor_IgnoresDuplicateTagNamesFromAttribute() }); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(DuplicateTagNameTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.DuplicateTagNameTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1387,12 +1361,12 @@ public void CreateDescriptor_OverridesTagNameFromAttribute() var expectedDescriptor = CreateTagHelperDescriptor( "data-condition", - typeof(OverrideNameTagHelper).FullName, + "TestNamespace.OverrideNameTagHelper", AssemblyName, - typeNamespace: typeof(OverrideNameTagHelper).FullName.Substring(0, typeof(OverrideNameTagHelper).FullName.Length - nameof(OverrideNameTagHelper).Length -1), - typeNameIdentifier: nameof(OverrideNameTagHelper)); + typeNamespace: "TestNamespace", + typeNameIdentifier: "OverrideNameTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(typeof(OverrideNameTagHelper).FullName); + var typeSymbol = Compilation.GetTypeByMetadataName("TestNamespace.OverrideNameTagHelper"); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1425,13 +1399,13 @@ public void CreateDescriptor_CreatesErrorOnInvalidNames( // Arrange name = name.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\"", "\\\""); var text = $$""" - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute).FullName}}("{{name}}")] - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("{{name}}")] + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var attribute = tagHelperType.GetAttributes().Single(); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1477,80 +1451,80 @@ public static TheoryData InvalidTagHelperAttributeDescriptorData { get { - var invalidBoundAttributeBuilder = new TagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, nameof(InvalidBoundAttribute), "Test"); - invalidBoundAttributeBuilder.Metadata(TypeName(typeof(InvalidBoundAttribute).FullName)); + var invalidBoundAttributeBuilder = new TagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, "InvalidBoundAttribute", "Test"); + invalidBoundAttributeBuilder.Metadata(TypeName("TestNamespace.InvalidBoundAttribute")); // type, expectedAttributeDescriptors - return new TheoryData> + return new TheoryData> { { - typeof(InvalidBoundAttribute), + "TestNamespace.InvalidBoundAttribute", new[] { - CreateAttributeFor(typeof(InvalidBoundAttribute), attribute => + CreateAttributeFor("TestNamespace.InvalidBoundAttribute", attribute => { attribute .Name("data-something") - .Metadata(PropertyName(nameof(InvalidBoundAttribute.DataSomething))) + .Metadata(PropertyName("DataSomething")) .TypeName(typeof(string).FullName); }), } }, { - typeof(InvalidBoundAttributeWithValid), + "TestNamespace.InvalidBoundAttributeWithValid", new[] { - CreateAttributeFor(typeof(InvalidBoundAttributeWithValid), attribute => + CreateAttributeFor("TestNamespace.InvalidBoundAttributeWithValid", attribute => { attribute .Name("data-something") - .Metadata(PropertyName(nameof(InvalidBoundAttributeWithValid.DataSomething))) + .Metadata(PropertyName("DataSomething")) .TypeName(typeof(string).FullName); ; }), - CreateAttributeFor(typeof(InvalidBoundAttributeWithValid), attribute => + CreateAttributeFor("TestNamespace.InvalidBoundAttributeWithValid", attribute => { attribute .Name("int-attribute") - .Metadata(PropertyName(nameof(InvalidBoundAttributeWithValid.IntAttribute))) + .Metadata(PropertyName("IntAttribute")) .TypeName(typeof(int).FullName); }), } }, { - typeof(OverriddenInvalidBoundAttributeWithValid), + "TestNamespace.OverriddenInvalidBoundAttributeWithValid", new[] { - CreateAttributeFor(typeof(OverriddenInvalidBoundAttributeWithValid), attribute => + CreateAttributeFor("TestNamespace.OverriddenInvalidBoundAttributeWithValid", attribute => { attribute .Name("valid-something") - .Metadata(PropertyName(nameof(OverriddenInvalidBoundAttributeWithValid.DataSomething))) + .Metadata(PropertyName("DataSomething")) .TypeName(typeof(string).FullName); }), } }, { - typeof(OverriddenValidBoundAttributeWithInvalid), + "TestNamespace.OverriddenValidBoundAttributeWithInvalid", new[] { - CreateAttributeFor(typeof(OverriddenValidBoundAttributeWithInvalid), attribute => + CreateAttributeFor("TestNamespace.OverriddenValidBoundAttributeWithInvalid", attribute => { attribute .Name("data-something") - .Metadata(PropertyName(nameof(OverriddenValidBoundAttributeWithInvalid.ValidSomething))) + .Metadata(PropertyName("ValidSomething")) .TypeName(typeof(string).FullName); }), } }, { - typeof(OverriddenValidBoundAttributeWithInvalidUpperCase), + "TestNamespace.OverriddenValidBoundAttributeWithInvalidUpperCase", new[] { - CreateAttributeFor(typeof(OverriddenValidBoundAttributeWithInvalidUpperCase), attribute => + CreateAttributeFor("TestNamespace.OverriddenValidBoundAttributeWithInvalidUpperCase", attribute => { attribute .Name("DATA-SOMETHING") - .Metadata(PropertyName(nameof(OverriddenValidBoundAttributeWithInvalidUpperCase.ValidSomething))) + .Metadata(PropertyName("ValidSomething")) .TypeName(typeof(string).FullName); }), } @@ -1562,12 +1536,12 @@ public static TheoryData InvalidTagHelperAttributeDescriptorData [Theory] [MemberData(nameof(InvalidTagHelperAttributeDescriptorData))] public void CreateDescriptor_DoesNotAllowDataDashAttributes( - Type type, + string typeFullName, IEnumerable expectedAttributeDescriptors) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(type.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(typeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -1605,14 +1579,14 @@ public void CreateDescriptor_WithValidAttributeName_HasNoErrors(string name) { // Arrange var text = $$""" - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute).FullName}}("{{name}}")] + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute("{{name}}")] public string SomeAttribute { get; set; } } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1646,14 +1620,14 @@ public void CreateDescriptor_WithValidAttributePrefix_HasNoErrors(string prefix) { // Arrange var text = $$""" - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute).FullName}}({{nameof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix)}} = "{{prefix}}")] + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute(DictionaryAttributePrefix = "{{prefix}}")] public System.Collections.Generic.IDictionary SomeAttribute { get; set; } } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1690,14 +1664,14 @@ public void CreateDescriptor_WithInvalidAttributeName_HasErrors(string name, str // Arrange name = name.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\"", "\\\""); var text = $$""" - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute).FullName}}("{{name}}")] + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute("{{name}}")] public string InvalidProperty { get; set; } } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1737,14 +1711,14 @@ public void CreateDescriptor_WithInvalidAttributePrefix_HasErrors(string prefix, // Arrange prefix = prefix.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\"", "\\\""); var text = $$""" - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute).FullName}}({{nameof(AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix)}} = "{{prefix}}")] + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute(DictionaryAttributePrefix = "{{prefix}}")] public System.Collections.Generic.IDictionary InvalidProperty { get; set; } } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1781,13 +1755,13 @@ public void CreateDescriptor_WithInvalidAllowedChildren_HasErrors(string name, s // Arrange name = name.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\"", "\\\""); var text = $$""" - [{{typeof(AspNetCore.Razor.TagHelpers.RestrictChildrenAttribute).FullName}}("{{name}}")] - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.RestrictChildrenAttribute("{{name}}")] + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1823,13 +1797,13 @@ public void CreateDescriptor_WithInvalidParentTag_HasErrors(string name, string[ // Arrange name = name.Replace("\n", "\\n").Replace("\r", "\\r").Replace("\"", "\\\""); var text = $$""" - [{{typeof(AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute).FullName}}({{nameof(AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute.ParentTag)}} = "{{name}}")] - public class DynamicTestTagHelper : {{typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName}} + [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(ParentTag = "{{name}}")] + public class DynamicTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { } """; - var syntaxTree = CSharpSyntaxTree.ParseText(text); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var syntaxTree = Parse(text); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var tagHelperType = compilation.GetTypeByMetadataName("DynamicTestTagHelper"); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: false, excludeHidden: false); @@ -1870,17 +1844,17 @@ public static TheoryData TagHelperWithPrefixData dictionaryNamespace = dictionaryNamespace.Substring(0, dictionaryNamespace.IndexOf('`')); // tagHelperType, expectedAttributeDescriptors, expectedDiagnostics - return new TheoryData, IEnumerable> + return new TheoryData, IEnumerable> { { - typeof(DefaultValidHtmlAttributePrefix), + "TestNamespace.DefaultValidHtmlAttributePrefix", new[] { - CreateAttributeFor(typeof(DefaultValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.DefaultValidHtmlAttributePrefix", attribute => { attribute .Name("dictionary-property") - .Metadata(PropertyName(nameof(DefaultValidHtmlAttributePrefix.DictionaryProperty))) + .Metadata(PropertyName("DictionaryProperty")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("dictionary-property-", typeof(string).FullName); }), @@ -1888,14 +1862,14 @@ public static TheoryData TagHelperWithPrefixData Enumerable.Empty() }, { - typeof(SingleValidHtmlAttributePrefix), + "TestNamespace.SingleValidHtmlAttributePrefix", new[] { - CreateAttributeFor(typeof(SingleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.SingleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name") - .Metadata(PropertyName(nameof(SingleValidHtmlAttributePrefix.DictionaryProperty))) + .Metadata(PropertyName("DictionaryProperty")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("valid-name-", typeof(string).FullName); }), @@ -1903,67 +1877,67 @@ public static TheoryData TagHelperWithPrefixData Enumerable.Empty() }, { - typeof(MultipleValidHtmlAttributePrefix), + "TestNamespace.MultipleValidHtmlAttributePrefix", new[] { - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name1") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.DictionaryProperty))) + .Metadata(PropertyName("DictionaryProperty")) .TypeName($"{typeof(Dictionary<,>).Namespace}.Dictionary") .AsDictionaryAttribute("valid-prefix1-", typeof(object).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name2") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.DictionarySubclassProperty))) - .TypeName(typeof(DictionarySubclass).FullName) + .Metadata(PropertyName("DictionarySubclassProperty")) + .TypeName("TestNamespace.DictionarySubclass") .AsDictionaryAttribute("valid-prefix2-", typeof(string).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name3") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.DictionaryWithoutParameterlessConstructorProperty))) - .TypeName(typeof(DictionaryWithoutParameterlessConstructor).FullName) + .Metadata(PropertyName("DictionaryWithoutParameterlessConstructorProperty")) + .TypeName("TestNamespace.DictionaryWithoutParameterlessConstructor") .AsDictionaryAttribute("valid-prefix3-", typeof(string).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name4") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.GenericDictionarySubclassProperty))) - .TypeName(typeof(GenericDictionarySubclass).Namespace + ".GenericDictionarySubclass") + .Metadata(PropertyName("GenericDictionarySubclassProperty")) + .TypeName("TestNamespace.GenericDictionarySubclass") .AsDictionaryAttribute("valid-prefix4-", typeof(object).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name5") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.SortedDictionaryProperty))) + .Metadata(PropertyName("SortedDictionaryProperty")) .TypeName(typeof(SortedDictionary).Namespace + ".SortedDictionary") .AsDictionaryAttribute("valid-prefix5-", typeof(int).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute .Name("valid-name6") - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.StringProperty))) + .Metadata(PropertyName("StringProperty")) .TypeName(typeof(string).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.GetOnlyDictionaryProperty))) + .Metadata(PropertyName("GetOnlyDictionaryProperty")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("get-only-dictionary-property-", typeof(int).FullName); }), - CreateAttributeFor(typeof(MultipleValidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleValidHtmlAttributePrefix", attribute => { attribute - .Metadata(PropertyName(nameof(MultipleValidHtmlAttributePrefix.GetOnlyDictionaryPropertyWithAttributePrefix))) + .Metadata(PropertyName("GetOnlyDictionaryPropertyWithAttributePrefix")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("valid-prefix6", typeof(string).FullName); }), @@ -1971,127 +1945,127 @@ public static TheoryData TagHelperWithPrefixData Enumerable.Empty() }, { - typeof(SingleInvalidHtmlAttributePrefix), + "TestNamespace.SingleInvalidHtmlAttributePrefix", new[] { - CreateAttributeFor(typeof(SingleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.SingleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name") - .Metadata(PropertyName(nameof(SingleInvalidHtmlAttributePrefix.StringProperty))) + .Metadata(PropertyName("StringProperty")) .TypeName(typeof(string).FullName) .AddDiagnostic(RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(SingleInvalidHtmlAttributePrefix).FullName, - nameof(SingleInvalidHtmlAttributePrefix.StringProperty))); + "TestNamespace.SingleInvalidHtmlAttributePrefix", + "StringProperty")); }), }, new[] { RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(SingleInvalidHtmlAttributePrefix).FullName, - nameof(SingleInvalidHtmlAttributePrefix.StringProperty)) + "TestNamespace.SingleInvalidHtmlAttributePrefix", + "StringProperty") } }, { - typeof(MultipleInvalidHtmlAttributePrefix), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", new[] { - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name1") - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.LongProperty))) + .Metadata(PropertyName("LongProperty")) .TypeName(typeof(long).FullName); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name2") - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntProperty))) + .Metadata(PropertyName("DictionaryOfIntProperty")) .TypeName($"{typeof(Dictionary<,>).Namespace}.Dictionary") .AsDictionaryAttribute("valid-prefix2-", typeof(string).FullName) .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntProperty))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "DictionaryOfIntProperty")); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name3") - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.ReadOnlyDictionaryProperty))) + .Metadata(PropertyName("ReadOnlyDictionaryProperty")) .TypeName($"{typeof(IReadOnlyDictionary<,>).Namespace}.IReadOnlyDictionary") .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.ReadOnlyDictionaryProperty))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "ReadOnlyDictionaryProperty")); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name4") - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.IntProperty))) + .Metadata(PropertyName("IntProperty")) .TypeName(typeof(int).FullName) .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.IntProperty))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "IntProperty")); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute .Name("valid-name5") - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntSubclassProperty))) - .TypeName(typeof(DictionaryOfIntSubclass).FullName) + .Metadata(PropertyName("DictionaryOfIntSubclassProperty")) + .TypeName("TestNamespace.DictionaryOfIntSubclass") .AsDictionaryAttribute("valid-prefix5-", typeof(string).FullName) .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntSubclassProperty))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "DictionaryOfIntSubclassProperty")); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryAttributePrefix))) + .Metadata(PropertyName("GetOnlyDictionaryAttributePrefix")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("valid-prefix6", typeof(string).FullName) .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryAttributePrefix))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "GetOnlyDictionaryAttributePrefix")); }), - CreateAttributeFor(typeof(MultipleInvalidHtmlAttributePrefix), attribute => + CreateAttributeFor("TestNamespace.MultipleInvalidHtmlAttributePrefix", attribute => { attribute - .Metadata(PropertyName(nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryPropertyWithAttributeName))) + .Metadata(PropertyName("GetOnlyDictionaryPropertyWithAttributeName")) .TypeName($"{dictionaryNamespace}") .AsDictionaryAttribute("invalid-name7-", typeof(object).FullName) .AddDiagnostic( RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryPropertyWithAttributeName))); + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "GetOnlyDictionaryPropertyWithAttributeName")); }), }, new[] { RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntProperty)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "DictionaryOfIntProperty"), RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.ReadOnlyDictionaryProperty)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "ReadOnlyDictionaryProperty"), RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.IntProperty)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "IntProperty"), RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.DictionaryOfIntSubclassProperty)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "DictionaryOfIntSubclassProperty"), RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNotNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryAttributePrefix)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "GetOnlyDictionaryAttributePrefix"), RazorDiagnosticFactory.CreateTagHelper_InvalidAttributePrefixNull( - typeof(MultipleInvalidHtmlAttributePrefix).FullName, - nameof(MultipleInvalidHtmlAttributePrefix.GetOnlyDictionaryPropertyWithAttributeName)), + "TestNamespace.MultipleInvalidHtmlAttributePrefix", + "GetOnlyDictionaryPropertyWithAttributeName"), } }, }; @@ -2101,13 +2075,13 @@ public static TheoryData TagHelperWithPrefixData [Theory] [MemberData(nameof(TagHelperWithPrefixData))] public void CreateDescriptor_WithPrefixes_ReturnsExpectedAttributeDescriptors( - Type tagHelperType, + string tagHelperTypeFullName, IEnumerable expectedAttributeDescriptors, IEnumerable expectedDiagnostics) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -2122,36 +2096,36 @@ public static TheoryData TagOutputHintData get { // tagHelperType, expectedDescriptor - return new TheoryData + return new TheoryData { { - typeof(MultipleDescriptorTagHelperWithOutputElementHint), - TagHelperDescriptorBuilder.Create(typeof(MultipleDescriptorTagHelperWithOutputElementHint).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace.MultipleDescriptorTagHelperWithOutputElementHint", + TagHelperDescriptorBuilder.Create("TestNamespace.MultipleDescriptorTagHelperWithOutputElementHint", AssemblyName) + .Metadata(GetMetadata("TestNamespace", "MultipleDescriptorTagHelperWithOutputElementHint")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("a")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("p")) .TagOutputHint("div") .Build() }, { - typeof(InheritedOutputElementHintTagHelper), - TagHelperDescriptorBuilder.Create(typeof(InheritedOutputElementHintTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace2.InheritedOutputElementHintTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace2.InheritedOutputElementHintTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace2", "InheritedOutputElementHintTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("inherited-output-element-hint")) .Build() }, { - typeof(OutputElementHintTagHelper), - TagHelperDescriptorBuilder.Create(typeof(OutputElementHintTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace2.OutputElementHintTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace2.OutputElementHintTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace2", "OutputElementHintTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("output-element-hint")) .TagOutputHint("hinted-value") .Build() }, { - typeof(OverriddenOutputElementHintTagHelper), - TagHelperDescriptorBuilder.Create(typeof(OverriddenOutputElementHintTagHelper).FullName, AssemblyName) - .Metadata(GetMetadata()) + "TestNamespace2.OverriddenOutputElementHintTagHelper", + TagHelperDescriptorBuilder.Create("TestNamespace2.OverriddenOutputElementHintTagHelper", AssemblyName) + .Metadata(GetMetadata("TestNamespace2", "OverriddenOutputElementHintTagHelper")) .TagMatchingRuleDescriptor(builder => builder.RequireTagName("overridden-output-element-hint")) .TagOutputHint("overridden") .Build() @@ -2163,12 +2137,12 @@ public static TheoryData TagOutputHintData [Theory] [MemberData(nameof(TagOutputHintData))] public void CreateDescriptor_CreatesDescriptorsWithOutputElementHint( - Type tagHelperType, + string tagHelperTypeFullName, TagHelperDescriptor expectedDescriptor) { // Arrange var factory = new DefaultTagHelperDescriptorFactory(Compilation, includeDocumentation: false, excludeHidden: false); - var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperType.FullName); + var typeSymbol = Compilation.GetTypeByMetadataName(tagHelperTypeFullName); // Act var descriptor = factory.CreateDescriptor(typeSymbol); @@ -2181,7 +2155,7 @@ public void CreateDescriptor_CreatesDescriptorsWithOutputElementHint( public void CreateDescriptor_CapturesDocumentationOnTagHelperClass() { // Arrange - var syntaxTree = CSharpSyntaxTree.ParseText(@" + var syntaxTree = Parse(@" using Microsoft.AspNetCore.Razor.TagHelpers; /// @@ -2190,10 +2164,10 @@ public void CreateDescriptor_CapturesDocumentationOnTagHelperClass() /// /// Inherits from . /// - public class DocumentedTagHelper : " + typeof(AspNetCore.Razor.TagHelpers.TagHelper).Name + @" + public class DocumentedTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper { }"); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: true, excludeHidden: false); var typeSymbol = compilation.GetTypeByMetadataName("DocumentedTagHelper"); var expectedDocumentation = @@ -2218,10 +2192,10 @@ public class DocumentedTagHelper : " + typeof(AspNetCore.Razor.TagHelpers.TagHel public void CreateDescriptor_CapturesDocumentationOnTagHelperProperties() { // Arrange - var syntaxTree = CSharpSyntaxTree.ParseText(@" + var syntaxTree = Parse(@" using System.Collections.Generic; - public class DocumentedTagHelper : " + typeof(AspNetCore.Razor.TagHelpers.TagHelper).FullName + @" + public class DocumentedTagHelper : Microsoft.spNetCore.Razor.TagHelpers.TagHelper { /// /// This is of type . @@ -2241,7 +2215,7 @@ public class DocumentedTagHelper : " + typeof(AspNetCore.Razor.TagHelpers.TagHel /// public List RemarksAndSummaryProperty { get; set; } }"); - var compilation = TestCompilation.Create(_assembly, syntaxTree); + var compilation = Compilation.AddSyntaxTrees(syntaxTree); var factory = new DefaultTagHelperDescriptorFactory(compilation, includeDocumentation: true, excludeHidden: false); var typeSymbol = compilation.GetTypeByMetadataName("DocumentedTagHelper"); var expectedDocumentations = new[] @@ -2453,27 +2427,33 @@ protected static TagHelperDescriptor CreateTagHelperDescriptor( return descriptor; } - private static BoundAttributeDescriptor CreateAttributeFor(Type tagHelperType, Action configure) + private static BoundAttributeDescriptor CreateAttributeFor(string tagHelperTypeFullName, Action configure) { - var tagHelperBuilder = new TagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, tagHelperType.Name, "Test"); - tagHelperBuilder.Metadata(TypeName(tagHelperType.FullName)); + var tagHelperBuilder = new TagHelperDescriptorBuilder(TagHelperConventions.DefaultKind, tagHelperTypeFullName.Split('.')[^1], "Test"); + tagHelperBuilder.Metadata(TypeName(tagHelperTypeFullName)); var attributeBuilder = new BoundAttributeDescriptorBuilder(tagHelperBuilder, TagHelperConventions.DefaultKind); configure(attributeBuilder); return attributeBuilder.Build(); } -} -[AspNetCore.Razor.TagHelpers.OutputElementHint("hinted-value")] -public class OutputElementHintTagHelper : AspNetCore.Razor.TagHelpers.TagHelper -{ -} + private const string AdditionalCode = + """ + namespace TestNamespace2 + { + [Microsoft.AspNetCore.Razor.TagHelpers.OutputElementHint("hinted-value")] + public class OutputElementHintTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper + { + } -public class InheritedOutputElementHintTagHelper : OutputElementHintTagHelper -{ -} + public class InheritedOutputElementHintTagHelper : OutputElementHintTagHelper + { + } -[AspNetCore.Razor.TagHelpers.OutputElementHint("overridden")] -public class OverriddenOutputElementHintTagHelper : OutputElementHintTagHelper -{ + [Microsoft.AspNetCore.Razor.TagHelpers.OutputElementHint("overridden")] + public class OverriddenOutputElementHintTagHelper : OutputElementHintTagHelper + { + } + } + """; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorProviderTest.cs index f5d46a59aec..c85e90979b3 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/DefaultTagHelperDescriptorProviderTest.cs @@ -4,23 +4,19 @@ #nullable disable using System.Linq; -using System.Reflection; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.CSharp; using Xunit; namespace Microsoft.CodeAnalysis.Razor; -public class DefaultTagHelperDescriptorProviderTest +public class DefaultTagHelperDescriptorProviderTest : TagHelperDescriptorProviderTestBase { - private static readonly Assembly _assembly = typeof(DefaultTagHelperDescriptorProviderTest).GetTypeInfo().Assembly; - [Fact] public void Execute_DoesNotAddEditorBrowsableNeverDescriptorsAtDesignTime() { // Arrange - var editorBrowsableTypeName = "Microsoft.CodeAnalysis.Razor.Workspaces.Test.EditorBrowsableTagHelper"; - var compilation = TestCompilation.Create(_assembly); + var editorBrowsableTypeName = "TestNamespace.EditorBrowsableTagHelper"; + var compilation = BaseCompilation; var descriptorProvider = new DefaultTagHelperDescriptorProvider(); var context = new TagHelperDescriptorProviderContext(compilation) @@ -44,7 +40,7 @@ public void Execute_WithDefaultDiscoversTagHelpersFromAssemblyAndReference() { // Arrange var testTagHelper = "TestAssembly.TestTagHelper"; - var enumTagHelper = "Microsoft.CodeAnalysis.Razor.Workspaces.Test.EnumTagHelper"; + var enumTagHelper = "TestNamespace.EnumTagHelper"; var csharp = @" using Microsoft.AspNetCore.Razor.TagHelpers; namespace TestAssembly @@ -54,7 +50,7 @@ public class TestTagHelper : TagHelper public override void Process(TagHelperContext context, TagHelperOutput output) {} } }"; - var compilation = TestCompilation.Create(_assembly, CSharpSyntaxTree.ParseText(csharp)); + var compilation = BaseCompilation.AddSyntaxTrees(Parse(csharp)); var descriptorProvider = new DefaultTagHelperDescriptorProvider(); var context = new TagHelperDescriptorProviderContext(compilation); @@ -74,7 +70,7 @@ public void Execute_WithTargetAssembly_Works() { // Arrange var testTagHelper = "TestAssembly.TestTagHelper"; - var enumTagHelper = "Microsoft.CodeAnalysis.Razor.Workspaces.Test.EnumTagHelper"; + var enumTagHelper = "TestNamespace.EnumTagHelper"; var csharp = @" using Microsoft.AspNetCore.Razor.TagHelpers; namespace TestAssembly @@ -84,11 +80,11 @@ public class TestTagHelper : TagHelper public override void Process(TagHelperContext context, TagHelperOutput output) {} } }"; - var compilation = TestCompilation.Create(_assembly, CSharpSyntaxTree.ParseText(csharp)); + var compilation = BaseCompilation.AddSyntaxTrees(Parse(csharp)); var descriptorProvider = new DefaultTagHelperDescriptorProvider(); var targetSymbol = (IAssemblySymbol)compilation.GetAssemblyOrModuleSymbol( - compilation.References.First(static r => r.Display.Contains("Microsoft.CodeAnalysis.Razor.Test.dll"))); + compilation.References.First(static r => r.Display.Contains("Microsoft.CodeAnalysis.Razor.Test"))); var context = new TagHelperDescriptorProviderContext(compilation, targetSymbol); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs index 101927ad544..397035db55b 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language; @@ -14,22 +12,22 @@ namespace Microsoft.CodeAnalysis.Razor; public class EventHandlerTagHelperDescriptorProviderTest : TagHelperDescriptorProviderTestBase { [Fact] - public void Execute_EventHandler_CreatesDescriptor() + public void Execute_EventHandler_TwoArgumentsCreatesDescriptor() { // Arrange - var compilation = BaseCompilation.AddSyntaxTrees(Parse(@" -using System; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; -namespace Test -{ - [EventHandler(""onclick"", typeof(Action))] - public class EventHandlers - { - } -} -")); + namespace Test + { + [EventHandler("onclick", typeof(Action))] + public class EventHandlers + { + } + } + """)); Assert.Empty(compilation.GetDiagnostics()); @@ -102,9 +100,9 @@ public class EventHandlers Assert.Collection( attribute.Metadata.OrderBy(kvp => kvp.Key), - kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), - kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), - kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), + kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); Assert.Equal( "Sets the '@onclick' attribute to the provided string or delegate value. " + @@ -122,6 +120,239 @@ public class EventHandlers Assert.False(attribute.IsEnum); } + [Fact] + public void Execute_EventHandler_FourArgumentsCreatesDescriptorWithDiagnostic() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick", typeof(Action), true, true)] + public class EventHandlers + { + } + } + """)); + + Assert.Empty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + var item = Assert.Single(matches); + + // These are features Event Handler Tag Helpers don't use. Verifying them once here and + // then ignoring them. + Assert.Empty(item.AllowedChildTags); + Assert.Null(item.TagOutputHint); + + // These are features that are invariants of all Event Handler Helpers. Verifying them once + // here and then ignoring them. + Assert.Empty(item.Diagnostics); + Assert.False(item.HasErrors); + Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, item.Kind); + Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); + Assert.Equal(ComponentMetadata.EventHandler.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]); + Assert.False(item.IsDefaultKind()); + Assert.False(item.KindUsesDefaultTagHelperRuntime()); + Assert.False(item.IsComponentOrChildContentTagHelper); + Assert.True(item.CaseSensitive); + + Assert.Equal( + "Sets the '@onclick' attribute to the provided string or delegate value. " + + "A delegate value should be of type 'System.Action'.", + item.Documentation); + + // These are all trivially derived from the assembly/namespace/type name + Assert.Equal("Microsoft.AspNetCore.Components", item.AssemblyName); + Assert.Equal("onclick", item.Name); + Assert.Equal("Test.EventHandlers", item.DisplayName); + Assert.Equal("Test.EventHandlers", item.GetTypeName()); + + Assert.Equal(3, item.TagMatchingRules.Length); + + var catchAllRule = item.TagMatchingRules[0]; + Assert.Empty(catchAllRule.Diagnostics); + Assert.False(catchAllRule.HasErrors); + Assert.Null(catchAllRule.ParentTag); + Assert.Equal("*", catchAllRule.TagName); + Assert.Equal(TagStructure.Unspecified, catchAllRule.TagStructure); + + var catchAllRequiredAttribute = Assert.Single(catchAllRule.Attributes); + Assert.Empty(catchAllRequiredAttribute.Diagnostics); + Assert.Equal("@onclick", catchAllRequiredAttribute.DisplayName); + Assert.Equal("@onclick", catchAllRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, catchAllRequiredAttribute.NameComparison); + Assert.Null(catchAllRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, catchAllRequiredAttribute.ValueComparison); + + var preventDefaultRule = item.TagMatchingRules[1]; + Assert.Empty(preventDefaultRule.Diagnostics); + Assert.False(preventDefaultRule.HasErrors); + Assert.Null(preventDefaultRule.ParentTag); + Assert.Equal("*", preventDefaultRule.TagName); + Assert.Equal(TagStructure.Unspecified, preventDefaultRule.TagStructure); + + var preventDefaultRequiredAttribute = Assert.Single(preventDefaultRule.Attributes); + Assert.Empty(preventDefaultRequiredAttribute.Diagnostics); + Assert.Equal("@onclick:preventDefault", preventDefaultRequiredAttribute.DisplayName); + Assert.Equal("@onclick:preventDefault", preventDefaultRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, preventDefaultRequiredAttribute.NameComparison); + Assert.Null(preventDefaultRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, preventDefaultRequiredAttribute.ValueComparison); + + var stopPropagationRule = item.TagMatchingRules[2]; + Assert.Empty(stopPropagationRule.Diagnostics); + Assert.False(stopPropagationRule.HasErrors); + Assert.Null(stopPropagationRule.ParentTag); + Assert.Equal("*", stopPropagationRule.TagName); + Assert.Equal(TagStructure.Unspecified, stopPropagationRule.TagStructure); + + var stopPropagationRequiredAttribute = Assert.Single(stopPropagationRule.Attributes); + Assert.Empty(stopPropagationRequiredAttribute.Diagnostics); + Assert.Equal("@onclick:stopPropagation", stopPropagationRequiredAttribute.DisplayName); + Assert.Equal("@onclick:stopPropagation", stopPropagationRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, stopPropagationRequiredAttribute.NameComparison); + Assert.Null(stopPropagationRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, stopPropagationRequiredAttribute.ValueComparison); + + var attribute = Assert.Single(item.BoundAttributes); + + // Invariants + Assert.Empty(attribute.Diagnostics); + Assert.False(attribute.HasErrors); + Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, attribute.Kind); + Assert.False(attribute.IsDefaultKind()); + Assert.False(attribute.HasIndexer); + Assert.Null(attribute.IndexerNamePrefix); + Assert.Null(attribute.IndexerTypeName); + Assert.False(attribute.IsIndexerBooleanProperty); + Assert.False(attribute.IsIndexerStringProperty); + + Assert.Collection( + attribute.Metadata.OrderBy(kvp => kvp.Key), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), + kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); + + Assert.Equal( + "Sets the '@onclick' attribute to the provided string or delegate value. " + + "A delegate value should be of type 'System.Action'.", + attribute.Documentation); + + Assert.Equal("@onclick", attribute.Name); + Assert.Equal("onclick", attribute.GetPropertyName()); + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback> Test.EventHandlers.onclick", attribute.DisplayName); + + // Defined from the property type + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback>", attribute.TypeName); + Assert.False(attribute.IsStringProperty); + Assert.False(attribute.IsBooleanProperty); + Assert.False(attribute.IsEnum); + } + + [Fact] + public void Execute_EventHandler_NoArgumentsDoesNotCreateDescriptor() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + + [Fact] + public void Execute_EventHandler_OneArgumentDoesNotCreateDescriptor() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick")] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + + [Fact] + public void Execute_EventHandler_ThreeArgumentsDoesNotCreateDiagnostic() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick", typeof(Action), true)] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + private static TagHelperDescriptor[] GetEventHandlerTagHelpers(TagHelperDescriptorProviderContext context) { return ExcludeBuiltInComponents(context).Where(t => t.IsEventHandlerTagHelper()).ToArray(); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/Microsoft.CodeAnalysis.Razor.Test.csproj b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/Microsoft.CodeAnalysis.Razor.Test.csproj index fede476e87b..c2c38119d75 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/Microsoft.CodeAnalysis.Razor.Test.csproj +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/Microsoft.CodeAnalysis.Razor.Test.csproj @@ -21,8 +21,6 @@ - - diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperDescriptorFactoryTagHelpers.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperDescriptorFactoryTagHelpers.cs index 325e4d4bd94..347654bd950 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperDescriptorFactoryTagHelpers.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperDescriptorFactoryTagHelpers.cs @@ -3,462 +3,470 @@ #nullable disable +namespace Microsoft.CodeAnalysis.Razor; + +internal static class TagHelperDescriptorFactoryTagHelpers +{ + public const string Code = """ using System.Collections.Generic; using System.ComponentModel; using Microsoft.AspNetCore.Razor.TagHelpers; -namespace Microsoft.CodeAnalysis.Razor.Workspaces.Test; - -public enum CustomEnum +namespace TestNamespace { - FirstValue, - SecondValue -} - -public class EnumTagHelper : TagHelper -{ - public int NonEnumProperty { get; set; } + public enum CustomEnum + { + FirstValue, + SecondValue + } - public CustomEnum EnumProperty { get; set; } -} + public class EnumTagHelper : TagHelper + { + public int NonEnumProperty { get; set; } -[HtmlTargetElement("p")] -[HtmlTargetElement("input")] -public class MultiEnumTagHelper : EnumTagHelper -{ -} + public CustomEnum EnumProperty { get; set; } + } -public class NestedEnumTagHelper : EnumTagHelper -{ - public NestedEnum NestedEnumProperty { get; set; } + [HtmlTargetElement("p")] + [HtmlTargetElement("input")] + public class MultiEnumTagHelper : EnumTagHelper + { + } - public enum NestedEnum + public class NestedEnumTagHelper : EnumTagHelper { - NestedOne, - NestedTwo + public NestedEnum NestedEnumProperty { get; set; } + + public enum NestedEnum + { + NestedOne, + NestedTwo + } } -} -[HtmlTargetElement("input", ParentTag = "div")] -public class RequiredParentTagHelper : TagHelper -{ -} + [HtmlTargetElement("input", ParentTag = "div")] + public class RequiredParentTagHelper : TagHelper + { + } -[HtmlTargetElement("p", ParentTag = "div")] -[HtmlTargetElement("input", ParentTag = "section")] -public class MultiSpecifiedRequiredParentTagHelper : TagHelper -{ -} + [HtmlTargetElement("p", ParentTag = "div")] + [HtmlTargetElement("input", ParentTag = "section")] + public class MultiSpecifiedRequiredParentTagHelper : TagHelper + { + } -[HtmlTargetElement("p")] -[HtmlTargetElement("input", ParentTag = "div")] -public class MultiWithUnspecifiedRequiredParentTagHelper : TagHelper -{ -} + [HtmlTargetElement("p")] + [HtmlTargetElement("input", ParentTag = "div")] + public class MultiWithUnspecifiedRequiredParentTagHelper : TagHelper + { + } -[RestrictChildren("p")] -public class RestrictChildrenTagHelper -{ -} + [RestrictChildren("p")] + public class RestrictChildrenTagHelper + { + } -[RestrictChildren("p", "strong")] -public class DoubleRestrictChildrenTagHelper -{ -} + [RestrictChildren("p", "strong")] + public class DoubleRestrictChildrenTagHelper + { + } -[HtmlTargetElement("p")] -[HtmlTargetElement("div")] -[RestrictChildren("p", "strong")] -public class MultiTargetRestrictChildrenTagHelper -{ -} + [HtmlTargetElement("p")] + [HtmlTargetElement("div")] + [RestrictChildren("p", "strong")] + public class MultiTargetRestrictChildrenTagHelper + { + } -[HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] -public class TagStructureTagHelper : TagHelper -{ -} + [HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] + public class TagStructureTagHelper : TagHelper + { + } -[HtmlTargetElement("p", TagStructure = TagStructure.NormalOrSelfClosing)] -[HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] -public class MultiSpecifiedTagStructureTagHelper : TagHelper -{ -} + [HtmlTargetElement("p", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] + public class MultiSpecifiedTagStructureTagHelper : TagHelper + { + } -[HtmlTargetElement("p")] -[HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] -public class MultiWithUnspecifiedTagStructureTagHelper : TagHelper -{ -} + [HtmlTargetElement("p")] + [HtmlTargetElement("input", TagStructure = TagStructure.WithoutEndTag)] + public class MultiWithUnspecifiedTagStructureTagHelper : TagHelper + { + } -[EditorBrowsable(EditorBrowsableState.Always)] -public class DefaultEditorBrowsableTagHelper : TagHelper -{ [EditorBrowsable(EditorBrowsableState.Always)] - public int Property { get; set; } -} + public class DefaultEditorBrowsableTagHelper : TagHelper + { + [EditorBrowsable(EditorBrowsableState.Always)] + public int Property { get; set; } + } -public class HiddenPropertyEditorBrowsableTagHelper : TagHelper -{ - [EditorBrowsable(EditorBrowsableState.Never)] - public int Property { get; set; } -} + public class HiddenPropertyEditorBrowsableTagHelper : TagHelper + { + [EditorBrowsable(EditorBrowsableState.Never)] + public int Property { get; set; } + } -public class MultiPropertyEditorBrowsableTagHelper : TagHelper -{ - [EditorBrowsable(EditorBrowsableState.Never)] - public int Property { get; set; } + public class MultiPropertyEditorBrowsableTagHelper : TagHelper + { + [EditorBrowsable(EditorBrowsableState.Never)] + public int Property { get; set; } - public virtual int Property2 { get; set; } -} + public virtual int Property2 { get; set; } + } -public class OverriddenPropertyEditorBrowsableTagHelper : MultiPropertyEditorBrowsableTagHelper -{ - [EditorBrowsable(EditorBrowsableState.Never)] - public override int Property2 { get; set; } -} + public class OverriddenPropertyEditorBrowsableTagHelper : MultiPropertyEditorBrowsableTagHelper + { + [EditorBrowsable(EditorBrowsableState.Never)] + public override int Property2 { get; set; } + } -[EditorBrowsable(EditorBrowsableState.Never)] -public class EditorBrowsableTagHelper : TagHelper -{ [EditorBrowsable(EditorBrowsableState.Never)] - public virtual int Property { get; set; } -} + public class EditorBrowsableTagHelper : TagHelper + { + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual int Property { get; set; } + } -public class InheritedEditorBrowsableTagHelper : EditorBrowsableTagHelper -{ - public override int Property { get; set; } -} + public class InheritedEditorBrowsableTagHelper : EditorBrowsableTagHelper + { + public override int Property { get; set; } + } -[EditorBrowsable(EditorBrowsableState.Advanced)] -public class OverriddenEditorBrowsableTagHelper : EditorBrowsableTagHelper -{ [EditorBrowsable(EditorBrowsableState.Advanced)] - public override int Property { get; set; } -} + public class OverriddenEditorBrowsableTagHelper : EditorBrowsableTagHelper + { + [EditorBrowsable(EditorBrowsableState.Advanced)] + public override int Property { get; set; } + } -[HtmlTargetElement("p")] -[HtmlTargetElement("div")] -[EditorBrowsable(EditorBrowsableState.Never)] -public class MultiEditorBrowsableTagHelper : TagHelper -{ -} + [HtmlTargetElement("p")] + [HtmlTargetElement("div")] + [EditorBrowsable(EditorBrowsableState.Never)] + public class MultiEditorBrowsableTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "class*")] -public class AttributeWildcardTargetingTagHelper : TagHelper -{ -} + [HtmlTargetElement(Attributes = "class*")] + public class AttributeWildcardTargetingTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "class*,style*")] -public class MultiAttributeWildcardTargetingTagHelper : TagHelper -{ -} + [HtmlTargetElement(Attributes = "class*,style*")] + public class MultiAttributeWildcardTargetingTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "class")] -public class AttributeTargetingTagHelper : TagHelper -{ -} + [HtmlTargetElement(Attributes = "class")] + public class AttributeTargetingTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "class,style")] -public class MultiAttributeTargetingTagHelper : TagHelper -{ -} + [HtmlTargetElement(Attributes = "class,style")] + public class MultiAttributeTargetingTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "custom")] -[HtmlTargetElement(Attributes = "class,style")] -public class MultiAttributeAttributeTargetingTagHelper : TagHelper -{ -} + [HtmlTargetElement(Attributes = "custom")] + [HtmlTargetElement(Attributes = "class,style")] + public class MultiAttributeAttributeTargetingTagHelper : TagHelper + { + } -[HtmlTargetElement(Attributes = "style")] -public class InheritedAttributeTargetingTagHelper : AttributeTargetingTagHelper -{ -} + [HtmlTargetElement(Attributes = "style")] + public class InheritedAttributeTargetingTagHelper : AttributeTargetingTagHelper + { + } -[HtmlTargetElement("input", Attributes = "class")] -public class RequiredAttributeTagHelper : TagHelper -{ -} + [HtmlTargetElement("input", Attributes = "class")] + public class RequiredAttributeTagHelper : TagHelper + { + } -[HtmlTargetElement("div", Attributes = "class")] -public class InheritedRequiredAttributeTagHelper : RequiredAttributeTagHelper -{ -} + [HtmlTargetElement("div", Attributes = "class")] + public class InheritedRequiredAttributeTagHelper : RequiredAttributeTagHelper + { + } -[HtmlTargetElement("div", Attributes = "class")] -[HtmlTargetElement("input", Attributes = "class")] -public class MultiAttributeRequiredAttributeTagHelper : TagHelper -{ -} + [HtmlTargetElement("div", Attributes = "class")] + [HtmlTargetElement("input", Attributes = "class")] + public class MultiAttributeRequiredAttributeTagHelper : TagHelper + { + } -[HtmlTargetElement("input", Attributes = "style")] -[HtmlTargetElement("input", Attributes = "class")] -public class MultiAttributeSameTagRequiredAttributeTagHelper : TagHelper -{ -} + [HtmlTargetElement("input", Attributes = "style")] + [HtmlTargetElement("input", Attributes = "class")] + public class MultiAttributeSameTagRequiredAttributeTagHelper : TagHelper + { + } -[HtmlTargetElement("input", Attributes = "class,style")] -public class MultiRequiredAttributeTagHelper : TagHelper -{ -} + [HtmlTargetElement("input", Attributes = "class,style")] + public class MultiRequiredAttributeTagHelper : TagHelper + { + } -[HtmlTargetElement("div", Attributes = "style")] -public class InheritedMultiRequiredAttributeTagHelper : MultiRequiredAttributeTagHelper -{ -} + [HtmlTargetElement("div", Attributes = "style")] + public class InheritedMultiRequiredAttributeTagHelper : MultiRequiredAttributeTagHelper + { + } -[HtmlTargetElement("div", Attributes = "class,style")] -[HtmlTargetElement("input", Attributes = "class,style")] -public class MultiTagMultiRequiredAttributeTagHelper : TagHelper -{ -} + [HtmlTargetElement("div", Attributes = "class,style")] + [HtmlTargetElement("input", Attributes = "class,style")] + public class MultiTagMultiRequiredAttributeTagHelper : TagHelper + { + } -[HtmlTargetElement("p")] -[HtmlTargetElement("div")] -public class MultiTagTagHelper -{ - public string ValidAttribute { get; set; } -} + [HtmlTargetElement("p")] + [HtmlTargetElement("div")] + public class MultiTagTagHelper + { + public string ValidAttribute { get; set; } + } -public class InheritedMultiTagTagHelper : MultiTagTagHelper -{ -} + public class InheritedMultiTagTagHelper : MultiTagTagHelper + { + } -[HtmlTargetElement("p")] -[HtmlTargetElement("p")] -[HtmlTargetElement("div")] -[HtmlTargetElement("div")] -public class DuplicateTagNameTagHelper -{ -} + [HtmlTargetElement("p")] + [HtmlTargetElement("p")] + [HtmlTargetElement("div")] + [HtmlTargetElement("div")] + public class DuplicateTagNameTagHelper + { + } -[HtmlTargetElement("data-condition")] -public class OverrideNameTagHelper -{ -} + [HtmlTargetElement("data-condition")] + public class OverrideNameTagHelper + { + } -public class InheritedSingleAttributeTagHelper : SingleAttributeTagHelper -{ -} + public class InheritedSingleAttributeTagHelper : SingleAttributeTagHelper + { + } -public class DuplicateAttributeNameTagHelper -{ - public string MyNameIsLegion { get; set; } + public class DuplicateAttributeNameTagHelper + { + public string MyNameIsLegion { get; set; } - [HtmlAttributeName("my-name-is-legion")] - public string Fred { get; set; } -} + [HtmlAttributeName("my-name-is-legion")] + public string Fred { get; set; } + } -public class NotBoundAttributeTagHelper -{ - public object BoundProperty { get; set; } + public class NotBoundAttributeTagHelper + { + public object BoundProperty { get; set; } - [HtmlAttributeNotBound] - public string NotBoundProperty { get; set; } + [HtmlAttributeNotBound] + public string NotBoundProperty { get; set; } - [HtmlAttributeName("unused")] - [HtmlAttributeNotBound] - public string NamedNotBoundProperty { get; set; } -} + [HtmlAttributeName("unused")] + [HtmlAttributeNotBound] + public string NamedNotBoundProperty { get; set; } + } -public class OverriddenAttributeTagHelper -{ - [HtmlAttributeName("SomethingElse")] - public virtual string ValidAttribute1 { get; set; } + public class OverriddenAttributeTagHelper + { + [HtmlAttributeName("SomethingElse")] + public virtual string ValidAttribute1 { get; set; } - [HtmlAttributeName("Something-Else")] - public string ValidAttribute2 { get; set; } -} + [HtmlAttributeName("Something-Else")] + public string ValidAttribute2 { get; set; } + } -public class InheritedOverriddenAttributeTagHelper : OverriddenAttributeTagHelper -{ - public override string ValidAttribute1 { get; set; } -} + public class InheritedOverriddenAttributeTagHelper : OverriddenAttributeTagHelper + { + public override string ValidAttribute1 { get; set; } + } -public class InheritedNotOverriddenAttributeTagHelper : OverriddenAttributeTagHelper -{ -} + public class InheritedNotOverriddenAttributeTagHelper : OverriddenAttributeTagHelper + { + } -public class ALLCAPSTAGHELPER : TagHelper -{ - public int ALLCAPSATTRIBUTE { get; set; } -} + public class ALLCAPSTAGHELPER : TagHelper + { + public int ALLCAPSATTRIBUTE { get; set; } + } -public class CAPSOnOUTSIDETagHelper : TagHelper -{ - public int CAPSOnOUTSIDEATTRIBUTE { get; set; } -} + public class CAPSOnOUTSIDETagHelper : TagHelper + { + public int CAPSOnOUTSIDEATTRIBUTE { get; set; } + } -public class capsONInsideTagHelper : TagHelper -{ - public int capsONInsideattribute { get; set; } -} + public class capsONInsideTagHelper : TagHelper + { + public int capsONInsideattribute { get; set; } + } -public class One1Two2Three3TagHelper : TagHelper -{ - public int One1Two2Three3Attribute { get; set; } -} + public class One1Two2Three3TagHelper : TagHelper + { + public int One1Two2Three3Attribute { get; set; } + } -public class ONE1TWO2THREE3TagHelper : TagHelper -{ - public int ONE1TWO2THREE3Attribute { get; set; } -} + public class ONE1TWO2THREE3TagHelper : TagHelper + { + public int ONE1TWO2THREE3Attribute { get; set; } + } -public class First_Second_ThirdHiTagHelper : TagHelper -{ - public int First_Second_ThirdAttribute { get; set; } -} + public class First_Second_ThirdHiTagHelper : TagHelper + { + public int First_Second_ThirdAttribute { get; set; } + } -public class UNSuffixedCLASS : TagHelper -{ - public int UNSuffixedATTRIBUTE { get; set; } -} + public class UNSuffixedCLASS : TagHelper + { + public int UNSuffixedATTRIBUTE { get; set; } + } -public class InvalidBoundAttribute : TagHelper -{ - public string DataSomething { get; set; } -} + public class InvalidBoundAttribute : TagHelper + { + public string DataSomething { get; set; } + } -public class InvalidBoundAttributeWithValid : SingleAttributeTagHelper -{ - public string DataSomething { get; set; } -} + public class InvalidBoundAttributeWithValid : SingleAttributeTagHelper + { + public string DataSomething { get; set; } + } -public class OverriddenInvalidBoundAttributeWithValid : TagHelper -{ - [HtmlAttributeName("valid-something")] - public string DataSomething { get; set; } -} + public class OverriddenInvalidBoundAttributeWithValid : TagHelper + { + [HtmlAttributeName("valid-something")] + public string DataSomething { get; set; } + } -public class OverriddenValidBoundAttributeWithInvalid : TagHelper -{ - [HtmlAttributeName("data-something")] - public string ValidSomething { get; set; } -} + public class OverriddenValidBoundAttributeWithInvalid : TagHelper + { + [HtmlAttributeName("data-something")] + public string ValidSomething { get; set; } + } -public class OverriddenValidBoundAttributeWithInvalidUpperCase : TagHelper -{ - [HtmlAttributeName("DATA-SOMETHING")] - public string ValidSomething { get; set; } -} + public class OverriddenValidBoundAttributeWithInvalidUpperCase : TagHelper + { + [HtmlAttributeName("DATA-SOMETHING")] + public string ValidSomething { get; set; } + } -public class DefaultValidHtmlAttributePrefix : TagHelper -{ - public IDictionary DictionaryProperty { get; set; } -} + public class DefaultValidHtmlAttributePrefix : TagHelper + { + public IDictionary DictionaryProperty { get; set; } + } -public class SingleValidHtmlAttributePrefix : TagHelper -{ - [HtmlAttributeName("valid-name")] - public IDictionary DictionaryProperty { get; set; } -} + public class SingleValidHtmlAttributePrefix : TagHelper + { + [HtmlAttributeName("valid-name")] + public IDictionary DictionaryProperty { get; set; } + } -public class MultipleValidHtmlAttributePrefix : TagHelper -{ - [HtmlAttributeName("valid-name1", DictionaryAttributePrefix = "valid-prefix1-")] - public Dictionary DictionaryProperty { get; set; } + public class MultipleValidHtmlAttributePrefix : TagHelper + { + [HtmlAttributeName("valid-name1", DictionaryAttributePrefix = "valid-prefix1-")] + public Dictionary DictionaryProperty { get; set; } - [HtmlAttributeName("valid-name2", DictionaryAttributePrefix = "valid-prefix2-")] - public DictionarySubclass DictionarySubclassProperty { get; set; } + [HtmlAttributeName("valid-name2", DictionaryAttributePrefix = "valid-prefix2-")] + public DictionarySubclass DictionarySubclassProperty { get; set; } - [HtmlAttributeName("valid-name3", DictionaryAttributePrefix = "valid-prefix3-")] - public DictionaryWithoutParameterlessConstructor DictionaryWithoutParameterlessConstructorProperty { get; set; } + [HtmlAttributeName("valid-name3", DictionaryAttributePrefix = "valid-prefix3-")] + public DictionaryWithoutParameterlessConstructor DictionaryWithoutParameterlessConstructorProperty { get; set; } - [HtmlAttributeName("valid-name4", DictionaryAttributePrefix = "valid-prefix4-")] - public GenericDictionarySubclass GenericDictionarySubclassProperty { get; set; } + [HtmlAttributeName("valid-name4", DictionaryAttributePrefix = "valid-prefix4-")] + public GenericDictionarySubclass GenericDictionarySubclassProperty { get; set; } - [HtmlAttributeName("valid-name5", DictionaryAttributePrefix = "valid-prefix5-")] - public SortedDictionary SortedDictionaryProperty { get; set; } + [HtmlAttributeName("valid-name5", DictionaryAttributePrefix = "valid-prefix5-")] + public SortedDictionary SortedDictionaryProperty { get; set; } - [HtmlAttributeName("valid-name6")] - public string StringProperty { get; set; } + [HtmlAttributeName("valid-name6")] + public string StringProperty { get; set; } - public IDictionary GetOnlyDictionaryProperty { get; } + public IDictionary GetOnlyDictionaryProperty { get; } - [HtmlAttributeName(DictionaryAttributePrefix = "valid-prefix6")] - public IDictionary GetOnlyDictionaryPropertyWithAttributePrefix { get; } -} + [HtmlAttributeName(DictionaryAttributePrefix = "valid-prefix6")] + public IDictionary GetOnlyDictionaryPropertyWithAttributePrefix { get; } + } -public class SingleInvalidHtmlAttributePrefix : TagHelper -{ - [HtmlAttributeName("valid-name", DictionaryAttributePrefix = "valid-prefix")] - public string StringProperty { get; set; } -} + public class SingleInvalidHtmlAttributePrefix : TagHelper + { + [HtmlAttributeName("valid-name", DictionaryAttributePrefix = "valid-prefix")] + public string StringProperty { get; set; } + } -public class MultipleInvalidHtmlAttributePrefix : TagHelper -{ - [HtmlAttributeName("valid-name1")] - public long LongProperty { get; set; } + public class MultipleInvalidHtmlAttributePrefix : TagHelper + { + [HtmlAttributeName("valid-name1")] + public long LongProperty { get; set; } - [HtmlAttributeName("valid-name2", DictionaryAttributePrefix = "valid-prefix2-")] - public Dictionary DictionaryOfIntProperty { get; set; } + [HtmlAttributeName("valid-name2", DictionaryAttributePrefix = "valid-prefix2-")] + public Dictionary DictionaryOfIntProperty { get; set; } - [HtmlAttributeName("valid-name3", DictionaryAttributePrefix = "valid-prefix3-")] - public IReadOnlyDictionary ReadOnlyDictionaryProperty { get; set; } + [HtmlAttributeName("valid-name3", DictionaryAttributePrefix = "valid-prefix3-")] + public IReadOnlyDictionary ReadOnlyDictionaryProperty { get; set; } - [HtmlAttributeName("valid-name4", DictionaryAttributePrefix = "valid-prefix4-")] - public int IntProperty { get; set; } + [HtmlAttributeName("valid-name4", DictionaryAttributePrefix = "valid-prefix4-")] + public int IntProperty { get; set; } - [HtmlAttributeName("valid-name5", DictionaryAttributePrefix = "valid-prefix5-")] - public DictionaryOfIntSubclass DictionaryOfIntSubclassProperty { get; set; } + [HtmlAttributeName("valid-name5", DictionaryAttributePrefix = "valid-prefix5-")] + public DictionaryOfIntSubclass DictionaryOfIntSubclassProperty { get; set; } - [HtmlAttributeName(DictionaryAttributePrefix = "valid-prefix6")] - public IDictionary GetOnlyDictionaryAttributePrefix { get; } + [HtmlAttributeName(DictionaryAttributePrefix = "valid-prefix6")] + public IDictionary GetOnlyDictionaryAttributePrefix { get; } - [HtmlAttributeName("invalid-name7")] - public IDictionary GetOnlyDictionaryPropertyWithAttributeName { get; } -} + [HtmlAttributeName("invalid-name7")] + public IDictionary GetOnlyDictionaryPropertyWithAttributeName { get; } + } -public class DictionarySubclass : Dictionary -{ -} + public class DictionarySubclass : Dictionary + { + } -public class DictionaryWithoutParameterlessConstructor : Dictionary -{ - public DictionaryWithoutParameterlessConstructor(int count) - : base() + public class DictionaryWithoutParameterlessConstructor : Dictionary { + public DictionaryWithoutParameterlessConstructor(int count) + : base() + { + } } -} -public class DictionaryOfIntSubclass : Dictionary -{ -} + public class DictionaryOfIntSubclass : Dictionary + { + } -public class GenericDictionarySubclass : Dictionary -{ -} + public class GenericDictionarySubclass : Dictionary + { + } -[OutputElementHint("strong")] -public class OutputElementHintTagHelper : TagHelper -{ -} + [OutputElementHint("strong")] + public class OutputElementHintTagHelper : TagHelper + { + } -[HtmlTargetElement("a")] -[HtmlTargetElement("p")] -[OutputElementHint("div")] -public class MultipleDescriptorTagHelperWithOutputElementHint : TagHelper -{ -} + [HtmlTargetElement("a")] + [HtmlTargetElement("p")] + [OutputElementHint("div")] + public class MultipleDescriptorTagHelperWithOutputElementHint : TagHelper + { + } -public class NonPublicAccessorTagHelper : TagHelper -{ - public string ValidAttribute { get; set; } - public string InvalidPrivateSetAttribute { get; private set; } - public string InvalidPrivateGetAttribute { private get; set; } - protected string InvalidProtectedAttribute { get; set; } - internal string InvalidInternalAttribute { get; set; } - protected internal string InvalidProtectedInternalAttribute { get; set; } -} + public class NonPublicAccessorTagHelper : TagHelper + { + public string ValidAttribute { get; set; } + public string InvalidPrivateSetAttribute { get; private set; } + public string InvalidPrivateGetAttribute { private get; set; } + protected string InvalidProtectedAttribute { get; set; } + internal string InvalidInternalAttribute { get; set; } + protected internal string InvalidProtectedInternalAttribute { get; set; } + } -public class SingleAttributeTagHelper : TagHelper -{ - public int IntAttribute { get; set; } -} + public class SingleAttributeTagHelper : TagHelper + { + public int IntAttribute { get; set; } + } -public class MissingAccessorTagHelper : TagHelper -{ - public string ValidAttribute { get; set; } - public string InvalidNoGetAttribute { set { } } - public string InvalidNoSetAttribute { get { return string.Empty; } } + public class MissingAccessorTagHelper : TagHelper + { + public string ValidAttribute { get; set; } + public string InvalidNoGetAttribute { set { } } + public string InvalidNoSetAttribute { get { return string.Empty; } } + } +} +"""; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperTypeVisitorTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperTypeVisitorTest.cs index 2f9eb46f588..b02afeda409 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperTypeVisitorTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/TagHelperTypeVisitorTest.cs @@ -4,26 +4,28 @@ #nullable disable using System.Collections.Generic; -using System.Reflection; -using Microsoft.AspNetCore.Razor.TagHelpers; using Xunit; namespace Microsoft.CodeAnalysis.Razor.Workspaces; -public class TagHelperTypeVisitorTest +public class TagHelperTypeVisitorTest : TagHelperDescriptorProviderTestBase { - private static readonly Assembly _assembly = typeof(TagHelperTypeVisitorTest).GetTypeInfo().Assembly; + public TagHelperTypeVisitorTest() : base(AdditionalCode) + { + Compilation = BaseCompilation; + ITagHelperSymbol = Compilation.GetTypeByMetadataName(TagHelperTypes.ITagHelper); + } - private static Compilation Compilation { get; } = TestCompilation.Create(_assembly); + private Compilation Compilation { get; } - private static INamedTypeSymbol ITagHelperSymbol { get; } = Compilation.GetTypeByMetadataName(TagHelperTypes.ITagHelper); + private INamedTypeSymbol ITagHelperSymbol { get; } [Fact] public void IsTagHelper_PlainTagHelper_ReturnsTrue() { // Arrange var testVisitor = new TagHelperTypeVisitor(ITagHelperSymbol, new List()); - var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Valid_PlainTagHelper).FullName); + var tagHelperSymbol = Compilation.GetTypeByMetadataName("TestNamespace.Valid_PlainTagHelper"); // Act var isTagHelper = testVisitor.IsTagHelper(tagHelperSymbol); @@ -37,7 +39,7 @@ public void IsTagHelper_InheritedTagHelper_ReturnsTrue() { // Arrange var testVisitor = new TagHelperTypeVisitor(ITagHelperSymbol, new List()); - var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Valid_InheritedTagHelper).FullName); + var tagHelperSymbol = Compilation.GetTypeByMetadataName("TestNamespace.Valid_InheritedTagHelper"); // Act var isTagHelper = testVisitor.IsTagHelper(tagHelperSymbol); @@ -51,7 +53,7 @@ public void IsTagHelper_AbstractTagHelper_ReturnsFalse() { // Arrange var testVisitor = new TagHelperTypeVisitor(ITagHelperSymbol, new List()); - var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_AbstractTagHelper).FullName); + var tagHelperSymbol = Compilation.GetTypeByMetadataName("TestNamespace.Invalid_AbstractTagHelper"); // Act var isTagHelper = testVisitor.IsTagHelper(tagHelperSymbol); @@ -65,7 +67,7 @@ public void IsTagHelper_GenericTagHelper_ReturnsFalse() { // Arrange var testVisitor = new TagHelperTypeVisitor(ITagHelperSymbol, new List()); - var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_GenericTagHelper<>).FullName); + var tagHelperSymbol = Compilation.GetTypeByMetadataName("TestNamespace.Invalid_GenericTagHelper`1"); // Act var isTagHelper = testVisitor.IsTagHelper(tagHelperSymbol); @@ -79,7 +81,7 @@ public void IsTagHelper_InternalTagHelper_ReturnsFalse() { // Arrange var testVisitor = new TagHelperTypeVisitor(ITagHelperSymbol, new List()); - var tagHelperSymbol = Compilation.GetTypeByMetadataName(typeof(Invalid_InternalTagHelper).FullName); + var tagHelperSymbol = Compilation.GetTypeByMetadataName("TestNamespace.Invalid_InternalTagHelper"); // Act var isTagHelper = testVisitor.IsTagHelper(tagHelperSymbol); @@ -88,32 +90,40 @@ public void IsTagHelper_InternalTagHelper_ReturnsFalse() Assert.False(isTagHelper); } - public class Invalid_NestedPublicTagHelper : TagHelper - { - } - - public class Valid_NestedPublicViewComponent - { - public string Invoke(string foo) => null; - } -} - -public abstract class Invalid_AbstractTagHelper : TagHelper -{ -} - -public class Invalid_GenericTagHelper : TagHelper -{ -} - -internal class Invalid_InternalTagHelper : TagHelper -{ -} - -public class Valid_PlainTagHelper : TagHelper -{ -} - -public class Valid_InheritedTagHelper : Valid_PlainTagHelper -{ + private const string AdditionalCode = + """ + using Microsoft.AspNetCore.Razor.TagHelpers; + + namespace TestNamespace + { + public class Invalid_NestedPublicTagHelper : TagHelper + { + } + + public class Valid_NestedPublicViewComponent + { + public string Invoke(string foo) => null; + } + + public abstract class Invalid_AbstractTagHelper : TagHelper + { + } + + public class Invalid_GenericTagHelper : TagHelper + { + } + + internal class Invalid_InternalTagHelper : TagHelper + { + } + + public class Valid_PlainTagHelper : TagHelper + { + } + + public class Valid_InheritedTagHelper : Valid_PlainTagHelper + { + } + } + """; } diff --git a/src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport.csproj b/src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport.csproj index f439aa3e63b..423e64725fa 100644 --- a/src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport.csproj +++ b/src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport/Microsoft.NET.Sdk.Razor.SourceGenerators.Transport.csproj @@ -9,7 +9,7 @@ false true - false + false diff --git a/src/Compiler/Microsoft.Net.Compilers.Razor.Toolset/Microsoft.Net.Compilers.Razor.Toolset.csproj b/src/Compiler/Microsoft.Net.Compilers.Razor.Toolset/Microsoft.Net.Compilers.Razor.Toolset.csproj index 32fc1ff170c..5aeeccbf89b 100644 --- a/src/Compiler/Microsoft.Net.Compilers.Razor.Toolset/Microsoft.Net.Compilers.Razor.Toolset.csproj +++ b/src/Compiler/Microsoft.Net.Compilers.Razor.Toolset/Microsoft.Net.Compilers.Razor.Toolset.csproj @@ -11,7 +11,7 @@ true false true - true + true .NET Compilers Razor Toolset Package. Referencing this package will cause the project to be built using the Razor compilers and source generator contained in the package, as opposed to the version installed with the SDK. diff --git a/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs b/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs index 42bf5b84580..90a85e481e8 100644 --- a/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs +++ b/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs @@ -39,7 +39,7 @@ public void CodeGeneration_DesignTime_LargeStaticFile() var codeDocument = ProjectEngine.ProcessDesignTime(MSN); var generated = codeDocument.GetCSharpDocument(); - if (generated.Diagnostics.Count != 0) + if (generated.Diagnostics.Length > 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); } @@ -51,7 +51,7 @@ public void CodeGeneration_Runtime_LargeStaticFile() var codeDocument = ProjectEngine.Process(MSN); var generated = codeDocument.GetCSharpDocument(); - if (generated.Diagnostics.Count != 0) + if (generated.Diagnostics.Length > 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); } diff --git a/src/Compiler/perf/Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.Compiler.csproj b/src/Compiler/perf/Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.Compiler.csproj index ff25b1f3ace..879da42abbc 100644 --- a/src/Compiler/perf/Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.Compiler.csproj +++ b/src/Compiler/perf/Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.Compiler.csproj @@ -5,7 +5,7 @@ Exe true true - true + true false diff --git a/src/Compiler/perf/Microbenchmarks/SyntaxTreeGenerationBenckmark.cs b/src/Compiler/perf/Microbenchmarks/SyntaxTreeGenerationBenckmark.cs index 8999f41ad87..6e686e23ff9 100644 --- a/src/Compiler/perf/Microbenchmarks/SyntaxTreeGenerationBenckmark.cs +++ b/src/Compiler/perf/Microbenchmarks/SyntaxTreeGenerationBenckmark.cs @@ -52,7 +52,7 @@ public void SyntaxTreeGeneration_DesignTime_LargeStaticFile() }); var syntaxTree = RazorSyntaxTree.Parse(MSN, options); - if (syntaxTree.Diagnostics.Count != 0) + if (syntaxTree.Diagnostics.Length != 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics)); } @@ -70,7 +70,7 @@ public void SyntaxTreeGeneration_Runtime_LargeStaticFile() }); var syntaxTree = RazorSyntaxTree.Parse(MSN, options); - if (syntaxTree.Diagnostics.Count != 0) + if (syntaxTree.Diagnostics.Length != 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, syntaxTree.Diagnostics)); } diff --git a/src/Compiler/test/Directory.Build.props b/src/Compiler/test/Directory.Build.props index 7af57e829d4..838e522f0f9 100644 --- a/src/Compiler/test/Directory.Build.props +++ b/src/Compiler/test/Directory.Build.props @@ -8,6 +8,6 @@ --> true false - true + true diff --git a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler.csproj b/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler.csproj deleted file mode 100644 index acb10650c86..00000000000 --- a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib/Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netstandard2.0 - - - - - - - - - - - - - - diff --git a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj b/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj deleted file mode 100644 index faa0c341e56..00000000000 --- a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.MvcShim/Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefaultNetCoreTargetFrameworks);$(DefaultNetFxTargetFramework) - true - - - - - - - - - - diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs index 9d5de9e89e6..b6d76601363 100644 --- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs +++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs @@ -1059,7 +1059,7 @@ namespace MyApp.Pages using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; #nullable restore -#line (2,2)-(3,1) ""Pages/Index.razor"" +#line (2,2)-(2,33) ""Pages/Index.razor"" using SurveyPromptRootNamspace; #line default @@ -1132,7 +1132,7 @@ namespace MyApp.Pages using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; #nullable restore -#line (2,2)-(3,1) ""Pages/Index.razor"" +#line (2,2)-(2,33) ""Pages/Index.razor"" using SurveyPromptRootNamspace; #line default @@ -1160,6 +1160,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. Assert.Equal(2, result.GeneratedSources.Length); Assert.Collection(eventListener.Events, + e => Assert.Equal("ComputeRazorSourceGeneratorOptions", e.EventName), e => Assert.Equal("DiscoverTagHelpersFromCompilationStart", e.EventName), e => Assert.Equal("DiscoverTagHelpersFromCompilationStop", e.EventName), e => Assert.Equal("DiscoverTagHelpersFromReferencesStart", e.EventName), @@ -3260,6 +3261,7 @@ public async Task IncrementalCompilation_OnlyCompilationRuns_When_MetadataRefere // reference causes the compilation to change so we re-run tag helper discovery there // but we didn't re-check the actual reference itself Assert.Collection(eventListener.Events, + e => Assert.Equal("ComputeRazorSourceGeneratorOptions", e.EventName), e => Assert.Equal("DiscoverTagHelpersFromCompilationStart", e.EventName), e => Assert.Equal("DiscoverTagHelpersFromCompilationStop", e.EventName)); } diff --git a/src/Compiler/tools/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj b/src/Compiler/tools/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj index fc904636846..584c2711ab5 100644 --- a/src/Compiler/tools/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj +++ b/src/Compiler/tools/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal/Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj @@ -6,7 +6,7 @@ false false true - false + false diff --git a/src/Compiler/tools/Microsoft.CodeAnalysis.Razor.Tooling.Internal/Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj b/src/Compiler/tools/Microsoft.CodeAnalysis.Razor.Tooling.Internal/Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj index 582b2166ce9..45c3032e4ba 100644 --- a/src/Compiler/tools/Microsoft.CodeAnalysis.Razor.Tooling.Internal/Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj +++ b/src/Compiler/tools/Microsoft.CodeAnalysis.Razor.Tooling.Internal/Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj @@ -6,7 +6,7 @@ false false true - false + false true diff --git a/src/Compiler/tools/RazorSyntaxGenerator/RazorSyntaxGenerator.csproj b/src/Compiler/tools/RazorSyntaxGenerator/RazorSyntaxGenerator.csproj index 614004aed9a..ffe509a8e85 100644 --- a/src/Compiler/tools/RazorSyntaxGenerator/RazorSyntaxGenerator.csproj +++ b/src/Compiler/tools/RazorSyntaxGenerator/RazorSyntaxGenerator.csproj @@ -9,7 +9,7 @@ false false - true + true diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 4cfa36773c0..f79adf835b1 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -5,14 +5,12 @@ using System; using System.IO; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.Microbenchmarks.LanguageServer; @@ -110,19 +108,13 @@ void Method() { } [Benchmark(Description = "Formatting")] public async Task RazorCSharpFormattingAsync() { - var options = new FormattingOptions() - { - TabSize = 4, - InsertSpaces = true - }; - - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); - var edits = await RazorFormattingService.FormatAsync(documentContext, range: null, options, CancellationToken.None); + var changes = await RazorFormattingService.GetDocumentFormattingChangesAsync(documentContext, htmlEdits: [], span: null, new RazorFormattingOptions(), CancellationToken.None); #if DEBUG // For debugging purposes only. - var changedText = DocumentText.WithChanges(edits.Select(DocumentText.GetTextChange)); + var changedText = DocumentText.WithChanges(changes); _ = changedText.ToString(); #endif } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs index efeead6a96e..d1d21777c6f 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs @@ -83,7 +83,7 @@ public async Task SetupAsync() CSharpCodeActionRange = DocumentText.GetZeroWidthRange(csharpCodeActionIndex); HtmlCodeActionRange = DocumentText.GetZeroWidthRange(htmlCodeActionIndex); - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); var codeDocument = await documentContext.GetCodeDocumentAsync(CancellationToken.None); // Need a root namespace for the Extract to Code Behind light bulb to be happy diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs index 0bf6c9fea83..d35a168a36e 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs @@ -79,7 +79,7 @@ public async Task SetupAsync() RazorPosition = DocumentText.GetPosition(razorCodeActionIndex); - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); RazorRequestContext = new RazorRequestContext(documentContext, RazorLanguageServerHost.GetRequiredService(), "lsp/method", uri: null); } @@ -146,7 +146,7 @@ public TestDelegatedCompletionListProvider(IEnumerable GetCompletionListAsync(int absoluteIndex, VSInternalCompletionContext completionContext, VersionedDocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) + public override Task GetCompletionListAsync(int absoluteIndex, VSInternalCompletionContext completionContext, DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) { return Task.FromResult( new VSInternalCompletionList diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 9e50156d7f5..7071c1986f1 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -10,10 +10,10 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -36,7 +36,7 @@ public class RazorDiagnosticsBenchmark : RazorLanguageServerBenchmarkBase private ImmutableArray SourceMappings { get; set; } private string? GeneratedCode { get; set; } private object? Diagnostics { get; set; } - private VersionedDocumentContext? VersionedDocumentContext { get; set; } + private DocumentContext? DocumentContext { get; set; } private VSInternalDocumentDiagnosticsParams? Request { get; set; } private IEnumerable? Response { get; set; } @@ -58,14 +58,13 @@ public void Setup() var stringSourceDocument = RazorSourceDocument.Create(GetFileContents(), UTF8Encoding.UTF8, RazorSourceDocumentProperties.Default); var mockRazorCodeDocument = new Mock(MockBehavior.Strict); - var mockRazorCSharpDocument = RazorCSharpDocument.Create( + var mockRazorCSharpDocument = new RazorCSharpDocument( mockRazorCodeDocument.Object, GeneratedCode, - RazorCodeGenerationOptions.CreateDesignTimeDefault(), - Array.Empty(), + RazorCodeGenerationOptions.DesignTimeDefault, + diagnostics: [], SourceMappings, - new List() - ); + linePragmas: []); var itemCollection = new ItemCollection(); itemCollection[typeof(RazorCSharpDocument)] = mockRazorCSharpDocument; @@ -74,17 +73,17 @@ public void Setup() RazorCodeDocument = mockRazorCodeDocument.Object; SourceText = RazorCodeDocument.Source.Text; - var documentContext = new Mock( + var documentContext = new Mock( MockBehavior.Strict, new object[] { It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny() }); documentContext .Setup(r => r.GetCodeDocumentAsync(It.IsAny())) .ReturnsAsync(RazorCodeDocument); documentContext.Setup(r => r.Uri).Returns(It.IsAny()); - documentContext.Setup(r => r.Version).Returns(It.IsAny()); + documentContext.Setup(r => r.Snapshot.Version).Returns(It.IsAny()); documentContext.Setup(r => r.GetSourceTextAsync(It.IsAny())).ReturnsAsync(It.IsAny()); RazorRequestContext = new RazorRequestContext(documentContext.Object, null!, "lsp/method", uri: null); - VersionedDocumentContext = documentContext.Object; + DocumentContext = documentContext.Object; var loggerFactory = EmptyLoggerFactory.Instance; var languageServerFeatureOptions = BuildFeatureOptions(); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs index d7825241214..dd76b418ad0 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.AspNetCore.Razor.LanguageServer.Semantic; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; @@ -28,13 +27,11 @@ public class RazorSemanticTokensBenchmark : RazorLanguageServerBenchmarkBase { private IRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - private Uri DocumentUri => DocumentContext.Uri; private IDocumentSnapshot DocumentSnapshot => DocumentContext.Snapshot; - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Range Range { get; set; } @@ -62,8 +59,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - var version = 1; - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var text = await DocumentContext.GetSourceTextAsync(CancellationToken.None).ConfigureAwait(false); Range = VsLspFactory.CreateRange( @@ -75,9 +71,6 @@ public async Task InitializeRazorSemanticAsync() public async Task RazorSemanticTokensRangeAsync() { var cancellationToken = CancellationToken.None; - var documentVersion = 1; - - VersionCache.TrackDocumentVersion(DocumentSnapshot, documentVersion); await RazorSemanticTokenService.GetSemanticTokensAsync(DocumentContext, Range.ToLinePositionSpan(), colorBackground: false, Guid.Empty, cancellationToken: cancellationToken).ConfigureAwait(false); } @@ -98,10 +91,7 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { - var capabilitiesService = new BenchmarkClientCapabilitiesService(new VSInternalClientCapabilities { SupportsVisualStudioExtensions = true }); - var legend = new RazorSemanticTokensLegendService(capabilitiesService); RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } internal class TestRazorSemanticTokensInfoService : RazorSemanticTokensInfoService @@ -117,7 +107,7 @@ public TestRazorSemanticTokensInfoService( // We can't get C# responses without significant amounts of extra work, so let's just shim it for now, any non-Null result is fine. protected override Task?> GetCSharpSemanticRangesAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, RazorCodeDocument codeDocument, LinePositionSpan razorRange, bool colorBackground, diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs index 8258f197fc8..e4c3e5fffd0 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs @@ -32,13 +32,9 @@ public class RazorSemanticTokensRangeEndpointBenchmark : RazorLanguageServerBenc private SemanticTokensRangeEndpoint SemanticTokensRangeEndpoint { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - private Uri DocumentUri => DocumentContext.Uri; - private IDocumentSnapshot DocumentSnapshot => DocumentContext.Snapshot; - - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Range Range { get; set; } @@ -70,8 +66,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - var version = 1; - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var razorOptionsMonitor = RazorLanguageServerHost.GetRequiredService(); var clientCapabilitiesService = new BenchmarkClientCapabilitiesService(new VSInternalClientCapabilities() { SupportsVisualStudioExtensions = true }); @@ -83,9 +78,6 @@ public async Task InitializeRazorSemanticAsync() start: (0, 0), end: (text.Lines.Count - 1, text.Lines[^1].Span.Length - 1)); - var documentVersion = 1; - VersionCache.TrackDocumentVersion(DocumentSnapshot, documentVersion); - RequestContext = new RazorRequestContext(DocumentContext, RazorLanguageServerHost.GetRequiredService(), "lsp/method", uri: null); var random = new Random(); @@ -133,7 +125,6 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } internal class TestCustomizableRazorSemanticTokensInfoService : RazorSemanticTokensInfoService @@ -149,7 +140,7 @@ public TestCustomizableRazorSemanticTokensInfoService( // We can't get C# responses without significant amounts of extra work, so let's just shim it for now, any non-Null result is fine. protected override Task?> GetCSharpSemanticRangesAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, RazorCodeDocument codeDocument, LinePositionSpan razorSpan, bool colorBackground, diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs index 4063270b669..20bcd3f5505 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs @@ -8,7 +8,6 @@ using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.CodeAnalysis.Text; @@ -23,9 +22,7 @@ public class RazorSemanticTokensScrollingBenchmark : RazorLanguageServerBenchmar { private IRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Uri DocumentUri => DocumentContext.Uri; @@ -52,7 +49,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version: 1); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var text = await DocumentSnapshot.GetTextAsync().ConfigureAwait(false); Range = VsLspFactory.CreateRange( @@ -66,9 +63,6 @@ public async Task InitializeRazorSemanticAsync() public async Task RazorSemanticTokensRangeScrollingAsync() { var cancellationToken = CancellationToken.None; - var documentVersion = 1; - - VersionCache!.TrackDocumentVersion(DocumentSnapshot, documentVersion); var documentLineCount = Range.End.Line; @@ -105,6 +99,5 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj index 1010350dd29..0fae6de3c03 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks.csproj @@ -7,7 +7,7 @@ true true false - true + true false @@ -43,6 +43,9 @@ TestServices\%(FileName)%(Extension) + + TestServices\%(FileName)%(Extension) + diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/Telerik/Kendo.Mvc.Examples.project.razor.json b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/Telerik/Kendo.Mvc.Examples.project.razor.json index 00ca3271787..9104b499f89 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/Telerik/Kendo.Mvc.Examples.project.razor.json +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/Telerik/Kendo.Mvc.Examples.project.razor.json @@ -1,5 +1,5 @@ { - "__Version": 5, + "__Version": 6, "ProjectKey": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\obj\\Debug\\net7.0\\", "FilePath": "C:\\Users\\admin\\location\\Kendo.Mvc.Examples\\Kendo.Mvc.Examples.csproj", "Configuration": { diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/project.razor.json b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/project.razor.json index 2521817d3c0..d1525d22f3a 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/project.razor.json +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/Resources/project.razor.json @@ -1,5 +1,5 @@ { - "__Version": 5, + "__Version": 6, "ProjectKey": "C:\\Users\\admin\\location\\blazorserver\\obj\\Debug\\net7.0\\", "FilePath": "C:\\Users\\admin\\location\\blazorserver\\blazorserver.csproj", "Configuration": { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs index 216ffd6c9ca..e2014f4b761 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs @@ -58,26 +58,6 @@ private static ImmutableArray WrapAll(ImmutableArray WrapAll(IReadOnlyList list, Func createWrapper) - where TInner : class - where TResult : class - { - var count = list.Count; - if (count == 0) - { - return ImmutableArray.Empty; - } - - using var builder = new PooledArrayBuilder(capacity: count); - - for (var i = 0; i < count; i++) - { - builder.Add(createWrapper(list[i])); - } - - return builder.DrainToImmutable(); - } - private static ImmutableArray WrapAll(IEnumerable items, Func createWrapper) where TInner : class where TResult : class diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorWorkspaceListenerBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorWorkspaceListenerBase.cs index 7ab3ecf2a4b..753ad07c46d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorWorkspaceListenerBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorWorkspaceListenerBase.cs @@ -279,7 +279,7 @@ private static async Task ProcessWorkCoreAsync(ImmutableArray work, Stream private static async Task ReportUpdateProjectAsync(Stream stream, Project project, ILogger logger, CancellationToken cancellationToken) { logger.LogTrace("Serializing information for {projectId}", project.Id); - var projectInfo = await RazorProjectInfoFactory.ConvertAsync(project, logger, cancellationToken).ConfigureAwait(false); + var projectInfo = await RazorProjectInfoFactory.ConvertAsync(project, cancellationToken).ConfigureAwait(false); if (projectInfo is null) { logger.LogTrace("Skipped writing data for {projectId}", project.Id); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs index dfef778fe71..c84789d378c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs @@ -113,12 +113,14 @@ protected virtual Task HandleDelegatedResponseAsync(TResponse delegat return default; } - var positionInfo = await DocumentPositionInfoStrategy.TryGetPositionInfoAsync(_documentMappingService, documentContext, request.Position, cancellationToken).ConfigureAwait(false); - if (positionInfo is null) + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + if (!codeDocument.Source.Text.TryGetAbsoluteIndex(request.Position, out var absoluteIndex)) { return default; } + var positionInfo = DocumentPositionInfoStrategy.GetPositionInfo(_documentMappingService, codeDocument, absoluteIndex); + var response = await TryHandleAsync(request, requestContext, positionInfo, cancellationToken).ConfigureAwait(false); if (response is not null && response is not ISumType { Value: null }) { @@ -141,7 +143,6 @@ protected virtual Task HandleDelegatedResponseAsync(TResponse delegat // Sometimes Html can actually be mapped to C#, like for example component attributes, which map to // C# properties, even though they appear entirely in a Html context. Since remapping is pretty cheap // it's easier to just try mapping, and see what happens, rather than checking for specific syntax nodes. - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); if (_documentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out Position? csharpPosition, out _)) { // We're just gonna pretend this mapped perfectly normally onto C#. Moving this logic to the actual position info diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AdhocWorkspaceFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AdhocWorkspaceFactory.cs deleted file mode 100644 index f0c5badb420..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AdhocWorkspaceFactory.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.LanguageServer.Common; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed class AdhocWorkspaceFactory(IHostServicesProvider hostServicesProvider) : IAdhocWorkspaceFactory -{ - public AdhocWorkspace Create(params IWorkspaceService[] workspaceServices) - { - workspaceServices ??= []; - - var fallbackServices = hostServicesProvider.GetServices(); - var services = AdhocServices.Create( - workspaceServices: workspaceServices.ToImmutableArray(), - languageServices: ImmutableArray.Empty, - fallbackServices); - - return new AdhocWorkspace(services); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs deleted file mode 100644 index 5e83a82a646..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; - -internal interface IOnAutoInsertProvider -{ - string TriggerCharacter { get; } - - bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 30565f8c181..d71c507cb57 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -2,7 +2,9 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Frozen; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,7 +14,9 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -25,21 +29,16 @@ internal class OnAutoInsertEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IDocumentMappingService documentMappingService, IClientConnection clientConnection, - IEnumerable onAutoInsertProvider, + IAutoInsertService autoInsertService, RazorLSPOptionsMonitor optionsMonitor, - IAdhocWorkspaceFactory workspaceFactory, IRazorFormattingService razorFormattingService, ILoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { - private static readonly HashSet s_htmlAllowedTriggerCharacters = new(StringComparer.Ordinal) { "=", }; - private static readonly HashSet s_cSharpAllowedTriggerCharacters = new(StringComparer.Ordinal) { "'", "/", "\n" }; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory; private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; - private readonly List _onAutoInsertProviders = onAutoInsertProvider.ToList(); + private readonly IAutoInsertService _autoInsertService = autoInsertService; protected override string CustomMessageTarget => CustomMessageNames.RazorOnAutoInsertEndpointName; @@ -52,17 +51,17 @@ internal class OnAutoInsertEndpoint( public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { - var triggerCharacters = _onAutoInsertProviders.Select(provider => provider.TriggerCharacter); + var triggerCharacters = _autoInsertService.TriggerCharacters; if (_languageServerFeatureOptions.SingleServerSupport) { - triggerCharacters = triggerCharacters.Concat(s_htmlAllowedTriggerCharacters).Concat(s_cSharpAllowedTriggerCharacters); + triggerCharacters = [ + .. triggerCharacters, + .. AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters, + .. AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters]; } - serverCapabilities.OnAutoInsertProvider = new VSInternalDocumentOnAutoInsertOptions() - { - TriggerCharacters = triggerCharacters.Distinct().ToArray() - }; + serverCapabilities.EnableOnAutoInsert(triggerCharacters); } protected override async Task TryHandleAsync(VSInternalDocumentOnAutoInsertParams request, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) @@ -83,36 +82,18 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V var character = request.Character; - using var applicableProviders = new PooledArrayBuilder(); - foreach (var provider in _onAutoInsertProviders) + if (_autoInsertService.TryResolveInsertion( + codeDocument, + request.Position, + character, + _optionsMonitor.CurrentValue.AutoClosingTags, + out var insertTextEdit)) { - if (provider.TriggerCharacter == character) + return new VSInternalDocumentOnAutoInsertResponseItem() { - applicableProviders.Add(provider); - } - } - - if (applicableProviders.Count == 0) - { - // There's currently a bug in the LSP platform where other language clients OnAutoInsert trigger characters influence every language clients trigger characters. - // To combat this we need to preemptively return so we don't try having our providers handle characters that they can't. - return null; - } - - var uri = request.TextDocument.Uri; - var position = request.Position; - - using var formattingContext = FormattingContext.Create(uri, documentContext.Snapshot, codeDocument, request.Options, _workspaceFactory); - foreach (var provider in applicableProviders) - { - if (provider.TryResolveInsertion(position, formattingContext, out var textEdit, out var format)) - { - return new VSInternalDocumentOnAutoInsertResponseItem() - { - TextEdit = textEdit, - TextEditFormat = format, - }; - } + TextEdit = insertTextEdit.TextEdit, + TextEditFormat = insertTextEdit.TextEditFormat, + }; } // No provider could handle the text edit. @@ -129,7 +110,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V if (positionInfo.LanguageKind == RazorLanguageKind.Html) { - if (!s_htmlAllowedTriggerCharacters.Contains(request.Character)) + if (!AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters.Contains(request.Character)) { Logger.LogInformation($"Inapplicable HTML trigger char {request.Character}."); return SpecializedTasks.Null(); @@ -145,7 +126,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } else if (positionInfo.LanguageKind == RazorLanguageKind.CSharp) { - if (!s_cSharpAllowedTriggerCharacters.Contains(request.Character)) + if (!AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters.Contains(request.Character)) { Logger.LogInformation($"Inapplicable C# trigger char {request.Character}."); return SpecializedTasks.Null(); @@ -202,19 +183,27 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } // For C# we run the edit through our formatting engine - var edits = new[] { delegatedResponse.TextEdit }; + Debug.Assert(positionInfo.LanguageKind == RazorLanguageKind.CSharp); + + var options = RazorFormattingOptions.From(originalRequest.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); - var mappedEdits = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet - ? await _razorFormattingService.FormatSnippetAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, cancellationToken).ConfigureAwait(false) - : await _razorFormattingService.FormatOnTypeAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, hostDocumentIndex: 0, triggerCharacter: '\0', cancellationToken).ConfigureAwait(false); - if (mappedEdits is not [{ } edit]) + var csharpSourceText = await documentContext.GetCSharpSourceTextAsync(cancellationToken).ConfigureAwait(false); + var textChange = csharpSourceText.GetTextChange(delegatedResponse.TextEdit); + + var mappedChange = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet + ? await _razorFormattingService.TryGetCSharpSnippetFormattingEditAsync(documentContext, [textChange], options, cancellationToken).ConfigureAwait(false) + : await _razorFormattingService.TryGetSingleCSharpEditAsync(documentContext, textChange, options, cancellationToken).ConfigureAwait(false); + if (mappedChange is not { } change) { return null; } + var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var mappedEdit = sourceText.GetTextEdit(change); + return new VSInternalDocumentOnAutoInsertResponseItem() { - TextEdit = edit, + TextEdit = mappedEdit, TextEditFormat = delegatedResponse.TextEditFormat, }; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs deleted file mode 100644 index 8df88d48145..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; - -// The main reason for this service is auto-insert of empty double quotes when a user types -// equals "=" after Blazor component attribute. We think this is Razor (correctly I guess) -// and wouldn't forward auto-insert request to HTML in this case. By essentially overriding -// language info here we allow the request to be sent over to HTML where it will insert empty -// double-quotes as it would for any other attribute value -internal class PreferHtmlInAttributeValuesDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy -{ - public static IDocumentPositionInfoStrategy Instance { get; } = new PreferHtmlInAttributeValuesDocumentPositionInfoStrategy(); - - public async Task TryGetPositionInfoAsync(IDocumentMappingService documentMappingService, DocumentContext documentContext, Position position, CancellationToken cancellationToken) - { - var defaultDocumentPositionInfo = await DefaultDocumentPositionInfoStrategy.Instance.TryGetPositionInfoAsync(documentMappingService, documentContext, position, cancellationToken).ConfigureAwait(false); - if (defaultDocumentPositionInfo is null) - { - return null; - } - - var absolutePosition = defaultDocumentPositionInfo.HostDocumentIndex; - if (defaultDocumentPositionInfo.LanguageKind != RazorLanguageKind.Razor || - absolutePosition < 1) - { - return defaultDocumentPositionInfo; - } - - // Get the node at previous position to see if we are after markup tag helper attribute, - // and more specifically after the EqualsToken of it - var previousPosition = absolutePosition - 1; - var owner = await documentContext.GetSyntaxNodeAsync(previousPosition, cancellationToken).ConfigureAwait(false); - if (owner is MarkupTagHelperAttributeSyntax { EqualsToken: { IsMissing: false } equalsToken } && - equalsToken.EndPosition == defaultDocumentPositionInfo.HostDocumentIndex) - { - return new DocumentPositionInfo(RazorLanguageKind.Html, defaultDocumentPositionInfo.Position, defaultDocumentPositionInfo.HostDocumentIndex); - } - - return defaultDocumentPositionInfo; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs deleted file mode 100644 index a216287aea1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; - -internal static class AddUsingsCodeActionProviderHelper -{ - public static async Task GetUsingStatementEditsAsync(RazorCodeDocument codeDocument, SourceText originalCSharpText, SourceText changedCSharpText, CancellationToken cancellationToken) - { - // Now that we're done with everything, lets see if there are any using statements to fix up - // We do this by comparing the original generated C# code, and the changed C# code, and look for a difference - // in using statements. We can't use edits for this for two main reasons: - // - // 1. Using statements in the generated code might come from _Imports.razor, or from this file, and C# will shove them anywhere - // 2. The edit might not be clean. eg given: - // using System; - // using System.Text; - // Adding "using System.Linq;" could result in an insert of "Linq;\r\nusing System." on line 2 - // - // So because of the above, we look for a difference in C# using directive nodes directly from the C# syntax tree, and apply them manually - // to the Razor document. - - var oldUsings = await FindUsingDirectiveStringsAsync(originalCSharpText, cancellationToken).ConfigureAwait(false); - var newUsings = await FindUsingDirectiveStringsAsync(changedCSharpText, cancellationToken).ConfigureAwait(false); - - using var edits = new PooledArrayBuilder(); - foreach (var usingStatement in newUsings.Except(oldUsings)) - { - // This identifier will be eventually thrown away. - Debug.Assert(codeDocument.Source.FilePath != null); - var identifier = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(codeDocument.Source.FilePath, UriKind.Relative) }; - var workspaceEdit = AddUsingsCodeActionResolver.CreateAddUsingWorkspaceEdit(usingStatement, additionalEdit: null, codeDocument, codeDocumentIdentifier: identifier); - edits.AddRange(workspaceEdit.DocumentChanges!.Value.First.First().Edits); - } - - return edits.ToArray(); - } - - private static async Task> FindUsingDirectiveStringsAsync(SourceText originalCSharpText, CancellationToken cancellationToken) - { - var syntaxTree = CSharpSyntaxTree.ParseText(originalCSharpText, cancellationToken: cancellationToken); - var syntaxRoot = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); - - // We descend any compilation unit (ie, the file) or and namespaces because the compiler puts all usings inside - // the namespace node. - var usings = syntaxRoot.DescendantNodes(n => n is BaseNamespaceDeclarationSyntax or CompilationUnitSyntax) - // Filter to using directives - .OfType() - // Select everything after the initial "using " part of the statement, and excluding the ending semi-colon. The - // semi-colon is valid in Razor, but users find it surprising. This is slightly lazy, for sure, but has - // the advantage of us not caring about changes to C# syntax, we just grab whatever Roslyn wanted to put in, so - // we should still work in C# v26 - .Select(u => u.ToString()["using ".Length..^1]); - - return usings; - } - - internal static readonly Regex AddUsingVSCodeAction = new Regex("@?using ([^;]+);?$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); - - // Internal for testing - internal static string GetNamespaceFromFQN(string fullyQualifiedName) - { - if (!TrySplitNamespaceAndType(fullyQualifiedName.AsSpan(), out var namespaceName, out _)) - { - return string.Empty; - } - - return namespaceName.ToString(); - } - - internal static bool TryCreateAddUsingResolutionParams(string fullyQualifiedName, Uri uri, TextDocumentEdit? additionalEdit, [NotNullWhen(true)] out string? @namespace, [NotNullWhen(true)] out RazorCodeActionResolutionParams? resolutionParams) - { - @namespace = GetNamespaceFromFQN(fullyQualifiedName); - if (string.IsNullOrEmpty(@namespace)) - { - @namespace = null; - resolutionParams = null; - return false; - } - - var actionParams = new AddUsingsCodeActionParams - { - Uri = uri, - Namespace = @namespace, - AdditionalEdit = additionalEdit - }; - - resolutionParams = new RazorCodeActionResolutionParams - { - Action = LanguageServerConstants.CodeActions.AddUsing, - Language = LanguageServerConstants.CodeActions.Languages.Razor, - Data = actionParams, - }; - - return true; - } - - /// - /// Extracts the namespace from a C# add using statement provided by Visual Studio - /// - /// Add using statement of the form `using System.X;` - /// Extract namespace `System.X` - /// The prefix to show, before the namespace, if any - /// - internal static bool TryExtractNamespace(string csharpAddUsing, out string @namespace, out string prefix) - { - // We must remove any leading/trailing new lines from the add using edit - csharpAddUsing = csharpAddUsing.Trim(); - var regexMatchedTextEdit = AddUsingVSCodeAction.Match(csharpAddUsing); - if (!regexMatchedTextEdit.Success || - - // Two Regex matching groups are expected - // 1. `using namespace;` - // 2. `namespace` - regexMatchedTextEdit.Groups.Count != 2) - { - // Text edit in an unexpected format - @namespace = string.Empty; - prefix = string.Empty; - return false; - } - - @namespace = regexMatchedTextEdit.Groups[1].Value; - prefix = csharpAddUsing[..regexMatchedTextEdit.Index]; - return true; - } - - internal static bool TrySplitNamespaceAndType(ReadOnlySpan fullTypeName, out ReadOnlySpan @namespace, out ReadOnlySpan typeName) - { - @namespace = default; - typeName = default; - - if (fullTypeName.IsEmpty) - { - return false; - } - - var nestingLevel = 0; - var splitLocation = -1; - for (var i = fullTypeName.Length - 1; i >= 0; i--) - { - var c = fullTypeName[i]; - if (c == Type.Delimiter && nestingLevel == 0) - { - splitLocation = i; - break; - } - else if (c == '>') - { - nestingLevel++; - } - else if (c == '<') - { - nestingLevel--; - } - } - - if (splitLocation == -1) - { - typeName = fullTypeName; - return true; - } - - @namespace = fullTypeName[..splitLocation]; - - var typeNameStartLocation = splitLocation + 1; - if (typeNameStartLocation < fullTypeName.Length) - { - typeName = fullTypeName[typeNameStartLocation..]; - } - - return true; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 9e62f694a04..0f1b77c1db4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -21,21 +22,6 @@ internal sealed class DefaultCSharpCodeActionResolver( IClientConnection clientConnection, IRazorFormattingService razorFormattingService) : CSharpCodeActionResolver(clientConnection) { - // Usually when we need to format code, we utilize the formatting options provided - // by the platform. However, we aren't provided such options in the case of code actions - // so we use a default (and commonly used) configuration. - private static readonly FormattingOptions s_defaultFormattingOptions = new FormattingOptions() - { - TabSize = 4, - InsertSpaces = true, - OtherOptions = new Dictionary - { - { "trimTrailingWhitespace", true }, - { "insertFinalNewline", true }, - { "trimFinalNewlines", true }, - }, - }; - private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; @@ -46,12 +32,12 @@ public async override Task ResolveAsync( CodeAction codeAction, CancellationToken cancellationToken) { - if (!_documentContextFactory.TryCreateForOpenDocument(csharpParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(csharpParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action @@ -75,25 +61,23 @@ public async override Task ResolveAsync( cancellationToken.ThrowIfCancellationRequested(); - var csharpTextEdits = textDocumentEdit.Edits; + var csharpSourceText = await documentContext.GetCSharpSourceTextAsync(cancellationToken).ConfigureAwait(false); + var csharpTextChanges = textDocumentEdit.Edits.SelectAsArray(csharpSourceText.GetTextChange); // Remaps the text edits from the generated C# to the razor file, // as well as applying appropriate formatting. - var formattedEdits = await _razorFormattingService.FormatCodeActionAsync( + var formattedChange = await _razorFormattingService.TryGetCSharpCodeActionEditAsync( documentContext, - RazorLanguageKind.CSharp, - csharpTextEdits, - s_defaultFormattingOptions, + csharpTextChanges, + new RazorFormattingOptions(), cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); - var documentVersion = documentContext.Version; - + var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { - Uri = csharpParams.RazorFileIdentifier.Uri, - Version = documentVersion, + Uri = csharpParams.RazorFileIdentifier.Uri }; resolvedCodeAction.Edit = new WorkspaceEdit() { @@ -101,7 +85,7 @@ public async override Task ResolveAsync( new TextDocumentEdit() { TextDocument = codeDocumentIdentifier, - Edits = formattedEdits, + Edits = formattedChange is { } change ? [sourceText.GetTextEdit(change)] : [], } } }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs index 0cbd6d6f4a6..679eb58c843 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -138,7 +139,7 @@ private static ImmutableArray ProcessCodeActionsVSCod var fqnCodeAction = CreateFQNCodeAction(context, diagnostic, codeAction, fqn); typeAccessibilityCodeActions.Add(fqnCodeAction); - if (AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fqn, context.Request.TextDocument.Uri, additionalEdit: null, out var @namespace, out var resolutionParams)) + if (AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fqn, context.Request.TextDocument.Uri, additionalEdit: null, out var @namespace, out var resolutionParams)) { var addUsingCodeAction = RazorCodeActionFactory.CreateAddComponentUsing(@namespace, newTagName: null, resolutionParams); typeAccessibilityCodeActions.Add(addUsingCodeAction); @@ -191,7 +192,7 @@ private static ImmutableArray ProcessCodeActionsVS( // For add using suggestions, the code action title is of the form: // `using System.Net;` else if (codeAction.Name is not null && codeAction.Name.Equals(RazorPredefinedCodeFixProviderNames.AddImport, StringComparison.Ordinal) && - AddUsingsCodeActionProviderHelper.TryExtractNamespace(codeAction.Title, out var @namespace, out var prefix)) + AddUsingsHelper.TryExtractNamespace(codeAction.Title, out var @namespace, out var prefix)) { codeAction.Title = $"{prefix}@using {@namespace}"; typeAccessibilityCodeActions.Add(codeAction.WrapResolvableCodeAction(context, LanguageServerConstants.CodeActions.Default)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs index 964f576f653..170b4cd3417 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs @@ -37,12 +37,12 @@ public async override Task ResolveAsync( { cancellationToken.ThrowIfCancellationRequested(); - if (!_documentContextFactory.TryCreateForOpenDocument(csharpParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(csharpParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action @@ -87,7 +87,6 @@ public async override Task ResolveAsync( var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { Uri = csharpParams.RazorFileIdentifier.Uri, - Version = documentContext.Version, }; resolvedCodeAction.Edit = new WorkspaceEdit() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs index 4a72ea63208..1914b6f87d7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs @@ -175,9 +175,9 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V return context; } - private async Task> GetDelegatedCodeActionsAsync(VersionedDocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) + private async Task> GetDelegatedCodeActionsAsync(DocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) { - var languageKind = _documentMappingService.GetLanguageKind(context.CodeDocument, context.Location.AbsoluteIndex, rightAssociative: false); + var languageKind = context.CodeDocument.GetLanguageKind(context.Location.AbsoluteIndex, rightAssociative: false); // No point delegating if we're in a Razor context if (languageKind == RazorLanguageKind.Razor) @@ -256,7 +256,7 @@ private static async Task> FilterCodeA } // Internal for testing - internal async Task GetCodeActionsFromLanguageServerAsync(RazorLanguageKind languageKind, VersionedDocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) + internal async Task GetCodeActionsFromLanguageServerAsync(RazorLanguageKind languageKind, DocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) { if (languageKind == RazorLanguageKind.CSharp) { @@ -282,7 +282,7 @@ internal async Task GetCodeActionsFromLanguageServe var delegatedParams = new DelegatedCodeActionParams() { - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, CodeActionParams = context.Request, LanguageKind = languageKind, CorrelationId = correlationId diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs index 1ce1cba0a8e..b5d22fabb6c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs @@ -54,7 +54,7 @@ public static async Task RemapAndFixHtmlCodeActionEditAsync(IEditMappingService foreach (var edit in documentEdits) { - edit.Edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, edit.Edits); + edit.Edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, edit.Edits); } codeAction.Edit = new WorkspaceEdit diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs index e95ca9d060c..4c8fa0a60f3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs @@ -28,12 +28,12 @@ public async override Task ResolveAsync( CodeAction codeAction, CancellationToken cancellationToken) { - if (!_documentContextFactory.TryCreateForOpenDocument(resolveParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(resolveParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(resolveParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.Html, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(resolveParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.Html, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs index 5923d2ed861..f0516a53585 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Threading; @@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -50,169 +52,91 @@ internal sealed class AddUsingsCodeActionResolver(IDocumentContextFactory docume } var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { Uri = actionParams.Uri }; - return CreateAddUsingWorkspaceEdit(actionParams.Namespace, actionParams.AdditionalEdit, codeDocument, codeDocumentIdentifier); + return AddUsingsHelper.CreateAddUsingWorkspaceEdit(actionParams.Namespace, actionParams.AdditionalEdit, codeDocument, codeDocumentIdentifier); } - internal static WorkspaceEdit CreateAddUsingWorkspaceEdit(string @namespace, TextDocumentEdit? additionalEdit, RazorCodeDocument codeDocument, OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier) + internal static bool TryCreateAddUsingResolutionParams(string fullyQualifiedName, Uri uri, TextDocumentEdit? additionalEdit, [NotNullWhen(true)] out string? @namespace, [NotNullWhen(true)] out RazorCodeActionResolutionParams? resolutionParams) { - /* The heuristic is as follows: - * - * - If no @using, @namespace, or @page directives are present, insert the statements at the top of the - * file in alphabetical order. - * - If a @namespace or @page are present, the statements are inserted after the last line-wise in - * alphabetical order. - * - If @using directives are present and alphabetized with System directives at the top, the statements - * will be placed in the correct locations according to that ordering. - * - Otherwise it's kind of undefined; it's only geared to insert based on alphabetization. - * - * This is generally sufficient for our current situation (inserting a single @using statement to include a - * component), however it has holes if we eventually use it for other purposes. If we want to deal with - * that now I can come up with a more sophisticated heuristic (something along the lines of checking if - * there's already an ordering, etc.). - */ - using var documentChanges = new PooledArrayBuilder(); - - // Need to add the additional edit first, as the actual usings go at the top of the file, and would - // change the ranges needed in the additional edit if they went in first - if (additionalEdit is not null) + @namespace = GetNamespaceFromFQN(fullyQualifiedName); + if (string.IsNullOrEmpty(@namespace)) { - documentChanges.Add(additionalEdit); + @namespace = null; + resolutionParams = null; + return false; } - using var usingDirectives = new PooledArrayBuilder(); - CollectUsingDirectives(codeDocument, ref usingDirectives.AsRef()); - if (usingDirectives.Count > 0) + var actionParams = new AddUsingsCodeActionParams { - // Interpolate based on existing @using statements - var edits = GenerateSingleUsingEditsInterpolated(codeDocument, codeDocumentIdentifier, @namespace, in usingDirectives); - documentChanges.Add(edits); - } - else - { - // Just throw them at the top - var edits = GenerateSingleUsingEditsAtTop(codeDocument, codeDocumentIdentifier, @namespace); - documentChanges.Add(edits); - } + Uri = uri, + Namespace = @namespace, + AdditionalEdit = additionalEdit + }; - return new WorkspaceEdit() + resolutionParams = new RazorCodeActionResolutionParams { - DocumentChanges = documentChanges.ToArray(), + Action = LanguageServerConstants.CodeActions.AddUsing, + Language = LanguageServerConstants.CodeActions.Languages.Razor, + Data = actionParams, }; + + return true; } - private static TextDocumentEdit GenerateSingleUsingEditsInterpolated( - RazorCodeDocument codeDocument, - OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, - string newUsingNamespace, - ref readonly PooledArrayBuilder existingUsingDirectives) + // Internal for testing + internal static string GetNamespaceFromFQN(string fullyQualifiedName) { - Debug.Assert(existingUsingDirectives.Count > 0); - - using var edits = new PooledArrayBuilder(); - var newText = $"@using {newUsingNamespace}{Environment.NewLine}"; - - foreach (var usingDirective in existingUsingDirectives) + if (!TrySplitNamespaceAndType(fullyQualifiedName.AsSpan(), out var namespaceName, out _)) { - // Skip System directives; if they're at the top we don't want to insert before them - var usingDirectiveNamespace = usingDirective.Statement.ParsedNamespace; - if (usingDirectiveNamespace.StartsWith("System", StringComparison.Ordinal)) - { - continue; - } - - if (string.CompareOrdinal(newUsingNamespace, usingDirectiveNamespace) < 0) - { - var usingDirectiveLineIndex = codeDocument.Source.Text.GetLinePosition(usingDirective.Node.Span.Start).Line; - var edit = VsLspFactory.CreateTextEdit(line: usingDirectiveLineIndex, character: 0, newText); - edits.Add(edit); - break; - } - } - - // If we haven't actually found a place to insert the using directive, do so at the end - if (edits.Count == 0) - { - var endIndex = existingUsingDirectives[^1].Node.Span.End; - var lineIndex = GetLineIndexOrEnd(codeDocument, endIndex - 1) + 1; - var edit = VsLspFactory.CreateTextEdit(line: lineIndex, character: 0, newText); - edits.Add(edit); + return string.Empty; } - return new TextDocumentEdit() - { - TextDocument = codeDocumentIdentifier, - Edits = edits.ToArray() - }; + return namespaceName.ToString(); } - private static TextDocumentEdit GenerateSingleUsingEditsAtTop( - RazorCodeDocument codeDocument, - OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, - string newUsingNamespace) + private static bool TrySplitNamespaceAndType(ReadOnlySpan fullTypeName, out ReadOnlySpan @namespace, out ReadOnlySpan typeName) { - var insertPosition = (0, 0); - - // If we don't have usings, insert after the last namespace or page directive, which ever comes later - var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; - var lastNamespaceOrPageDirective = syntaxTreeRoot - .DescendantNodes() - .LastOrDefault(IsNamespaceOrPageDirective); + @namespace = default; + typeName = default; - if (lastNamespaceOrPageDirective != null) + if (fullTypeName.IsEmpty) { - var lineIndex = GetLineIndexOrEnd(codeDocument, lastNamespaceOrPageDirective.Span.End - 1) + 1; - insertPosition = (lineIndex, 0); + return false; } - // Insert all usings at the given point - return new TextDocumentEdit + var nestingLevel = 0; + var splitLocation = -1; + for (var i = fullTypeName.Length - 1; i >= 0; i--) { - TextDocument = codeDocumentIdentifier, - Edits = [VsLspFactory.CreateTextEdit(insertPosition, newText: $"@using {newUsingNamespace}{Environment.NewLine}")] - }; - } - - private static int GetLineIndexOrEnd(RazorCodeDocument codeDocument, int endIndex) - { - if (endIndex < codeDocument.Source.Text.Length) - { - return codeDocument.Source.Text.GetLinePosition(endIndex).Line; - } - else - { - return codeDocument.Source.Text.Lines.Count; + var c = fullTypeName[i]; + if (c == Type.Delimiter && nestingLevel == 0) + { + splitLocation = i; + break; + } + else if (c == '>') + { + nestingLevel++; + } + else if (c == '<') + { + nestingLevel--; + } } - } - private static void CollectUsingDirectives(RazorCodeDocument codeDocument, ref PooledArrayBuilder directives) - { - var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; - foreach (var node in syntaxTreeRoot.DescendantNodes()) + if (splitLocation == -1) { - if (node is RazorDirectiveSyntax directiveNode) - { - foreach (var child in directiveNode.DescendantNodes()) - { - if (child.GetChunkGenerator() is AddImportChunkGenerator { IsStatic: false } usingStatement) - { - directives.Add(new RazorUsingDirective(directiveNode, usingStatement)); - } - } - } + typeName = fullTypeName; + return true; } - } - private static bool IsNamespaceOrPageDirective(SyntaxNode node) - { - if (node is RazorDirectiveSyntax directiveNode) + @namespace = fullTypeName[..splitLocation]; + + var typeNameStartLocation = splitLocation + 1; + if (typeNameStartLocation < fullTypeName.Length) { - return directiveNode.DirectiveDescriptor == ComponentPageDirective.Directive || - directiveNode.DirectiveDescriptor == NamespaceDirective.Directive || - directiveNode.DirectiveDescriptor == PageDirective.Directive; + typeName = fullTypeName[typeNameStartLocation..]; } - return false; + return true; } - - private readonly record struct RazorUsingDirective(RazorDirectiveSyntax Node, AddImportChunkGenerator Statement); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/CodeBlockService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/CodeBlockService.cs index 9cda5df9204..01869f6106e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/CodeBlockService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/CodeBlockService.cs @@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -48,7 +50,7 @@ public static TextEdit[] CreateFormattedTextEdit(RazorCodeDocument code, string || !csharpCodeBlock.Children.TryGetCloseBraceNode(out var closeBrace)) { // No well-formed @code block exists. Generate the method within an @code block at the end of the file and conduct manual formatting. - var indentedMethod = FormattingUtilities.AddIndentationToMethod(templateWithMethodSignature, options, startingIndent: 0); + var indentedMethod = FormattingUtilities.AddIndentationToMethod(templateWithMethodSignature, options.TabSize, options.InsertSpaces, startingIndent: 0); var codeBlockStartText = "@code {" + Environment.NewLine; var sourceText = code.Source.Text; var lastCharacterLocation = sourceText.Lines[^1]; @@ -111,7 +113,8 @@ private static string FormatMethodInCodeBlock( var numCharacterBefore = codeBlockSourceLocation.CharacterIndex - 5; var formattedGeneratedMethod = FormattingUtilities.AddIndentationToMethod( method, - options, + options.TabSize, + options.InsertSpaces, codeBlockStartAbsoluteIndex, numCharacterBefore, source); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs index 2e8ec37c2f9..8a551f300b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs @@ -176,7 +176,7 @@ private static async Task AddComponentAccessFromTagAsync(RazorCodeActionContext // name to give the tag. if (!tagHelperPair.CaseInsensitiveMatch || newTagName is not null) { - if (AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fullyQualifiedName, context.Request.TextDocument.Uri, additionalEdit, out var @namespace, out var resolutionParams)) + if (AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fullyQualifiedName, context.Request.TextDocument.Uri, additionalEdit, out var @namespace, out var resolutionParams)) { var addUsingCodeAction = RazorCodeActionFactory.CreateAddComponentUsing(@namespace, newTagName, resolutionParams); container.Add(addUsingCodeAction); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index 86af5075d71..026cf9c36ec 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; @@ -18,8 +19,10 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using CSharpSyntaxFactory = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; @@ -58,7 +61,7 @@ internal sealed class GenerateMethodCodeActionResolver( return null; } - if (!_documentContextFactory.TryCreateForOpenDocument(actionParams.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(actionParams.Uri, out var documentContext)) { return null; } @@ -107,7 +110,8 @@ razorClassName is null || var classLocationLineSpan = @class.GetLocation().GetLineSpan(); var formattedMethod = FormattingUtilities.AddIndentationToMethod( templateWithMethodSignature, - _razorLSPOptionsMonitor.CurrentValue, + _razorLSPOptionsMonitor.CurrentValue.TabSize, + _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, @class.SpanStart, classLocationLineSpan.StartLinePosition.Character, content); @@ -139,7 +143,7 @@ razorClassName is null || private async Task GenerateMethodInCodeBlockAsync( RazorCodeDocument code, GenerateMethodCodeActionParams actionParams, - VersionedDocumentContext documentContext, + DocumentContext documentContext, string? razorNamespace, string? razorClassName, CancellationToken cancellationToken) @@ -202,20 +206,20 @@ private async Task GenerateMethodInCodeBlockAsync( if (result is not null) { - var formattingOptions = new FormattingOptions() + var formattingOptions = new RazorFormattingOptions() { TabSize = _razorLSPOptionsMonitor.CurrentValue.TabSize, InsertSpaces = _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, + CodeBlockBraceOnNextLine = _razorLSPOptionsMonitor.CurrentValue.CodeBlockBraceOnNextLine }; - var formattedEdits = await _razorFormattingService.FormatCodeActionAsync( + var formattedChange = await _razorFormattingService.TryGetCSharpCodeActionEditAsync( documentContext, - RazorLanguageKind.CSharp, - result, + result.SelectAsArray(code.Source.Text.GetTextChange), formattingOptions, cancellationToken).ConfigureAwait(false); - edits = formattedEdits; + edits = formattedChange is { } change ? [code.Source.Text.GetTextEdit(change)] : []; } } @@ -228,7 +232,7 @@ private async Task GenerateMethodInCodeBlockAsync( return new WorkspaceEdit() { DocumentChanges = new[] { razorTextDocEdit } }; } - private static async Task PopulateMethodSignatureAsync(VersionedDocumentContext documentContext, GenerateMethodCodeActionParams actionParams, CancellationToken cancellationToken) + private static async Task PopulateMethodSignatureAsync(DocumentContext documentContext, GenerateMethodCodeActionParams actionParams, CancellationToken cancellationToken) { var templateWithMethodSignature = s_generateMethodTemplate.Replace(MethodName, actionParams.MethodName); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs index 3e53f3ab948..8cd27d497a3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs @@ -9,55 +9,44 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.ColorPresentation; using Microsoft.VisualStudio.LanguageServer.Protocol; +using LspColorPresentation = Microsoft.CodeAnalysis.Razor.Protocol.ColorPresentation.ColorPresentation; namespace Microsoft.AspNetCore.Razor.LanguageServer.ColorPresentation; -using ColorPresentation = CodeAnalysis.Razor.Protocol.ColorPresentation.ColorPresentation; - [RazorLanguageServerEndpoint(CustomMessageNames.ColorPresentationMethodName)] -internal sealed class ColorPresentationEndpoint : IRazorRequestHandler +internal sealed class ColorPresentationEndpoint(IClientConnection clientConnection) : IRazorRequestHandler { - private readonly IClientConnection _clientConnection; - - public ColorPresentationEndpoint(IClientConnection clientConnection) - { - if (clientConnection is null) - { - throw new ArgumentNullException(nameof(clientConnection)); - } - - _clientConnection = clientConnection; - } + private readonly IClientConnection _clientConnection = clientConnection; public bool MutatesSolutionState => false; public TextDocumentIdentifier GetTextDocumentIdentifier(ColorPresentationParams request) => request.TextDocument; - public async Task HandleRequestAsync(ColorPresentationParams request, RazorRequestContext context, CancellationToken cancellationToken) + public async Task HandleRequestAsync(ColorPresentationParams request, RazorRequestContext context, CancellationToken cancellationToken) { var documentContext = context.DocumentContext; if (documentContext is null) { - return Array.Empty(); + return []; } var delegatedRequest = new DelegatedColorPresentationParams { - RequiredHostDocumentVersion = documentContext.Version, + RequiredHostDocumentVersion = documentContext.Snapshot.Version, Color = request.Color, Range = request.Range, TextDocument = request.TextDocument }; - var colorPresentations = await _clientConnection.SendRequestAsync( + var colorPresentations = await _clientConnection.SendRequestAsync( CustomMessageNames.RazorProvideHtmlColorPresentationEndpoint, delegatedRequest, cancellationToken).ConfigureAwait(false); if (colorPresentations is null) { - return Array.Empty(); + return []; } // HTML and Razor documents have identical mapping locations. Because of this we can return the result as-is. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs index f296da09b3d..9caeb7cc5de 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs @@ -33,7 +33,7 @@ public CompletionListProvider(RazorCompletionListProvider razorCompletionListPro public async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index f977eb4b4ff..81d2a97b3e6 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -2,33 +2,29 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; -internal class DelegatedCompletionItemResolver : CompletionItemResolver +internal class DelegatedCompletionItemResolver( + IDocumentContextFactory documentContextFactory, + IRazorFormattingService formattingService, + RazorLSPOptionsMonitor optionsMonitor, + IClientConnection clientConnection) : CompletionItemResolver { - private readonly IDocumentContextFactory _documentContextFactory; - private readonly IRazorFormattingService _formattingService; - private readonly IClientConnection _clientConnection; - - public DelegatedCompletionItemResolver( - IDocumentContextFactory documentContextFactory, - IRazorFormattingService formattingService, - IClientConnection clientConnection) - { - _documentContextFactory = documentContextFactory; - _formattingService = formattingService; - _clientConnection = clientConnection; - } + private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; + private readonly IRazorFormattingService _formattingService = formattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly IClientConnection _clientConnection = clientConnection; public override async Task ResolveAsync( VSInternalCompletionItem item, @@ -100,7 +96,7 @@ private async Task PostProcessCompletionItemAsync( } var identifier = context.OriginalRequestParams.Identifier.TextDocumentIdentifier; - if (!_documentContextFactory.TryCreateForOpenDocument(identifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(identifier, out var documentContext)) { return resolvedCompletionItem; } @@ -117,18 +113,26 @@ private async Task PostProcessCompletionItemAsync( return resolvedCompletionItem; } + var options = RazorFormattingOptions.From(formattingOptions, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + + var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var csharpSourceText = await documentContext.GetCSharpSourceTextAsync(cancellationToken).ConfigureAwait(false); + if (resolvedCompletionItem.TextEdit is not null) { if (resolvedCompletionItem.TextEdit.Value.TryGetFirst(out var textEdit)) { - var formattedTextEdit = await _formattingService.FormatSnippetAsync( + var textChange = csharpSourceText.GetTextChange(textEdit); + var formattedTextChange = await _formattingService.TryGetCSharpSnippetFormattingEditAsync( documentContext, - RazorLanguageKind.CSharp, - new[] { textEdit }, - formattingOptions, + [textChange], + options, cancellationToken).ConfigureAwait(false); - resolvedCompletionItem.TextEdit = formattedTextEdit.FirstOrDefault(); + if (formattedTextChange is { } change) + { + resolvedCompletionItem.TextEdit = sourceText.GetTextEdit(change); + } } else { @@ -140,14 +144,14 @@ private async Task PostProcessCompletionItemAsync( if (resolvedCompletionItem.AdditionalTextEdits is not null) { - var formattedTextEdits = await _formattingService.FormatSnippetAsync( + var additionalChanges = resolvedCompletionItem.AdditionalTextEdits.SelectAsArray(csharpSourceText.GetTextChange); + var formattedTextChange = await _formattingService.TryGetCSharpSnippetFormattingEditAsync( documentContext, - RazorLanguageKind.CSharp, - resolvedCompletionItem.AdditionalTextEdits, - formattingOptions, + additionalChanges, + options, cancellationToken).ConfigureAwait(false); - resolvedCompletionItem.AdditionalTextEdits = formattedTextEdits; + resolvedCompletionItem.AdditionalTextEdits = formattedTextChange is { } change ? [sourceText.GetTextEdit(change)] : null; } return resolvedCompletionItem; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs index 2c8e023b46d..35ffb1fba6a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -51,7 +52,7 @@ public DelegatedCompletionListProvider( public virtual async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) @@ -119,7 +120,7 @@ public DelegatedCompletionListProvider( return rewrittenResponse; } - private async Task ShouldIncludeSnippetsAsync(VersionedDocumentContext documentContext, int absoluteIndex, CancellationToken cancellationToken) + private async Task ShouldIncludeSnippetsAsync(DocumentContext documentContext, int absoluteIndex, CancellationToken cancellationToken) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var tree = codeDocument.GetSyntaxTree(); @@ -182,7 +183,7 @@ private static VSInternalCompletionContext RewriteContext(VSInternalCompletionCo } private async Task TryGetProvisionalCompletionInfoAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalCompletionContext completionContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index fea284d3d97..298e83b4bb7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -36,6 +36,11 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V { ResolveProvider = true, TriggerCharacters = _completionListProvider.AggregateTriggerCharacters.ToArray(), + // This is the intersection of C# and HTML commit characters. + // We need to specify it so that platform can correctly calculate ApplicableToSpan in + // https://devdiv.visualstudio.com/DevDiv/_git/VSLanguageServerClient?path=/src/product/RemoteLanguage/Impl/Features/Completion/AsyncCompletionSource.cs&version=GBdevelop&line=855&lineEnd=855&lineStartColumn=9&lineEndColumn=49&lineStyle=plain&_a=contents + // This is needed to fix https://github.com/dotnet/razor/issues/10787 in particular + AllCommitCharacters = [" ", ">", ";", "="] }; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs index e73f38dcad8..ea0b2a76a02 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs @@ -39,7 +39,7 @@ internal class RazorCompletionListProvider( public virtual async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, HashSet? existingCompletions, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index 1bcb7c82ec0..65499e03d23 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -19,30 +19,17 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorBreakpointSpanEndpoint)] -internal class RazorBreakpointSpanEndpoint : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler +internal class RazorBreakpointSpanEndpoint( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler { - private readonly IDocumentMappingService _documentMappingService; - private readonly ILogger _logger; + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; - public RazorBreakpointSpanEndpoint( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - { - if (loggerFactory is null) - { - throw new ArgumentNullException(nameof(loggerFactory)); - } - - _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _logger = loggerFactory.GetOrCreateLogger(); - } - public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) - { - return request.Uri; - } + => request.Uri; public async Task HandleRequestAsync(RazorBreakpointSpanParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { @@ -52,6 +39,12 @@ public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) return null; } + if (documentContext.Snapshot.Version != request.HostDocumentSyncVersion) + { + // Whether we are being asked about an old version of the C# document, or somehow a future one, we can't rely on the result. + return null; + } + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var hostDocumentIndex = sourceText.GetPosition(request.Position); @@ -62,7 +55,7 @@ public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) } var projectedIndex = hostDocumentIndex; - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); // If we're in C#, then map to the right position in the generated document if (languageKind == RazorLanguageKind.CSharp && !_documentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), hostDocumentIndex, out _, out projectedIndex)) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs index 844da19f1a8..a61b01cdfd2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs @@ -20,35 +20,17 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorProximityExpressionsEndpoint)] -internal class RazorProximityExpressionsEndpoint : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler +internal class RazorProximityExpressionsEndpoint( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler { - private readonly IDocumentMappingService _documentMappingService; - private readonly ILogger _logger; - - public RazorProximityExpressionsEndpoint( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - { - if (documentMappingService is null) - { - throw new ArgumentNullException(nameof(documentMappingService)); - } - - if (loggerFactory is null) - { - throw new ArgumentNullException(nameof(loggerFactory)); - } - - _documentMappingService = documentMappingService; - _logger = loggerFactory.GetOrCreateLogger(); - } + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; public Uri GetTextDocumentIdentifier(RazorProximityExpressionsParams request) - { - return request.Uri; - } + => request.Uri; public async Task HandleRequestAsync(RazorProximityExpressionsParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { @@ -58,6 +40,12 @@ public Uri GetTextDocumentIdentifier(RazorProximityExpressionsParams request) return null; } + if (documentContext.Snapshot.Version != request.HostDocumentSyncVersion) + { + // Whether we are being asked about an old version of the C# document, or somehow a future one, we can't rely on the result. + return null; + } + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var hostDocumentIndex = sourceText.GetPosition(request.Position); @@ -68,7 +56,7 @@ public Uri GetTextDocumentIdentifier(RazorProximityExpressionsParams request) } var projectedIndex = hostDocumentIndex; - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); // If we're in C#, then map to the right position in the generated document if (languageKind == RazorLanguageKind.CSharp && !_documentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), hostDocumentIndex, out _, out projectedIndex)) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs deleted file mode 100644 index 976829713ad..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultDocumentPositionInfoStrategy.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal class DefaultDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy -{ - public static IDocumentPositionInfoStrategy Instance { get; } = new DefaultDocumentPositionInfoStrategy(); - - public async Task TryGetPositionInfoAsync( - IDocumentMappingService documentMappingService, - DocumentContext documentContext, - Position position, - CancellationToken cancellationToken) - { - var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); - if (!sourceText.TryGetAbsoluteIndex(position, out var absoluteIndex)) - { - return null; - } - - return await documentMappingService.GetPositionInfoAsync(documentContext, absoluteIndex, cancellationToken).ConfigureAwait(false); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultHostServicesProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultHostServicesProvider.cs index 355e9afe62b..95642353d8e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultHostServicesProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultHostServicesProvider.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.Workspaces; namespace Microsoft.AspNetCore.Razor.LanguageServer; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs index 304c7729526..dd22142c0ef 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/DefinitionEndpoint.cs @@ -1,42 +1,38 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; -using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Threading; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.GoToDefinition; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.VisualStudio.LanguageServer.Protocol; using DefinitionResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation, - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation[], + Microsoft.VisualStudio.LanguageServer.Protocol.Location, + Microsoft.VisualStudio.LanguageServer.Protocol.Location[], Microsoft.VisualStudio.LanguageServer.Protocol.DocumentLink[]>; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -using SyntaxKind = Microsoft.AspNetCore.Razor.Language.SyntaxKind; namespace Microsoft.AspNetCore.Razor.LanguageServer.Definition; [RazorLanguageServerEndpoint(Methods.TextDocumentDefinitionName)] internal sealed class DefinitionEndpoint( - IRazorComponentSearchEngine componentSearchEngine, + IRazorComponentDefinitionService componentDefinitionService, IDocumentMappingService documentMappingService, LanguageServerFeatureOptions languageServerFeatureOptions, IClientConnection clientConnection, ILoggerFactory loggerFactory) - : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider + : AbstractRazorDelegatingEndpoint( + languageServerFeatureOptions, + documentMappingService, + clientConnection, + loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { - private readonly IRazorComponentSearchEngine _componentSearchEngine = componentSearchEngine; + private readonly IRazorComponentDefinitionService _componentDefinitionService = componentDefinitionService; private readonly IDocumentMappingService _documentMappingService = documentMappingService; protected override bool PreferCSharpOverHtmlIfPossible => true; @@ -50,60 +46,31 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V serverCapabilities.DefinitionProvider = new DefinitionOptions(); } - protected async override Task TryHandleAsync(TextDocumentPositionParams request, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) + protected async override Task TryHandleAsync( + TextDocumentPositionParams request, + RazorRequestContext requestContext, + DocumentPositionInfo positionInfo, + CancellationToken cancellationToken) { Logger.LogInformation($"Starting go-to-def endpoint request."); + var documentContext = requestContext.DocumentContext; if (documentContext is null) { return null; } - if (!FileKinds.IsComponent(documentContext.FileKind)) - { - Logger.LogInformation($"FileKind '{documentContext.FileKind}' is not a component type."); - return default; - } - // If single server support is on, then we ignore attributes, as they are better handled by delegating to Roslyn - var (originTagDescriptor, attributeDescriptor) = await GetOriginTagHelperBindingAsync(documentContext, positionInfo.HostDocumentIndex, SingleServerSupport, Logger, cancellationToken).ConfigureAwait(false); - if (originTagDescriptor is null) - { - Logger.LogInformation($"Origin TagHelper descriptor is null."); - return default; - } - - var originComponentDocumentSnapshot = await _componentSearchEngine.TryLocateComponentAsync(documentContext.Snapshot, originTagDescriptor).ConfigureAwait(false); - if (originComponentDocumentSnapshot is null) - { - Logger.LogInformation($"Origin TagHelper document snapshot is null."); - return default; - } - - var originComponentDocumentFilePath = originComponentDocumentSnapshot.FilePath.AssumeNotNull(); - - Logger.LogInformation($"Definition found at file path: {originComponentDocumentFilePath}"); - - var range = await GetNavigateRangeAsync(originComponentDocumentSnapshot, attributeDescriptor, cancellationToken).ConfigureAwait(false); - - var originComponentUri = new UriBuilder - { - Path = originComponentDocumentFilePath, - Scheme = Uri.UriSchemeFile, - Host = string.Empty, - }.Uri; - - return new[] - { - new VSInternalLocation - { - Uri = originComponentUri, - Range = range, - }, - }; + return await _componentDefinitionService + .GetDefinitionAsync(documentContext.Snapshot, positionInfo, ignoreAttributes: SingleServerSupport, cancellationToken) + .ConfigureAwait(false); } - protected override Task CreateDelegatedParamsAsync(TextDocumentPositionParams request, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) + protected override Task CreateDelegatedParamsAsync( + TextDocumentPositionParams request, + RazorRequestContext requestContext, + DocumentPositionInfo positionInfo, + CancellationToken cancellationToken) { var documentContext = requestContext.DocumentContext; if (documentContext is null) @@ -117,25 +84,30 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V positionInfo.LanguageKind)); } - protected async override Task HandleDelegatedResponseAsync(DefinitionResult? response, TextDocumentPositionParams originalRequest, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) + protected async override Task HandleDelegatedResponseAsync( + DefinitionResult? response, + TextDocumentPositionParams originalRequest, + RazorRequestContext requestContext, + DocumentPositionInfo positionInfo, + CancellationToken cancellationToken) { - if (response is null) + if (response is not DefinitionResult result) { return null; } - if (response.Value.TryGetFirst(out var location)) + if (result.TryGetFirst(out var location)) { (location.Uri, location.Range) = await _documentMappingService.MapToHostDocumentUriAndRangeAsync(location.Uri, location.Range, cancellationToken).ConfigureAwait(false); } - else if (response.Value.TryGetSecond(out var locations)) + else if (result.TryGetSecond(out var locations)) { foreach (var loc in locations) { (loc.Uri, loc.Range) = await _documentMappingService.MapToHostDocumentUriAndRangeAsync(loc.Uri, loc.Range, cancellationToken).ConfigureAwait(false); } } - else if (response.Value.TryGetThird(out var links)) + else if (result.TryGetThird(out var links)) { foreach (var link in links) { @@ -146,187 +118,6 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } } - return response; - } - - internal static async Task<(TagHelperDescriptor?, BoundAttributeDescriptor?)> GetOriginTagHelperBindingAsync( - DocumentContext documentContext, - int absoluteIndex, - bool ignoreAttributes, - ILogger logger, - CancellationToken cancellationToken) - { - var owner = await documentContext.GetSyntaxNodeAsync(absoluteIndex, cancellationToken).ConfigureAwait(false); - if (owner is null) - { - logger.LogInformation($"Could not locate owner."); - return (null, null); - } - - var node = owner.FirstAncestorOrSelf(n => - n.Kind == SyntaxKind.MarkupTagHelperStartTag || - n.Kind == SyntaxKind.MarkupTagHelperEndTag); - if (node is null) - { - logger.LogInformation($"Could not locate ancestor of type MarkupTagHelperStartTag or MarkupTagHelperEndTag."); - return (null, null); - } - - var name = GetStartOrEndTagName(node); - if (name is null) - { - logger.LogInformation($"Could not retrieve name of start or end tag."); - return (null, null); - } - - string? propertyName = null; - - if (!ignoreAttributes && node is MarkupTagHelperStartTagSyntax startTag) - { - // Include attributes where the end index also matches, since GetSyntaxNodeAsync will consider that the start tag but we behave - // as if the user wants to go to the attribute definition. - // ie: - var selectedAttribute = startTag.Attributes.FirstOrDefault(a => a.Span.Contains(absoluteIndex) || a.Span.End == absoluteIndex); - - // If we're on an attribute then just validate against the attribute name - if (selectedAttribute is MarkupTagHelperAttributeSyntax attribute) - { - // Normal attribute, ie - name = attribute.Name; - propertyName = attribute.TagHelperAttributeInfo.Name; - } - else if (selectedAttribute is MarkupMinimizedTagHelperAttributeSyntax minimizedAttribute) - { - // Minimized attribute, ie - name = minimizedAttribute.Name; - propertyName = minimizedAttribute.TagHelperAttributeInfo.Name; - } - } - - if (!name.Span.IntersectsWith(absoluteIndex)) - { - logger.LogInformation($"Tag name or attributes' span does not intersect with location's absolute index ({absoluteIndex})."); - return (null, null); - } - - if (node.Parent is not MarkupTagHelperElementSyntax tagHelperElement) - { - logger.LogInformation($"Parent of start or end tag is not a MarkupTagHelperElement."); - return (null, null); - } - - if (tagHelperElement.TagHelperInfo?.BindingResult is not TagHelperBinding binding) - { - logger.LogInformation($"MarkupTagHelperElement does not contain TagHelperInfo."); - return (null, null); - } - - var originTagDescriptor = binding.Descriptors.FirstOrDefault(static d => !d.IsAttributeDescriptor()); - if (originTagDescriptor is null) - { - logger.LogInformation($"Origin TagHelper descriptor is null."); - return (null, null); - } - - var attributeDescriptor = (propertyName is not null) - ? originTagDescriptor.BoundAttributes.FirstOrDefault(a => a.Name?.Equals(propertyName, StringComparison.Ordinal) == true) - : null; - - return (originTagDescriptor, attributeDescriptor); - } - - private static SyntaxNode? GetStartOrEndTagName(SyntaxNode node) - { - return node switch - { - MarkupTagHelperStartTagSyntax tagHelperStartTag => tagHelperStartTag.Name, - MarkupTagHelperEndTagSyntax tagHelperEndTag => tagHelperEndTag.Name, - _ => null - }; - } - - private async Task GetNavigateRangeAsync(IDocumentSnapshot documentSnapshot, BoundAttributeDescriptor? attributeDescriptor, CancellationToken cancellationToken) - { - if (attributeDescriptor is not null) - { - Logger.LogInformation($"Attempting to get definition from an attribute directly."); - - var originCodeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); - var range = await TryGetPropertyRangeAsync(originCodeDocument, attributeDescriptor.GetPropertyName(), _documentMappingService, Logger, cancellationToken).ConfigureAwait(false); - - if (range is not null) - { - return range; - } - } - - // When navigating from a start or end tag, we just take the user to the top of the file. - // If we were trying to navigate to a property, and we couldn't find it, we can at least take - // them to the file for the component. If the property was defined in a partial class they can - // at least then press F7 to go there. - return VsLspFactory.DefaultRange; - } - - internal static async Task TryGetPropertyRangeAsync(RazorCodeDocument codeDocument, string propertyName, IDocumentMappingService documentMappingService, ILogger logger, CancellationToken cancellationToken) - { - // Parse the C# file and find the property that matches the name. - // We don't worry about parameter attributes here for two main reasons: - // 1. We don't have symbolic information, so the best we could do would be checking for any - // attribute named Parameter, regardless of which namespace. It also means we would have - // to do more checks for all of the various ways that the attribute could be specified - // (eg fully qualified, aliased, etc.) - // 2. Since C# doesn't allow multiple properties with the same name, and we're doing a case - // sensitive search, we know the property we find is the one the user is trying to encode in a - // tag helper attribute. If they don't have the [Parameter] attribute then the Razor compiler - // will error, but allowing them to Go To Def on that property regardless, actually helps - // them fix the error. - var csharpText = codeDocument.GetCSharpSourceText(); - var syntaxTree = CSharpSyntaxTree.ParseText(csharpText, cancellationToken: cancellationToken); - var root = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); - - // Since we know how the compiler generates the C# source we can be a little specific here, and avoid - // long tree walks. If the compiler ever changes how they generate their code, the tests for this will break - // so we'll know about it. - if (GetClassDeclaration(root) is { } classDeclaration) - { - var property = classDeclaration - .Members - .OfType() - .Where(p => p.Identifier.ValueText.Equals(propertyName, StringComparison.Ordinal)) - .FirstOrDefault(); - - if (property is null) - { - // The property probably exists in a partial class - logger.LogInformation($"Could not find property in the generated source. Comes from partial?"); - return null; - } - - var range = csharpText.GetRange(property.Identifier.Span); - if (documentMappingService.TryMapToHostDocumentRange(codeDocument.GetCSharpDocument(), range, out var originalRange)) - { - return originalRange; - } - - logger.LogInformation($"Property found but couldn't map its location."); - } - - logger.LogInformation($"Generated C# was not in expected shape (CompilationUnit [-> Namespace] -> Class)"); - - return null; - - static ClassDeclarationSyntax? GetClassDeclaration(CodeAnalysis.SyntaxNode root) - { - return root switch - { - CompilationUnitSyntax unit => unit switch - { - { Members: [NamespaceDeclarationSyntax { Members: [ClassDeclarationSyntax c, ..] }, ..] } => c, - { Members: [ClassDeclarationSyntax c, ..] } => c, - _ => null, - }, - _ => null, - }; - } + return result; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/RazorComponentDefinitionService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/RazorComponentDefinitionService.cs new file mode 100644 index 00000000000..a95d0f3fdcb --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Definition/RazorComponentDefinitionService.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.GoToDefinition; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Workspaces; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Definition; + +internal sealed class RazorComponentDefinitionService( + IRazorComponentSearchEngine componentSearchEngine, + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) + : AbstractRazorComponentDefinitionService(componentSearchEngine, documentMappingService, loggerFactory.GetOrCreateLogger()) +{ +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs index 68d893f9b24..257a785126c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs @@ -3,13 +3,18 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Telemetry; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Diagnostics; @@ -25,6 +30,7 @@ internal class DocumentPullDiagnosticsEndpoint : IRazorRequestHandler _lastReporedProjectTagHelperCount = ImmutableDictionary.Empty; public DocumentPullDiagnosticsEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, @@ -72,7 +78,11 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno return null; } - var razorDiagnostics = await GetRazorDiagnosticsAsync(documentContext, cancellationToken).ConfigureAwait(false); + var documentSnapshot = documentContext.Snapshot; + + var razorDiagnostics = await GetRazorDiagnosticsAsync(documentSnapshot).ConfigureAwait(false); + + await ReportRZ10012TelemetryAsync(documentContext, razorDiagnostics, cancellationToken).ConfigureAwait(false); var (csharpDiagnostics, htmlDiagnostics) = await GetHtmlCSharpDiagnosticsAsync(documentContext, correlationId, cancellationToken).ConfigureAwait(false); @@ -96,7 +106,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno { if (report.Diagnostics is not null) { - var mappedDiagnostics = await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.CSharp, report.Diagnostics, documentContext, cancellationToken).ConfigureAwait(false); + var mappedDiagnostics = await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.CSharp, report.Diagnostics, documentSnapshot).ConfigureAwait(false); report.Diagnostics = mappedDiagnostics; } @@ -110,7 +120,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno { if (report.Diagnostics is not null) { - var mappedDiagnostics = await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.Html, report.Diagnostics, documentContext, cancellationToken).ConfigureAwait(false); + var mappedDiagnostics = await _translateDiagnosticsService.TranslateAsync(RazorLanguageKind.Html, report.Diagnostics, documentSnapshot).ConfigureAwait(false); report.Diagnostics = mappedDiagnostics; } @@ -121,19 +131,19 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno return allDiagnostics.ToArray(); } - private static async Task GetRazorDiagnosticsAsync(VersionedDocumentContext documentContext, CancellationToken cancellationToken) + private static async Task GetRazorDiagnosticsAsync(IDocumentSnapshot documentSnapshot) { - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); + var sourceText = codeDocument.Source.Text; var csharpDocument = codeDocument.GetCSharpDocument(); var diagnostics = csharpDocument.Diagnostics; - if (diagnostics.Count == 0) + if (diagnostics.Length == 0) { return null; } - var convertedDiagnostics = RazorDiagnosticConverter.Convert(diagnostics, sourceText, documentContext.Snapshot); + var convertedDiagnostics = RazorDiagnosticConverter.Convert(diagnostics, sourceText, documentSnapshot); return [ @@ -145,7 +155,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno ]; } - private async Task<(VSInternalDiagnosticReport[]? CSharpDiagnostics, VSInternalDiagnosticReport[]? HtmlDiagnostics)> GetHtmlCSharpDiagnosticsAsync(VersionedDocumentContext documentContext, Guid correlationId, CancellationToken cancellationToken) + private async Task<(VSInternalDiagnosticReport[]? CSharpDiagnostics, VSInternalDiagnosticReport[]? HtmlDiagnostics)> GetHtmlCSharpDiagnosticsAsync(DocumentContext documentContext, Guid correlationId, CancellationToken cancellationToken) { var delegatedParams = new DelegatedDiagnosticParams(documentContext.GetTextDocumentIdentifierAndVersion(), correlationId); var delegatedResponse = await _clientConnection.SendRequestAsync( @@ -160,4 +170,59 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno return (delegatedResponse.CSharpDiagnostics, delegatedResponse.HtmlDiagnostics); } + + /// + /// Reports telemetry for RZ10012 "Found markup element with unexpected name" to help track down potential issues + /// with taghelpers being discovered (or lack thereof) + /// + private async ValueTask ReportRZ10012TelemetryAsync(DocumentContext documentContext, VSInternalDiagnosticReport[]? razorDiagnostics, CancellationToken cancellationToken) + { + if (razorDiagnostics is null) + { + return; + } + + if (_telemetryReporter is null) + { + return; + } + + var relevantDiagnosticsCount = razorDiagnostics.Sum(CountDiagnostics); + if (relevantDiagnosticsCount == 0) + { + return; + } + + var tagHelpers = await documentContext.Project.GetTagHelpersAsync(cancellationToken).ConfigureAwait(false); + var tagHelperCount = tagHelpers.Count(); + var shouldReport = false; + + ImmutableInterlocked.AddOrUpdate( + ref _lastReporedProjectTagHelperCount, + documentContext.Project.Key, + (k) => + { + shouldReport = true; + return tagHelperCount; + }, + (k, currentValue) => + { + shouldReport = currentValue != tagHelperCount; + return tagHelperCount; + }); + + if (shouldReport) + { + _telemetryReporter.ReportEvent( + "RZ10012", + Severity.Low, + new("tagHelpers", tagHelperCount), + new("RZ10012errors", relevantDiagnosticsCount), + new("project", documentContext.Project.Key.Id)); + } + + static int CountDiagnostics(VSInternalDiagnosticReport report) + => report.Diagnostics?.Count(d => d.Code == ComponentDiagnosticFactory.UnexpectedMarkupElement.Id) + ?? 0; + } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs index e3f0eb8d901..204b03658af 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Utilities; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -155,11 +156,7 @@ .. csharpDiagnostics ?? [] PublishDiagnosticsForFilePath(document.FilePath, combinedDiagnostics); - if (_logger.IsEnabled(LogLevel.Trace)) - { - var diagnosticString = string.Join(", ", razorDiagnostics.Select(diagnostic => diagnostic.Id)); - _logger.LogTrace($"Publishing diagnostics for document '{document.FilePath}': {diagnosticString}"); - } + _logger.LogTrace($"Publishing diagnostics for document '{document.FilePath}': {string.Join(", ", razorDiagnostics.Select(diagnostic => diagnostic.Id))}"); async Task GetCSharpDiagnosticsAsync(IDocumentSnapshot document, CancellationToken token) { @@ -191,7 +188,7 @@ .. csharpDiagnostics ?? [] if (_documentContextFactory.Value.TryCreate(delegatedParams.TextDocument.Uri, projectContext: null, out var documentContext)) { return await _translateDiagnosticsService.Value - .TranslateAsync(RazorLanguageKind.CSharp, fullDiagnostics.Items, documentContext, token) + .TranslateAsync(RazorLanguageKind.CSharp, fullDiagnostics.Items, documentContext.Snapshot) .ConfigureAwait(false); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs index 61fa87dd95e..1275669a97c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs @@ -1,29 +1,58 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Protocol.ColorPresentation; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentColor; [RazorLanguageServerEndpoint(Methods.TextDocumentDocumentColorName)] -internal sealed class DocumentColorEndpoint(IDocumentColorService documentColorService, IClientConnection clientConnection) : IRazorRequestHandler, ICapabilitiesProvider +internal sealed class DocumentColorEndpoint(IClientConnection clientConnection) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IDocumentColorService _documentColorService = documentColorService ?? throw new ArgumentNullException(nameof(documentColorService)); - private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); + private readonly IClientConnection _clientConnection = clientConnection; public bool MutatesSolutionState => false; public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) - => serverCapabilities.EnableDocumentColorProvider(); + => serverCapabilities.DocumentColorProvider = true; public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentColorParams request) => request.TextDocument; - public Task HandleRequestAsync(DocumentColorParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) - => _documentColorService.GetColorInformationAsync(_clientConnection, request, requestContext.DocumentContext, cancellationToken); + public async Task HandleRequestAsync(DocumentColorParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) + { + var documentContext = requestContext.DocumentContext; + + // Workaround for Web Tools bug https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1743689 where they sometimes + // send requests for filenames that are stale, possibly due to adornment taggers being cached incorrectly (or caching + // filenames incorrectly) + if (documentContext is null) + { + return []; + } + + var delegatedRequest = new DelegatedDocumentColorParams() + { + HostDocumentVersion = documentContext.Snapshot.Version, + TextDocument = request.TextDocument + }; + + var documentColors = await _clientConnection.SendRequestAsync( + CustomMessageNames.RazorProvideHtmlDocumentColorEndpoint, + delegatedRequest, + cancellationToken).ConfigureAwait(false); + + if (documentColors is null) + { + return []; + } + + // HTML and Razor documents have identical mapping locations. Because of this we can return the result as-is. + return documentColors; + } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorService.cs deleted file mode 100644 index 56cf6818cd2..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorService.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Protocol.ColorPresentation; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentColor; - -internal sealed class DocumentColorService() : IDocumentColorService -{ - public async Task GetColorInformationAsync(IClientConnection clientConnection, DocumentColorParams request, VersionedDocumentContext? documentContext, CancellationToken cancellationToken) - { - // Workaround for Web Tools bug https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1743689 where they sometimes - // send requests for filenames that are stale, possibly due to adornment taggers being cached incorrectly (or caching - // filenames incorrectly) - if (documentContext is null) - { - return []; - } - - var delegatedRequest = new DelegatedDocumentColorParams() - { - HostDocumentVersion = documentContext.Version, - TextDocument = request.TextDocument - }; - - var documentColors = await clientConnection.SendRequestAsync( - CustomMessageNames.RazorProvideHtmlDocumentColorEndpoint, - delegatedRequest, - cancellationToken).ConfigureAwait(false); - - if (documentColors is null) - { - return []; - } - - // HTML and Razor documents have identical mapping locations. Because of this we can return the result as-is. - return documentColors; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/IDocumentColorService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/IDocumentColorService.cs deleted file mode 100644 index f2e90ab2df7..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/IDocumentColorService.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentColor; - -internal interface IDocumentColorService -{ - Task GetColorInformationAsync(IClientConnection clientConnection, DocumentColorParams request, VersionedDocumentContext? documentContext, CancellationToken cancellationToken); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index c752e617e0b..68755ea2ae8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -18,30 +18,26 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal sealed class DocumentContextFactory( IProjectSnapshotManager projectManager, - IDocumentVersionCache documentVersionCache, ILoggerFactory loggerFactory) : IDocumentContextFactory { private readonly IProjectSnapshotManager _projectManager = projectManager; - private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { var filePath = documentUri.GetAbsoluteOrUNCPath(); - if (!TryGetDocumentAndVersion(filePath, projectContext, versioned, out var documentAndVersion)) + if (!TryResolveDocument(filePath, projectContext, out var documentSnapshot)) { // Stale request or misbehaving client, see above comment. context = null; return false; } - var (documentSnapshot, version) = documentAndVersion; if (documentSnapshot is null) { Debug.Fail($"Document snapshot should never be null here for '{filePath}'. This indicates that our acquisition of documents / versions did not behave as expected."); @@ -49,57 +45,10 @@ public bool TryCreate( return false; } - if (versioned) - { - // If we were asked for a versioned document, but have no version info, then we didn't find the document - if (version is null) - { - context = null; - return false; - } - - context = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext, version.Value); - return true; - } - context = new DocumentContext(documentUri, documentSnapshot, projectContext); return true; } - private bool TryGetDocumentAndVersion( - string filePath, - VSProjectContext? projectContext, - bool versioned, - [NotNullWhen(true)] out DocumentSnapshotAndVersion? documentAndVersion) - { - if (TryResolveDocument(filePath, projectContext, out var documentSnapshot)) - { - if (!versioned) - { - documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, Version: null); - return true; - } - - if (_documentVersionCache.TryGetDocumentVersion(documentSnapshot, out var version)) - { - documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, version.Value); - return true; - } - - _logger.LogWarning($"Tried to create context for document {filePath} and project {projectContext?.Id} and a document was found, but version didn't match."); - } - - // This is super rare, if we get here it could mean many things. Some of which: - // 1. Stale request: - // - Got queued after a "document closed" / "document removed" type action - // - Took too long to run and by the time the request needed the document context the - // version cache has evicted the entry - // 2. Client is misbehaving and sending requests for a document that we've never seen before. - _logger.LogWarning($"Tried to create context for document {filePath} and project {projectContext?.Id} which was not found."); - documentAndVersion = null; - return false; - } - private bool TryResolveDocument( string filePath, VSProjectContext? projectContext, @@ -132,6 +81,4 @@ private bool TryResolveDocument( documentSnapshot = null; return false; } - - private record DocumentSnapshotAndVersion(IDocumentSnapshot Snapshot, int? Version); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs index f0059d00a19..203f8a0d49a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -71,7 +69,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( return null; } - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); // See if we can handle this directly in Razor. If not, we'll let things flow to the below delegated handling. var result = await TryGetRazorWorkspaceEditAsync(languageKind, request, cancellationToken).ConfigureAwait(false); if (result is not null) @@ -93,7 +91,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( var requestParams = CreateRazorRequestParameters(request); - requestParams.HostDocumentVersion = documentContext.Version; + requestParams.HostDocumentVersion = documentContext.Snapshot.Version; requestParams.Kind = languageKind; // For CSharp we need to map the range to the generated document @@ -115,7 +113,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( // The responses we get back will be for virtual documents, so we have to map them back to the real // document, and in the case of C#, map the returned ranges too - var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument, documentContext.Version); + var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument); return edit; } @@ -149,7 +147,7 @@ private Dictionary MapChanges(Dictionary return remappedChanges; } - private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, bool mapRanges, RazorCodeDocument codeDocument, int hostDocumentVersion) + private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, bool mapRanges, RazorCodeDocument codeDocument) { using var remappedDocumentEdits = new PooledArrayBuilder(documentEdits.Length); foreach (var entry in documentEdits) @@ -176,7 +174,6 @@ private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, TextDocument = new OptionalVersionedTextDocumentIdentifier() { Uri = razorDocumentUri, - Version = hostDocumentVersion }, Edits = [.. remappedEdits] }); @@ -207,12 +204,12 @@ private TextEdit[] MapTextEdits(bool mapRanges, RazorCodeDocument codeDocument, return mappedEdits.ToArray(); } - private WorkspaceEdit? MapWorkspaceEdit(WorkspaceEdit workspaceEdit, bool mapRanges, RazorCodeDocument codeDocument, int hostDocumentVersion) + private WorkspaceEdit? MapWorkspaceEdit(WorkspaceEdit workspaceEdit, bool mapRanges, RazorCodeDocument codeDocument) { if (workspaceEdit.TryGetTextDocumentEdits(out var documentEdits)) { // The LSP spec says, we should prefer `DocumentChanges` property over `Changes` if available. - var remappedEdits = MapDocumentChanges(documentEdits, mapRanges, codeDocument, hostDocumentVersion); + var remappedEdits = MapDocumentChanges(documentEdits, mapRanges, codeDocument); return new WorkspaceEdit() { DocumentChanges = remappedEdits diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSymbols/DocumentSymbolEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSymbols/DocumentSymbolEndpoint.cs index 6a783934424..87c7da60572 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSymbols/DocumentSymbolEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSymbols/DocumentSymbolEndpoint.cs @@ -10,7 +10,9 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Protocol.DocumentSymbols; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text.Tagging; @@ -18,21 +20,14 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentSymbols; [RazorLanguageServerEndpoint(Methods.TextDocumentDocumentSymbolName)] -internal class DocumentSymbolEndpoint : IRazorRequestHandler?>, ICapabilitiesProvider +internal class DocumentSymbolEndpoint( + IClientConnection clientConnection, + IDocumentSymbolService documentSymbolService, + LanguageServerFeatureOptions languageServerFeatureOptions) : IRazorRequestHandler?>, ICapabilitiesProvider { - private readonly IClientConnection _clientConnection; - private readonly IDocumentMappingService _documentMappingService; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions; - - public DocumentSymbolEndpoint( - IClientConnection clientConnection, - IDocumentMappingService documentMappingService, - LanguageServerFeatureOptions languageServerFeatureOptions) - { - _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _languageServerFeatureOptions = languageServerFeatureOptions; - } + private readonly IClientConnection _clientConnection = clientConnection; + private readonly IDocumentSymbolService _documentSymbolService = documentSymbolService; + private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; public bool MutatesSolutionState => false; @@ -76,74 +71,6 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentSymbolParams req var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var csharpDocument = codeDocument.GetCSharpDocument(); - - if (symbols.TryGetFirst(out var documentSymbols)) - { - return RemapDocumentSymbols(csharpDocument, documentSymbols); - } - else if (symbols.TryGetSecond(out var symbolInformations)) - { - using var _ = ListPool.GetPooledObject(out var mappedSymbols); - - foreach (var symbolInformation in symbolInformations) - { - if (_documentMappingService.TryMapToHostDocumentRange(csharpDocument, symbolInformation.Location.Range, out var newRange)) - { - symbolInformation.Location.Range = newRange; - symbolInformation.Location.Uri = documentContext.Uri; - mappedSymbols.Add(symbolInformation); - } - } - - return mappedSymbols.ToArray(); - } - else - { - Debug.Fail("Unsupported response type"); - throw new InvalidOperationException(); - } - } - - private DocumentSymbol[]? RemapDocumentSymbols(RazorCSharpDocument csharpDocument, DocumentSymbol[]? documentSymbols) - { - if (documentSymbols is null) - { - return null; - } - - using var _ = ListPool.GetPooledObject(out var mappedSymbols); - - foreach (var documentSymbol in documentSymbols) - { - if (TryRemapRanges(csharpDocument, documentSymbol)) - { - documentSymbol.Children = RemapDocumentSymbols(csharpDocument, documentSymbol.Children); - - mappedSymbols.Add(documentSymbol); - } - else if (documentSymbol.Children is [_, ..] && - RemapDocumentSymbols(csharpDocument, documentSymbol.Children) is [_, ..] mappedChildren) - { - // This range didn't map, but some/all of its children did, so we promote them to this level so we don't - // lose any information. - mappedSymbols.AddRange(mappedChildren); - } - } - - return mappedSymbols.ToArray(); - - bool TryRemapRanges(RazorCSharpDocument csharpDocument, DocumentSymbol documentSymbol) - { - if (_documentMappingService.TryMapToHostDocumentRange(csharpDocument, documentSymbol.Range, out var newRange) && - _documentMappingService.TryMapToHostDocumentRange(csharpDocument, documentSymbol.SelectionRange, out var newSelectionRange)) - { - documentSymbol.Range = newRange; - documentSymbol.SelectionRange = newSelectionRange; - - return true; - } - - return false; - } + return _documentSymbolService.GetDocumentSymbols(documentContext.Uri, csharpDocument, symbols); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs index afd1da50b3c..73c66dab4b9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs @@ -60,7 +60,7 @@ public async Task HandleNotificationAsync(DidChangeTextDocumentParams request, R sourceText = ApplyContentChanges(request.ContentChanges, sourceText); await _projectService - .UpdateDocumentAsync(documentContext.FilePath, sourceText, request.TextDocument.Version, cancellationToken) + .UpdateDocumentAsync(documentContext.FilePath, sourceText, cancellationToken) .ConfigureAwait(false); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs index 8af40ddf029..cb07a86ef22 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs @@ -23,6 +23,6 @@ public Task HandleNotificationAsync(DidOpenTextDocumentParams request, RazorRequ var sourceText = SourceText.From(request.TextDocument.Text); return _projectService.OpenDocumentAsync( - request.TextDocument.Uri.GetAbsoluteOrUNCPath(), sourceText, request.TextDocument.Version, cancellationToken); + request.TextDocument.Uri.GetAbsoluteOrUNCPath(), sourceText, cancellationToken); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs deleted file mode 100644 index 8c75ad73168..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache -{ - private readonly struct DocumentEntry(IDocumentSnapshot document, int version) - { - public WeakReference Document { get; } = new WeakReference(document); - - public int Version { get; } = version; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs deleted file mode 100644 index 8af39581c2a..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -#if !NET -using System.Collections.Generic; -#endif -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache -{ - internal TestAccessor GetTestAccessor() => new(this); - - internal class TestAccessor(DocumentVersionCache @this) - { - private readonly DocumentVersionCache _this = @this; - - public record struct DocumentEntry(IDocumentSnapshot? Document, int Version); - - public ImmutableDictionary> GetEntries() - { - using var result = new PooledDictionaryBuilder>(); - using var _ = _this._lock.EnterReadLock(); - - foreach (var (key, entries) in _this._documentLookup_NeedsLock) - { - using var versions = new PooledArrayBuilder(); - - foreach (var entry in entries) - { - var document = entry.Document.TryGetTarget(out var target) - ? target - : null; - - var version = entry.Version; - - versions.Add(new(document, version)); - } - - result.Add(key, versions.ToImmutable()); - } - - return result.ToImmutable(); - } - - public void MarkAsLatestVersion(IDocumentSnapshot document) - { - using (_this._lock.EnterUpgradeableReadLock()) - { - _this.MarkAsLatestVersion(document); - } - } - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs deleted file mode 100644 index b92fc2a926e..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Workspaces; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache : IDocumentVersionCache, IRazorStartupService -{ - internal const int MaxDocumentTrackingCount = 20; - - private readonly Dictionary> _documentLookup_NeedsLock = new(FilePathComparer.Instance); - private readonly ReadWriterLocker _lock = new(); - private readonly IProjectSnapshotManager _projectManager; - - public DocumentVersionCache(IProjectSnapshotManager projectManager) - { - _projectManager = projectManager; - _projectManager.Changed += ProjectManager_Changed; - } - - private void ProjectManager_Changed(object? sender, ProjectChangeEventArgs args) - { - // Don't do any work if the solution is closing - if (args.SolutionIsClosing) - { - return; - } - - if (args.Kind == ProjectChangeKind.DocumentChanged) - { - var documentFilePath = args.DocumentFilePath.AssumeNotNull(); - - using (_lock.EnterUpgradeableReadLock()) - { - if (_documentLookup_NeedsLock.ContainsKey(documentFilePath) && - !_projectManager.IsDocumentOpen(documentFilePath)) - { - using (_lock.EnterWriteLock()) - { - // Document closed, evict entry. - _documentLookup_NeedsLock.Remove(documentFilePath); - } - } - } - } - - // Any event that has a project may have changed the state of the documents - // and therefore requires us to mark all existing documents as latest. - if (!_projectManager.TryGetLoadedProject(args.ProjectKey, out var project)) - { - // Project no longer loaded, so there's no work to do. - return; - } - - CaptureProjectDocumentsAsLatest(project); - } - - public void TrackDocumentVersion(IDocumentSnapshot documentSnapshot, int version) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - using (_lock.EnterUpgradeableReadLock()) - { - TrackDocumentVersionCore(documentSnapshot, version); - } - } - - private void TrackDocumentVersionCore(IDocumentSnapshot documentSnapshot, int version) - { - Debug.Assert(_lock.IsUpgradeableReadLockHeld); - - // Need to ensure the write lock covers all uses of documentEntries, not just DocumentLookup - using (_lock.EnterWriteLock()) - { - var key = documentSnapshot.FilePath.AssumeNotNull(); - if (!_documentLookup_NeedsLock.TryGetValue(key, out var documentEntries)) - { - documentEntries = []; - _documentLookup_NeedsLock.Add(key, documentEntries); - } - - if (documentEntries.Count == MaxDocumentTrackingCount) - { - // Clear the oldest document entry - - // With this approach we'll slowly leak memory as new documents are added to the system. We don't clear up - // document file paths where where all of the corresponding entries are expired. - documentEntries.RemoveAt(0); - } - - var entry = new DocumentEntry(documentSnapshot, version); - documentEntries.Add(entry); - } - } - - public int GetLatestDocumentVersion(string filePath) - { - using var _ = _lock.EnterReadLock(); - - if (!_documentLookup_NeedsLock.TryGetValue(filePath, out var documentEntries)) - { - return -1; - } - - return documentEntries[^1].Version; - } - - public bool TryGetDocumentVersion(IDocumentSnapshot documentSnapshot, [NotNullWhen(true)] out int? version) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - using var _ = _lock.EnterReadLock(); - - var filePath = documentSnapshot.FilePath.AssumeNotNull(); - if (!_documentLookup_NeedsLock.TryGetValue(filePath, out var documentEntries)) - { - version = null; - return false; - } - - // We iterate backwards over the entries to prioritize newer entries. - for (var i = documentEntries.Count - 1; i >= 0; i--) - { - if (documentEntries[i].Document.TryGetTarget(out var document) && - document == documentSnapshot) - { - version = documentEntries[i].Version; - return true; - } - } - - version = null; - return false; - } - - private void CaptureProjectDocumentsAsLatest(IProjectSnapshot projectSnapshot) - { - Debug.Assert(!_lock.IsUpgradeableReadLockHeld); - - using var _ = _lock.EnterUpgradeableReadLock(); - - foreach (var documentPath in projectSnapshot.DocumentFilePaths) - { - if (_documentLookup_NeedsLock.ContainsKey(documentPath) && - projectSnapshot.GetDocument(documentPath) is { } document) - { - MarkAsLatestVersion(document); - } - } - } - - private void MarkAsLatestVersion(IDocumentSnapshot document) - { - Debug.Assert(_lock.IsUpgradeableReadLockHeld); - - if (!_documentLookup_NeedsLock.TryGetValue(document.FilePath.AssumeNotNull(), out var documentEntries)) - { - return; - } - - var latestEntry = documentEntries[^1]; - - // Update our internal tracking state to track the changed document as the latest document. - TrackDocumentVersionCore(document, latestEntry.Version); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs index a81541b76d2..97819fcb3f0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs @@ -7,9 +7,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -internal readonly struct RazorRequestContext(VersionedDocumentContext? documentContext, ILspServices lspServices, string method, Uri? uri) +internal readonly struct RazorRequestContext(DocumentContext? documentContext, ILspServices lspServices, string method, Uri? uri) { - public readonly VersionedDocumentContext? DocumentContext = documentContext; + public readonly DocumentContext? DocumentContext = documentContext; public readonly ILspServices LspServices = lspServices; public readonly string Method = method; public readonly Uri? Uri = uri; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index dad0994085a..73eabc9a9ab 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -22,10 +22,13 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Tooltip; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.CodeAnalysis.Razor.Completion; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.SemanticTokens; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.Extensions.DependencyInjection; @@ -55,22 +58,19 @@ public static void AddLifeCycleServices(this IServiceCollection services, RazorL services.AddSingleton(clientConnection); } - public static void AddFormattingServices(this IServiceCollection services) + public static void AddFormattingServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions) { // Formatting services.AddSingleton(); - // Formatting Passes - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - - services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); + if (!featureOptions.UseRazorCohostServer) + { + services.AddSingleton(); + + services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); + } } public static void AddCompletionServices(this IServiceCollection services) @@ -161,14 +161,16 @@ public static void AddCodeActionsServices(this IServiceCollection services) public static void AddTextDocumentServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions) { - services.AddHandlerWithCapabilities(); if (!featureOptions.UseRazorCohostServer) { + services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); - } - services.AddHandlerWithCapabilities(); - services.AddHandler(); + services.AddSingleton(); + services.AddSingleton(); + services.AddHandlerWithCapabilities(); + services.AddHandler(); + } services.AddHandlerWithCapabilities(); services.AddHandler(); @@ -197,9 +199,6 @@ public static void AddDocumentManagementServices(this IServiceCollection service services.AddSingleton(); services.AddSingleton(sp => new Lazy(sp.GetRequiredService)); - services.AddSingleton(); - services.AddSingleton((services) => (IRazorStartupService)services.GetRequiredService()); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton((services) => (RazorProjectService)services.GetRequiredService()); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs index d94e078be6b..f2f71470096 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs @@ -55,7 +55,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(FoldingRangeParams reque var requestParams = new RazorFoldingRangeRequestParam { - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, TextDocument = @params.TextDocument, }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index 1c074702874..1564a8d4129 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -1,28 +1,27 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentFormattingName)] -internal class DocumentFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal class DocumentFormattingEndpoint( + IRazorFormattingService razorFormattingService, + IHtmlFormatter htmlFormatter, + RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService; - private readonly RazorLSPOptionsMonitor _optionsMonitor; - - public DocumentFormattingEndpoint( - IRazorFormattingService razorFormattingService, - RazorLSPOptionsMonitor optionsMonitor) - { - _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - } + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; public bool MutatesSolutionState => false; @@ -55,7 +54,11 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentFormattingParams return null; } - var edits = await _razorFormattingService.FormatAsync(documentContext, range: null, request.Options, cancellationToken).ConfigureAwait(false); - return edits; + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + + var htmlChanges = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); + var changes = await _razorFormattingService.GetDocumentFormattingChangesAsync(documentContext, htmlChanges, span: null, options, cancellationToken).ConfigureAwait(false); + + return [.. changes.Select(codeDocument.Source.Text.GetTextEdit)]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 77c5b6a37ae..7012b8173d7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -2,15 +2,18 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; +using System.Collections.Frozen; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -20,29 +23,21 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentOnTypeFormattingName)] internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, - IDocumentMappingService documentMappingService, + IHtmlFormatter htmlFormatter, RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; - private static readonly IReadOnlyList s_htmlTriggerCharacters = new[] { "\n", "{", "}", ";" }; - private static readonly IReadOnlyList s_allTriggerCharacters = s_csharpTriggerCharacters.Concat(s_htmlTriggerCharacters).ToArray(); - public bool MutatesSolutionState => false; public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { - serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions - { - FirstTriggerCharacter = s_allTriggerCharacters[0], - MoreTriggerCharacter = s_allTriggerCharacters.Skip(1).ToArray(), - }; + serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions().EnableOnTypeFormattingTriggerCharacters(); } public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormattingParams request) @@ -66,14 +61,13 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting return null; } - if (!s_allTriggerCharacters.Contains(request.Character, StringComparer.Ordinal)) + if (!RazorFormattingService.AllTriggerCharacterSet.Contains(request.Character)) { _logger.LogWarning($"Unexpected trigger character '{request.Character}'."); return null; } var documentContext = requestContext.DocumentContext; - if (documentContext is null) { _logger.LogWarning($"Failed to find document {request.TextDocument.Uri}."); @@ -95,47 +89,38 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting return null; } - var triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); - if (triggerCharacterKind is not (RazorLanguageKind.CSharp or RazorLanguageKind.Html)) - { - _logger.LogInformation($"Unsupported trigger character language {triggerCharacterKind:G}."); - return null; - } - - if (!IsApplicableTriggerCharacter(request.Character, triggerCharacterKind)) + if (_razorFormattingService.TryGetOnTypeFormattingTriggerKind(codeDocument, hostDocumentIndex, request.Character, out var triggerCharacterKind)) { - // We were triggered but the trigger character doesn't make sense for the current cursor position. Bail. - _logger.LogInformation($"Unsupported trigger character location."); return null; } cancellationToken.ThrowIfCancellationRequested(); - Debug.Assert(request.Character.Length > 0); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); - var formattedEdits = await _razorFormattingService.FormatOnTypeAsync(documentContext, triggerCharacterKind, Array.Empty(), request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); - if (formattedEdits.Length == 0) + ImmutableArray formattedChanges; + if (triggerCharacterKind == RazorLanguageKind.CSharp) { - _logger.LogInformation($"No formatting changes were necessary"); - return null; + formattedChanges = await _razorFormattingService.GetCSharpOnTypeFormattingChangesAsync(documentContext, options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); } - - _logger.LogInformation($"Returning {formattedEdits.Length} final formatted results."); - return formattedEdits; - } - - private static bool IsApplicableTriggerCharacter(string triggerCharacter, RazorLanguageKind languageKind) - { - if (languageKind == RazorLanguageKind.CSharp) + else if (triggerCharacterKind == RazorLanguageKind.Html) { - return s_csharpTriggerCharacters.Contains(triggerCharacter); + var htmlChanges = await _htmlFormatter.GetOnTypeFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Position, request.Character, request.Options, cancellationToken).ConfigureAwait(false); + formattedChanges = await _razorFormattingService.GetHtmlOnTypeFormattingChangesAsync(documentContext, htmlChanges, options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); } - else if (languageKind == RazorLanguageKind.Html) + else { - return s_htmlTriggerCharacters.Contains(triggerCharacter); + Assumed.Unreachable(); + return null; + } + + if (formattedChanges.Length == 0) + { + _logger.LogInformation($"No formatting changes were necessary"); + return null; } - // Unknown trigger character. - return false; + _logger.LogInformation($"Returning {formattedChanges.Length} final formatted results."); + return [.. formattedChanges.Select(sourceText.GetTextEdit)]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index 414a1bf1ef5..7ba97f9f9fb 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -1,28 +1,27 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentRangeFormattingName)] -internal class DocumentRangeFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal class DocumentRangeFormattingEndpoint( + IRazorFormattingService razorFormattingService, + IHtmlFormatter htmlFormatter, + RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService; - private readonly RazorLSPOptionsMonitor _optionsMonitor; - - public DocumentRangeFormattingEndpoint( - IRazorFormattingService razorFormattingService, - RazorLSPOptionsMonitor optionsMonitor) - { - _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - } + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; public bool MutatesSolutionState => false; @@ -55,8 +54,11 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentRangeFormattingP return null; } - var edits = await _razorFormattingService.FormatAsync(documentContext, request.Range, request.Options, cancellationToken).ConfigureAwait(false); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + + var htmlChanges = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); + var changes = await _razorFormattingService.GetDocumentFormattingChangesAsync(documentContext, htmlChanges, request.Range.ToLinePositionSpan(), options, cancellationToken).ConfigureAwait(false); - return edits; + return [.. changes.Select(codeDocument.Source.Text.GetTextEdit)]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs deleted file mode 100644 index ff1eccb1f1c..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal sealed class FormattingContentValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) -{ - private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - - // We want this to run at the very end. - public override int Order => DefaultOrder + 1000; - - public override bool IsValidationPass => true; - - // Internal for testing. - internal bool DebugAssertsEnabled { get; set; } = true; - - public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) - { - if (result.Kind != RazorLanguageKind.Razor) - { - // We don't care about changes to projected documents here. - return Task.FromResult(result); - } - - var text = context.SourceText; - var edits = result.Edits; - var changes = edits.Select(text.GetTextChange); - var changedText = text.WithChanges(changes); - - if (!text.NonWhitespaceContentEquals(changedText)) - { - // Looks like we removed some non-whitespace content as part of formatting. Oops. - // Discard this formatting result. - - _logger.LogWarning($"{SR.Format_operation_changed_nonwhitespace}"); - - foreach (var edit in edits) - { - if (edit.NewText.Any(c => !char.IsWhiteSpace(c))) - { - _logger.LogWarning($"{SR.FormatEdit_at_adds(edit.Range.ToDisplayString(), edit.NewText)}"); - } - else if (text.TryGetFirstNonWhitespaceOffset(text.GetTextSpan(edit.Range), out _)) - { - _logger.LogWarning($"{SR.FormatEdit_at_deletes(edit.Range.ToDisplayString(), text.ToString(text.GetTextSpan(edit.Range)))}"); - } - } - - if (DebugAssertsEnabled) - { - Debug.Fail("A formatting result was rejected because it was going to change non-whitespace content in the document."); - } - - return Task.FromResult(new FormattingResult([])); - } - - return Task.FromResult(result); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingOptionsExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingOptionsExtensions.cs deleted file mode 100644 index 5271e0f9ec1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingOptionsExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.ExternalAccess.Razor; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal static class FormattingOptionsExtensions -{ - public static RazorIndentationOptions GetIndentationOptions(this FormattingOptions options) - => new( - UseTabs: !options.InsertSpaces, - TabSize: options.TabSize, - IndentationSize: options.TabSize); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs deleted file mode 100644 index 8f0f6e1dc86..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal abstract class FormattingPassBase(IDocumentMappingService documentMappingService) : IFormattingPass -{ - protected static readonly int DefaultOrder = 1000; - - public abstract bool IsValidationPass { get; } - - public virtual int Order => DefaultOrder; - - protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; - - public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); - - protected TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits, RazorLanguageKind projectedKind) - { - if (codeDocument is null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (projectedTextEdits is null) - { - throw new ArgumentNullException(nameof(projectedTextEdits)); - } - - if (projectedKind != RazorLanguageKind.CSharp) - { - // Non C# projections map directly to Razor. No need to remap. - return projectedTextEdits; - } - - if (codeDocument.IsUnsupported()) - { - return []; - } - - var edits = DocumentMappingService.GetHostDocumentEdits(codeDocument.GetCSharpDocument(), projectedTextEdits); - - return edits; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingResult.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingResult.cs deleted file mode 100644 index 7dc0c87c222..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingResult.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal struct FormattingResult -{ - public FormattingResult(TextEdit[] edits, RazorLanguageKind kind = RazorLanguageKind.Razor) - { - if (edits is null) - { - throw new ArgumentNullException(nameof(edits)); - } - - Edits = edits; - Kind = kind; - } - - public TextEdit[] Edits { get; } - - public RazorLanguageKind Kind { get; } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 288afdeacac..c20911085c1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -2,11 +2,13 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.TextDifferencing; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Formatting; using Microsoft.CodeAnalysis.Text; @@ -14,41 +16,25 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -internal class HtmlFormatter +internal sealed class HtmlFormatter( + IClientConnection clientConnection) : IHtmlFormatter { - private readonly IDocumentVersionCache _documentVersionCache; - private readonly IClientConnection _clientConnection; + private readonly IClientConnection _clientConnection = clientConnection; - public HtmlFormatter( - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache) - { - _clientConnection = clientConnection; - _documentVersionCache = documentVersionCache; - } - - public async Task FormatAsync( - FormattingContext context, + public async Task> GetDocumentFormattingEditsAsync( + IDocumentSnapshot documentSnapshot, + Uri uri, + FormattingOptions options, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) - { - return Array.Empty(); - } - var @params = new RazorDocumentFormattingParams() { TextDocument = new TextDocumentIdentifier { - Uri = context.Uri, + Uri = uri, }, - HostDocumentVersion = documentVersion.Value, - Options = context.Options + HostDocumentVersion = documentSnapshot.Version, + Options = options }; var result = await _clientConnection.SendRequestAsync( @@ -56,25 +42,30 @@ public async Task FormatAsync( @params, cancellationToken).ConfigureAwait(false); - return result?.Edits ?? Array.Empty(); - } - - public async Task FormatOnTypeAsync( - FormattingContext context, - CancellationToken cancellationToken) - { - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) + if (result?.Edits is null) { - return Array.Empty(); + return []; } + var sourceText = await documentSnapshot.GetTextAsync().ConfigureAwait(false); + return result.Edits.SelectAsArray(sourceText.GetTextChange); + } + + public async Task> GetOnTypeFormattingEditsAsync( + IDocumentSnapshot documentSnapshot, + Uri uri, + Position position, + string triggerCharacter, + FormattingOptions options, + CancellationToken cancellationToken) + { var @params = new RazorDocumentOnTypeFormattingParams() { - Position = context.SourceText.GetPosition(context.HostDocumentIndex), - Character = context.TriggerCharacter.ToString(), - TextDocument = new TextDocumentIdentifier { Uri = context.Uri }, - Options = context.Options, - HostDocumentVersion = documentVersion.Value, + Position = position, + Character = triggerCharacter.ToString(), + TextDocument = new TextDocumentIdentifier { Uri = uri }, + Options = options, + HostDocumentVersion = documentSnapshot.Version, }; var result = await _clientConnection.SendRequestAsync( @@ -82,7 +73,13 @@ public async Task FormatOnTypeAsync( @params, cancellationToken).ConfigureAwait(false); - return result?.Edits ?? Array.Empty(); + if (result?.Edits is null) + { + return []; + } + + var sourceText = await documentSnapshot.GetTextAsync().ConfigureAwait(false); + return result.Edits.SelectAsArray(sourceText.GetTextChange); } /// @@ -91,20 +88,15 @@ public async Task FormatOnTypeAsync( /// minimal text edits /// // Internal for testing - public static TextEdit[] FixHtmlTestEdits(SourceText htmlSourceText, TextEdit[] edits) + public static TextEdit[] FixHtmlTextEdits(SourceText htmlSourceText, TextEdit[] edits) { // Avoid computing a minimal diff if we don't need to - if (!edits.Any(e => e.NewText.Contains("~"))) + if (!edits.Any(static e => e.NewText.Contains("~"))) return edits; - // First we apply the edits that the Html language server wanted, to the Html document - var textChanges = edits.Select(htmlSourceText.GetTextChange); - var changedText = htmlSourceText.WithChanges(textChanges); - - // Now we use our minimal text differ algorithm to get the bare minimum of edits - var minimalChanges = SourceTextDiffer.GetMinimalTextChanges(htmlSourceText, changedText, DiffKind.Char); - var minimalEdits = minimalChanges.Select(htmlSourceText.GetTextEdit).ToArray(); + var changes = edits.SelectAsArray(htmlSourceText.GetTextChange); - return minimalEdits; + var fixedChanges = htmlSourceText.MinimizeTextChanges(changes); + return [.. fixedChanges.Select(htmlSourceText.GetTextEdit)]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IFormattingPass.cs deleted file mode 100644 index 1c88df4ae32..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IFormattingPass.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal interface IFormattingPass -{ - int Order { get; } - - bool IsValidationPass { get; } - - Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs new file mode 100644 index 00000000000..06995483bb2 --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +internal interface IHtmlFormatter +{ + Task> GetDocumentFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, FormattingOptions options, CancellationToken cancellationToken); + Task> GetOnTypeFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, Position position, string triggerCharacter, FormattingOptions options, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs deleted file mode 100644 index 9048b915931..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal interface IRazorFormattingService -{ - Task FormatAsync( - VersionedDocumentContext documentContext, - Range? range, - FormattingOptions options, - CancellationToken cancellationToken); - - Task FormatOnTypeAsync( - DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] formattedEdits, - FormattingOptions options, - int hostDocumentIndex, - char triggerCharacter, - CancellationToken cancellationToken); - - Task FormatCodeActionAsync( - DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] formattedEdits, - FormattingOptions options, - CancellationToken cancellationToken); - - Task FormatSnippetAsync( - DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] edits, - FormattingOptions options, - CancellationToken cancellationToken); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs new file mode 100644 index 00000000000..e47da7f437d --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +internal sealed class LspFormattingCodeDocumentProvider : IFormattingCodeDocumentProvider +{ + public Task GetCodeDocumentAsync(IDocumentSnapshot snapshot) + { + // Formatting always uses design time + return snapshot.GetGeneratedOutputAsync(forceDesignTimeGeneratedOutput: true); + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs deleted file mode 100644 index 7989815323b..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.TextDifferencing; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal class RazorFormattingService : IRazorFormattingService -{ - private readonly List _formattingPasses; - private readonly IAdhocWorkspaceFactory _workspaceFactory; - - public RazorFormattingService( - IEnumerable formattingPasses, - IAdhocWorkspaceFactory workspaceFactory) - { - if (formattingPasses is null) - { - throw new ArgumentNullException(nameof(formattingPasses)); - } - - _formattingPasses = formattingPasses.OrderBy(f => f.Order).ToList(); - _workspaceFactory = workspaceFactory ?? throw new ArgumentNullException(nameof(workspaceFactory)); - } - - public async Task FormatAsync( - VersionedDocumentContext documentContext, - Range? range, - FormattingOptions options, - CancellationToken cancellationToken) - { - var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); - - // Range formatting happens on every paste, and if there are Razor diagnostics in the file - // that can make some very bad results. eg, given: - // - // | - // @code { - // } - // - // When pasting " d.Span != SourceSpan.Undefined && range.OverlapsWith(sourceText.GetRange(d.Span)))) - { - return []; - } - } - - var uri = documentContext.Uri; - var documentSnapshot = documentContext.Snapshot; - var hostDocumentVersion = documentContext.Version; - using var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, _workspaceFactory); - var originalText = context.SourceText; - - var result = new FormattingResult([]); - foreach (var pass in _formattingPasses) - { - cancellationToken.ThrowIfCancellationRequested(); - result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); - } - - var filteredEdits = range is null - ? result.Edits - : result.Edits.Where(e => range.LineOverlapsWith(e.Range)); - - return GetMinimalEdits(originalText, filteredEdits); - } - - private static TextEdit[] GetMinimalEdits(SourceText originalText, IEnumerable filteredEdits) - { - // Make sure the edits actually change something, or its not worth responding - var textChanges = filteredEdits.Select(originalText.GetTextChange); - var changedText = originalText.WithChanges(textChanges); - if (changedText.ContentEquals(originalText)) - { - return Array.Empty(); - } - - // Only send back the minimum edits - var minimalChanges = SourceTextDiffer.GetMinimalTextChanges(originalText, changedText, DiffKind.Char); - var finalEdits = minimalChanges.Select(originalText.GetTextEdit).ToArray(); - - return finalEdits; - } - - public Task FormatOnTypeAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - - public Task FormatCodeActionAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: false, automaticallyAddUsings: true, cancellationToken: cancellationToken); - - public async Task FormatSnippetAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) - { - if (kind == RazorLanguageKind.CSharp) - { - WrapCSharpSnippets(edits); - } - - var formattedEdits = await ApplyFormattedEditsAsync( - documentContext, - kind, - edits, - options, - hostDocumentIndex: 0, - triggerCharacter: '\0', - bypassValidationPasses: true, - collapseEdits: true, - automaticallyAddUsings: false, - cancellationToken: cancellationToken).ConfigureAwait(false); - - if (kind == RazorLanguageKind.CSharp) - { - UnwrapCSharpSnippets(formattedEdits); - } - - return formattedEdits; - } - - private async Task ApplyFormattedEditsAsync( - DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] formattedEdits, - FormattingOptions options, - int hostDocumentIndex, - char triggerCharacter, - bool bypassValidationPasses, - bool collapseEdits, - bool automaticallyAddUsings, - CancellationToken cancellationToken) - { - // If we only received a single edit, let's always return a single edit back. - // Otherwise, merge only if explicitly asked. - collapseEdits |= formattedEdits.Length == 1; - - var documentSnapshot = documentContext.Snapshot; - var uri = documentContext.Uri; - var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); - using var context = FormattingContext.CreateForOnTypeFormatting(uri, documentSnapshot, codeDocument, options, _workspaceFactory, automaticallyAddUsings: automaticallyAddUsings, hostDocumentIndex, triggerCharacter); - var result = new FormattingResult(formattedEdits, kind); - - foreach (var pass in _formattingPasses) - { - if (pass.IsValidationPass && bypassValidationPasses) - { - continue; - } - - cancellationToken.ThrowIfCancellationRequested(); - result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); - } - - var originalText = context.SourceText; - var edits = GetMinimalEdits(originalText, result.Edits); - - if (collapseEdits) - { - var collapsedEdit = MergeEdits(edits, originalText); - if (collapsedEdit.NewText.Length == 0 && - collapsedEdit.Range.IsZeroWidth()) - { - return Array.Empty(); - } - - return new[] { collapsedEdit }; - } - - return edits; - } - - // Internal for testing - internal static TextEdit MergeEdits(TextEdit[] edits, SourceText sourceText) - { - if (edits.Length == 1) - { - return edits[0]; - } - - var textChanges = new List(); - foreach (var edit in edits) - { - var change = new TextChange(sourceText.GetTextSpan(edit.Range), edit.NewText); - textChanges.Add(change); - } - - var changedText = sourceText.WithChanges(textChanges); - var affectedRange = changedText.GetEncompassingTextChangeRange(sourceText); - var spanBeforeChange = affectedRange.Span; - var spanAfterChange = new TextSpan(spanBeforeChange.Start, affectedRange.NewLength); - var newText = changedText.GetSubTextString(spanAfterChange); - - var encompassingChange = new TextChange(spanBeforeChange, newText); - - return sourceText.GetTextEdit(encompassingChange); - } - - private static void WrapCSharpSnippets(TextEdit[] snippetEdits) - { - // Currently this method only supports wrapping `$0`, any additional markers aren't formatted properly. - - for (var i = 0; i < snippetEdits.Length; i++) - { - var snippetEdit = snippetEdits[i]; - - // Formatting doesn't work with syntax errors caused by the cursor marker ($0). - // So, let's avoid the error by wrapping the cursor marker in a comment. - var wrappedText = snippetEdit.NewText.Replace("$0", "/*$0*/"); - snippetEdit.NewText = wrappedText; - } - } - - private static void UnwrapCSharpSnippets(TextEdit[] snippetEdits) - { - for (var i = 0; i < snippetEdits.Length; i++) - { - var snippetEdit = snippetEdits[i]; - - // Unwrap the cursor marker. - var unwrappedText = snippetEdit.NewText.Replace("/*$0*/", "$0"); - snippetEdit.NewText = unwrappedText; - } - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 4799f85575e..9f10511a0e9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; @@ -62,7 +63,7 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou : new DocumentKey(ProjectKey.Unknown, filePath); PublishData? previouslyPublishedData; - IReadOnlyList textChanges; + ImmutableArray textChanges; lock (_publishedCSharpData) { @@ -72,24 +73,25 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou previouslyPublishedData = PublishData.Default; } - textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); - if (textChanges.Count == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) + if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) { - // Source texts match along with host document versions. We've already published something that looks like this. No-op. + // We've already published a newer version of this document. No-op. + _logger.LogWarning($"Skipping publish of C# for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); return; } - if (_logger.IsEnabled(LogLevel.Trace)) + textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); + if (textChanges.Length == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) { - var previousDocumentLength = previouslyPublishedData.SourceText.Length; - var currentDocumentLength = sourceText.Length; - var documentLengthDelta = sourceText.Length - previousDocumentLength; - _logger.LogTrace( - $"Updating C# buffer of {filePath} for project {documentKey.ProjectKey} to correspond with host document " + - $"version {hostDocumentVersion}. {previousDocumentLength} -> {currentDocumentLength} = Change delta of " + - $"{documentLengthDelta} via {textChanges.Count} text changes."); + // Source texts match along with host document versions. We've already published something that looks like this. No-op. + return; } + _logger.LogDebug( + $"Updating C# buffer of {filePath} for project {documentKey.ProjectKey} to correspond with host document " + + $"version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of " + + $"{sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Length} text changes."); + _publishedCSharpData[documentKey] = new PublishData(sourceText, hostDocumentVersion); } @@ -108,7 +110,7 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourceText, int hostDocumentVersion) { PublishData? previouslyPublishedData; - IReadOnlyList textChanges; + ImmutableArray textChanges; lock (_publishedHtmlData) { @@ -117,22 +119,23 @@ public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourc previouslyPublishedData = PublishData.Default; } - textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); - if (textChanges.Count == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) + if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) { - // Source texts match along with host document versions. We've already published something that looks like this. No-op. + // We've already published a newer version of this document. No-op. + _logger.LogWarning($"Skipping publish of Html for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); return; } - if (_logger.IsEnabled(LogLevel.Trace)) + textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); + if (textChanges.Length == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) { - var previousDocumentLength = previouslyPublishedData.SourceText.Length; - var currentDocumentLength = sourceText.Length; - var documentLengthDelta = sourceText.Length - previousDocumentLength; - _logger.LogTrace( - $"Updating HTML buffer of {filePath} to correspond with host document version {hostDocumentVersion}. {previousDocumentLength} -> {currentDocumentLength} = Change delta of {documentLengthDelta} via {textChanges.Count} text changes."); + // Source texts match along with host document versions. We've already published something that looks like this. No-op. + return; } + _logger.LogDebug( + $"Updating HTML buffer of {filePath} to correspond with host document version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of {sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Length} text changes."); + _publishedHtmlData[filePath] = new PublishData(sourceText, hostDocumentVersion); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs index 2fe06d466d3..d057edfc632 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs @@ -9,33 +9,35 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal class GeneratedDocumentSynchronizer( IGeneratedDocumentPublisher publisher, - IDocumentVersionCache documentVersionCache, - LanguageServerFeatureOptions languageServerFeatureOptions) : IDocumentProcessedListener + LanguageServerFeatureOptions languageServerFeatureOptions, + IProjectSnapshotManager projectManager) : IDocumentProcessedListener { private readonly IGeneratedDocumentPublisher _publisher = publisher; - private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; + private readonly IProjectSnapshotManager _projectManager = projectManager; public void DocumentProcessed(RazorCodeDocument codeDocument, IDocumentSnapshot document) { - if (!_documentVersionCache.TryGetDocumentVersion(document, out var hostDocumentVersion)) + var hostDocumentVersion = document.Version; + var filePath = document.FilePath.AssumeNotNull(); + + // If the document isn't open, and we're not updating buffers for closed documents, then we don't need to do anything. + if (!_projectManager.IsDocumentOpen(document.FilePath) && + !_languageServerFeatureOptions.UpdateBuffersForClosedDocuments) { - // Could not resolve document version return; } - var filePath = document.FilePath.AssumeNotNull(); - // If cohosting is on, then it is responsible for updating the Html buffer if (!_languageServerFeatureOptions.UseRazorCohostServer) { var htmlText = codeDocument.GetHtmlSourceText(); - _publisher.PublishHtml(document.Project.Key, filePath, htmlText, hostDocumentVersion.Value); + _publisher.PublishHtml(document.Project.Key, filePath, htmlText, hostDocumentVersion); } var csharpText = codeDocument.GetCSharpSourceText(); - _publisher.PublishCSharp(document.Project.Key, filePath, csharpText, hostDocumentVersion.Value); + _publisher.PublishCSharp(document.Project.Key, filePath, csharpText, hostDocumentVersion); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs similarity index 67% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs index 83b32a3dd23..f6016f918cf 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs @@ -1,12 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -internal static class VSInternalServerCapabilitiesExtensions +internal static class LspInitializationHelpers { public static void EnableInlayHints(this VSInternalServerCapabilities serverCapabilities) { @@ -17,11 +20,6 @@ public static void EnableInlayHints(this VSInternalServerCapabilities serverCapa }; } - public static void EnableDocumentColorProvider(this VSInternalServerCapabilities serverCapabilities) - { - serverCapabilities.DocumentColorProvider = new DocumentColorOptions(); - } - public static void EnableSemanticTokens(this VSInternalServerCapabilities serverCapabilities, ISemanticTokensLegendService legend) { serverCapabilities.SemanticTokensOptions = new SemanticTokensOptions().EnableSemanticTokens(legend); @@ -70,4 +68,29 @@ public static void EnableMapCodeProvider(this VSInternalServerCapabilities serve { serverCapabilities.MapCodeProvider = true; } + + public static void EnableOnAutoInsert( + this VSInternalServerCapabilities serverCapabilities, + IEnumerable triggerCharacters) + { + serverCapabilities.OnAutoInsertProvider = new VSInternalDocumentOnAutoInsertOptions() + .EnableOnAutoInsert(triggerCharacters); + } + + public static VSInternalDocumentOnAutoInsertOptions EnableOnAutoInsert( + this VSInternalDocumentOnAutoInsertOptions options, + IEnumerable triggerCharacters) + { + options.TriggerCharacters = triggerCharacters.Distinct().ToArray(); + + return options; + } + + public static DocumentOnTypeFormattingOptions EnableOnTypeFormattingTriggerCharacters(this DocumentOnTypeFormattingOptions options) + { + options.FirstTriggerCharacter = RazorFormattingService.FirstTriggerCharacter; + options.MoreTriggerCharacter = RazorFormattingService.MoreTriggerCharacters.ToArray(); + + return options; + } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs index 4fb546a09d6..5160930cfe8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs @@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.Tooltip; +using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -35,7 +36,7 @@ internal sealed partial class HoverService( private readonly IDocumentMappingService _documentMappingService = documentMappingService; private readonly IClientCapabilitiesService _clientCapabilitiesService = clientCapabilitiesService; - public async Task GetRazorHoverInfoAsync(VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken) + public async Task GetRazorHoverInfoAsync(DocumentContext documentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken) { // HTML can still sometimes be handled by razor. For example hovering over // a component tag like will still be in an html context @@ -57,7 +58,7 @@ internal sealed partial class HoverService( return await GetHoverInfoAsync(documentContext.FilePath, codeDocument, location, _clientCapabilitiesService.ClientCapabilities, cancellationToken).ConfigureAwait(false); } - public async Task TranslateDelegatedResponseAsync(VSInternalHover? response, VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) + public async Task TranslateDelegatedResponseAsync(VSInternalHover? response, DocumentContext documentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) { if (response?.Range is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs index 5408dd8f17d..b3ef864a76c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs @@ -11,6 +11,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Hover; internal interface IHoverService { - Task GetRazorHoverInfoAsync(VersionedDocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken); - Task TranslateDelegatedResponseAsync(VSInternalHover? response, VersionedDocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken); + Task GetRazorHoverInfoAsync(DocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken); + Task TranslateDelegatedResponseAsync(VSInternalHover? response, DocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IAdhocWorkspaceFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IAdhocWorkspaceFactory.cs deleted file mode 100644 index 084a0b01ae9..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IAdhocWorkspaceFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal interface IAdhocWorkspaceFactory -{ - AdhocWorkspace Create(params IWorkspaceService[] workspaceServices); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs deleted file mode 100644 index dc7b13c4880..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentPositionInfoStrategy.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal interface IDocumentPositionInfoStrategy -{ - Task TryGetPositionInfoAsync( - IDocumentMappingService documentMappingService, - DocumentContext documentContext, - Position position, - CancellationToken cancellationToken); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs deleted file mode 100644 index 932d55ea68a..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal interface IDocumentVersionCache -{ - bool TryGetDocumentVersion(IDocumentSnapshot documentSnapshot, [NotNullWhen(true)] out int? version); - void TrackDocumentVersion(IDocumentSnapshot documentSnapshot, int version); - - // HACK: This is temporary to allow the cohosting and normal language server to co-exist and share code - int GetLatestDocumentVersion(string filePath); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs index 27c85a48882..f09716a0c38 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ILoggerExtensions.cs @@ -9,54 +9,3 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -internal static class ILoggerExtensions -{ - public static bool TestOnlyLoggingEnabled = false; - - [Conditional("DEBUG")] - public static void LogTestOnly(this ILogger logger, ref TestLogMessageInterpolatedStringHandler handler) - { - if (TestOnlyLoggingEnabled) - { - logger.Log(LogLevel.Debug, handler.ToString(), exception: null); - } - } -} - -[InterpolatedStringHandler] -internal ref struct TestLogMessageInterpolatedStringHandler -{ - private PooledObject _builder; - - public TestLogMessageInterpolatedStringHandler(int literalLength, int _, out bool isEnabled) - { - isEnabled = ILoggerExtensions.TestOnlyLoggingEnabled; - if (isEnabled) - { - _builder = StringBuilderPool.GetPooledObject(); - _builder.Object.EnsureCapacity(literalLength); - } - } - - public void AppendLiteral(string s) - { - _builder.Object.Append(s); - } - - public void AppendFormatted(T t) - { - _builder.Object.Append(t?.ToString() ?? "[null]"); - } - - public void AppendFormatted(T t, string format) - { - _builder.Object.AppendFormat(format, t); - } - - public override string ToString() - { - var result = _builder.Object.ToString(); - _builder.Dispose(); - return result; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs index 54865b68151..fce91249bf1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.InlayHints; internal interface IInlayHintService { - Task GetInlayHintsAsync(IClientConnection clientConnection, VersionedDocumentContext documentContext, Range range, CancellationToken cancellationToken); + Task GetInlayHintsAsync(IClientConnection clientConnection, DocumentContext documentContext, Range range, CancellationToken cancellationToken); Task ResolveInlayHintAsync(IClientConnection clientConnection, InlayHint inlayHint, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs index 294a6adc827..60b405b5faa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs @@ -22,7 +22,7 @@ internal sealed class InlayHintService(IDocumentMappingService documentMappingSe { private readonly IDocumentMappingService _documentMappingService = documentMappingService; - public async Task GetInlayHintsAsync(IClientConnection clientConnection, VersionedDocumentContext documentContext, Range range, CancellationToken cancellationToken) + public async Task GetInlayHintsAsync(IClientConnection clientConnection, DocumentContext documentContext, Range range, CancellationToken cancellationToken) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var csharpDocument = codeDocument.GetCSharpDocument(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 0a452d66217..03ff37b121a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -11,9 +11,10 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Completion; @@ -27,7 +28,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.InlineCompletion; internal sealed class InlineCompletionEndpoint( IDocumentMappingService documentMappingService, IClientConnection clientConnection, - IAdhocWorkspaceFactory adhocWorkspaceFactory, + IFormattingCodeDocumentProvider formattingCodeDocumentProvider, + RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { @@ -36,9 +38,10 @@ internal sealed class InlineCompletionEndpoint( "if", "indexer", "interface", "invoke", "iterator", "iterindex", "lock", "mbox", "namespace", "#if", "#region", "prop", "propfull", "propg", "sim", "struct", "svm", "switch", "try", "tryf", "unchecked", "unsafe", "using", "while"); - private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - private readonly IAdhocWorkspaceFactory _adhocWorkspaceFactory = adhocWorkspaceFactory ?? throw new ArgumentNullException(nameof(adhocWorkspaceFactory)); + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly IClientConnection _clientConnection = clientConnection; + private readonly IFormattingCodeDocumentProvider _formattingCodeDocumentProvider = formattingCodeDocumentProvider; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; @@ -58,10 +61,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti public async Task HandleRequestAsync(VSInternalInlineCompletionRequest request, RazorRequestContext requestContext, CancellationToken cancellationToken) { - if (request is null) - { - throw new ArgumentNullException(nameof(request)); - } + ArgHelper.ThrowIfNull(request); _logger.LogInformation($"Starting request for {request.TextDocument.Uri} at {request.Position}."); @@ -80,7 +80,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var hostDocumentIndex = sourceText.GetPosition(request.Position); - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); // Map to the location in the C# document. if (languageKind != RazorLanguageKind.CSharp || @@ -110,10 +110,9 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti return null; } - var items = new List(); + using var items = new PooledArrayBuilder(list.Items.Length); foreach (var item in list.Items) { - var containsSnippet = item.TextFormat == InsertTextFormat.Snippet; var range = item.Range ?? projectedPosition.ToZeroWidthRange(); if (!_documentMappingService.TryMapToHostDocumentRange(codeDocument.GetCSharpDocument(), range, out var rangeInRazorDoc)) @@ -122,7 +121,12 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti continue; } - using var formattingContext = FormattingContext.Create(request.TextDocument.Uri, documentContext.Snapshot, codeDocument, request.Options, _adhocWorkspaceFactory); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + var formattingContext = FormattingContext.Create( + documentContext.Snapshot, + codeDocument, + options, + _formattingCodeDocumentProvider); if (!TryGetSnippetWithAdjustedIndentation(formattingContext, item.Text, hostDocumentIndex, out var newSnippetText)) { continue; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs index e8d9f6c580e..bd88b799311 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs @@ -22,19 +22,9 @@ internal class LspEditMappingService( { private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; - protected override bool TryGetVersionedDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out VersionedDocumentContext? documentContext) + protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out DocumentContext? documentContext) { - if (!_documentContextFactory.TryCreateForOpenDocument(razorDocumentUri, projectContext, out documentContext)) - { - return false; - } - - return true; - } - - protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, [NotNullWhen(true)] out DocumentContext? documentContext) - { - if (!_documentContextFactory.TryCreate(razorDocumentUri, out documentContext)) + if (!_documentContextFactory.TryCreate(razorDocumentUri, projectContext, out documentContext)) { return false; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspWorkspaceProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspWorkspaceProvider.cs deleted file mode 100644 index e6e0e83aeb8..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspWorkspaceProvider.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.Workspaces; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed class LspWorkspaceProvider(IAdhocWorkspaceFactory workspaceFactory) : IWorkspaceProvider, IDisposable -{ - private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory; - - private Workspace? _workspace; - private bool _disposed; - - void IDisposable.Dispose() - { - if (_disposed) - { - return; - } - - _workspace?.Dispose(); - _disposed = true; - } - - public Workspace GetWorkspace() - { - if (_disposed) - { - throw new ObjectDisposedException(nameof(LspWorkspaceProvider)); - } - - return _workspace ??= _workspaceFactory.Create(); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs index e38ace89ca0..4d61c202e32 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs @@ -85,7 +85,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V continue; } - if (!_documentContextFactory.TryCreateForOpenDocument(mapping.TextDocument.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(mapping.TextDocument.Uri, out var documentContext)) { continue; } @@ -131,7 +131,7 @@ private async Task TryMapCodeAsync( Location[][] locations, List changes, Guid mapCodeCorrelationId, - VersionedDocumentContext documentContext, + DocumentContext documentContext, CancellationToken cancellationToken) { var syntaxTree = codeToMap.GetSyntaxTree(); @@ -162,7 +162,7 @@ private async Task TryMapCodeAsync( ImmutableArray nodesToMap, Guid mapCodeCorrelationId, List changes, - VersionedDocumentContext documentContext, + DocumentContext documentContext, CancellationToken cancellationToken) { var didCalculateCSharpFocusLocations = false; @@ -357,7 +357,7 @@ private async Task GetCSharpFocusLocationsAsync(Location[][] focus continue; } - if (!_documentContextFactory.TryCreateForOpenDocument(potentialLocation.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(potentialLocation.Uri, out var documentContext)) { continue; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs index 62f55e00a19..da40358e0af 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -39,7 +40,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(RazorLanguageQueryParams } var documentSnapshot = documentContext.Snapshot; - var documentVersion = documentContext.Version; + var documentVersion = documentContext.Snapshot.Version; var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); var sourceText = await documentSnapshot.GetTextAsync().ConfigureAwait(false); @@ -60,7 +61,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(RazorLanguageQueryParams var responsePositionIndex = hostDocumentIndex; - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); if (languageKind == RazorLanguageKind.CSharp) { if (_documentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), hostDocumentIndex, out Position? projectedPosition, out var projectedIndex)) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs index a6e0c6f6a29..1223d0f5c39 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs @@ -53,7 +53,7 @@ public Uri GetTextDocumentIdentifier(RazorMapToDocumentRangesParams request) return new RazorMapToDocumentRangesResponse() { Ranges = request.ProjectedRanges, - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, }; } @@ -76,7 +76,7 @@ public Uri GetTextDocumentIdentifier(RazorMapToDocumentRangesParams request) return new RazorMapToDocumentRangesResponse() { Ranges = ranges, - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, }; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs deleted file mode 100644 index 98b8fcac5d1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/PreferAttributeNameDocumentPositionInfoStrategy.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -/// -/// A projection strategy that, when given a position that occurs anywhere in an attribute name, will return the projection -/// for the position at the start of the attribute name, ignoring any prefix or suffix. eg given any location within the -/// attribute "@bind-Value:after", it will return the projection at the point of the word "Value" therein. -/// -internal class PreferAttributeNameDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy -{ - public static IDocumentPositionInfoStrategy Instance { get; } = new PreferAttributeNameDocumentPositionInfoStrategy(); - - public async Task TryGetPositionInfoAsync( - IDocumentMappingService documentMappingService, - DocumentContext documentContext, - Position position, - CancellationToken cancellationToken) - { - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); - if (sourceText.TryGetAbsoluteIndex(position, out var absoluteIndex)) - { - // First, lets see if we should adjust the location to get a better result from C#. For example given - // where | is the cursor, we would be unable to map that location to C#. If we pretend the caret was 3 characters to the right though, - // in the actual component property name, then the C# server would give us a result, so we fake it. - if (RazorSyntaxFacts.TryGetAttributeNameAbsoluteIndex(codeDocument, absoluteIndex, out var attributeNameIndex)) - { - position = sourceText.GetPosition(attributeNameIndex); - } - } - - // We actually don't need a different projection strategy, we just wanted to move the caret position - return await DefaultDocumentPositionInfoStrategy.Instance - .TryGetPositionInfoAsync(documentMappingService, documentContext, position, cancellationToken) - .ConfigureAwait(false); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs index e83c8c327f1..942c95985bc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs @@ -14,8 +14,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; internal interface IRazorProjectService { Task AddDocumentToMiscProjectAsync(string filePath, CancellationToken cancellationToken); - Task OpenDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken); - Task UpdateDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken); + Task OpenDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken); + Task UpdateDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken); Task CloseDocumentAsync(string filePath, CancellationToken cancellationToken); Task RemoveDocumentAsync(string filePath, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index 74ebb392272..9f7d10a9cd4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -36,7 +36,6 @@ internal partial class RazorProjectService : IRazorProjectService, IRazorProject private readonly IRazorProjectInfoDriver _projectInfoDriver; private readonly IProjectSnapshotManager _projectManager; private readonly RemoteTextLoaderFactory _remoteTextLoaderFactory; - private readonly IDocumentVersionCache _documentVersionCache; private readonly ILogger _logger; private readonly CancellationTokenSource _disposeTokenSource; @@ -45,14 +44,12 @@ internal partial class RazorProjectService : IRazorProjectService, IRazorProject public RazorProjectService( IProjectSnapshotManager projectManager, IRazorProjectInfoDriver projectInfoDriver, - IDocumentVersionCache documentVersionCache, RemoteTextLoaderFactory remoteTextLoaderFactory, ILoggerFactory loggerFactory) { _projectInfoDriver = projectInfoDriver; _projectManager = projectManager; _remoteTextLoaderFactory = remoteTextLoaderFactory; - _documentVersionCache = documentVersionCache; _logger = loggerFactory.GetOrCreateLogger(); // We kick off initialization immediately to ensure that the IRazorProjectService @@ -159,29 +156,29 @@ await _projectManager private void AddDocumentToMiscProjectCore(ProjectSnapshotManager.Updater updater, string filePath) { var textDocumentPath = FilePathNormalizer.Normalize(filePath); + _logger.LogDebug($"Asked to add {textDocumentPath} to the miscellaneous files project, because we don't have project info (yet?)"); - _logger.LogDebug($"Adding {filePath} to the miscellaneous files project, because we don't have project info (yet?)"); - var miscFilesProject = _projectManager.GetMiscellaneousProject(); - - if (miscFilesProject.GetDocument(FilePathNormalizer.Normalize(textDocumentPath)) is not null) + if (_projectManager.TryResolveDocumentInAnyProject(textDocumentPath, _logger, out var document)) { - // Document already added. This usually occurs when VSCode has already pre-initialized - // open documents and then we try to manually add all known razor documents. + // Already in a known project, so we don't want it in the misc files project + _logger.LogDebug($"File {textDocumentPath} is already in {document.Project.Key}, so we're not adding it to the miscellaneous files project"); return; } + var miscFilesProject = _projectManager.GetMiscellaneousProject(); + // Representing all of our host documents with a re-normalized target path to workaround GetRelatedDocument limitations. var normalizedTargetFilePath = textDocumentPath.Replace('/', '\\').TrimStart('\\'); var hostDocument = new HostDocument(textDocumentPath, normalizedTargetFilePath); var textLoader = _remoteTextLoaderFactory.Create(textDocumentPath); - _logger.LogInformation($"Adding document '{filePath}' to project '{miscFilesProject.Key}'."); + _logger.LogInformation($"Adding document '{textDocumentPath}' to project '{miscFilesProject.Key}'."); updater.DocumentAdded(miscFilesProject.Key, hostDocument, textLoader); } - public async Task OpenDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken) + public async Task OpenDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken) { await WaitForInitializationAsync().ConfigureAwait(false); @@ -208,14 +205,6 @@ await _projectManager.UpdateAsync( _logger.LogInformation($"Opening document '{textDocumentPath}' in project '{projectSnapshot.Key}'."); updater.DocumentOpened(projectSnapshot.Key, textDocumentPath, sourceText); }); - - // Use a separate loop, as the above call modified out projects, so we have to make sure we're operating on the latest snapshot - ActOnDocumentInMultipleProjects( - filePath, - (projectSnapshot, textDocumentPath) => - { - TrackDocumentVersion(projectSnapshot, textDocumentPath, version, startGenerating: true); - }); }, cancellationToken) .ConfigureAwait(false); @@ -289,7 +278,7 @@ await _projectManager.UpdateAsync( .ConfigureAwait(false); } - public async Task UpdateDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken) + public async Task UpdateDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken) { await WaitForInitializationAsync().ConfigureAwait(false); @@ -304,14 +293,6 @@ await _projectManager.UpdateAsync( updater.DocumentChanged(project.Key, textDocumentPath, sourceText); }); - - // Use a separate loop, as the above call modified out projects, so we have to make sure we're operating on the latest snapshot - ActOnDocumentInMultipleProjects( - filePath, - (projectSnapshot, textDocumentPath) => - { - TrackDocumentVersion(projectSnapshot, textDocumentPath, version, startGenerating: false); - }); }, cancellationToken) .ConfigureAwait(false); @@ -672,20 +653,4 @@ private void TryMigrateMiscellaneousDocumentsToProject(ProjectSnapshotManager.Up updater.DocumentAdded(projectSnapshot.Key, newHostDocument, textLoader); } } - - private void TrackDocumentVersion(IProjectSnapshot projectSnapshot, string textDocumentPath, int version, bool startGenerating) - { - if (projectSnapshot.GetDocument(FilePathNormalizer.Normalize(textDocumentPath)) is not { } documentSnapshot) - { - return; - } - - _documentVersionCache.TrackDocumentVersion(documentSnapshot, version); - - if (startGenerating) - { - // Start generating the C# for the document so it can immediately be ready for incoming requests. - documentSnapshot.GetGeneratedOutputAsync().Forget(); - } - } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index 601df17f06c..ee027bd962b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Extensions; using Microsoft.AspNetCore.Razor.LanguageServer.FindAllReferences; using Microsoft.AspNetCore.Razor.LanguageServer.Folding; +using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.LanguageServer.Implementation; using Microsoft.AspNetCore.Razor.LanguageServer.InlayHints; @@ -24,8 +25,12 @@ using Microsoft.AspNetCore.Razor.LanguageServer.SignatureHelp; using Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag; using Microsoft.AspNetCore.Razor.Telemetry; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.FoldingRanges; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.GoToDefinition; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol.DocumentSymbols; using Microsoft.CodeAnalysis.Razor.Rename; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CommonLanguageServerProtocol.Framework; @@ -114,8 +119,7 @@ protected override ILspServices ConstructLspServices() // Add the logger as a service in case anything in CLaSP pulls it out to do logging services.AddSingleton(Logger); - services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); var featureOptions = _featureOptions ?? new DefaultLanguageServerFeatureOptions(); services.AddSingleton(featureOptions); @@ -124,22 +128,26 @@ protected override ILspServices ConstructLspServices() services.AddLifeCycleServices(this, _clientConnection, _lspServerActivationTracker); - services.AddDiagnosticServices(); services.AddSemanticTokensServices(featureOptions); services.AddDocumentManagementServices(featureOptions); services.AddCompletionServices(); - services.AddFormattingServices(); + services.AddFormattingServices(featureOptions); services.AddCodeActionsServices(); services.AddOptionsServices(_lspOptions); services.AddHoverServices(); services.AddTextDocumentServices(featureOptions); - // Auto insert - services.AddSingleton(); - services.AddSingleton(); - if (!featureOptions.UseRazorCohostServer) { + // Diagnostics + services.AddDiagnosticServices(); + + // Auto insert + services.AddSingleton(); + services.AddSingleton(); + + services.AddSingleton(); + // Folding Range Providers services.AddSingleton(); services.AddSingleton(); @@ -175,16 +183,17 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption // Transient because it should only be used once and I'm hoping it doesn't stick around. services.AddTransient(sp => sp.GetRequiredService()); - services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); - - services.AddHandlerWithCapabilities(); - if (!featureOptions.UseRazorCohostServer) { + services.AddHandlerWithCapabilities(); + + services.AddSingleton(); + services.AddHandlerWithCapabilities(); + services.AddSingleton(); services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); @@ -193,20 +202,21 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption services.AddSingleton(); services.AddHandlerWithCapabilities(); services.AddHandler(); + + services.AddHandlerWithCapabilities(); + services.AddSingleton(); + + services.AddHandlerWithCapabilities(); + services.AddHandler(); } services.AddHandler(); services.AddHandler(); services.AddHandler(); - services.AddHandlerWithCapabilities(); - services.AddSingleton(); - - services.AddHandler(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs index 3383b82b7cb..f89b213204c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs @@ -21,7 +21,7 @@ public override Task CreateRequestContextAsync().GetOrCreateLogger(); - VersionedDocumentContext? documentContext = null; + DocumentContext? documentContext = null; var textDocumentHandler = methodHandler as ITextDocumentIdentifierHandler; Uri? uri = null; @@ -35,7 +35,7 @@ public override Task CreateRequestContextAsync uriHandler) { @@ -43,7 +43,7 @@ public override Task CreateRequestContextAsync Create component from tag - - Diagnostics after: - - - Diagnostics before: - Document {0} was not found. - - Edit at {0} adds the non-whitespace content '{1}'. - - - Edit at {0} deletes the non-whitespace content '{1}'. - Extract block to code behind File was externally modified: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Generate Async Event Handler '{0}' Generate Event Handler '{0}' - - Razor language services not configured properly, missing language service '{0}'. - Not available in diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.cs.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.cs.xlf index de1af9b86ea..3143ba21b8a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.cs.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.cs.xlf @@ -17,31 +17,11 @@ Vytvořit komponentu ze značky - - Diagnostics after: - Diagnostika po: - - - - Diagnostics before: - Diagnostika před: - - Document {0} was not found. Dokument {0} nebyl nalezen. - - Edit at {0} adds the non-whitespace content '{1}'. - Úprava na {0} přidá neprázdný obsah {1}. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Úprava na {0} odstraní neprázdný obsah {1}. - - Extract block to code behind Extrahovat blok do kódu na pozadí @@ -57,16 +37,6 @@ Došlo k externí úpravě souboru: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Operace formátování je ukončována, protože by zavedla nebo odebrala jednu z více diagnostik. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Operace formátování je ukončována, protože by přidala nebo odstranila neprázdný obsah. - - Generate Async Event Handler '{0}' Generovat asynchronní obslužnou rutinu události {0} @@ -77,11 +47,6 @@ Generovat obslužnou rutinu události {0} - - Razor language services not configured properly, missing language service '{0}'. - Služby jazyka Razor nejsou správně nakonfigurované, chybí služba jazyka {0}. - - Not available in Není k dispozici v diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.de.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.de.xlf index 7da645a36d2..ead49ca2fad 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.de.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.de.xlf @@ -17,31 +17,11 @@ Komponente aus Tag erstellen - - Diagnostics after: - Diagnose nach: - - - - Diagnostics before: - Diagnose vor: - - Document {0} was not found. Dokument „{0}“ wurde nicht gefunden. - - Edit at {0} adds the non-whitespace content '{1}'. - Das Bearbeiten bei {0} fügt den Nicht-Leerraum-Inhalt "{1}" hinzu. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Das Bearbeiten bei {0} löscht den Nicht-Leerraum-Inhalt "{1}". - - Extract block to code behind Block auf CodeBehind extrahieren @@ -57,16 +37,6 @@ Datei wurde extern modifiziert: {0}. - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Ein Formatierungsvorgang wird abgebrochen, weil er eine oder mehrere Diagnosen einführen oder entfernen würde. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Ein Formatierungsvorgang wird abgebrochen, da er Nicht-Leerraum-Inhalte hinzufügen oder löschen würde. - - Generate Async Event Handler '{0}' Asynchronen Ereignishandler "{0}" generieren @@ -77,11 +47,6 @@ Ereignishandler "{0}" generieren - - Razor language services not configured properly, missing language service '{0}'. - Razor-Sprachdienste sind nicht ordnungsgemäß konfiguriert, der Sprachdienst "{0}" fehlt. - - Not available in Nicht verfügbar in diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.es.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.es.xlf index 72e2980b035..b4b9ebced30 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.es.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.es.xlf @@ -17,31 +17,11 @@ Crear un componente a partir de la etiqueta - - Diagnostics after: - Diagnósticos después de: - - - - Diagnostics before: - Diagnósticos antes de: - - Document {0} was not found. No se encontró el documento {0}. - - Edit at {0} adds the non-whitespace content '{1}'. - Editar en {0}agregar el contenido que no es un espacio en blanco "{1}" . - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Editar en {0} eliminar el contenido que no es un espacio en blanco "{1}" . - - Extract block to code behind Extraer el bloque al código subyacente @@ -57,16 +37,6 @@ El archivo se modificó externamente: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Se está abandonando una operación de formato porque introduciría o quitaría uno de más diagnósticos. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Se está abandonando una operación de formato porque agregaría o eliminaría contenido que no es un espacio en blanco. - - Generate Async Event Handler '{0}' Generar controlador de eventos asincrónicos ''{0}'' @@ -77,11 +47,6 @@ Generar controlador de eventos ''{0}'' - - Razor language services not configured properly, missing language service '{0}'. - Los servicios de lenguaje Razor no están configurados correctamente; falta el servicio de idioma "{0}". - - Not available in No disponible en diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.fr.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.fr.xlf index 0c3ee61e8de..f9a1e2f469c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.fr.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.fr.xlf @@ -17,31 +17,11 @@ Créer un composant à partir de la balise - - Diagnostics after: - Diagnostics après : - - - - Diagnostics before: - Diagnostics avant : - - Document {0} was not found. Le document {0} est introuvable. - - Edit at {0} adds the non-whitespace content '{1}'. - Modifier à {0} ajoute le contenu autre qu’un espace « {1} ». - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Modifier à {0} supprime le contenu autre qu’un espace « {1} ». - - Extract block to code behind Extraire le bloc vers le code-behind @@ -57,16 +37,6 @@ Le fichier a été modifié en externe : {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Une opération de formatage est en cours d’abandon, car elle introduit ou supprime un ou plusieurs diagnostics. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Une opération de formatage est en cours d’abandon, car elle ajouterait ou supprimerait du contenu qui n’est pas un espace blanc. - - Generate Async Event Handler '{0}' Générer le gestionnaire d’événements asynchrone « {0} » @@ -77,11 +47,6 @@ Générer le gestionnaire d’événements '{0}' - - Razor language services not configured properly, missing language service '{0}'. - Les services de langage Razor ne sont pas configurés correctement, le service de langage «{0}» manquant. - - Not available in Non disponible dans diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.it.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.it.xlf index 20333e772ac..2c006abb4d9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.it.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.it.xlf @@ -17,31 +17,11 @@ Crea componente da tag - - Diagnostics after: - Diagnostica dopo: - - - - Diagnostics before: - Diagnostica prima di: - - Document {0} was not found. Impossibile trovare il documento{0}. - - Edit at {0} adds the non-whitespace content '{1}'. - La modifica in {0} aggiunge contenuti diversi da spazi vuoti '{1}'. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - La modifica in {0} elimina contenuti diversi da spazi vuoti '{1}'. - - Extract block to code behind Estrai il blocco in code-behind @@ -57,16 +37,6 @@ Il file è stato modificato esternamente: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - È in corso l'abbandono di un'operazione di formato perché comporterebbe l'introduzione o la rimozione di una o più operazioni di diagnostica. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - È in corso l'abbandono di un'operazione di formattazione perché aggiungerebbe o eliminerebbe contenuto diverso da spazi vuoti. - - Generate Async Event Handler '{0}' Genera gestore dell'evento '{0}' asincrono @@ -77,11 +47,6 @@ Genera gestore dell'evento '{0}' - - Razor language services not configured properly, missing language service '{0}'. - I servizi di linguaggio Razor non sono configurati correttamente. Manca il servizio di linguaggio '{0}'. - - Not available in Non disponibili in diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ja.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ja.xlf index 6016bbea305..2021b54fc77 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ja.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ja.xlf @@ -17,31 +17,11 @@ タグからコンポーネントを作成する - - Diagnostics after: - 次の時間が経過した後の診断: - - - - Diagnostics before: - 次の時間以前の診断: - - Document {0} was not found. ドキュメント {0}が見つかりませんでした。 - - Edit at {0} adds the non-whitespace content '{1}'. - {0} で編集すると空白以外のスペース '{1}' が追加されます。 - - - - Edit at {0} deletes the non-whitespace content '{1}'. - {0} で削除すると空白以外のスペース '{1}' が追加されます。 - - Extract block to code behind ブロック抽出から分離コード @@ -57,16 +37,6 @@ ファイルが外部で変更されました: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - 書式設定操作は、さらに診断の 1 つを導入または削除するため、破棄されています。 - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - 書式設定操作は、空白以外のコンテンツを追加または削除するため、破棄されています。 - - Generate Async Event Handler '{0}' 非同期イベント ハンドラー '{0}' の生成 @@ -77,11 +47,6 @@ イベント ハンドラー '{0}' の生成 - - Razor language services not configured properly, missing language service '{0}'. - Razor 言語サービスが正しく構成されていません。言語サービス '{0}' がありません。 - - Not available in 次では使用できません: diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ko.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ko.xlf index 4579e5803b2..b57675ee714 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ko.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ko.xlf @@ -17,31 +17,11 @@ 태그에서 구성 요소 만들기 - - Diagnostics after: - 다음 이후 진단: - - - - Diagnostics before: - 다음 이전 진단: - - Document {0} was not found. 문서 {0}을(를) 찾을 수 없습니다. - - Edit at {0} adds the non-whitespace content '{1}'. - {0}에서 편집은 공백이 아닌 콘텐츠 '{1}'을(를) 추가합니다. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - {0}에서 편집은 공백이 아닌 콘텐츠 '{1}'을(를) 삭제합니다. - - Extract block to code behind 코드 숨김에 블록 추출 @@ -57,16 +37,6 @@ {0}의 파일이 외부에서 수정되었습니다. - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - 서식 작업이 중단되는 이유는 진단 중 하나를 더 도입하거나 제거할 수 있기 때문입니다. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - 공백이 아닌 콘텐츠를 추가하거나 삭제하기 때문에 형식 작업이 중단됩니다. - - Generate Async Event Handler '{0}' 비동기 이벤트 처리기 '{0}' 생성 @@ -77,11 +47,6 @@ 이벤트 처리기 '{0}' 생성 - - Razor language services not configured properly, missing language service '{0}'. - Razor 언어 서비스가 제대로 구성되지 않았습니다. 언어 서비스 '{0}'이(가) 없습니다. - - Not available in 에서 사용할 수 없음 diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pl.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pl.xlf index 765d2f018bc..558fc0bad17 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pl.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pl.xlf @@ -17,31 +17,11 @@ Utwórz składnik z tagu - - Diagnostics after: - Diagnostyka po: - - - - Diagnostics before: - Diagnostyka przed: - - Document {0} was not found. Nie znaleziono {0} dokumentu. - - Edit at {0} adds the non-whitespace content '{1}'. - Edycja na stronie {0} dodaje zawartość bez białych znaków „{1}”. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Edycja na stronie {0} usuwa zawartość bez białych znaków „{1}”. - - Extract block to code behind Wyodrębnij blok do kodu znajdującego się poza @@ -57,16 +37,6 @@ Plik został zmodyfikowany na zewnątrz: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Operacja formatowania jest porzucana, ponieważ spowodowałaby wprowadzenie lub usunięcie jednej z większej liczby diagnostyki. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Operacja formatowania jest porzucana, ponieważ doda lub usunie zawartość bez białych znaków. - - Generate Async Event Handler '{0}' Generuj asynchroniczny program obsługi zdarzeń „{0}” @@ -77,11 +47,6 @@ Generuj obsługę zdarzeń „{0}” - - Razor language services not configured properly, missing language service '{0}'. - Usługi języka dla składni Razor nie zostały prawidłowo skonfigurowane — brak usługi językowej "{0}". - - Not available in Niedostępne w diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pt-BR.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pt-BR.xlf index 62ad6fd0364..54f52940111 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pt-BR.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.pt-BR.xlf @@ -17,31 +17,11 @@ Criar componente a partir da marca - - Diagnostics after: - Diagnóstico após: - - - - Diagnostics before: - Diagnóstico antes: - - Document {0} was not found. O documento {0} não foi encontrado. - - Edit at {0} adds the non-whitespace content '{1}'. - Editar em {0} adiciona o conteúdo que não é espaço em branco ''{1}''. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Editar em {0} exclui o conteúdo que não é espaço em branco ''{1}''. - - Extract block to code behind Extrair o bloco para codificar atrás @@ -57,16 +37,6 @@ O arquivo foi modificado externamente: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Uma operação de formato está sendo abandonada porque introduziria ou removeria um ou mais diagnósticos. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Uma operação de formato está sendo abandonada porque adicionaria ou excluiria conteúdo que não é espaço em branco. - - Generate Async Event Handler '{0}' Gerar Manipulador de Eventos Assíncronos '{0}' @@ -77,11 +47,6 @@ Gerar manipulador de eventos '{0}' - - Razor language services not configured properly, missing language service '{0}'. - Serviços de Linguagem Razor não configurados corretamente, serviço de linguagem '{0}' ausente. - - Not available in Não disponível em diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ru.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ru.xlf index df1d6913ba1..aa9d28f0e1d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ru.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.ru.xlf @@ -17,31 +17,11 @@ Создание компонента из тега - - Diagnostics after: - Диагностика после: - - - - Diagnostics before: - Диагностика до: - - Document {0} was not found. Документ {0} не найден. - - Edit at {0} adds the non-whitespace content '{1}'. - Редактирование {0} добавляет содержимое, не являющееся пробелами "{1}". - - - - Edit at {0} deletes the non-whitespace content '{1}'. - Редактирование {0} удаляет содержимое, не являющееся пробелами "{1}". - - Extract block to code behind Извлечь блок в код программной части @@ -57,16 +37,6 @@ Файл был изменен извне: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Операция форматирования отменяется, поскольку она вводит или удаляет одну или несколько диагностик. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Операция форматирования отменяется, поскольку она может добавить или удалить содержимое, отличное от пробелов. - - Generate Async Event Handler '{0}' Создать обработчик асинхронных событий "{0}" @@ -77,11 +47,6 @@ Создать обработчик событий "{0}" - - Razor language services not configured properly, missing language service '{0}'. - Языковые службы Razor настроены неправильно, отсутствует языковая служба "{0}". - - Not available in Недоступно в diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.tr.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.tr.xlf index 002635c7ab8..34a2514c8f1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.tr.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.tr.xlf @@ -17,31 +17,11 @@ Etiketten bileşen oluştur - - Diagnostics after: - Şundan sonraki tanılama: - - - - Diagnostics before: - Şundan önceki tanılama: - - Document {0} was not found. Belge {0} bulunamadı. - - Edit at {0} adds the non-whitespace content '{1}'. - {0} konumunda düzenleme, '{1}' boşluk dışı içeriğini ekler. - - - - Edit at {0} deletes the non-whitespace content '{1}'. - {0} konumunda düzenleme, '{1}' boşluk dışı içeriğini siler. - - Extract block to code behind Bloğu arkadaki koda ayıkla @@ -57,16 +37,6 @@ Dosya dışarıdan değiştirildi: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - Bir veya daha fazla tanılamayı ortaya çıkarabileceği veya kaldırabileceği için biçimlendirme işlemi bırakılıyor. - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - Boşluk dışı içeriği ekleyebileceği veya silebileceği için biçimlendirme işlemi bırakıl. - - Generate Async Event Handler '{0}' '{0}' Asenkron Olay İşleyicisini Oluştur @@ -77,11 +47,6 @@ '{0}' Olay İşleyicisi Oluştur - - Razor language services not configured properly, missing language service '{0}'. - Razor dil hizmetleri düzgün yapılandırılmadı, '{0}' dil hizmeti eksik. - - Not available in Şurada kullanılamaz: diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hans.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hans.xlf index c75b40f673c..e6b8974c03e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hans.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hans.xlf @@ -17,31 +17,11 @@ 从标记创建组件 - - Diagnostics after: - 诊断后: - - - - Diagnostics before: - 诊断前: - - Document {0} was not found. 找不到文档 {0}。 - - Edit at {0} adds the non-whitespace content '{1}'. - 于 {0} 编辑,添加非空格内容“{1}”。 - - - - Edit at {0} deletes the non-whitespace content '{1}'. - 于 {0} 编辑,删除非空格内容“{1}”。 - - Extract block to code behind 将块提取到代码隐藏中 @@ -57,16 +37,6 @@ 已从外部修改了文件: {0}。 - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - 正在放弃格式操作,因为它会引入或删除其他诊断之一。 - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - 正在放弃格式操作,因为它会添加或删除非空格内容。 - - Generate Async Event Handler '{0}' 生成异步事件处理程序“{0}” @@ -77,11 +47,6 @@ 生成事件处理程序 "{0}" - - Razor language services not configured properly, missing language service '{0}'. - Razor 语言服务未正确配置,缺少语言服务 "{0}"。 - - Not available in 在以下位置不可用 diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hant.xlf b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hant.xlf index 588a1945b6c..2417c021352 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hant.xlf +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Resources/xlf/SR.zh-Hant.xlf @@ -17,31 +17,11 @@ 從標籤建立元件 - - Diagnostics after: - 在以下事項之後的診斷: - - - - Diagnostics before: - 在以下事項之前的診斷: - - Document {0} was not found. 找不到文件 {0}。 - - Edit at {0} adds the non-whitespace content '{1}'. - 在 {0} 處編輯將新增非空白內容 '{1}'。 - - - - Edit at {0} deletes the non-whitespace content '{1}'. - 在 {0} 處編輯將刪除非空白內容 '{1}'。 - - Extract block to code behind 擷取區塊以在後方編碼 @@ -57,16 +37,6 @@ 已在外部修改檔案: {0} - - A format operation is being abandoned because it would introduce or remove one of more diagnostics. - 將放棄格式化作業,因為它將引入或移除一個或多個診斷。 - - - - A format operation is being abandoned because it would add or delete non-whitespace content. - 將放棄格式化作業,因為它將新增或删除非空白內容。 - - Generate Async Event Handler '{0}' 產生非同步事件處理常式 '{0}' @@ -77,11 +47,6 @@ 產生事件處理常式 '{0}' - - Razor language services not configured properly, missing language service '{0}'. - 未正確設定 Razor 語言服務,遺漏語言服務 '{0}'。 - - Not available in 無法使用於 diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs index 6a2e9d8dceb..982197f8e19 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Semantic/Services/LSPCSharpSemanticTokensProvider.cs @@ -26,12 +26,12 @@ internal class LSPCSharpSemanticTokensProvider(LanguageServerFeatureOptions lang private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async Task GetCSharpSemanticTokensResponseAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, ImmutableArray csharpSpans, Guid correlationId, CancellationToken cancellationToken) { - var documentVersion = documentContext.Version; + var documentVersion = documentContext.Snapshot.Version; using var _ = ListPool.GetPooledObject(out var csharpRangeList); foreach (var span in csharpSpans) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index 3d2b69e43a5..3cd304c989a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -2,38 +2,19 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.SpellCheck; [RazorLanguageServerEndpoint(VSInternalMethods.TextDocumentSpellCheckableRangesName)] -internal sealed class DocumentSpellCheckEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal sealed class DocumentSpellCheckEndpoint( + ISpellCheckService spellCheckService) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IDocumentMappingService _documentMappingService; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions; - private readonly IClientConnection _clientConnection; - - public DocumentSpellCheckEndpoint( - IDocumentMappingService documentMappingService, - LanguageServerFeatureOptions languageServerFeatureOptions, - IClientConnection clientConnection) - { - _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); - _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - } + private readonly ISpellCheckService _spellCheckService = spellCheckService; public bool MutatesSolutionState => false; @@ -43,14 +24,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellCheckableParams request) - { - if (request.TextDocument is null) - { - throw new ArgumentNullException(nameof(request.TextDocument)); - } - - return request.TextDocument; - } + => request.TextDocument; public async Task HandleRequestAsync(VSInternalDocumentSpellCheckableParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { @@ -60,150 +34,15 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellC return null; } - using var _ = ListPool.GetPooledObject(out var ranges); + var data = await _spellCheckService.GetSpellCheckRangeTriplesAsync(documentContext, cancellationToken).ConfigureAwait(false); - await AddRazorSpellCheckRangesAsync(ranges, documentContext, cancellationToken).ConfigureAwait(false); - - if (_languageServerFeatureOptions.SingleServerSupport) - { - await AddCSharpSpellCheckRangesAsync(ranges, documentContext, cancellationToken).ConfigureAwait(false); - } - - return new[] - { + return + [ new VSInternalSpellCheckableRangeReport { - Ranges = ConvertSpellCheckRangesToIntTriples(ranges), + Ranges = data, ResultId = Guid.NewGuid().ToString() } - }; - } - - private static async Task AddRazorSpellCheckRangesAsync(List ranges, VersionedDocumentContext documentContext, CancellationToken cancellationToken) - { - var tree = await documentContext.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - - // We don't want to report spelling errors in script or style tags, so we avoid descending into them at all, which - // means we don't need complicated logic, and it performs a bit better. We assume any C# in them will still be reported - // by Roslyn. - // In an ideal world we wouldn't need this logic at all, as we would defer to the Html LSP server to provide spell checking - // but it doesn't currently support it. When that support is added, we can remove all of this but the RazorCommentBlockSyntax - // handling. - foreach (var node in tree.Root.DescendantNodes(n => n is not MarkupElementSyntax { StartTag.Name.Content: "script" or "style" })) - { - if (node is RazorCommentBlockSyntax commentBlockSyntax) - { - ranges.Add(new((int)VSInternalSpellCheckableRangeKind.Comment, commentBlockSyntax.Comment.SpanStart, commentBlockSyntax.Comment.Span.Length)); - } - else if (node is MarkupTextLiteralSyntax textLiteralSyntax) - { - // Attribute names are text literals, but we don't want to spell check them because either C# will, - // whether they're component attributes based on property names, or they come from tag helper attribute - // parameters as strings, or they're Html attributes which are not necessarily expected to be real words. - if (node.Parent is MarkupTagHelperAttributeSyntax or - MarkupAttributeBlockSyntax or - MarkupMinimizedAttributeBlockSyntax or - MarkupTagHelperDirectiveAttributeSyntax or - MarkupMinimizedTagHelperAttributeSyntax or - MarkupMinimizedTagHelperDirectiveAttributeSyntax or - MarkupMiscAttributeContentSyntax) - { - continue; - } - - // Text literals appear everywhere in Razor to hold newlines and indentation, so its worth saving the tokens - if (textLiteralSyntax.ContainsOnlyWhitespace()) - { - continue; - } - - if (textLiteralSyntax.Span.Length == 0) - { - continue; - } - - ranges.Add(new((int)VSInternalSpellCheckableRangeKind.String, textLiteralSyntax.SpanStart, textLiteralSyntax.Span.Length)); - } - } - } - - private async Task AddCSharpSpellCheckRangesAsync(List ranges, VersionedDocumentContext documentContext, CancellationToken cancellationToken) - { - var delegatedParams = new DelegatedSpellCheckParams(documentContext.GetTextDocumentIdentifierAndVersion()); - var delegatedResponse = await _clientConnection.SendRequestAsync( - CustomMessageNames.RazorSpellCheckEndpoint, - delegatedParams, - cancellationToken).ConfigureAwait(false); - - if (delegatedResponse is null) - { - return; - } - - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - var csharpDocument = codeDocument.GetCSharpDocument(); - - foreach (var report in delegatedResponse) - { - if (report.Ranges is not { } csharpRanges) - { - continue; - } - - // Since we get C# tokens that have relative starts, we need to convert them back to absolute indexes - // so we can sort them with the Razor tokens later - var absoluteCSharpStartIndex = 0; - for (var i = 0; i < csharpRanges.Length; i += 3) - { - var kind = csharpRanges[i]; - var start = csharpRanges[i + 1]; - var length = csharpRanges[i + 2]; - - absoluteCSharpStartIndex += start; - - // We need to map the start index to produce results, and we validate that we can map the end index so we don't have - // squiggles that go from C# into Razor/Html. - if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) && - _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3)) - { - ranges.Add(new(kind, hostDocumentIndex, length)); - } - - absoluteCSharpStartIndex += length; - } - } - } - - private static int[] ConvertSpellCheckRangesToIntTriples(List ranges) - { - // Important to sort first, or the client will just ignore anything we say - ranges.Sort(CompareSpellCheckRanges); - - using var _ = ListPool.GetPooledObject(out var data); - data.SetCapacityIfLarger(ranges.Count * 3); - - var lastAbsoluteEndIndex = 0; - foreach (var range in ranges) - { - if (range.Length == 0) - { - continue; - } - - data.Add(range.Kind); - data.Add(range.AbsoluteStartIndex - lastAbsoluteEndIndex); - data.Add(range.Length); - - lastAbsoluteEndIndex = range.AbsoluteStartIndex + range.Length; - } - - return data.ToArray(); - } - - private record struct SpellCheckRange(int Kind, int AbsoluteStartIndex, int Length); - - private static int CompareSpellCheckRanges(SpellCheckRange x, SpellCheckRange y) - { - return x.AbsoluteStartIndex.CompareTo(y.AbsoluteStartIndex); + ]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs new file mode 100644 index 00000000000..f0181c75da7 --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs @@ -0,0 +1,77 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.SpellCheck; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.SpellCheck; + +internal sealed class LspCSharpSpellCheckRangeProvider( + LanguageServerFeatureOptions languageServerFeatureOptions, + IClientConnection clientConnection) : ICSharpSpellCheckRangeProvider +{ + private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; + private readonly IClientConnection _clientConnection = clientConnection; + + public async Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken) + { + if (!_languageServerFeatureOptions.SingleServerSupport) + { + return []; + } + + var delegatedParams = new DelegatedSpellCheckParams(documentContext.GetTextDocumentIdentifierAndVersion()); + var delegatedResponse = await _clientConnection.SendRequestAsync( + CustomMessageNames.RazorSpellCheckEndpoint, + delegatedParams, + cancellationToken).ConfigureAwait(false); + + if (delegatedResponse is not [_, ..] response) + { + return []; + } + + // Most common case is we'll get one report back from Roslyn, so we'll use that as the initial capacity. + var initialCapacity = response[0].Ranges?.Length ?? 4; + + using var ranges = new PooledArrayBuilder(initialCapacity); + foreach (var report in delegatedResponse) + { + if (report.Ranges is not { } csharpRanges) + { + continue; + } + + // Since we get C# tokens that have relative starts, we need to convert them back to absolute indexes + // so we can sort them with the Razor tokens later + var absoluteCSharpStartIndex = 0; + for (var i = 0; i < csharpRanges.Length; i += 3) + { + var kind = csharpRanges[i]; + var start = csharpRanges[i + 1]; + var length = csharpRanges[i + 2]; + + absoluteCSharpStartIndex += start; + + ranges.Add(new(kind, absoluteCSharpStartIndex, length)); + + absoluteCSharpStartIndex += length; + } + } + + return ranges.DrainToImmutable(); + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index 990dbc07a6e..67359999a29 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -9,7 +8,6 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; @@ -18,14 +16,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorWrapWithTagEndpoint)] -internal class WrapWithTagEndpoint( - IClientConnection clientConnection, - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : IRazorRequestHandler +internal class WrapWithTagEndpoint(IClientConnection clientConnection, ILoggerFactory loggerFactory) : IRazorRequestHandler { - private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); + private readonly IClientConnection _clientConnection = clientConnection; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; @@ -69,7 +62,20 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(WrapWithTagParams reques // // Instead of C#, which certainly would be expected to go in an if statement, we'll see HTML, which obviously // is the better choice for this operation. - var languageKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: true); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: true); + + // However, reverse scenario is possible as well, when we have + //
+ // |@if (true) {} + //

+ //
+ // in which case right-associative GetLanguageKind will return Razor and left-associative will return HTML + // We should hand that case as well, see https://github.com/dotnet/razor/issues/10819 + if (languageKind is RazorLanguageKind.Razor) + { + languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); + } + if (languageKind is not RazorLanguageKind.Html) { // In general, we don't support C# for obvious reasons, but we can support implicit expressions. ie @@ -104,7 +110,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(WrapWithTagParams reques var versioned = new VersionedTextDocumentIdentifier { Uri = request.TextDocument.Uri, - Version = documentContext.Version, + Version = documentContext.Snapshot.Version, }; var parameter = new DelegatedWrapWithTagParams(versioned, request); @@ -116,7 +122,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(WrapWithTagParams reques if (htmlResponse.TextEdits is not null) { var htmlSourceText = await documentContext.GetHtmlSourceTextAsync(cancellationToken).ConfigureAwait(false); - htmlResponse.TextEdits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, htmlResponse.TextEdits); + htmlResponse.TextEdits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, htmlResponse.TextEdits); } return htmlResponse; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Microsoft.AspNetCore.Razor.ProjectEngineHost.csproj b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Microsoft.AspNetCore.Razor.ProjectEngineHost.csproj index a1b367de03d..3e1f302dc61 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Microsoft.AspNetCore.Razor.ProjectEngineHost.csproj +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Microsoft.AspNetCore.Razor.ProjectEngineHost.csproj @@ -6,7 +6,7 @@ Microsoft.AspNetCore.Razor false false - true + true false true diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs index 53905d716e8..606a35ef44b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Linq; using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.AspNetCore.Razor.ProjectEngineHost; @@ -15,12 +14,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) var documentNode = codeDocument.GetDocumentIntermediateNode(); ThrowForMissingDocumentDependency(documentNode); - var cSharpDocument = RazorCSharpDocument.Create( - codeDocument, - UnsupportedDisclaimer, - documentNode.Options, - Enumerable.Empty()); - codeDocument.SetCSharpDocument(cSharpDocument); + var csharpDocument = new RazorCSharpDocument(codeDocument, UnsupportedDisclaimer, documentNode.Options, diagnostics: []); + codeDocument.SetCSharpDocument(csharpDocument); codeDocument.SetUnsupported(); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/RazorConfigurationFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/RazorConfigurationFormatter.cs index 94a229eedb7..6232c1fabdb 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/RazorConfigurationFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/RazorConfigurationFormatter.cs @@ -22,14 +22,10 @@ public override RazorConfiguration Deserialize(ref MessagePackReader reader, Ser var configurationName = CachedStringFormatter.Instance.Deserialize(ref reader, options) ?? string.Empty; var languageVersionText = CachedStringFormatter.Instance.Deserialize(ref reader, options) ?? string.Empty; + var suppressAddComponentParameter = reader.ReadBoolean(); + var useConsolidatedMvcViews = reader.ReadBoolean(); - count -= 2; - - if (reader.NextMessagePackType is MessagePackType.Boolean) - { - reader.ReadBoolean(); // forceRuntimeCodeGeneration - count -= 1; - } + count -= 4; using var builder = new PooledArrayBuilder(); @@ -45,14 +41,19 @@ public override RazorConfiguration Deserialize(ref MessagePackReader reader, Ser ? version : RazorLanguageVersion.Version_2_1; - return new(languageVersion, configurationName, extensions); + return new( + languageVersion, + configurationName, + extensions, + UseConsolidatedMvcViews: useConsolidatedMvcViews, + SuppressAddComponentParameter: suppressAddComponentParameter); } public override void Serialize(ref MessagePackWriter writer, RazorConfiguration value, SerializerCachingOptions options) { - // Write 3 values + 1 value per extension. + // Write 4 values + 1 value per extension. var extensions = value.Extensions; - var count = extensions.Length + 2; + var count = extensions.Length + 4; writer.WriteArrayHeader(count); @@ -67,7 +68,10 @@ public override void Serialize(ref MessagePackWriter writer, RazorConfiguration CachedStringFormatter.Instance.Serialize(ref writer, value.LanguageVersion.ToString(), options); } - count -= 2; + writer.Write(value.SuppressAddComponentParameter); + writer.Write(value.UseConsolidatedMvcViews); + + count -= 4; for (var i = 0; i < count; i++) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/SerializationFormat.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/SerializationFormat.cs index bb550776606..0fc5c52667c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/SerializationFormat.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Serialization/MessagePack/SerializationFormat.cs @@ -9,5 +9,5 @@ internal static class SerializationFormat // or any of the types that compose it changes. This includes: RazorConfiguration, // ProjectWorkspaceState, TagHelperDescriptor, and DocumentSnapshotHandle. // NOTE: If this version is changed, a coordinated insertion is required between Roslyn and Razor for the C# extension. - public const int Version = 5; + public const int Version = 6; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorProjectInfoFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/RazorProjectInfoFactory.cs similarity index 85% rename from src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorProjectInfoFactory.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/RazorProjectInfoFactory.cs index c99a25ec283..37a68df1de7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace/RazorProjectInfoFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/RazorProjectInfoFactory.cs @@ -1,23 +1,26 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; +using System.IO; using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Serialization; using Microsoft.AspNetCore.Razor.Telemetry; -using Microsoft.AspNetCore.Razor.Utilities; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Razor; -using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.Razor.Compiler.CSharp; -namespace Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace; +namespace Microsoft.AspNetCore.Razor.Utilities; internal static class RazorProjectInfoFactory { @@ -30,19 +33,17 @@ static RazorProjectInfoFactory() : StringComparison.OrdinalIgnoreCase; } - public static async Task ConvertAsync(Project project, ILogger? logger, CancellationToken cancellationToken) + public static async Task ConvertAsync(Project project, CancellationToken cancellationToken) { var projectPath = Path.GetDirectoryName(project.FilePath); if (projectPath is null) { - logger?.LogInformation("projectPath is null, skip conversion for {projectId}", project.Id); return null; } var intermediateOutputPath = Path.GetDirectoryName(project.CompilationOutputInfo.AssemblyPath); if (intermediateOutputPath is null) { - logger?.LogInformation("intermediatePath is null, skip conversion for {projectId}", project.Id); return null; } @@ -52,23 +53,19 @@ static RazorProjectInfoFactory() // Not a razor project if (documents.Length == 0) { - if (project.DocumentIds.Count == 0) - { - logger?.LogInformation("No razor documents for {projectId}", project.Id); - } - else - { - logger?.LogTrace("No documents in {projectId}", project.Id); - } - return null; } var csharpLanguageVersion = (project.ParseOptions as CSharpParseOptions)?.LanguageVersion ?? LanguageVersion.Default; - var options = project.AnalyzerOptions.AnalyzerConfigOptionsProvider; - var configuration = ComputeRazorConfigurationOptions(options, logger, out var defaultNamespace); + var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); + if (compilation is null) + { + return null; + } + var options = project.AnalyzerOptions.AnalyzerConfigOptionsProvider; + var configuration = ComputeRazorConfigurationOptions(options, compilation, out var defaultNamespace); var fileSystem = RazorProjectFileSystem.Create(projectPath); var defaultConfigure = (RazorProjectEngineBuilder builder) => @@ -104,7 +101,7 @@ static RazorProjectInfoFactory() documents: documents); } - private static RazorConfiguration ComputeRazorConfigurationOptions(AnalyzerConfigOptionsProvider options, ILogger? logger, out string defaultNamespace) + private static RazorConfiguration ComputeRazorConfigurationOptions(AnalyzerConfigOptionsProvider options, Compilation compilation, out string defaultNamespace) { // See RazorSourceGenerator.RazorProviders.cs @@ -119,11 +116,17 @@ private static RazorConfiguration ComputeRazorConfigurationOptions(AnalyzerConfi if (!globalOptions.TryGetValue("build_property.RazorLangVersion", out var razorLanguageVersionString) || !RazorLanguageVersion.TryParse(razorLanguageVersionString, out var razorLanguageVersion)) { - logger?.LogTrace("Using default of latest language version"); razorLanguageVersion = RazorLanguageVersion.Latest; } - var razorConfiguration = new RazorConfiguration(razorLanguageVersion, configurationName, Extensions: [], UseConsolidatedMvcViews: true); + var suppressAddComponentParameter = !compilation.HasAddComponentParameter(); + + var razorConfiguration = new RazorConfiguration( + razorLanguageVersion, + configurationName, + Extensions: [], + UseConsolidatedMvcViews: true, + suppressAddComponentParameter); defaultNamespace = rootNamespace ?? "ASP"; // TODO: Source generator does this. Do we want it? @@ -182,7 +185,7 @@ private static string GetTargetPath(string documentFilePath, string normalizedPr private static bool TryGetFileKind(string filePath, [NotNullWhen(true)] out string? fileKind) { - var extension = Path.GetExtension(filePath.AsSpan()); + var extension = Path.GetExtension(filePath); if (extension.Equals(".cshtml", s_stringComparison)) { @@ -216,8 +219,8 @@ private static bool TryGetRazorFileName(string? filePath, [NotNullWhen(true)] ou var path = filePath.AsSpan(); // Generated files have a path like: virtualcsharp-razor:///e:/Scratch/RazorInConsole/Goo.cshtml__virtual.cs - if (path.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && - (path.EndsWith(generatedRazorExtension, s_stringComparison) || path.EndsWith(generatedCshtmlExtension, s_stringComparison))) + if (path.StartsWith(prefix.AsSpan(), StringComparison.OrdinalIgnoreCase) && + (path.EndsWith(generatedRazorExtension.AsSpan(), s_stringComparison) || path.EndsWith(generatedCshtmlExtension.AsSpan(), s_stringComparison))) { // Go through the file path normalizer because it also does Uri decoding, and we're converting from a Uri to a path // but "new Uri(filePath).LocalPath" seems wasteful diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocLanguageServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocLanguageServices.cs similarity index 90% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocLanguageServices.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocLanguageServices.cs index 1aea1e54e3f..f3976c29ed0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocLanguageServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocLanguageServices.cs @@ -4,9 +4,8 @@ using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Common; +namespace Microsoft.CodeAnalysis.Razor.Workspaces; internal sealed class AdhocLanguageServices( AdhocWorkspaceServices workspaceServices, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocServices.cs similarity index 96% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocServices.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocServices.cs index 45364d4990c..7445136553a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocServices.cs @@ -4,10 +4,10 @@ using System; using System.Collections.Immutable; using System.Reflection; -using Microsoft.CodeAnalysis; +using Microsoft.AspNetCore.Razor; using Microsoft.CodeAnalysis.Host; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Common; +namespace Microsoft.CodeAnalysis.Razor.Workspaces; internal sealed class AdhocServices : HostServices { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocWorkspaceServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocWorkspaceServices.cs similarity index 95% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocWorkspaceServices.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocWorkspaceServices.cs index 629f30c4852..1bc19ebb363 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Common/AdhocWorkspaceServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AdhocWorkspaceServices.cs @@ -4,11 +4,9 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Common; +namespace Microsoft.CodeAnalysis.Razor.Workspaces; internal sealed class AdhocWorkspaceServices : HostWorkspaceServices { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs similarity index 74% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs index e216c899d0d..e5e9febc604 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs @@ -7,13 +7,13 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; -internal sealed class AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor) : IOnAutoInsertProvider +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal class AutoClosingTagOnAutoInsertProvider : IOnAutoInsertProvider { // From http://dev.w3.org/html5/spec/Overview.html#elements-0 private static readonly ImmutableHashSet s_voidElements = ImmutableHashSet.Create(StringComparer.OrdinalIgnoreCase, @@ -38,55 +38,58 @@ internal sealed class AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor private static readonly ImmutableHashSet s_voidElementsCaseSensitive = s_voidElements.WithComparer(StringComparer.Ordinal); - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - public string TriggerCharacter => ">"; - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) { - if (!_optionsMonitor.CurrentValue.AutoClosingTags) - { - format = default; - edit = default; - return false; - } + autoInsertEdit = null; - if (!context.SourceText.TryGetAbsoluteIndex(position, out var afterCloseAngleIndex)) + if (!(enableAutoClosingTags + && codeDocument.Source.Text is { } sourceText + && sourceText.TryGetAbsoluteIndex(position, out var afterCloseAngleIndex) + && TryResolveAutoClosingBehavior(codeDocument, afterCloseAngleIndex) is { } tagNameWithClosingBehavior)) { - format = default; - edit = default; return false; } - if (!TryResolveAutoClosingBehavior(context, afterCloseAngleIndex, out var tagName, out var autoClosingBehavior)) + if (tagNameWithClosingBehavior.AutoClosingBehavior == AutoClosingBehavior.EndTag) { - format = default; - edit = default; - return false; - } + var formatForEndTag = InsertTextFormat.Snippet; + var editForEndTag = VsLspFactory.CreateTextEdit(position, $"$0"); - if (autoClosingBehavior == AutoClosingBehavior.EndTag) - { - format = InsertTextFormat.Snippet; - edit = VsLspFactory.CreateTextEdit(position, $"$0"); + autoInsertEdit = new() + { + TextEdit = editForEndTag, + TextEditFormat = formatForEndTag + }; return true; } - Debug.Assert(autoClosingBehavior == AutoClosingBehavior.SelfClosing); + Debug.Assert(tagNameWithClosingBehavior.AutoClosingBehavior == AutoClosingBehavior.SelfClosing); - format = InsertTextFormat.Plaintext; + var format = InsertTextFormat.Plaintext; // Need to replace the `>` with ' />$0' or '/>$0' depending on if there's prefixed whitespace. - var insertionText = char.IsWhiteSpace(context.SourceText[afterCloseAngleIndex - 2]) ? "/" : " /"; - edit = VsLspFactory.CreateTextEdit(position.Line, position.Character - 1, insertionText); + var insertionText = char.IsWhiteSpace(sourceText[afterCloseAngleIndex - 2]) ? "/" : " /"; + var edit = VsLspFactory.CreateTextEdit(position.Line, position.Character - 1, insertionText); + + autoInsertEdit = new() + { + TextEdit = edit, + TextEditFormat = format + }; return true; } - private static bool TryResolveAutoClosingBehavior(FormattingContext context, int afterCloseAngleIndex, [NotNullWhen(true)] out string? name, out AutoClosingBehavior autoClosingBehavior) + private static TagNameWithClosingBehavior? TryResolveAutoClosingBehavior(RazorCodeDocument codeDocument, int afterCloseAngleIndex) { - var syntaxTree = context.CodeDocument.GetSyntaxTree(); + var syntaxTree = codeDocument.GetSyntaxTree(); var closeAngle = syntaxTree.Root.FindToken(afterCloseAngleIndex - 1); if (closeAngle.Parent is MarkupStartTagSyntax @@ -96,19 +99,17 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int } startTag) { var unescapedTagName = startTag.Name.Content; - autoClosingBehavior = InferAutoClosingBehavior(unescapedTagName, caseSensitive: false); + var autoClosingBehavior = InferAutoClosingBehavior(unescapedTagName, caseSensitive: false); if (autoClosingBehavior == AutoClosingBehavior.EndTag && !CouldAutoCloseParentOrSelf(unescapedTagName, htmlElement)) { // Auto-closing behavior is end-tag; however, we already have and end-tag therefore we don't need to do anything! - autoClosingBehavior = default; - name = null; - return false; + return default; } // Finally capture the entire tag name with the potential escape operator. - name = startTag.GetTagNameWithOptionalBang(); - return true; + var name = startTag.GetTagNameWithOptionalBang(); + return new TagNameWithClosingBehavior(name, autoClosingBehavior); } if (closeAngle.Parent is MarkupTagHelperStartTagSyntax @@ -117,9 +118,9 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int Parent: MarkupTagHelperElementSyntax { TagHelperInfo.BindingResult: var binding } tagHelperElement } startTagHelper) { - name = startTagHelper.Name.Content; + var name = startTagHelper.Name.Content; - if (!TryGetTagHelperAutoClosingBehavior(binding, out autoClosingBehavior)) + if (!TryGetTagHelperAutoClosingBehavior(binding, out var autoClosingBehavior)) { autoClosingBehavior = InferAutoClosingBehavior(name, caseSensitive: true); } @@ -127,17 +128,13 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int if (autoClosingBehavior == AutoClosingBehavior.EndTag && !CouldAutoCloseParentOrSelf(name, tagHelperElement)) { // Auto-closing behavior is end-tag; however, we already have and end-tag therefore we don't need to do anything! - autoClosingBehavior = default; - name = null; - return false; + return default; } - return true; + return new TagNameWithClosingBehavior(name, autoClosingBehavior); } - autoClosingBehavior = default; - name = null; - return false; + return default; } private static AutoClosingBehavior InferAutoClosingBehavior(string name, bool caseSensitive) @@ -193,7 +190,7 @@ private static bool TryGetTagHelperAutoClosingBehavior(TagHelperBinding bindingR return false; } - private static bool CouldAutoCloseParentOrSelf(string currentTagName, SyntaxNode node) + private static bool CouldAutoCloseParentOrSelf(string currentTagName, RazorSyntaxNode node) { do { @@ -255,4 +252,6 @@ private enum AutoClosingBehavior EndTag, SelfClosing, } + + private readonly record struct TagNameWithClosingBehavior(string TagName, AutoClosingBehavior AutoClosingBehavior); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs new file mode 100644 index 00000000000..d6b6e3e3a47 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Frozen; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal class AutoInsertService(IEnumerable onAutoInsertProviders) : IAutoInsertService +{ + private readonly ImmutableArray _onAutoInsertProviders = onAutoInsertProviders.ToImmutableArray(); + + public static FrozenSet HtmlAllowedAutoInsertTriggerCharacters { get; } + = new string[] { "=" }.ToFrozenSet(StringComparer.Ordinal); + public static FrozenSet CSharpAllowedAutoInsertTriggerCharacters { get; } + = new string[] { "'", "/", "\n" }.ToFrozenSet(StringComparer.Ordinal); + + private readonly ImmutableArray _triggerCharacters = CalculateTriggerCharacters(onAutoInsertProviders); + + private static ImmutableArray CalculateTriggerCharacters(IEnumerable onAutoInsertProviders) + { + using var builder = new PooledArrayBuilder(); + using var _ = StringHashSetPool.Ordinal.GetPooledObject(out var set); + foreach (var provider in onAutoInsertProviders) + { + var triggerCharacter = provider.TriggerCharacter; + if (set.Add(triggerCharacter)) + { + builder.Add(triggerCharacter); + } + } + + return builder.DrainToImmutable(); + } + + public ImmutableArray TriggerCharacters => _triggerCharacters; + + public bool TryResolveInsertion( + RazorCodeDocument codeDocument, + Position position, + string character, + bool autoCloseTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? insertTextEdit) + { + using var applicableProviders = new PooledArrayBuilder(capacity: _onAutoInsertProviders.Length); + foreach (var provider in _onAutoInsertProviders) + { + if (provider.TriggerCharacter == character) + { + applicableProviders.Add(provider); + } + } + + if (applicableProviders.Count == 0) + { + // There's currently a bug in the LSP platform where other language clients OnAutoInsert trigger characters influence every language clients trigger characters. + // To combat this we need to preemptively return so we don't try having our providers handle characters that they can't. + insertTextEdit = null; + return false; + } + + foreach (var provider in applicableProviders) + { + if (provider.TryResolveInsertion(position, codeDocument, autoCloseTags, out insertTextEdit)) + { + return true; + } + } + + // No provider could handle the text edit. + insertTextEdit = null; + return false; + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs similarity index 50% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs index 8ce976721ee..b2a791b6881 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs @@ -7,47 +7,45 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; -internal sealed class CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor) : IOnAutoInsertProvider +internal class CloseTextTagOnAutoInsertProvider : IOnAutoInsertProvider { - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - public string TriggerCharacter => ">"; - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) { - if (!_optionsMonitor.CurrentValue.AutoClosingTags) + if (!(enableAutoClosingTags && IsAtTextTag(codeDocument, position))) { - // We currently only support auto-closing tags our onType formatter. - format = default; - edit = default; - return false; - } - - if (!IsAtTextTag(context, position)) - { - format = default; - edit = default; + autoInsertEdit = null; return false; } // This is a text tag. - format = InsertTextFormat.Snippet; - edit = VsLspFactory.CreateTextEdit(position, $"$0"); + var format = InsertTextFormat.Snippet; + var edit = VsLspFactory.CreateTextEdit(position, $"$0"); + + autoInsertEdit = new() + { + TextEdit = edit, + TextEditFormat = format + }; return true; } - private static bool IsAtTextTag(FormattingContext context, Position position) + private static bool IsAtTextTag(RazorCodeDocument codeDocument, Position position) { - var syntaxTree = context.CodeDocument.GetSyntaxTree(); + var syntaxTree = codeDocument.GetSyntaxTree(); - if (!context.SourceText.TryGetAbsoluteIndex(position, out var absoluteIndex)) + if (!(codeDocument.Source.Text is { } sourceText + && sourceText.TryGetAbsoluteIndex(position, out var absoluteIndex))) { return false; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs new file mode 100644 index 00000000000..8bad0493d0f --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IAutoInsertService +{ + ImmutableArray TriggerCharacters { get; } + + bool TryResolveInsertion( + RazorCodeDocument codeDocument, + Position position, + string character, + bool autoCloseTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? insertTextEdit); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs new file mode 100644 index 00000000000..ba6458712a0 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IOnAutoInsertProvider : IOnAutoInsertTriggerCharacterProvider +{ + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs new file mode 100644 index 00000000000..cfc1ffbed5e --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs @@ -0,0 +1,9 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IOnAutoInsertTriggerCharacterProvider +{ + string TriggerCharacter { get; } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CSSErrorCodes.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/CSSErrorCodes.cs similarity index 89% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CSSErrorCodes.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/CSSErrorCodes.cs index bafb8675ab1..658f918272f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CSSErrorCodes.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/CSSErrorCodes.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.LanguageServer; +namespace Microsoft.CodeAnalysis.Razor.Diagnostics; // Note: This type should be kept in sync with WTE's ErrorCodes.cs internal static class CSSErrorCodes diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/HTMLErrorCodes.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/HTMLErrorCodes.cs similarity index 97% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/HTMLErrorCodes.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/HTMLErrorCodes.cs index 015feacef97..dc0042a9dd7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/HTMLErrorCodes.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/HTMLErrorCodes.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.LanguageServer; +namespace Microsoft.CodeAnalysis.Razor.Diagnostics; // Note: This type should be kept in sync with WTE's ErrorCodes.cs internal static class HtmlErrorCodes diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticConverter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorDiagnosticConverter.cs similarity index 71% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticConverter.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorDiagnosticConverter.cs index 1ee9556ff92..bbbacbee1d5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticConverter.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorDiagnosticConverter.cs @@ -2,15 +2,17 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; +using System.Collections.Immutable; using System.Globalization; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; +using LspDiagnostic = Microsoft.VisualStudio.LanguageServer.Protocol.Diagnostic; +using LspDiagnosticSeverity = Microsoft.VisualStudio.LanguageServer.Protocol.DiagnosticSeverity; +using LspRange = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics; +namespace Microsoft.CodeAnalysis.Razor.Diagnostics; internal static class RazorDiagnosticConverter { @@ -46,9 +48,9 @@ public static VSDiagnosticProjectInformation[] GetProjectInformation(IDocumentSn }]; } - internal static Diagnostic[] Convert(IReadOnlyList diagnostics, SourceText sourceText, IDocumentSnapshot documentSnapshot) + internal static LspDiagnostic[] Convert(ImmutableArray diagnostics, SourceText sourceText, IDocumentSnapshot documentSnapshot) { - var convertedDiagnostics = new Diagnostic[diagnostics.Count]; + var convertedDiagnostics = new LspDiagnostic[diagnostics.Length]; var i = 0; foreach (var diagnostic in diagnostics) @@ -60,18 +62,18 @@ internal static Diagnostic[] Convert(IReadOnlyList diagnostics, } // Internal for testing - internal static DiagnosticSeverity ConvertSeverity(RazorDiagnosticSeverity severity) + internal static LspDiagnosticSeverity ConvertSeverity(RazorDiagnosticSeverity severity) { return severity switch { - RazorDiagnosticSeverity.Error => DiagnosticSeverity.Error, - RazorDiagnosticSeverity.Warning => DiagnosticSeverity.Warning, - _ => DiagnosticSeverity.Information, + RazorDiagnosticSeverity.Error => LspDiagnosticSeverity.Error, + RazorDiagnosticSeverity.Warning => LspDiagnosticSeverity.Warning, + _ => LspDiagnosticSeverity.Information, }; } // Internal for testing - internal static Range? ConvertSpanToRange(SourceSpan sourceSpan, SourceText sourceText) + internal static LspRange? ConvertSpanToRange(SourceSpan sourceSpan, SourceText sourceText) { if (sourceSpan == SourceSpan.Undefined) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorTranslateDiagnosticsService.cs similarity index 87% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorTranslateDiagnosticsService.cs index 9efb5b39ee5..b662d2ca2b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorTranslateDiagnosticsService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Diagnostics/RazorTranslateDiagnosticsService.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; @@ -18,12 +17,14 @@ using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Diagnostic = Microsoft.VisualStudio.LanguageServer.Protocol.Diagnostic; -using DiagnosticSeverity = Microsoft.VisualStudio.LanguageServer.Protocol.DiagnosticSeverity; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; +using LspDiagnostic = Microsoft.VisualStudio.LanguageServer.Protocol.Diagnostic; +using LspDiagnosticSeverity = Microsoft.VisualStudio.LanguageServer.Protocol.DiagnosticSeverity; +using LspRange = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics; +namespace Microsoft.CodeAnalysis.Razor.Diagnostics; + +using RazorDiagnosticFactory = AspNetCore.Razor.Language.RazorDiagnosticFactory; +using SyntaxNode = AspNetCore.Razor.Language.Syntax.SyntaxNode; /// /// Contains several methods for mapping and filtering Razor and C# diagnostics. It allows for @@ -48,16 +49,14 @@ internal class RazorTranslateDiagnosticsService(IDocumentMappingService document /// /// The `RazorLanguageKind` of the `Diagnostic` objects included in `diagnostics`. /// An array of `Diagnostic` objects to translate. - /// The `DocumentContext` for the code document associated with the diagnostics. - /// A `CancellationToken` to observe while waiting for the task to complete. + /// The `DocumentContext` for the code document associated with the diagnostics. /// An array of translated diagnostics - internal async Task TranslateAsync( + internal async Task TranslateAsync( RazorLanguageKind diagnosticKind, - Diagnostic[] diagnostics, - DocumentContext documentContext, - CancellationToken cancellationToken) + LspDiagnostic[] diagnostics, + IDocumentSnapshot documentSnapshot) { - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); if (codeDocument.IsUnsupported() != false) { _logger.LogInformation($"Unsupported code document."); @@ -78,20 +77,20 @@ internal async Task TranslateAsync( var mappedDiagnostics = MapDiagnostics( diagnosticKind, filteredDiagnostics, - documentContext.Snapshot, + documentSnapshot, codeDocument); return mappedDiagnostics; } - private Diagnostic[] FilterCSharpDiagnostics(Diagnostic[] unmappedDiagnostics, RazorCodeDocument codeDocument) + private LspDiagnostic[] FilterCSharpDiagnostics(LspDiagnostic[] unmappedDiagnostics, RazorCodeDocument codeDocument) { return unmappedDiagnostics.Where(d => !ShouldFilterCSharpDiagnosticBasedOnErrorCode(d, codeDocument)).ToArray(); } - private static Diagnostic[] FilterHTMLDiagnostics( - Diagnostic[] unmappedDiagnostics, + private static LspDiagnostic[] FilterHTMLDiagnostics( + LspDiagnostic[] unmappedDiagnostics, RazorCodeDocument codeDocument) { var syntaxTree = codeDocument.GetSyntaxTree(); @@ -110,14 +109,14 @@ private static Diagnostic[] FilterHTMLDiagnostics( return filteredDiagnostics; } - private Diagnostic[] MapDiagnostics( + private LspDiagnostic[] MapDiagnostics( RazorLanguageKind languageKind, - Diagnostic[] diagnostics, + LspDiagnostic[] diagnostics, IDocumentSnapshot documentSnapshot, RazorCodeDocument codeDocument) { var projects = RazorDiagnosticConverter.GetProjectInformation(documentSnapshot); - using var mappedDiagnostics = new PooledArrayBuilder(); + using var mappedDiagnostics = new PooledArrayBuilder(); foreach (var diagnostic in diagnostics) { @@ -146,7 +145,7 @@ private Diagnostic[] MapDiagnostics( } private static bool InCSharpLiteral( - Diagnostic d, + LspDiagnostic d, SourceText sourceText, RazorSyntaxTree syntaxTree) { @@ -177,7 +176,7 @@ or SyntaxKind.CSharpStatementLiteral or SyntaxKind.CSharpEphemeralTextLiteral; } - private static bool AppliesToTagHelperTagName(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + private static bool AppliesToTagHelperTagName(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { // Goal of this method is to filter diagnostics that touch TagHelper tag names. Reason being is TagHelpers can output anything. Meaning // If you have a TagHelper like: @@ -214,7 +213,7 @@ private static bool AppliesToTagHelperTagName(Diagnostic diagnostic, SourceText return true; } - private static bool ShouldFilterHtmlDiagnosticBasedOnErrorCode(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + private static bool ShouldFilterHtmlDiagnosticBasedOnErrorCode(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { if (!diagnostic.Code.HasValue) { @@ -235,7 +234,7 @@ private static bool ShouldFilterHtmlDiagnosticBasedOnErrorCode(Diagnostic diagno _ => false, }; - static bool IsCSharpInStyleBlock(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsCSharpInStyleBlock(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { // C# in a style block causes diagnostics because the HTML background document replaces C# with "~" var owner = syntaxTree.FindInnermostNode(sourceText, diagnostic.Range.Start); @@ -253,7 +252,7 @@ static bool IsCSharpInStyleBlock(Diagnostic diagnostic, SourceText sourceText, R // Ideally this would be solved instead by not emitting the "!" at the HTML backing file, // but we don't currently have a system to accomplish that - static bool IsAnyFilteredTooFewElementsError(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsAnyFilteredTooFewElementsError(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { var owner = syntaxTree.FindInnermostNode(sourceText, diagnostic.Range.Start); if (owner is null) @@ -282,7 +281,7 @@ static bool IsAnyFilteredTooFewElementsError(Diagnostic diagnostic, SourceText s // Ideally this would be solved instead by not emitting the "!" at the HTML backing file, // but we don't currently have a system to accomplish that - static bool IsHtmlWithBangAndMatchingTags(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsHtmlWithBangAndMatchingTags(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { var owner = syntaxTree.FindInnermostNode(sourceText, diagnostic.Range.Start); if (owner is null) @@ -306,11 +305,11 @@ static bool IsHtmlWithBangAndMatchingTags(Diagnostic diagnostic, SourceText sour return haveBang && namesEquivalent; } - static bool IsAnyFilteredInvalidNestingError(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsAnyFilteredInvalidNestingError(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) => IsInvalidNestingWarningWithinComponent(diagnostic, sourceText, syntaxTree) || IsInvalidNestingFromBody(diagnostic, sourceText, syntaxTree); - static bool IsInvalidNestingWarningWithinComponent(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsInvalidNestingWarningWithinComponent(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { var owner = syntaxTree.FindInnermostNode(sourceText, diagnostic.Range.Start); if (owner is null) @@ -325,7 +324,7 @@ static bool IsInvalidNestingWarningWithinComponent(Diagnostic diagnostic, Source // Ideally this would be solved instead by not emitting the "!" at the HTML backing file, // but we don't currently have a system to accomplish that - static bool IsInvalidNestingFromBody(Diagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) + static bool IsInvalidNestingFromBody(LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree) { var owner = syntaxTree.FindInnermostNode(sourceText, diagnostic.Range.Start); if (owner is null) @@ -350,7 +349,7 @@ static bool IsInvalidNestingFromBody(Diagnostic diagnostic, SourceText sourceTex } private static bool InAttributeContainingCSharp( - Diagnostic diagnostic, + LspDiagnostic diagnostic, SourceText sourceText, RazorSyntaxTree syntaxTree, Dictionary processedAttributes) @@ -400,7 +399,7 @@ n is GenericBlockSyntax || } } - private bool ShouldFilterCSharpDiagnosticBasedOnErrorCode(Diagnostic diagnostic, RazorCodeDocument codeDocument) + private bool ShouldFilterCSharpDiagnosticBasedOnErrorCode(LspDiagnostic diagnostic, RazorCodeDocument codeDocument) { if (diagnostic.Code is not { } code || !code.TryGetSecond(out var str) || @@ -413,10 +412,10 @@ private bool ShouldFilterCSharpDiagnosticBasedOnErrorCode(Diagnostic diagnostic, { "CS1525" => ShouldIgnoreCS1525(diagnostic, codeDocument), _ => s_cSharpDiagnosticsToIgnore.Contains(str) && - diagnostic.Severity != DiagnosticSeverity.Error + diagnostic.Severity != LspDiagnosticSeverity.Error }; - bool ShouldIgnoreCS1525(Diagnostic diagnostic, RazorCodeDocument codeDocument) + bool ShouldIgnoreCS1525(LspDiagnostic diagnostic, RazorCodeDocument codeDocument) { if (CheckIfDocumentHasRazorDiagnostic(codeDocument, RazorDiagnosticFactory.TagHelper_EmptyBoundAttribute.Id) && TryGetOriginalDiagnosticRange(diagnostic, codeDocument, out var originalRange) && @@ -437,10 +436,10 @@ bool ShouldIgnoreCS1525(Diagnostic diagnostic, RazorCodeDocument codeDocument) private static bool CheckIfDocumentHasRazorDiagnostic(RazorCodeDocument codeDocument, string razorDiagnosticCode) { - return codeDocument.GetSyntaxTree().Diagnostics.Any(d => d.Id.Equals(razorDiagnosticCode, StringComparison.Ordinal)); + return codeDocument.GetSyntaxTree().Diagnostics.Any(razorDiagnosticCode, static (d, code) => d.Id == code); } - private bool TryGetOriginalDiagnosticRange(Diagnostic diagnostic, RazorCodeDocument codeDocument, [NotNullWhen(true)] out Range? originalRange) + private bool TryGetOriginalDiagnosticRange(LspDiagnostic diagnostic, RazorCodeDocument codeDocument, [NotNullWhen(true)] out LspRange? originalRange) { if (IsRudeEditDiagnostic(diagnostic)) { @@ -460,7 +459,7 @@ private bool TryGetOriginalDiagnosticRange(Diagnostic diagnostic, RazorCodeDocum { // Couldn't remap the range correctly. // If this isn't an `Error` Severity Diagnostic we can discard it. - if (diagnostic.Severity != DiagnosticSeverity.Error) + if (diagnostic.Severity != LspDiagnosticSeverity.Error) { return false; } @@ -474,14 +473,14 @@ private bool TryGetOriginalDiagnosticRange(Diagnostic diagnostic, RazorCodeDocum return true; } - private static bool IsRudeEditDiagnostic(Diagnostic diagnostic) + private static bool IsRudeEditDiagnostic(LspDiagnostic diagnostic) { return diagnostic.Code.HasValue && diagnostic.Code.Value.TryGetSecond(out var str) && str.StartsWith("ENC"); } - private bool TryRemapRudeEditRange(Range diagnosticRange, RazorCodeDocument codeDocument, [NotNullWhen(true)] out Range? remappedRange) + private bool TryRemapRudeEditRange(LspRange diagnosticRange, RazorCodeDocument codeDocument, [NotNullWhen(true)] out LspRange? remappedRange) { // This is a rude edit diagnostic that has already been mapped to the Razor document. The mapping isn't absolutely correct though, // it's based on the runtime code generation of the Razor document therefore we need to re-map the already mapped diagnostic in a diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractDocumentMappingService.cs index 60949687b5e..24a3e906c93 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractDocumentMappingService.cs @@ -8,11 +8,9 @@ using System.Linq; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -24,7 +22,7 @@ internal abstract class AbstractDocumentMappingService(IFilePathService filePath protected readonly IFilePathService FilePathService = filePathService; protected readonly ILogger Logger = logger; - public IEnumerable GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, IEnumerable generatedDocumentChanges) + public IEnumerable GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, ImmutableArray generatedDocumentChanges) { var generatedDocumentSourceText = generatedDocument.GetGeneratedSourceText(); var lastNewLineAddedToLine = 0; @@ -341,114 +339,6 @@ static LinePosition GetGeneratedPosition(IRazorGeneratedDocument generatedDocume } } - public RazorLanguageKind GetLanguageKind(RazorCodeDocument codeDocument, int hostDocumentIndex, bool rightAssociative) - { - var classifiedSpans = GetClassifiedSpans(codeDocument); - var tagHelperSpans = GetTagHelperSpans(codeDocument); - var documentLength = codeDocument.Source.Text.Length; - var languageKind = GetLanguageKindCore(classifiedSpans, tagHelperSpans, hostDocumentIndex, documentLength, rightAssociative); - - return languageKind; - } - - // Internal for testing - internal static RazorLanguageKind GetLanguageKindCore( - ImmutableArray classifiedSpans, - ImmutableArray tagHelperSpans, - int hostDocumentIndex, - int hostDocumentLength, - bool rightAssociative) - { - var length = classifiedSpans.Length; - for (var i = 0; i < length; i++) - { - var classifiedSpan = classifiedSpans[i]; - var span = classifiedSpan.Span; - - if (span.AbsoluteIndex <= hostDocumentIndex) - { - var end = span.AbsoluteIndex + span.Length; - if (end >= hostDocumentIndex) - { - if (end == hostDocumentIndex) - { - // We're at an edge. - - if (classifiedSpan.SpanKind is SpanKindInternal.MetaCode or SpanKindInternal.Transition) - { - // If we're on an edge of a transition of some kind (MetaCode representing an open or closing piece of syntax such as <|, - // and Transition representing an explicit transition to/from razor syntax, such as @|), prefer to classify to the span - // to the right to better represent where the user clicks - continue; - } - - // If we're right associative, then we don't want to use the classification that we're at the end - // of, if we're also at the start of the next one - if (rightAssociative) - { - if (i < classifiedSpans.Length - 1 && classifiedSpans[i + 1].Span.AbsoluteIndex == hostDocumentIndex) - { - // If we're at the start of the next span, then use that span - return GetLanguageFromClassifiedSpan(classifiedSpans[i + 1]); - } - - // Otherwise, we did not find a match using right associativity, so check for tag helpers - break; - } - } - - return GetLanguageFromClassifiedSpan(classifiedSpan); - } - } - } - - foreach (var tagHelperSpan in tagHelperSpans) - { - var span = tagHelperSpan.Span; - - if (span.AbsoluteIndex <= hostDocumentIndex) - { - var end = span.AbsoluteIndex + span.Length; - if (end >= hostDocumentIndex) - { - if (end == hostDocumentIndex) - { - // We're at an edge. TagHelper spans never own their edge and aren't represented by marker spans - continue; - } - - // Found intersection - return RazorLanguageKind.Html; - } - } - } - - // Use the language of the last classified span if we're at the end - // of the document. - if (classifiedSpans.Length != 0 && hostDocumentIndex == hostDocumentLength) - { - var lastClassifiedSpan = classifiedSpans.Last(); - return GetLanguageFromClassifiedSpan(lastClassifiedSpan); - } - - // Default to Razor - return RazorLanguageKind.Razor; - - static RazorLanguageKind GetLanguageFromClassifiedSpan(ClassifiedSpanInternal classifiedSpan) - { - // Overlaps with request - return classifiedSpan.SpanKind switch - { - SpanKindInternal.Markup => RazorLanguageKind.Html, - SpanKindInternal.Code => RazorLanguageKind.CSharp, - - // Content type was non-C# or Html or we couldn't find a classified span overlapping the request position. - // All other classified span kinds default back to Razor - _ => RazorLanguageKind.Razor, - }; - } - } - private bool TryMapToHostDocumentRangeStrict(IRazorGeneratedDocument generatedDocument, LinePositionSpan generatedDocumentRange, out LinePositionSpan hostDocumentRange) { hostDocumentRange = default; @@ -666,36 +556,4 @@ static bool IsPositionWithinDocument(LinePosition linePosition, SourceText sourc return sourceText.TryGetAbsoluteIndex(linePosition, out _); } } - - private static ImmutableArray GetClassifiedSpans(RazorCodeDocument document) - { - // Since this service is called so often, we get a good performance improvement by caching these values - // for this code document. If the document changes, as the user types, then the document instance will be - // different, so we don't need to worry about invalidating the cache. - if (!document.Items.TryGetValue(typeof(ClassifiedSpanInternal), out ImmutableArray classifiedSpans)) - { - var syntaxTree = document.GetSyntaxTree(); - classifiedSpans = ClassifiedSpanVisitor.VisitRoot(syntaxTree); - - document.Items[typeof(ClassifiedSpanInternal)] = classifiedSpans; - } - - return classifiedSpans; - } - - private static ImmutableArray GetTagHelperSpans(RazorCodeDocument document) - { - // Since this service is called so often, we get a good performance improvement by caching these values - // for this code document. If the document changes, as the user types, then the document instance will be - // different, so we don't need to worry about invalidating the cache. - if (!document.Items.TryGetValue(typeof(TagHelperSpanInternal), out ImmutableArray tagHelperSpans)) - { - var syntaxTree = document.GetSyntaxTree(); - tagHelperSpans = TagHelperSpanVisitor.VisitRoot(syntaxTree); - - document.Items[typeof(TagHelperSpanInternal)] = tagHelperSpans; - } - - return tagHelperSpans; - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs index f19d04c3500..7296deae4ec 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs @@ -26,7 +26,7 @@ public async Task RemapWorkspaceEditAsync(IDocumentSnapshot conte if (workspaceEdit.TryGetTextDocumentEdits(out var documentEdits)) { // The LSP spec says, we should prefer `DocumentChanges` property over `Changes` if available. - var remappedEdits = await RemapVersionedDocumentEditsAsync(contextDocumentSnapshot, documentEdits, cancellationToken).ConfigureAwait(false); + var remappedEdits = await RemapTextDocumentEditsAsync(contextDocumentSnapshot, documentEdits, cancellationToken).ConfigureAwait(false); return new WorkspaceEdit() { @@ -62,7 +62,7 @@ private async Task> RemapDocumentEditsAsync(IDocu continue; } - if (!TryGetDocumentContext(contextDocumentSnapshot, uri, out var documentContext)) + if (!TryGetDocumentContext(contextDocumentSnapshot, uri, projectContext: null, out var documentContext)) { continue; } @@ -107,7 +107,7 @@ private TextEdit[] RemapTextEditsCore(Uri generatedDocumentUri, RazorCodeDocumen return remappedEdits.ToArray(); } - private async Task RemapVersionedDocumentEditsAsync(IDocumentSnapshot contextDocumentSnapshot, TextDocumentEdit[] documentEdits, CancellationToken cancellationToken) + private async Task RemapTextDocumentEditsAsync(IDocumentSnapshot contextDocumentSnapshot, TextDocumentEdit[] documentEdits, CancellationToken cancellationToken) { using var remappedDocumentEdits = new PooledArrayBuilder(documentEdits.Length); @@ -125,7 +125,7 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen var razorDocumentUri = _filePathService.GetRazorDocumentUri(generatedDocumentUri); - if (!TryGetVersionedDocumentContext(contextDocumentSnapshot, razorDocumentUri, entry.TextDocument.GetProjectContext(), out var documentContext)) + if (!TryGetDocumentContext(contextDocumentSnapshot, razorDocumentUri, entry.TextDocument.GetProjectContext(), out var documentContext)) { continue; } @@ -144,7 +144,6 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen TextDocument = new OptionalVersionedTextDocumentIdentifier() { Uri = razorDocumentUri, - Version = documentContext.Version }, Edits = remappedEdits }); @@ -153,7 +152,5 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen return remappedDocumentEdits.ToArray(); } - protected abstract bool TryGetVersionedDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out VersionedDocumentContext? documentContext); - - protected abstract bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, [NotNullWhen(true)] out DocumentContext? documentContext); + protected abstract bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out DocumentContext? documentContext); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DefaultDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DefaultDocumentPositionInfoStrategy.cs new file mode 100644 index 00000000000..c126e2656f1 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DefaultDocumentPositionInfoStrategy.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Language; + +namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; + +internal sealed class DefaultDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy +{ + public static IDocumentPositionInfoStrategy Instance { get; } = new DefaultDocumentPositionInfoStrategy(); + + private DefaultDocumentPositionInfoStrategy() + { + } + + public DocumentPositionInfo GetPositionInfo(IDocumentMappingService mappingService, RazorCodeDocument codeDocument, int hostDocumentIndex) + => mappingService.GetPositionInfo(codeDocument, hostDocumentIndex); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DocumentPositionInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DocumentPositionInfo.cs index cfc2ad81629..bbb745aea2c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DocumentPositionInfo.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/DocumentPositionInfo.cs @@ -10,4 +10,4 @@ namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; /// Represents a position in a document. If is Razor then the position will be /// in the host document, otherwise it will be in the corresponding generated document. /// -internal record DocumentPositionInfo(RazorLanguageKind LanguageKind, Position Position, int HostDocumentIndex); +internal readonly record struct DocumentPositionInfo(RazorLanguageKind LanguageKind, Position Position, int HostDocumentIndex); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs index 486a7e28a67..108cc3fca69 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingService.cs @@ -2,15 +2,15 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; internal interface IDocumentMappingService { - IEnumerable GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, IEnumerable generatedDocumentEdits); + IEnumerable GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, ImmutableArray generatedDocumentEdits); bool TryMapToHostDocumentRange(IRazorGeneratedDocument generatedDocument, LinePositionSpan generatedDocumentRange, MappingBehavior mappingBehavior, out LinePositionSpan hostDocumentRange); @@ -21,6 +21,4 @@ internal interface IDocumentMappingService bool TryMapToGeneratedDocumentPosition(IRazorGeneratedDocument generatedDocument, int hostDocumentIndex, out LinePosition generatedPosition, out int generatedIndex); bool TryMapToGeneratedDocumentOrNextCSharpPosition(IRazorGeneratedDocument generatedDocument, int hostDocumentIndex, out LinePosition generatedPosition, out int generatedIndex); - - RazorLanguageKind GetLanguageKind(RazorCodeDocument codeDocument, int hostDocumentIndex, bool rightAssociative); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs index ce8bf2f4218..ec358cd5540 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentMappingServiceExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; @@ -22,7 +23,7 @@ public static TextEdit[] GetHostDocumentEdits(this IDocumentMappingService servi var generatedDocumentSourceText = generatedDocument.GetGeneratedSourceText(); var documentText = generatedDocument.CodeDocument.AssumeNotNull().Source.Text; - var changes = generatedDocumentEdits.Select(generatedDocumentSourceText.GetTextChange); + var changes = generatedDocumentEdits.SelectAsArray(generatedDocumentSourceText.GetTextChange); var mappedChanges = service.GetHostDocumentEdits(generatedDocument, changes); return mappedChanges.Select(documentText.GetTextEdit).ToArray(); } @@ -48,7 +49,7 @@ public static DocumentPositionInfo GetPositionInfo( var sourceText = codeDocument.Source.Text; var position = sourceText.GetPosition(hostDocumentIndex); - var languageKind = service.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); if (languageKind is not RazorLanguageKind.Razor) { var generatedDocument = languageKind is RazorLanguageKind.CSharp diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentPositionInfoStrategy.cs new file mode 100644 index 00000000000..9e257a712a8 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/IDocumentPositionInfoStrategy.cs @@ -0,0 +1,11 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Language; + +namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; + +internal interface IDocumentPositionInfoStrategy +{ + DocumentPositionInfo GetPositionInfo(IDocumentMappingService mappingService, RazorCodeDocument codeDocument, int hostDocumentIndex); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferAttributeNameDocumentPositionInfoStrategy.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferAttributeNameDocumentPositionInfoStrategy.cs new file mode 100644 index 00000000000..86c1cf5017a --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferAttributeNameDocumentPositionInfoStrategy.cs @@ -0,0 +1,33 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Language; + +namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; + +/// +/// A projection strategy that, when given a position that occurs anywhere in an attribute name, will return the projection +/// for the position at the start of the attribute name, ignoring any prefix or suffix. eg given any location within the +/// attribute "@bind-Value:after", it will return the projection at the point of the word "Value" therein. +/// +internal sealed class PreferAttributeNameDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy +{ + public static IDocumentPositionInfoStrategy Instance { get; } = new PreferAttributeNameDocumentPositionInfoStrategy(); + + private PreferAttributeNameDocumentPositionInfoStrategy() + { + } + + public DocumentPositionInfo GetPositionInfo(IDocumentMappingService mappingService, RazorCodeDocument codeDocument, int hostDocumentIndex) + { + // First, lets see if we should adjust the location to get a better result from C#. For example given + // where | is the cursor, we would be unable to map that location to C#. If we pretend the caret was 3 characters to the right though, + // in the actual component property name, then the C# server would give us a result, so we fake it. + if (RazorSyntaxFacts.TryGetAttributeNameAbsoluteIndex(codeDocument, hostDocumentIndex, out var attributeNameIndex)) + { + hostDocumentIndex = attributeNameIndex; + } + + return DefaultDocumentPositionInfoStrategy.Instance.GetPositionInfo(mappingService, codeDocument, hostDocumentIndex); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs new file mode 100644 index 00000000000..7de3f5f7612 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/PreferHtmlInAttributeValuesDocumentPositionStrategy.cs @@ -0,0 +1,54 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.DocumentMapping; + +// The main reason for this service is auto-insert of empty double quotes when a user types +// equals "=" after Blazor component attribute. We think this is Razor (correctly I guess) +// and wouldn't forward auto-insert request to HTML in this case. By essentially overriding +// language info here we allow the request to be sent over to HTML where it will insert empty +// double-quotes as it would for any other attribute value +internal sealed class PreferHtmlInAttributeValuesDocumentPositionInfoStrategy : IDocumentPositionInfoStrategy +{ + public static IDocumentPositionInfoStrategy Instance { get; } = new PreferHtmlInAttributeValuesDocumentPositionInfoStrategy(); + + private PreferHtmlInAttributeValuesDocumentPositionInfoStrategy() + { + } + + public DocumentPositionInfo GetPositionInfo(IDocumentMappingService mappingService, RazorCodeDocument codeDocument, int hostDocumentIndex) + { + var positionInfo = DefaultDocumentPositionInfoStrategy.Instance.GetPositionInfo(mappingService, codeDocument, hostDocumentIndex); + + var absolutePosition = positionInfo.HostDocumentIndex; + if (positionInfo.LanguageKind != RazorLanguageKind.Razor || + absolutePosition < 1) + { + return positionInfo; + } + + // Get the node at previous position to see if we are after markup tag helper attribute, + // and more specifically after the EqualsToken of it + var previousPosition = absolutePosition - 1; + + var syntaxTree = codeDocument.GetSyntaxTree().AssumeNotNull(); + + var owner = syntaxTree.Root is RazorSyntaxNode root + ? root.FindInnermostNode(previousPosition) + : null; + + if (owner is MarkupTagHelperAttributeSyntax { EqualsToken: { IsMissing: false } equalsToken } && + equalsToken.EndPosition == positionInfo.HostDocumentIndex) + { + return positionInfo with { LanguageKind = RazorLanguageKind.Html }; + } + + return positionInfo; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs index 3cd11ef1405..4ae8ede32f2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs @@ -28,4 +28,22 @@ public static bool OverlapsWith(this LinePositionSpan span, LinePositionSpan oth // Empty ranges do not overlap with any range. return overlapStart.CompareTo(overlapEnd) < 0; } + + public static bool LineOverlapsWith(this LinePositionSpan span, LinePositionSpan other) + { + var overlapStart = span.Start.Line < other.Start.Line + ? other.Start.Line + : span.Start.Line; + + var overlapEnd = span.End.Line > other.End.Line + ? other.End.Line + : span.End.Line; + + return overlapStart <= overlapEnd; + } + + public static bool Contains(this LinePositionSpan span, LinePositionSpan other) + { + return span.Start <= other.Start && span.End >= other.End; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs index 8341fe945df..af23b206d4e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorCodeDocumentExtensions.cs @@ -2,10 +2,12 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Intermediate; +using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -139,4 +141,142 @@ public static bool ComponentNamespaceMatches(this RazorCodeDocument razorCodeDoc return namespaceNode.Content == fullyQualifiedNamespace; } + + public static RazorLanguageKind GetLanguageKind(this RazorCodeDocument codeDocument, int hostDocumentIndex, bool rightAssociative) + { + var classifiedSpans = GetClassifiedSpans(codeDocument); + var tagHelperSpans = GetTagHelperSpans(codeDocument); + var documentLength = codeDocument.Source.Text.Length; + + return GetLanguageKindCore(classifiedSpans, tagHelperSpans, hostDocumentIndex, documentLength, rightAssociative); + } + + private static ImmutableArray GetClassifiedSpans(RazorCodeDocument document) + { + // Since this service is called so often, we get a good performance improvement by caching these values + // for this code document. If the document changes, as the user types, then the document instance will be + // different, so we don't need to worry about invalidating the cache. + if (!document.Items.TryGetValue(typeof(ClassifiedSpanInternal), out ImmutableArray classifiedSpans)) + { + var syntaxTree = document.GetSyntaxTree(); + classifiedSpans = syntaxTree.GetClassifiedSpans(); + + document.Items[typeof(ClassifiedSpanInternal)] = classifiedSpans; + } + + return classifiedSpans; + } + + private static ImmutableArray GetTagHelperSpans(RazorCodeDocument document) + { + // Since this service is called so often, we get a good performance improvement by caching these values + // for this code document. If the document changes, as the user types, then the document instance will be + // different, so we don't need to worry about invalidating the cache. + if (!document.Items.TryGetValue(typeof(TagHelperSpanInternal), out ImmutableArray tagHelperSpans)) + { + var syntaxTree = document.GetSyntaxTree(); + tagHelperSpans = syntaxTree.GetTagHelperSpans(); + + document.Items[typeof(TagHelperSpanInternal)] = tagHelperSpans; + } + + return tagHelperSpans; + } + + private static RazorLanguageKind GetLanguageKindCore( + ImmutableArray classifiedSpans, + ImmutableArray tagHelperSpans, + int hostDocumentIndex, + int hostDocumentLength, + bool rightAssociative) + { + var length = classifiedSpans.Length; + for (var i = 0; i < length; i++) + { + var classifiedSpan = classifiedSpans[i]; + var span = classifiedSpan.Span; + + if (span.AbsoluteIndex <= hostDocumentIndex) + { + var end = span.AbsoluteIndex + span.Length; + if (end >= hostDocumentIndex) + { + if (end == hostDocumentIndex) + { + // We're at an edge. + + if (classifiedSpan.SpanKind is SpanKindInternal.MetaCode or SpanKindInternal.Transition) + { + // If we're on an edge of a transition of some kind (MetaCode representing an open or closing piece of syntax such as <|, + // and Transition representing an explicit transition to/from razor syntax, such as @|), prefer to classify to the span + // to the right to better represent where the user clicks + continue; + } + + // If we're right associative, then we don't want to use the classification that we're at the end + // of, if we're also at the start of the next one + if (rightAssociative) + { + if (i < classifiedSpans.Length - 1 && classifiedSpans[i + 1].Span.AbsoluteIndex == hostDocumentIndex) + { + // If we're at the start of the next span, then use that span + return GetLanguageFromClassifiedSpan(classifiedSpans[i + 1]); + } + + // Otherwise, we did not find a match using right associativity, so check for tag helpers + break; + } + } + + return GetLanguageFromClassifiedSpan(classifiedSpan); + } + } + } + + foreach (var tagHelperSpan in tagHelperSpans) + { + var span = tagHelperSpan.Span; + + if (span.AbsoluteIndex <= hostDocumentIndex) + { + var end = span.AbsoluteIndex + span.Length; + if (end >= hostDocumentIndex) + { + if (end == hostDocumentIndex) + { + // We're at an edge. TagHelper spans never own their edge and aren't represented by marker spans + continue; + } + + // Found intersection + return RazorLanguageKind.Html; + } + } + } + + // Use the language of the last classified span if we're at the end + // of the document. + if (classifiedSpans.Length != 0 && hostDocumentIndex == hostDocumentLength) + { + var lastClassifiedSpan = classifiedSpans.Last(); + return GetLanguageFromClassifiedSpan(lastClassifiedSpan); + } + + // Default to Razor + return RazorLanguageKind.Razor; + + static RazorLanguageKind GetLanguageFromClassifiedSpan(ClassifiedSpanInternal classifiedSpan) + { + // Overlaps with request + return classifiedSpan.SpanKind switch + { + SpanKindInternal.Markup => RazorLanguageKind.Html, + SpanKindInternal.Code => RazorLanguageKind.CSharp, + + // Content type was non-C# or Html or we couldn't find a classified span overlapping the request position. + // All other classified span kinds default back to Razor + _ => RazorLanguageKind.Razor, + }; + } + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs index e3232c19d44..3fc596cab98 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs @@ -6,6 +6,7 @@ using System.Linq; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.Language.Syntax; @@ -308,4 +309,75 @@ static bool IsCSharpCodeBlockSyntax(SyntaxNode node) return node is CSharpCodeBlockSyntax; } } + + public static bool IsAnyAttributeSyntax(this SyntaxNode node) + { + return node is + MarkupAttributeBlockSyntax or + MarkupMinimizedAttributeBlockSyntax or + MarkupTagHelperAttributeSyntax or + MarkupMinimizedTagHelperAttributeSyntax or + MarkupTagHelperDirectiveAttributeSyntax or + MarkupMinimizedTagHelperDirectiveAttributeSyntax or + MarkupMiscAttributeContentSyntax; + } + + public static bool TryGetLinePositionSpanWithoutWhitespace(this SyntaxNode node, RazorSourceDocument source, out LinePositionSpan linePositionSpan) + { + var tokens = node.GetTokens(); + + SyntaxToken? firstToken = null; + foreach (var token in tokens) + { + if (!token.IsWhitespace()) + { + firstToken = token; + break; + } + } + + SyntaxToken? lastToken = null; + for (var i = tokens.Count - 1; i >= 0; i--) + { + var token = tokens[i]; + if (!token.IsWhitespace()) + { + lastToken = token; + break; + } + } + + // These two are either both null or neither null, but the || means the compiler doesn't give us nullability warnings + if (firstToken is null || lastToken is null) + { + linePositionSpan = default; + return false; + } + + var startPositionSpan = GetLinePositionSpan(firstToken, source, node.SpanStart); + var endPositionSpan = GetLinePositionSpan(lastToken, source, node.SpanStart); + + linePositionSpan = new LinePositionSpan(startPositionSpan.Start, endPositionSpan.End); + return true; + + // This is needed because SyntaxToken positions taken from GetTokens + // are relative to their parent node and not to the document. + static LinePositionSpan GetLinePositionSpan(SyntaxNode node, RazorSourceDocument source, int parentStart) + { + var sourceText = source.Text; + + var start = node.Position + parentStart; + var end = node.EndPosition + parentStart; + + if (start == sourceText.Length && node.FullWidth == 0) + { + // Marker symbol at the end of the document. + var location = node.GetSourceLocation(source); + var position = location.ToLinePosition(); + return new LinePositionSpan(position, position); + } + + return sourceText.GetLinePositionSpan(start, end); + } + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_Location.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_Location.cs new file mode 100644 index 00000000000..d79991b8e22 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_Location.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Roslyn.LanguageServer.Protocol; + +internal static partial class RoslynLspExtensions +{ + public static void Deconstruct(this Location position, out Uri uri, out Range range) + => (uri, range) = (position.Uri, position.Range); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_SourceText.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_SourceText.cs index fbeb95c1b9f..2a7b95f56e3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_SourceText.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspExtensions_SourceText.cs @@ -1,16 +1,27 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor; using Microsoft.CodeAnalysis.Text; namespace Roslyn.LanguageServer.Protocol; internal static partial class RoslynLspExtensions { + public static int GetPosition(this SourceText text, Position position) + => text.GetPosition(position.ToLinePosition()); + + public static Position GetPosition(this SourceText text, int position) + => text.GetLinePosition(position).ToPosition(); + public static Range GetRange(this SourceText text, TextSpan span) => text.GetLinePositionSpan(span).ToRange(); + public static bool TryGetAbsoluteIndex(this SourceText text, Position position, out int absoluteIndex) + => text.TryGetAbsoluteIndex(position.Line, position.Character, out absoluteIndex); + + public static int GetRequiredAbsoluteIndex(this SourceText text, Position position) + => text.GetRequiredAbsoluteIndex(position.Line, position.Character); + public static TextSpan GetTextSpan(this SourceText text, Range range) => text.GetTextSpan(range.Start.Line, range.Start.Character, range.End.Line, range.End.Character); @@ -18,6 +29,5 @@ public static TextChange GetTextChange(this SourceText text, TextEdit edit) => new(text.GetTextSpan(edit.Range), edit.NewText); public static TextEdit GetTextEdit(this SourceText text, TextChange change) - => RoslynLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText.AssumeNotNull()); - + => RoslynLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText ?? ""); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspFactory.cs index 841ea8c1ed4..f26c4feb903 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RoslynLspFactory.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Diagnostics; using Microsoft.CodeAnalysis.Text; @@ -159,6 +160,18 @@ public static Range CreateSingleLineRange(LinePosition start, int length) public static Range CreateSingleLineRange((int line, int character) start, int length) => CreateRange(CreatePosition(start), CreatePosition(start.line, start.character + length)); + public static Location CreateLocation(Uri uri, Range range) + => new() { Uri = uri, Range = range }; + + public static Location CreateLocation(Uri uri, LinePositionSpan span) + => new() { Uri = uri, Range = CreateRange(span) }; + + public static DocumentLink CreateDocumentLink(Uri target, Range range) + => new() { Target = target, Range = range }; + + public static DocumentLink CreateDocumentLink(Uri target, LinePositionSpan span) + => new() { Target = target, Range = CreateRange(span) }; + public static TextEdit CreateTextEdit(Range range, string newText) => new() { Range = range, NewText = newText }; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs index 6d72290f117..58485594520 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs @@ -3,8 +3,11 @@ using System; using System.Buffers; +using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.TextDifferencing; using Microsoft.CodeAnalysis.Razor.Workspaces; namespace Microsoft.CodeAnalysis.Text; @@ -269,4 +272,67 @@ public static bool TryGetSourceLocation(this SourceText text, int line, int char location = default; return false; } + + /// + /// Applies the set of edits specified, and returns the minimal set needed to make the same changes + /// + public static ImmutableArray MinimizeTextChanges(this SourceText text, ImmutableArray changes) + => MinimizeTextChanges(text, changes, out _); + + /// + /// Applies the set of edits specified, and returns the minimal set needed to make the same changes + /// + public static ImmutableArray MinimizeTextChanges(this SourceText text, ImmutableArray changes, out SourceText originalTextWithChanges) + { + originalTextWithChanges = text.WithChanges(changes); + + if (text.ContentEquals(originalTextWithChanges)) + { + return []; + } + + return SourceTextDiffer.GetMinimalTextChanges(text, originalTextWithChanges, DiffKind.Char); + } + + /// + /// Determines if the given has more LF line endings ('\n') than CRLF line endings ('\r\n'). + /// + /// The to examine. + /// + /// true if the is deemed to use LF line endings; otherwise, false. + /// + public static bool HasLFLineEndings(this SourceText text) + { + var crlfCount = 0; + var lfCount = 0; + + foreach (var line in text.Lines) + { + var lineBreakSpan = TextSpan.FromBounds(line.End, line.EndIncludingLineBreak); + var lineBreak = line.Text?.ToString(lineBreakSpan) ?? string.Empty; + if (lineBreak == "\r\n") + { + crlfCount++; + } + else if (lineBreak == "\n") + { + lfCount++; + } + } + + return lfCount > crlfCount; + } + + public static ImmutableArray GetTextChangesArray(this SourceText newText, SourceText oldText) + { + var list = newText.GetTextChanges(oldText); + + // Fast path for the common case. The base SourceText.GetTextChanges method returns an ImmutableArray + if (list is ImmutableArray array) + { + return array; + } + + return list.ToImmutableArray(); + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Location.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Location.cs new file mode 100644 index 00000000000..e3d77984aae --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Location.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.VisualStudio.LanguageServer.Protocol; + +internal static partial class VsLspExtensions +{ + public static void Deconstruct(this Location position, out Uri uri, out Range range) + => (uri, range) = (position.Uri, position.Range); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Range.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Range.cs index ce405277933..582e9b0bea5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Range.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_Range.cs @@ -61,7 +61,6 @@ public static bool LineOverlapsWith(this Range range, Range other) public static bool Contains(this Range range, Range other) { - return range.Start.CompareTo(other.Start) <= 0 && range.End.CompareTo(other.End) >= 0; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SourceText.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SourceText.cs index 0df608360b8..1eff67c59aa 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SourceText.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SourceText.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Text; @@ -46,5 +45,5 @@ public static TextChange GetTextChange(this SourceText text, TextEdit edit) => new(text.GetTextSpan(edit.Range), edit.NewText); public static TextEdit GetTextEdit(this SourceText text, TextChange change) - => VsLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText.AssumeNotNull()); + => VsLspFactory.CreateTextEdit(text.GetRange(change.Span), change.NewText ?? ""); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SyntaxNode.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SyntaxNode.cs index 92c243bacb5..a92ee4b4831 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SyntaxNode.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspExtensions_SyntaxNode.cs @@ -1,10 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; namespace Microsoft.VisualStudio.LanguageServer.Protocol; @@ -17,64 +15,4 @@ public static Range GetRange(this SyntaxNode node, RazorSourceDocument source) return VsLspFactory.CreateRange(linePositionSpan); } - - public static Range? GetRangeWithoutWhitespace(this SyntaxNode node, RazorSourceDocument source) - { - var tokens = node.GetTokens(); - - SyntaxToken? firstToken = null; - for (var i = 0; i < tokens.Count; i++) - { - var token = tokens[i]; - if (!token.IsWhitespace()) - { - firstToken = token; - break; - } - } - - SyntaxToken? lastToken = null; - for (var i = tokens.Count - 1; i >= 0; i--) - { - var token = tokens[i]; - if (!token.IsWhitespace()) - { - lastToken = token; - break; - } - } - - if (firstToken is null && lastToken is null) - { - return null; - } - - var startPositionSpan = GetLinePositionSpan(firstToken, source, node.SpanStart); - var endPositionSpan = GetLinePositionSpan(lastToken, source, node.SpanStart); - - return VsLspFactory.CreateRange(startPositionSpan.Start, endPositionSpan.End); - - // This is needed because SyntaxToken positions taken from GetTokens - // are relative to their parent node and not to the document. - static LinePositionSpan GetLinePositionSpan(SyntaxNode? node, RazorSourceDocument source, int parentStart) - { - ArgHelper.ThrowIfNull(node); - ArgHelper.ThrowIfNull(source); - - var sourceText = source.Text; - - var start = node.Position + parentStart; - var end = node.EndPosition + parentStart; - - if (start == sourceText.Length && node.FullWidth == 0) - { - // Marker symbol at the end of the document. - var location = node.GetSourceLocation(source); - var position = location.ToLinePosition(); - return new LinePositionSpan(position, position); - } - - return sourceText.GetLinePositionSpan(start, end); - } - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspFactory.cs index 5b29d44cc60..53664af6b1f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/VsLspFactory.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Diagnostics; using Microsoft.CodeAnalysis.Text; @@ -159,6 +160,18 @@ public static Range CreateSingleLineRange(LinePosition start, int length) public static Range CreateSingleLineRange((int line, int character) start, int length) => CreateRange(CreatePosition(start), CreatePosition(start.line, start.character + length)); + public static Location CreateLocation(string filePath, LinePositionSpan span) + => CreateLocation(CreateFilePathUri(filePath), CreateRange(span)); + + public static Location CreateLocation(Uri uri, LinePositionSpan span) + => CreateLocation(uri, CreateRange(span)); + + public static Location CreateLocation(string filePath, Range range) + => CreateLocation(CreateFilePathUri(filePath), range); + + public static Location CreateLocation(Uri uri, Range range) + => new() { Uri = uri, Range = range }; + public static TextEdit CreateTextEdit(Range range, string newText) => new() { Range = range, NewText = newText }; @@ -185,4 +198,16 @@ public static TextEdit CreateTextEdit(LinePosition position, string newText) public static TextEdit CreateTextEdit((int line, int character) position, string newText) => CreateTextEdit(CreateZeroWidthRange(position), newText); + + public static Uri CreateFilePathUri(string filePath) + { + var builder = new UriBuilder + { + Path = filePath, + Scheme = Uri.UriSchemeFile, + Host = string.Empty, + }; + + return builder.Uri; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs new file mode 100644 index 00000000000..b7bc5f33fc3 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs @@ -0,0 +1,272 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.Razor.Extensions; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Components; +using Microsoft.AspNetCore.Razor.Language.Extensions; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal static class AddUsingsHelper +{ + private static readonly Regex s_addUsingVSCodeAction = new Regex("@?using ([^;]+);?$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); + + private readonly record struct RazorUsingDirective(RazorDirectiveSyntax Node, AddImportChunkGenerator Statement); + + public static async Task GetUsingStatementEditsAsync(RazorCodeDocument codeDocument, SourceText originalCSharpText, SourceText changedCSharpText, CancellationToken cancellationToken) + { + // Now that we're done with everything, lets see if there are any using statements to fix up + // We do this by comparing the original generated C# code, and the changed C# code, and look for a difference + // in using statements. We can't use edits for this for two main reasons: + // + // 1. Using statements in the generated code might come from _Imports.razor, or from this file, and C# will shove them anywhere + // 2. The edit might not be clean. eg given: + // using System; + // using System.Text; + // Adding "using System.Linq;" could result in an insert of "Linq;\r\nusing System." on line 2 + // + // So because of the above, we look for a difference in C# using directive nodes directly from the C# syntax tree, and apply them manually + // to the Razor document. + + var oldUsings = await FindUsingDirectiveStringsAsync(originalCSharpText, cancellationToken).ConfigureAwait(false); + var newUsings = await FindUsingDirectiveStringsAsync(changedCSharpText, cancellationToken).ConfigureAwait(false); + + using var edits = new PooledArrayBuilder(); + foreach (var usingStatement in newUsings.Except(oldUsings)) + { + // This identifier will be eventually thrown away. + Debug.Assert(codeDocument.Source.FilePath != null); + var identifier = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(codeDocument.Source.FilePath, UriKind.Relative) }; + var workspaceEdit = CreateAddUsingWorkspaceEdit(usingStatement, additionalEdit: null, codeDocument, codeDocumentIdentifier: identifier); + edits.AddRange(workspaceEdit.DocumentChanges!.Value.First.First().Edits); + } + + return edits.ToArray(); + } + + /// + /// Extracts the namespace from a C# add using statement provided by Visual Studio + /// + /// Add using statement of the form `using System.X;` + /// Extract namespace `System.X` + /// The prefix to show, before the namespace, if any + /// + public static bool TryExtractNamespace(string csharpAddUsing, out string @namespace, out string prefix) + { + // We must remove any leading/trailing new lines from the add using edit + csharpAddUsing = csharpAddUsing.Trim(); + var regexMatchedTextEdit = s_addUsingVSCodeAction.Match(csharpAddUsing); + if (!regexMatchedTextEdit.Success || + + // Two Regex matching groups are expected + // 1. `using namespace;` + // 2. `namespace` + regexMatchedTextEdit.Groups.Count != 2) + { + // Text edit in an unexpected format + @namespace = string.Empty; + prefix = string.Empty; + return false; + } + + @namespace = regexMatchedTextEdit.Groups[1].Value; + prefix = csharpAddUsing[..regexMatchedTextEdit.Index]; + return true; + } + + public static WorkspaceEdit CreateAddUsingWorkspaceEdit(string @namespace, TextDocumentEdit? additionalEdit, RazorCodeDocument codeDocument, OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier) + { + /* The heuristic is as follows: + * + * - If no @using, @namespace, or @page directives are present, insert the statements at the top of the + * file in alphabetical order. + * - If a @namespace or @page are present, the statements are inserted after the last line-wise in + * alphabetical order. + * - If @using directives are present and alphabetized with System directives at the top, the statements + * will be placed in the correct locations according to that ordering. + * - Otherwise it's kind of undefined; it's only geared to insert based on alphabetization. + * + * This is generally sufficient for our current situation (inserting a single @using statement to include a + * component), however it has holes if we eventually use it for other purposes. If we want to deal with + * that now I can come up with a more sophisticated heuristic (something along the lines of checking if + * there's already an ordering, etc.). + */ + using var documentChanges = new PooledArrayBuilder(); + + // Need to add the additional edit first, as the actual usings go at the top of the file, and would + // change the ranges needed in the additional edit if they went in first + if (additionalEdit is not null) + { + documentChanges.Add(additionalEdit); + } + + using var usingDirectives = new PooledArrayBuilder(); + CollectUsingDirectives(codeDocument, ref usingDirectives.AsRef()); + if (usingDirectives.Count > 0) + { + // Interpolate based on existing @using statements + var edits = GenerateSingleUsingEditsInterpolated(codeDocument, codeDocumentIdentifier, @namespace, in usingDirectives); + documentChanges.Add(edits); + } + else + { + // Just throw them at the top + var edits = GenerateSingleUsingEditsAtTop(codeDocument, codeDocumentIdentifier, @namespace); + documentChanges.Add(edits); + } + + return new WorkspaceEdit() + { + DocumentChanges = documentChanges.ToArray(), + }; + } + + private static async Task> FindUsingDirectiveStringsAsync(SourceText originalCSharpText, CancellationToken cancellationToken) + { + var syntaxTree = CSharpSyntaxTree.ParseText(originalCSharpText, cancellationToken: cancellationToken); + var syntaxRoot = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); + + // We descend any compilation unit (ie, the file) or and namespaces because the compiler puts all usings inside + // the namespace node. + var usings = syntaxRoot.DescendantNodes(n => n is BaseNamespaceDeclarationSyntax or CompilationUnitSyntax) + // Filter to using directives + .OfType() + // Select everything after the initial "using " part of the statement, and excluding the ending semi-colon. The + // semi-colon is valid in Razor, but users find it surprising. This is slightly lazy, for sure, but has + // the advantage of us not caring about changes to C# syntax, we just grab whatever Roslyn wanted to put in, so + // we should still work in C# v26 + .Select(u => u.ToString()["using ".Length..^1]); + + return usings; + } + + private static TextDocumentEdit GenerateSingleUsingEditsInterpolated( + RazorCodeDocument codeDocument, + OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, + string newUsingNamespace, + ref readonly PooledArrayBuilder existingUsingDirectives) + { + Debug.Assert(existingUsingDirectives.Count > 0); + + using var edits = new PooledArrayBuilder(); + var newText = $"@using {newUsingNamespace}{Environment.NewLine}"; + + foreach (var usingDirective in existingUsingDirectives) + { + // Skip System directives; if they're at the top we don't want to insert before them + var usingDirectiveNamespace = usingDirective.Statement.ParsedNamespace; + if (usingDirectiveNamespace.StartsWith("System", StringComparison.Ordinal)) + { + continue; + } + + if (string.CompareOrdinal(newUsingNamespace, usingDirectiveNamespace) < 0) + { + var usingDirectiveLineIndex = codeDocument.Source.Text.GetLinePosition(usingDirective.Node.Span.Start).Line; + var edit = VsLspFactory.CreateTextEdit(line: usingDirectiveLineIndex, character: 0, newText); + edits.Add(edit); + break; + } + } + + // If we haven't actually found a place to insert the using directive, do so at the end + if (edits.Count == 0) + { + var endIndex = existingUsingDirectives[^1].Node.Span.End; + var lineIndex = GetLineIndexOrEnd(codeDocument, endIndex - 1) + 1; + var edit = VsLspFactory.CreateTextEdit(line: lineIndex, character: 0, newText); + edits.Add(edit); + } + + return new TextDocumentEdit() + { + TextDocument = codeDocumentIdentifier, + Edits = edits.ToArray() + }; + } + + private static TextDocumentEdit GenerateSingleUsingEditsAtTop( + RazorCodeDocument codeDocument, + OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, + string newUsingNamespace) + { + var insertPosition = (0, 0); + + // If we don't have usings, insert after the last namespace or page directive, which ever comes later + var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; + var lastNamespaceOrPageDirective = syntaxTreeRoot + .DescendantNodes() + .LastOrDefault(IsNamespaceOrPageDirective); + + if (lastNamespaceOrPageDirective != null) + { + var lineIndex = GetLineIndexOrEnd(codeDocument, lastNamespaceOrPageDirective.Span.End - 1) + 1; + insertPosition = (lineIndex, 0); + } + + // Insert all usings at the given point + return new TextDocumentEdit + { + TextDocument = codeDocumentIdentifier, + Edits = [VsLspFactory.CreateTextEdit(insertPosition, newText: $"@using {newUsingNamespace}{Environment.NewLine}")] + }; + } + + private static int GetLineIndexOrEnd(RazorCodeDocument codeDocument, int endIndex) + { + if (endIndex < codeDocument.Source.Text.Length) + { + return codeDocument.Source.Text.GetLinePosition(endIndex).Line; + } + else + { + return codeDocument.Source.Text.Lines.Count; + } + } + + private static void CollectUsingDirectives(RazorCodeDocument codeDocument, ref PooledArrayBuilder directives) + { + var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; + foreach (var node in syntaxTreeRoot.DescendantNodes()) + { + if (node is RazorDirectiveSyntax directiveNode) + { + foreach (var child in directiveNode.DescendantNodes()) + { + if (child.GetChunkGenerator() is AddImportChunkGenerator { IsStatic: false } usingStatement) + { + directives.Add(new RazorUsingDirective(directiveNode, usingStatement)); + } + } + } + } + } + + private static bool IsNamespaceOrPageDirective(RazorSyntaxNode node) + { + if (node is RazorDirectiveSyntax directiveNode) + { + return directiveNode.DirectiveDescriptor == ComponentPageDirective.Directive || + directiveNode.DirectiveDescriptor == NamespaceDirective.Directive || + directiveNode.DirectiveDescriptor == PageDirective.Directive; + } + + return false; + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormatter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs similarity index 87% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormatter.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs index f87c51192c1..1dd52b3e7b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormatter.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs @@ -1,8 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,12 +12,12 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class CSharpFormatter(IDocumentMappingService documentMappingService) { @@ -25,75 +25,54 @@ internal sealed class CSharpFormatter(IDocumentMappingService documentMappingSer private readonly IDocumentMappingService _documentMappingService = documentMappingService; - public async Task FormatAsync(FormattingContext context, Range rangeToFormat, CancellationToken cancellationToken) + public async Task> FormatAsync(HostWorkspaceServices hostWorkspaceServices, Document csharpDocument, FormattingContext context, LinePositionSpan spanToFormat, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (rangeToFormat is null) - { - throw new ArgumentNullException(nameof(rangeToFormat)); - } - - if (!_documentMappingService.TryMapToGeneratedDocumentRange(context.CodeDocument.GetCSharpDocument(), rangeToFormat, out var projectedRange)) + if (!_documentMappingService.TryMapToGeneratedDocumentRange(context.CodeDocument.GetCSharpDocument(), spanToFormat, out var projectedSpan)) { return []; } - var edits = await GetFormattingEditsAsync(context, projectedRange, cancellationToken).ConfigureAwait(false); + var edits = await GetFormattingEditsAsync(hostWorkspaceServices, csharpDocument, projectedSpan, context.Options.ToIndentationOptions(), cancellationToken).ConfigureAwait(false); var mappedEdits = MapEditsToHostDocument(context.CodeDocument, edits); return mappedEdits; } public static async Task> GetCSharpIndentationAsync( FormattingContext context, - IReadOnlyCollection projectedDocumentLocations, + HashSet projectedDocumentLocations, + HostWorkspaceServices hostWorkspaceServices, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (projectedDocumentLocations is null) - { - throw new ArgumentNullException(nameof(projectedDocumentLocations)); - } - // Sorting ensures we count the marker offsets correctly. // We also want to ensure there are no duplicates to avoid duplicate markers. - var filteredLocations = projectedDocumentLocations.Distinct().OrderBy(l => l).ToList(); + var filteredLocations = projectedDocumentLocations.OrderAsArray(); - var indentations = await GetCSharpIndentationCoreAsync(context, filteredLocations, cancellationToken).ConfigureAwait(false); + var indentations = await GetCSharpIndentationCoreAsync(context, filteredLocations, hostWorkspaceServices, cancellationToken).ConfigureAwait(false); return indentations; } - private TextEdit[] MapEditsToHostDocument(RazorCodeDocument codeDocument, TextEdit[] csharpEdits) + private ImmutableArray MapEditsToHostDocument(RazorCodeDocument codeDocument, ImmutableArray csharpEdits) { var actualEdits = _documentMappingService.GetHostDocumentEdits(codeDocument.GetCSharpDocument(), csharpEdits); - return actualEdits; + return actualEdits.ToImmutableArray(); } - private static async Task GetFormattingEditsAsync(FormattingContext context, Range projectedRange, CancellationToken cancellationToken) + private static async Task> GetFormattingEditsAsync(HostWorkspaceServices hostWorkspaceServices, Document csharpDocument, LinePositionSpan projectedSpan, RazorIndentationOptions indentationOptions, CancellationToken cancellationToken) { - var csharpSourceText = context.CodeDocument.GetCSharpSourceText(); - var spanToFormat = csharpSourceText.GetTextSpan(projectedRange); - var root = await context.CSharpWorkspaceDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + var root = await csharpDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + var csharpSourceText = await csharpDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var spanToFormat = csharpSourceText.GetTextSpan(projectedSpan); Assumes.NotNull(root); - var changes = RazorCSharpFormattingInteractionService.GetFormattedTextChanges(context.CSharpWorkspace.Services, root, spanToFormat, context.Options.GetIndentationOptions(), cancellationToken); - - var edits = changes.Select(csharpSourceText.GetTextEdit).ToArray(); - return edits; + var changes = RazorCSharpFormattingInteractionService.GetFormattedTextChanges(hostWorkspaceServices, root, spanToFormat, indentationOptions, cancellationToken); + return changes.ToImmutableArray(); } - private static async Task> GetCSharpIndentationCoreAsync(FormattingContext context, List projectedDocumentLocations, CancellationToken cancellationToken) + private static async Task> GetCSharpIndentationCoreAsync(FormattingContext context, ImmutableArray projectedDocumentLocations, HostWorkspaceServices hostWorkspaceServices, CancellationToken cancellationToken) { // No point calling the C# formatting if we won't be interested in any of its work anyway - if (projectedDocumentLocations.Count == 0) + if (projectedDocumentLocations.Length == 0) { return []; } @@ -106,7 +85,7 @@ private static async Task> GetCSharpIndentationCoreAsync(Fo // At this point, we have added all the necessary markers and attached annotations. // Let's invoke the C# formatter and hope for the best. - var formattedRoot = RazorCSharpFormattingInteractionService.Format(context.CSharpWorkspace.Services, root, context.Options.GetIndentationOptions(), cancellationToken); + var formattedRoot = RazorCSharpFormattingInteractionService.Format(hostWorkspaceServices, root, context.Options.ToIndentationOptions(), cancellationToken); var formattedText = formattedRoot.GetText(); var desiredIndentationMap = new Dictionary(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingBlockKind.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingBlockKind.cs similarity index 84% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingBlockKind.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingBlockKind.cs index 50ac3e691f8..ff80c2cc1e9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingBlockKind.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingBlockKind.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal enum FormattingBlockKind { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs similarity index 70% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContext.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index 9e1c13b6e92..bfae1b89b6a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -9,31 +9,34 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal class FormattingContext : IDisposable +internal sealed class FormattingContext { - private readonly IAdhocWorkspaceFactory _workspaceFactory; - private Document? _csharpWorkspaceDocument; - private AdhocWorkspace? _csharpWorkspace; + private readonly IFormattingCodeDocumentProvider _codeDocumentProvider; private IReadOnlyList? _formattingSpans; private IReadOnlyDictionary? _indentations; - private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, - bool isFormatOnType, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) + private FormattingContext( + IFormattingCodeDocumentProvider codeDocumentProvider, + IDocumentSnapshot originalSnapshot, + RazorCodeDocument codeDocument, + RazorFormattingOptions options, + bool automaticallyAddUsings, + int hostDocumentIndex, + char triggerCharacter) { - _workspaceFactory = workspaceFactory; - Uri = uri; + _codeDocumentProvider = codeDocumentProvider; OriginalSnapshot = originalSnapshot; CodeDocument = codeDocument; Options = options; - IsFormatOnType = isFormatOnType; AutomaticallyAddUsings = automaticallyAddUsings; HostDocumentIndex = hostDocumentIndex; TriggerCharacter = triggerCharacter; @@ -41,11 +44,9 @@ private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDoc public static bool SkipValidateComponents { get; set; } - public Uri Uri { get; } public IDocumentSnapshot OriginalSnapshot { get; } public RazorCodeDocument CodeDocument { get; } - public FormattingOptions Options { get; } - public bool IsFormatOnType { get; } + public RazorFormattingOptions Options { get; } public bool AutomaticallyAddUsings { get; } public int HostDocumentIndex { get; } public char TriggerCharacter { get; } @@ -56,24 +57,6 @@ private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDoc public string NewLineString => Environment.NewLine; - public Document CSharpWorkspaceDocument - { - get - { - if (_csharpWorkspaceDocument is null) - { - var workspace = CSharpWorkspace; - var project = workspace.AddProject("TestProject", LanguageNames.CSharp); - var csharpSourceText = CodeDocument.GetCSharpSourceText(); - _csharpWorkspaceDocument = workspace.AddDocument(project.Id, "TestDocument", csharpSourceText); - } - - return _csharpWorkspaceDocument; - } - } - - public AdhocWorkspace CSharpWorkspace => _csharpWorkspace ??= _workspaceFactory.Create(); - /// A Dictionary of int (line number) to IndentationContext. /// /// Don't use this to discover the indentation level you should have, use @@ -83,7 +66,7 @@ public IReadOnlyDictionary GetIndentations() { if (_indentations is null) { - var sourceText = this.SourceText; + var sourceText = SourceText; var indentations = new Dictionary(); var previousIndentationLevel = 0; @@ -97,7 +80,7 @@ public IReadOnlyDictionary GetIndentations() // The existingIndentation above is measured in characters, and is used to create text edits // The below is measured in columns, so takes into account tab size. This is useful for creating // new indentation strings - var existingIndentationSize = line.GetIndentationSize(this.Options.TabSize); + var existingIndentationSize = line.GetIndentationSize(Options.TabSize); var emptyOrWhitespaceLine = false; if (nonWsPos is null) @@ -176,11 +159,6 @@ private IReadOnlyList GetFormattingSpans() private static IReadOnlyList GetFormattingSpans(RazorSyntaxTree syntaxTree, bool inGlobalNamespace) { - if (syntaxTree is null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - var visitor = new FormattingVisitor(inGlobalNamespace: inGlobalNamespace); visitor.Visit(syntaxTree.Root); @@ -224,11 +202,10 @@ public bool TryGetIndentationLevel(int position, out int indentationLevel) public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out FormattingSpan? result) { result = null; - var formattingspans = GetFormattingSpans(); - for (var i = 0; i < formattingspans.Count; i++) + var formattingSpans = GetFormattingSpans(); + foreach (var formattingSpan in formattingSpans.AsEnumerable()) { - var formattingspan = formattingspans[i]; - var span = formattingspan.Span; + var span = formattingSpan.Span; if (span.Start <= absoluteIndex && span.End >= absoluteIndex) { @@ -239,7 +216,7 @@ public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out Form continue; } - result = formattingspan; + result = formattingSpan; return true; } } @@ -247,35 +224,19 @@ public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out Form return false; } - public void Dispose() - { - _csharpWorkspace?.Dispose(); - if (_csharpWorkspaceDocument != null) - { - _csharpWorkspaceDocument = null; - } - } - public async Task WithTextAsync(SourceText changedText) { - if (changedText is null) - { - throw new ArgumentNullException(nameof(changedText)); - } - var changedSnapshot = OriginalSnapshot.WithText(changedText); - var codeDocument = await changedSnapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(changedSnapshot).ConfigureAwait(false); DEBUG_ValidateComponents(CodeDocument, codeDocument); var newContext = new FormattingContext( - _workspaceFactory, - Uri, + _codeDocumentProvider, OriginalSnapshot, codeDocument, Options, - IsFormatOnType, AutomaticallyAddUsings, HostDocumentIndex, TriggerCharacter); @@ -296,85 +257,44 @@ private static void DEBUG_ValidateComponents(RazorCodeDocument oldCodeDocument, return; } - var oldTagHelperElements = oldCodeDocument.GetSyntaxTree().Root.DescendantNodesAndSelf().OfType().Count(); - var newTagHelperElements = newCodeDocument.GetSyntaxTree().Root.DescendantNodesAndSelf().OfType().Count(); + var oldTagHelperElements = oldCodeDocument.GetSyntaxTree().Root.DescendantNodesAndSelf().OfType().Count(); + var newTagHelperElements = newCodeDocument.GetSyntaxTree().Root.DescendantNodesAndSelf().OfType().Count(); Debug.Assert(oldTagHelperElements == newTagHelperElements, $"Previous context had {oldTagHelperElements} components, new only has {newTagHelperElements}."); } public static FormattingContext CreateForOnTypeFormatting( - Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, - FormattingOptions options, - IAdhocWorkspaceFactory workspaceFactory, + RazorFormattingOptions options, + IFormattingCodeDocumentProvider codeDocumentProvider, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: true, automaticallyAddUsings, hostDocumentIndex, triggerCharacter); + return new FormattingContext( + codeDocumentProvider, + originalSnapshot, + codeDocument, + options, + automaticallyAddUsings, + hostDocumentIndex, + triggerCharacter); } public static FormattingContext Create( - Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, - FormattingOptions options, - IAdhocWorkspaceFactory workspaceFactory) - { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: false, automaticallyAddUsings: false, hostDocumentIndex: 0, triggerCharacter: '\0'); - } - - private static FormattingContext CreateCore( - Uri uri, - IDocumentSnapshot originalSnapshot, - RazorCodeDocument codeDocument, - FormattingOptions options, - IAdhocWorkspaceFactory workspaceFactory, - bool isFormatOnType, - bool automaticallyAddUsings, - int hostDocumentIndex, - char triggerCharacter) + RazorFormattingOptions options, + IFormattingCodeDocumentProvider codeDocumentProvider) { - if (uri is null) - { - throw new ArgumentNullException(nameof(uri)); - } - - if (originalSnapshot is null) - { - throw new ArgumentNullException(nameof(originalSnapshot)); - } - - if (codeDocument is null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (workspaceFactory is null) - { - throw new ArgumentNullException(nameof(workspaceFactory)); - } - - // hostDocumentIndex, triggerCharacter and automaticallyAddUsings are only supported in on type formatting - Debug.Assert(isFormatOnType || (hostDocumentIndex == 0 && triggerCharacter == '\0' && automaticallyAddUsings == false)); - - var result = new FormattingContext( - workspaceFactory, - uri, + return new FormattingContext( + codeDocumentProvider, originalSnapshot, codeDocument, options, - isFormatOnType, - automaticallyAddUsings, - hostDocumentIndex, - triggerCharacter - ); - - return result; + automaticallyAddUsings: false, + hostDocumentIndex: 0, + triggerCharacter: '\0' + ); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpan.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpan.cs similarity index 96% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpan.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpan.cs index 0afa79033e6..6ceb2a138a6 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpan.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpan.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal class FormattingSpan { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpanKind.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpanKind.cs similarity index 80% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpanKind.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpanKind.cs index 707683355aa..24d4e98b82b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpanKind.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingSpanKind.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal enum FormattingSpanKind { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingUtilities.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingUtilities.cs similarity index 74% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingUtilities.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingUtilities.cs index 9cd27d17513..7e57a27d3fc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingUtilities.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingUtilities.cs @@ -2,9 +2,8 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal static class FormattingUtilities { @@ -17,19 +16,20 @@ internal static class FormattingUtilities /// /// The method to add indenting to. The method should be marked with where an indent is wanted /// - /// - /// The that contains information about indenting. + /// + /// The indentation size + /// + /// + /// Use spaces for indentation. /// /// /// The size of the any existing indent. /// /// The indented method. - public static string AddIndentationToMethod(string method, RazorLSPOptions options, int startingIndent) + public static string AddIndentationToMethod(string method, int tabSize, bool insertSpaces, int startingIndent) { - var indentSize = options.TabSize; - var insertSpaces = options.InsertSpaces; - var initialIndent = GetIndentationString(startingIndent, insertSpaces, indentSize); - var indent = GetIndentationString(indentSize, insertSpaces, indentSize); + var initialIndent = GetIndentationString(startingIndent, insertSpaces, tabSize); + var indent = GetIndentationString(tabSize, insertSpaces, tabSize); return method.Replace(InitialIndent, initialIndent).Replace(Indent, indent); } @@ -40,8 +40,11 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio /// The method to add indenting to. The method should be marked with where an indent is wanted /// and where some initial indent is needed. /// - /// - /// The that contains information about indenting. + /// + /// The indentation size + /// + /// + /// Use spaces for indentation. /// /// /// The absolute index of the beginning of the class in the C# file the method will be added to. @@ -53,14 +56,14 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio /// The contents of the C# file. /// /// The indented method. - public static string AddIndentationToMethod(string method, RazorLSPOptions options, int startAbsoluteIndex, int numCharacterBefore, string source) + public static string AddIndentationToMethod(string method, int tabSize, bool insertSpaces, int startAbsoluteIndex, int numCharacterBefore, string source) { var startingIndent = 0; for (var i = 1; i <= numCharacterBefore; i++) { if (source[startAbsoluteIndex - i] == '\t') { - startingIndent += options.TabSize; + startingIndent += tabSize; } else { @@ -68,7 +71,7 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio } } - return AddIndentationToMethod(method, options, startingIndent); + return AddIndentationToMethod(method, tabSize, insertSpaces, startingIndent); } /// @@ -78,9 +81,10 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio /// The method to add indenting to. The method should be marked with where an indent is wanted /// and where some initial indent is needed. /// - /// - /// The that contains information about indenting. + /// + /// The indentation size /// + /// /// /// The absolute index of the beginning of the code block in the Razor file where the method will be added to. /// @@ -91,14 +95,14 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio /// The of the razor file the method is being added to. /// /// The indented method. - public static string AddIndentationToMethod(string method, RazorLSPOptions options, int startAbsoluteIndex, int numCharacterBefore, RazorSourceDocument source) + public static string AddIndentationToMethod(string method, int tabSize, bool insertSpaces, int startAbsoluteIndex, int numCharacterBefore, RazorSourceDocument source) { var startingIndent = 0; for (var i = 1; i <= numCharacterBefore; i++) { if (source.Text[startAbsoluteIndex - i] == '\t') { - startingIndent += options.TabSize; + startingIndent += tabSize; } else { @@ -106,7 +110,7 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio } } - return AddIndentationToMethod(method, options, startingIndent); + return AddIndentationToMethod(method, tabSize, insertSpaces, startingIndent); } /// @@ -114,7 +118,7 @@ public static string AddIndentationToMethod(string method, RazorLSPOptions optio /// /// An amount of characters to represent the indentation. /// Whether spaces are used for indentation. - /// The size of a tab. + /// The size of a tab and indentation. /// A whitespace string representation indentation. public static string GetIndentationString(int indentation, bool insertSpaces, int tabSize) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingVisitor.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingVisitor.cs similarity index 96% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingVisitor.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingVisitor.cs index f670882725b..dacc33a58dc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingVisitor.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingVisitor.cs @@ -7,14 +7,18 @@ using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Components; -using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +using RazorSyntaxTokenList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; +using RazorSyntaxWalker = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxWalker; -internal class FormattingVisitor : SyntaxWalker +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +// There is already RazorSyntaxNode so not following that pattern for this alias +using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; + +internal class FormattingVisitor : RazorSyntaxWalker { private const string HtmlTag = "html"; @@ -318,7 +322,7 @@ public override void VisitMarkupAttributeBlock(MarkupAttributeBlockSyntax node) { WriteBlock(node, FormattingBlockKind.Markup, n => { - var equalsSyntax = SyntaxFactory.MarkupTextLiteral(new SyntaxList(node.EqualsToken), chunkGenerator: null); + var equalsSyntax = SyntaxFactory.MarkupTextLiteral(new RazorSyntaxTokenList(node.EqualsToken), chunkGenerator: null); var mergedAttributePrefix = SyntaxUtilities.MergeTextLiterals(node.NamePrefix, node.Name, node.NameSuffix, equalsSyntax, node.ValuePrefix); Visit(mergedAttributePrefix); Visit(node.Value); @@ -330,7 +334,7 @@ public override void VisitMarkupTagHelperAttribute(MarkupTagHelperAttributeSynta { WriteBlock(node, FormattingBlockKind.Tag, n => { - var equalsSyntax = SyntaxFactory.MarkupTextLiteral(new SyntaxList(node.EqualsToken), chunkGenerator: null); + var equalsSyntax = SyntaxFactory.MarkupTextLiteral(new RazorSyntaxTokenList(node.EqualsToken), chunkGenerator: null); var mergedAttributePrefix = SyntaxUtilities.MergeTextLiterals(node.NamePrefix, node.Name, node.NameSuffix, equalsSyntax, node.ValuePrefix); Visit(mergedAttributePrefix); Visit(node.Value); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs new file mode 100644 index 00000000000..0d1c25da983 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal interface IFormattingCodeDocumentProvider +{ + Task GetCodeDocumentAsync(IDocumentSnapshot snapshot); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs new file mode 100644 index 00000000000..f33544cb4e3 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal interface IFormattingPass +{ + Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs new file mode 100644 index 00000000000..b5e260327f9 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -0,0 +1,61 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal interface IRazorFormattingService +{ + Task> GetDocumentFormattingChangesAsync( + DocumentContext documentContext, + ImmutableArray htmlEdits, + LinePositionSpan? span, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + Task> GetHtmlOnTypeFormattingChangesAsync( + DocumentContext documentContext, + ImmutableArray htmlEdits, + RazorFormattingOptions options, + int hostDocumentIndex, + char triggerCharacter, + CancellationToken cancellationToken); + + Task> GetCSharpOnTypeFormattingChangesAsync( + DocumentContext documentContext, + RazorFormattingOptions options, + int hostDocumentIndex, + char triggerCharacter, + CancellationToken cancellationToken); + + Task TryGetSingleCSharpEditAsync( + DocumentContext documentContext, + TextChange csharpEdit, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + Task TryGetCSharpCodeActionEditAsync( + DocumentContext documentContext, + ImmutableArray csharpEdits, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + Task TryGetCSharpSnippetFormattingEditAsync( + DocumentContext documentContext, + ImmutableArray csharpEdits, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + bool TryGetOnTypeFormattingTriggerKind( + RazorCodeDocument codeDocument, + int hostDocumentIndex, + string triggerCharacter, + out RazorLanguageKind triggerCharacterKind); +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IndentationContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IndentationContext.cs similarity index 96% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IndentationContext.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IndentationContext.cs index fadd42bf76a..f688f92c5bb 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IndentationContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IndentationContext.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal class IndentationContext { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs similarity index 54% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs index 7db855f9bd1..591573959bb 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs @@ -2,46 +2,40 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; +/// +/// Gets edits in Razor files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class CSharpFormattingPass( IDocumentMappingService documentMappingService, + IHostServicesProvider hostServicesProvider, ILoggerFactory loggerFactory) - : CSharpFormattingPassBase(documentMappingService) + : CSharpFormattingPassBase(documentMappingService, hostServicesProvider, isFormatOnType: false) { + private readonly CSharpFormatter _csharpFormatter = new(documentMappingService); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // Run after the HTML and Razor formatter pass. - public override int Order => DefaultOrder - 3; - - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + protected async override Task> ExecuteCoreAsync(FormattingContext context, RoslynWorkspaceHelper roslynWorkspaceHelper, ImmutableArray changes, CancellationToken cancellationToken) { - if (context.IsFormatOnType || result.Kind != RazorLanguageKind.Razor) - { - // We don't want to handle OnTypeFormatting here. - return result; - } - // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; var changedContext = context; - if (result.Edits.Length > 0) + if (changes.Length > 0) { - var changes = result.Edits.Select(originalText.GetTextChange).ToArray(); changedText = changedText.WithChanges(changes); changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); } @@ -49,10 +43,10 @@ public async override Task ExecuteAsync(FormattingContext cont cancellationToken.ThrowIfCancellationRequested(); // Apply original C# edits - var csharpEdits = await FormatCSharpAsync(changedContext, cancellationToken).ConfigureAwait(false); - if (csharpEdits.Length > 0) + var csharpDocument = roslynWorkspaceHelper.CreateCSharpDocument(changedContext.CodeDocument); + var csharpChanges = await FormatCSharpAsync(changedContext, roslynWorkspaceHelper.HostWorkspaceServices, csharpDocument, cancellationToken).ConfigureAwait(false); + if (csharpChanges.Length > 0) { - var csharpChanges = csharpEdits.Select(changedText.GetTextChange); changedText = changedText.WithChanges(csharpChanges); changedContext = await changedContext.WithTextAsync(changedText).ConfigureAwait(false); @@ -61,8 +55,8 @@ public async override Task ExecuteAsync(FormattingContext cont cancellationToken.ThrowIfCancellationRequested(); - var indentationChanges = await AdjustIndentationAsync(changedContext, cancellationToken).ConfigureAwait(false); - if (indentationChanges.Count > 0) + var indentationChanges = await AdjustIndentationAsync(changedContext, startLine: 0, endLineInclusive: changedText.Lines.Count - 1, roslynWorkspaceHelper.HostWorkspaceServices, cancellationToken).ConfigureAwait(false); + if (indentationChanges.Length > 0) { // Apply the edits that modify indentation. changedText = changedText.WithChanges(indentationChanges); @@ -72,17 +66,14 @@ public async override Task ExecuteAsync(FormattingContext cont _logger.LogTestOnly($"Generated C#:\r\n{context.CSharpSourceText}"); - var finalChanges = changedText.GetTextChanges(originalText); - var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - - return new FormattingResult(finalEdits); + return changedText.GetTextChangesArray(originalText); } - private async Task> FormatCSharpAsync(FormattingContext context, CancellationToken cancellationToken) + private async Task> FormatCSharpAsync(FormattingContext context, HostWorkspaceServices hostWorkspaceServices, Document csharpDocument, CancellationToken cancellationToken) { var sourceText = context.SourceText; - using var csharpEdits = new PooledArrayBuilder(); + using var csharpChanges = new PooledArrayBuilder(); foreach (var mapping in context.CodeDocument.GetCSharpDocument().SourceMappings) { var span = new TextSpan(mapping.OriginalSpan.AbsoluteIndex, mapping.OriginalSpan.Length); @@ -93,11 +84,12 @@ private async Task> FormatCSharpAsync(FormattingContext } // These should already be remapped. - var range = sourceText.GetRange(span); - var edits = await CSharpFormatter.FormatAsync(context, range, cancellationToken).ConfigureAwait(false); - csharpEdits.AddRange(edits.Where(e => range.Contains(e.Range))); + var spanToFormat = sourceText.GetLinePositionSpan(span); + + var changes = await _csharpFormatter.FormatAsync(hostWorkspaceServices, csharpDocument, context, spanToFormat, cancellationToken).ConfigureAwait(false); + csharpChanges.AddRange(changes.Where(e => spanToFormat.Contains(sourceText.GetLinePositionSpan(e.Span)))); } - return csharpEdits.ToImmutable(); + return csharpChanges.ToImmutable(); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.RoslynWorkspaceHelper.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.RoslynWorkspaceHelper.cs new file mode 100644 index 00000000000..3ad4bfee98a --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.RoslynWorkspaceHelper.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.Workspaces; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal abstract partial class CSharpFormattingPassBase +{ + protected sealed class RoslynWorkspaceHelper(IHostServicesProvider hostServicesProvider) : IDisposable + { + private readonly Lazy _lazyWorkspace = new(() => CreateWorkspace(hostServicesProvider)); + + public HostWorkspaceServices HostWorkspaceServices => _lazyWorkspace.Value.Services; + + public Document CreateCSharpDocument(RazorCodeDocument codeDocument) + { + var project = _lazyWorkspace.Value.CurrentSolution.AddProject("TestProject", "TestProject", LanguageNames.CSharp); + var csharpSourceText = codeDocument.GetCSharpSourceText(); + return project.AddDocument("TestDocument", csharpSourceText); + } + + private static AdhocWorkspace CreateWorkspace(IHostServicesProvider hostServicesProvider) + { + var fallbackServices = hostServicesProvider.GetServices(); + var services = AdhocServices.Create( + workspaceServices: [], + languageServices: [], + fallbackServices); + + return new AdhocWorkspace(services); + } + + public void Dispose() + { + if (_lazyWorkspace.IsValueCreated) + { + _lazyWorkspace.Value.Dispose(); + } + } + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs similarity index 90% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPassBase.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs index 590189a5362..b9a476872fe 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; @@ -11,26 +12,32 @@ using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal abstract class CSharpFormattingPassBase : FormattingPassBase +internal abstract partial class CSharpFormattingPassBase(IDocumentMappingService documentMappingService, IHostServicesProvider hostServicesProvider, bool isFormatOnType) : IFormattingPass { - protected CSharpFormattingPassBase(IDocumentMappingService documentMappingService) - : base(documentMappingService) + private readonly bool _isFormatOnType = isFormatOnType; + + protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; + + public async Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) { - CSharpFormatter = new CSharpFormatter(documentMappingService); - } + using var roslynWorkspaceHelper = new RoslynWorkspaceHelper(hostServicesProvider); - protected CSharpFormatter CSharpFormatter { get; } + return await ExecuteCoreAsync(context, roslynWorkspaceHelper, changes, cancellationToken).ConfigureAwait(false); + } - public override bool IsValidationPass => false; + protected abstract Task> ExecuteCoreAsync(FormattingContext context, RoslynWorkspaceHelper roslynWorkspaceHelper, ImmutableArray changes, CancellationToken cancellationToken); - protected async Task> AdjustIndentationAsync(FormattingContext context, CancellationToken cancellationToken, Range? range = null) + protected async Task> AdjustIndentationAsync(FormattingContext context, int startLine, int endLineInclusive, HostWorkspaceServices hostWorkspaceServices, CancellationToken cancellationToken) { // In this method, the goal is to make final adjustments to the indentation of each line. // We will take into account the following, @@ -38,7 +45,6 @@ protected async Task> AdjustIndentationAsync(FormattingContext // 2. The indentation due to Razor and HTML constructs var text = context.SourceText; - range ??= text.GetRange(TextSpan.FromBounds(0, text.Length)); // To help with figuring out the correct indentation, first we will need the indentation // that the C# formatter wants to apply in the following locations, @@ -48,7 +54,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext // Due to perf concerns, we only want to invoke the real C# formatter once. // So, let's collect all the significant locations that we want to obtain the CSharpDesiredIndentations for. - var significantLocations = new HashSet(); + using var _1 = HashSetPool.GetPooledObject(out var significantLocations); // First, collect all the locations at the beginning and end of each source mapping. var sourceMappingMap = new Dictionary(); @@ -56,7 +62,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext { var mappingSpan = new TextSpan(mapping.OriginalSpan.AbsoluteIndex, mapping.OriginalSpan.Length); #if DEBUG - var spanText = context.SourceText.GetSubText(mappingSpan).ToString(); + var spanText = context.SourceText.GetSubTextString(mappingSpan); #endif var options = new ShouldFormatOptions( @@ -90,7 +96,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext // Next, collect all the line starts that start in C# context var indentations = context.GetIndentations(); var lineStartMap = new Dictionary(); - for (var i = range.Start.Line; i <= range.End.Line; i++) + for (var i = startLine; i <= endLineInclusive; i++) { if (indentations[i].EmptyOrWhitespaceLine) { @@ -116,7 +122,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext } // Now, invoke the C# formatter to obtain the CSharpDesiredIndentation for all significant locations. - var significantLocationIndentation = await CSharpFormatter.GetCSharpIndentationAsync(context, significantLocations, cancellationToken).ConfigureAwait(false); + var significantLocationIndentation = await CSharpFormatter.GetCSharpIndentationAsync(context, significantLocations, hostWorkspaceServices, cancellationToken).ConfigureAwait(false); // Build source mapping indentation scopes. var sourceMappingIndentations = new SortedDictionary(); @@ -136,7 +142,10 @@ protected async Task> AdjustIndentationAsync(FormattingContext } var scopeOwner = syntaxTreeRoot.FindInnermostNode(originalLocation); - sourceMappingIndentations[originalLocation] = new IndentationData(indentation); + if (!sourceMappingIndentations.ContainsKey(originalLocation)) + { + sourceMappingIndentations[originalLocation] = new IndentationData(indentation); + } // For @section blocks we have special handling to add a fake source mapping/significant location at the end of the // section, to return the indentation back to before the start of the section block. @@ -172,7 +181,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext // Now, let's combine the C# desired indentation with the Razor and HTML indentation for each line. var newIndentations = new Dictionary(); - for (var i = range.Start.Line; i <= range.End.Line; i++) + for (var i = startLine; i <= endLineInclusive; i++) { if (indentations[i].EmptyOrWhitespaceLine) { @@ -253,7 +262,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext if (indentations[i].StartsInHtmlContext) { // This is a non-C# line. - if (context.IsFormatOnType) + if (_isFormatOnType) { // HTML formatter doesn't run in the case of format on type. // Let's stick with our syntax understanding of HTML to figure out the desired indentation. @@ -275,7 +284,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext } // Now that we have collected all the indentations for each line, let's convert them to text edits. - var changes = new List(); + using var changes = new PooledArrayBuilder(capacity: newIndentations.Count); foreach (var item in newIndentations) { var line = item.Key; @@ -288,19 +297,19 @@ protected async Task> AdjustIndentationAsync(FormattingContext changes.Add(new TextChange(spanToReplace, effectiveDesiredIndentation)); } - return changes; + return changes.DrainToImmutable(); } protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) => ShouldFormat(context, mappingSpan, allowImplicitStatements, out _); - protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements, out SyntaxNode? foundOwner) + protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements, out RazorSyntaxNode? foundOwner) => ShouldFormat(context, mappingSpan, new ShouldFormatOptions(allowImplicitStatements, isLineRequest: false), out foundOwner); private static bool ShouldFormatLine(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) => ShouldFormat(context, mappingSpan, new ShouldFormatOptions(allowImplicitStatements, isLineRequest: true), out _); - private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, ShouldFormatOptions options, out SyntaxNode? foundOwner) + private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, ShouldFormatOptions options, out RazorSyntaxNode? foundOwner) { // We should be called with the range of various C# SourceMappings. @@ -440,10 +449,10 @@ bool IsInBoundComponentAttributeName() return owner is MarkupTextLiteralSyntax { - Parent: MarkupTagHelperAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupMinimizedTagHelperAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupMinimizedTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } + Parent: MarkupTagHelperAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupMinimizedTagHelperAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupMinimizedTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo.Bound: true } } && !options.IsLineRequest; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs similarity index 71% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index bad1194d899..df2f821b088 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -3,54 +3,49 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.AspNetCore.Razor.TextDifferencing; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; -using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; +/// +/// Gets edits in C# files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class CSharpOnTypeFormattingPass( IDocumentMappingService documentMappingService, + IHostServicesProvider hostServicesProvider, ILoggerFactory loggerFactory) - : CSharpFormattingPassBase(documentMappingService) + : CSharpFormattingPassBase(documentMappingService, hostServicesProvider, isFormatOnType: true) { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + protected async override Task> ExecuteCoreAsync(FormattingContext context, RoslynWorkspaceHelper roslynWorkspaceHelper, ImmutableArray changes, CancellationToken cancellationToken) { - if (!context.IsFormatOnType || result.Kind != RazorLanguageKind.CSharp) - { - // We don't want to handle regular formatting or non-C# on type formatting here. - return result; - } - // Normalize and re-map the C# edits. var codeDocument = context.CodeDocument; var csharpText = codeDocument.GetCSharpSourceText(); - var textEdits = result.Edits; - if (textEdits.Length == 0) + if (changes.Length == 0) { if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), context.HostDocumentIndex, out _, out var projectedIndex)) { - _logger.LogWarning($"Failed to map to projected position for document {context.Uri}."); - return result; + _logger.LogWarning($"Failed to map to projected position for document {context.OriginalSnapshot.FilePath}."); + return changes; } // Ask C# for formatting changes. @@ -58,10 +53,10 @@ public async override Task ExecuteAsync(FormattingContext cont formatOnReturn: true, formatOnTyping: true, formatOnSemicolon: true, formatOnCloseBrace: true); var formattingChanges = await RazorCSharpFormattingInteractionService.GetFormattingChangesAsync( - context.CSharpWorkspaceDocument, + roslynWorkspaceHelper.CreateCSharpDocument(context.CodeDocument), typedChar: context.TriggerCharacter, projectedIndex, - context.Options.GetIndentationOptions(), + context.Options.ToIndentationOptions(), autoFormattingOptions, indentStyle: CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Smart, cancellationToken).ConfigureAwait(false); @@ -69,61 +64,58 @@ public async override Task ExecuteAsync(FormattingContext cont if (formattingChanges.IsEmpty) { _logger.LogInformation($"Received no results."); - return result; + return changes; } - textEdits = formattingChanges.Select(csharpText.GetTextEdit).ToArray(); - _logger.LogInformation($"Received {textEdits.Length} results from C#."); + changes = formattingChanges; + _logger.LogInformation($"Received {changes.Length} results from C#."); } // Sometimes the C# document is out of sync with our document, so Roslyn can return edits to us that will throw when we try // to normalize them. Instead of having this flow up and log a NFW, we just capture it here. Since this only happens when typing // very quickly, it is a safe assumption that we'll get another chance to do on type formatting, since we know the user is typing. // The proper fix for this is https://github.com/dotnet/razor-tooling/issues/6650 at which point this can be removed - foreach (var edit in textEdits) + foreach (var edit in changes) { - var startLine = edit.Range.Start.Line; - var endLine = edit.Range.End.Line; - var count = csharpText.Lines.Count; - if (startLine >= count || endLine >= count) + var startPos = edit.Span.Start; + var endPos = edit.Span.End; + var count = csharpText.Length; + if (startPos >= count || endPos >= count) { - _logger.LogWarning($"Got a bad edit that couldn't be applied. Edit is {startLine}-{endLine} but there are only {count} lines in C#."); - return result; + _logger.LogWarning($"Got a bad edit that couldn't be applied. Edit is {startPos}-{endPos} but there are only {count} characters in C#."); + return changes; } } - var normalizedEdits = NormalizeTextEdits(csharpText, textEdits, out var originalTextWithChanges); - var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits, result.Kind); - var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); - if (filteredEdits.Length == 0) + var normalizedChanges = csharpText.MinimizeTextChanges(changes, out var originalTextWithChanges); + var mappedChanges = RemapTextChanges(codeDocument, normalizedChanges); + var filteredChanges = FilterCSharpTextChanges(context, mappedChanges); + if (filteredChanges.Length == 0) { // There are no C# edits for us to apply that could be mapped, but we might still need to check for using statements // because they are non mappable, but might be the only thing changed (eg from the Add Using code action) // // If there aren't any edits that are likely to contain using statement changes, this call will no-op. + filteredChanges = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, changes, originalTextWithChanges, filteredChanges, cancellationToken).ConfigureAwait(false); - filteredEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, textEdits, originalTextWithChanges, filteredEdits, cancellationToken).ConfigureAwait(false); - - return new FormattingResult(filteredEdits); + return filteredChanges; } // Find the lines that were affected by these edits. var originalText = codeDocument.Source.Text; _logger.LogTestOnly($"Original text:\r\n{originalText}"); - var changes = filteredEdits.Select(originalText.GetTextChange); - // Apply the format on type edits sent over by the client. - var formattedText = ApplyChangesAndTrackChange(originalText, changes, out _, out var spanAfterFormatting); + var formattedText = ApplyChangesAndTrackChange(originalText, filteredChanges, out _, out var spanAfterFormatting); _logger.LogTestOnly($"After C# changes:\r\n{formattedText}"); var changedContext = await context.WithTextAsync(formattedText).ConfigureAwait(false); - var rangeAfterFormatting = formattedText.GetRange(spanAfterFormatting); + var linePositionSpanAfterFormatting = formattedText.GetLinePositionSpan(spanAfterFormatting); cancellationToken.ThrowIfCancellationRequested(); // We make an optimistic attempt at fixing corner cases. - var cleanupChanges = CleanupDocument(changedContext, rangeAfterFormatting); + var cleanupChanges = CleanupDocument(changedContext, linePositionSpanAfterFormatting); var cleanedText = formattedText.WithChanges(cleanupChanges); _logger.LogTestOnly($"After CleanupDocument:\r\n{cleanedText}"); @@ -136,7 +128,7 @@ public async override Task ExecuteAsync(FormattingContext cont // We only want to adjust the range that was affected. // We need to take into account the lines affected by formatting as well as cleanup. - var lineDelta = LineDelta(formattedText, cleanupChanges, out var firstPosition, out var lastPosition); + var lineDelta = LineDelta(formattedText, cleanupChanges, out var firstLine, out var lastLine); // Okay hear me out, I know this looks lazy, but it totally makes sense. // This method is called with edits that the C# formatter wants to make, and from those edits we work out which @@ -154,7 +146,7 @@ public async override Task ExecuteAsync(FormattingContext cont // // We'll happy format lines 1 and 2, and ignore the closing brace altogether. So, by looking one line further // we won't have that problem. - if (rangeAfterFormatting.End.Line + lineDelta < cleanedText.Lines.Count - 1) + if (linePositionSpanAfterFormatting.End.Line + lineDelta < cleanedText.Lines.Count - 1) { lineDelta++; } @@ -172,25 +164,13 @@ public async override Task ExecuteAsync(FormattingContext cont // we'd format line 6 and call it a day, even though the formatter made an edit on line 3. To fix this we use the // first and last position of edits made above, and make sure our range encompasses them as well. For convenience // we calculate these positions in the LineDelta method called above. - // This is essentially: rangeToAdjust = new Range(Math.Min(firstFormattingEdit, userEdit), Math.Max(lastFormattingEdit, userEdit)) - var start = rangeAfterFormatting.Start; - if (firstPosition is not null && firstPosition.CompareTo(start) < 0) - { - start = firstPosition; - } + var startLine = Math.Min(firstLine, linePositionSpanAfterFormatting.Start.Line); + var endLineInclusive = Math.Max(lastLine, linePositionSpanAfterFormatting.End.Line + lineDelta); - var end = VsLspFactory.CreatePosition(rangeAfterFormatting.End.Line + lineDelta, 0); - if (lastPosition is not null && lastPosition.CompareTo(start) < 0) - { - end = lastPosition; - } - - var rangeToAdjust = VsLspFactory.CreateRange(start, end); + Debug.Assert(cleanedText.Lines.Count > endLineInclusive, "Invalid range. This is unexpected."); - Debug.Assert(cleanedText.IsValidPosition(rangeToAdjust.End), "Invalid range. This is unexpected."); - - var indentationChanges = await AdjustIndentationAsync(changedContext, cancellationToken, rangeToAdjust).ConfigureAwait(false); - if (indentationChanges.Count > 0) + var indentationChanges = await AdjustIndentationAsync(changedContext, startLine, endLineInclusive, roslynWorkspaceHelper.HostWorkspaceServices, cancellationToken).ConfigureAwait(false); + if (indentationChanges.Length > 0) { // Apply the edits that modify indentation. cleanedText = cleanedText.WithChanges(indentationChanges); @@ -199,27 +179,39 @@ public async override Task ExecuteAsync(FormattingContext cont } // Now that we have made all the necessary changes to the document. Let's diff the original vs final version and return the diff. - var finalChanges = cleanedText.GetTextChanges(originalText); - var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); + var finalChanges = cleanedText.GetTextChangesArray(originalText); - finalEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, textEdits, originalTextWithChanges, finalEdits, cancellationToken).ConfigureAwait(false); + finalChanges = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, changes, originalTextWithChanges, finalChanges, cancellationToken).ConfigureAwait(false); - return new FormattingResult(finalEdits); + return finalChanges; } - private static async Task AddUsingStatementEditsIfNecessaryAsync(FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) + private ImmutableArray RemapTextChanges(RazorCodeDocument codeDocument, ImmutableArray projectedTextChanges) + { + if (codeDocument.IsUnsupported()) + { + return []; + } + + var changes = DocumentMappingService.GetHostDocumentEdits(codeDocument.GetCSharpDocument(), projectedTextChanges); + + return changes.ToImmutableArray(); + } + + private static async Task> AddUsingStatementEditsIfNecessaryAsync(FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, ImmutableArray changes, SourceText originalTextWithChanges, ImmutableArray finalChanges, CancellationToken cancellationToken) { if (context.AutomaticallyAddUsings) { // Because we need to parse the C# code twice for this operation, lets do a quick check to see if its even necessary - if (textEdits.Any(e => e.NewText.IndexOf("using") != -1)) + if (changes.Any(static e => e.NewText is not null && e.NewText.IndexOf("using") != -1)) { - var usingStatementEdits = await AddUsingsCodeActionProviderHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); - finalEdits = [.. usingStatementEdits, .. finalEdits]; + var usingStatementEdits = await AddUsingsHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); + var usingStatementChanges = usingStatementEdits.Select(codeDocument.Source.Text.GetTextChange); + finalChanges = [.. usingStatementChanges, .. finalChanges]; } } - return finalEdits; + return finalChanges; } // Returns the minimal TextSpan that encompasses all the differences between the old and the new text. @@ -234,21 +226,15 @@ private static SourceText ApplyChangesAndTrackChange(SourceText oldText, IEnumer return newText; } - private static TextEdit[] FilterCSharpTextEdits(FormattingContext context, TextEdit[] edits) + private static ImmutableArray FilterCSharpTextChanges(FormattingContext context, ImmutableArray changes) { - var filteredEdits = edits.Where(e => - { - var span = context.SourceText.GetTextSpan(e.Range); - return ShouldFormat(context, span, allowImplicitStatements: false); - }).ToArray(); - - return filteredEdits; + return changes.WhereAsArray(e => ShouldFormat(context, e.Span, allowImplicitStatements: false)); } - private static int LineDelta(SourceText text, IEnumerable changes, out Position? firstPosition, out Position? lastPosition) + private static int LineDelta(SourceText text, IEnumerable changes, out int firstLine, out int lastLine) { - firstPosition = null; - lastPosition = null; + firstLine = 0; + lastLine = 0; // Let's compute the number of newlines added/removed by the incoming changes. var delta = 0; @@ -257,20 +243,11 @@ private static int LineDelta(SourceText text, IEnumerable changes, o { var newLineCount = change.NewText is null ? 0 : change.NewText.Split('\n').Length - 1; - var range = text.GetRange(change.Span); - Debug.Assert(range.Start.Line <= range.End.Line, "Invalid range."); - // For convenience, since we're already iterating through things, we also find the extremes // of the range of edits that were made. - if (firstPosition is null || firstPosition.CompareTo(range.Start) > 0) - { - firstPosition = range.Start; - } - - if (lastPosition is null || lastPosition.CompareTo(range.End) < 0) - { - lastPosition = range.End; - } + var range = text.GetLinePositionSpan(change.Span); + firstLine = Math.Min(firstLine, range.Start.Line); + lastLine = Math.Max(lastLine, range.End.Line); // The number of lines added/removed will be, // the number of lines added by the change - the number of lines the change span represents @@ -280,32 +257,31 @@ private static int LineDelta(SourceText text, IEnumerable changes, o return delta; } - private static List CleanupDocument(FormattingContext context, Range? range = null) + private static ImmutableArray CleanupDocument(FormattingContext context, LinePositionSpan spanAfterFormatting) { var text = context.SourceText; - range ??= text.GetRange(TextSpan.FromBounds(0, text.Length)); var csharpDocument = context.CodeDocument.GetCSharpDocument(); - var changes = new List(); + using var changes = new PooledArrayBuilder(); foreach (var mapping in csharpDocument.SourceMappings) { var mappingSpan = new TextSpan(mapping.OriginalSpan.AbsoluteIndex, mapping.OriginalSpan.Length); - var mappingRange = text.GetRange(mappingSpan); - if (!range.LineOverlapsWith(mappingRange)) + var mappingLinePositionSpan = text.GetLinePositionSpan(mappingSpan); + if (!spanAfterFormatting.LineOverlapsWith(mappingLinePositionSpan)) { // We don't care about this range. It didn't change. continue; } - CleanupSourceMappingStart(context, mappingRange, changes, out var newLineAdded); + CleanupSourceMappingStart(context, mappingLinePositionSpan, ref changes.AsRef(), out var newLineAdded); - CleanupSourceMappingEnd(context, mappingRange, changes, newLineAdded); + CleanupSourceMappingEnd(context, mappingLinePositionSpan, ref changes.AsRef(), newLineAdded); } - return changes; + return changes.ToImmutable(); } - private static void CleanupSourceMappingStart(FormattingContext context, Range sourceMappingRange, List changes, out bool newLineAdded) + private static void CleanupSourceMappingStart(FormattingContext context, LinePositionSpan sourceMappingRange, ref PooledArrayBuilder changes, out bool newLineAdded) { newLineAdded = false; @@ -335,7 +311,7 @@ private static void CleanupSourceMappingStart(FormattingContext context, Range s if (owner is CSharpStatementLiteralSyntax && owner.TryGetPreviousSibling(out var prevNode) && - prevNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + prevNode.FirstAncestorOrSelf(static a => a is CSharpTemplateBlockSyntax) is { } template && owner.SpanStart == template.Span.End && IsOnSingleLine(template, text)) { @@ -428,7 +404,7 @@ private static string PrependLines(string text, string newLine, int count) return builder.ToString(); } - private static void CleanupSourceMappingEnd(FormattingContext context, Range sourceMappingRange, List changes, bool newLineWasAddedAtStart) + private static void CleanupSourceMappingEnd(FormattingContext context, LinePositionSpan sourceMappingRange, ref PooledArrayBuilder changes, bool newLineWasAddedAtStart) { // // We look through every source mapping that intersects with the affected range and @@ -489,7 +465,7 @@ private static void CleanupSourceMappingEnd(FormattingContext context, Range sou if (owner is CSharpStatementLiteralSyntax && owner.NextSpan() is { } nextNode && - nextNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + nextNode.FirstAncestorOrSelf(static a => a is CSharpTemplateBlockSyntax) is { } template && template.SpanStart == owner.Span.End && IsOnSingleLine(template, text)) { @@ -535,19 +511,10 @@ private static void CleanupSourceMappingEnd(FormattingContext context, Range sou changes.Add(change); } - private static bool IsOnSingleLine(SyntaxNode node, SourceText text) + private static bool IsOnSingleLine(RazorSyntaxNode node, SourceText text) { var linePositionSpan = text.GetLinePositionSpan(node.Span); return linePositionSpan.Start.Line == linePositionSpan.End.Line; } - - private static TextEdit[] NormalizeTextEdits(SourceText originalText, TextEdit[] edits, out SourceText originalTextWithChanges) - { - var changes = edits.Select(originalText.GetTextChange); - originalTextWithChanges = originalText.WithChanges(changes); - var cleanChanges = SourceTextDiffer.GetMinimalTextChanges(originalText, originalTextWithChanges, DiffKind.Char); - var cleanEdits = cleanChanges.Select(originalText.GetTextEdit).ToArray(); - return cleanEdits; - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs new file mode 100644 index 00000000000..6e7c9470052 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs @@ -0,0 +1,55 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal sealed class FormattingContentValidationPass(ILoggerFactory loggerFactory) : IFormattingPass +{ + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + // Internal for testing. + internal bool DebugAssertsEnabled { get; set; } = true; + + public Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) + { + var text = context.SourceText; + var changedText = text.WithChanges(changes); + + if (!text.NonWhitespaceContentEquals(changedText)) + { + // Looks like we removed some non-whitespace content as part of formatting. Oops. + // Discard this formatting result. + + _logger.LogWarning($"{SR.Format_operation_changed_nonwhitespace}"); + + foreach (var change in changes) + { + if (change.NewText?.Any(c => !char.IsWhiteSpace(c)) ?? false) + { + _logger.LogWarning($"{SR.FormatEdit_at_adds(text.GetLinePositionSpan(change.Span), change.NewText)}"); + } + else if (text.TryGetFirstNonWhitespaceOffset(change.Span, out _)) + { + _logger.LogWarning($"{SR.FormatEdit_at_deletes(text.GetLinePositionSpan(change.Span), text.ToString(change.Span))}"); + } + } + + if (DebugAssertsEnabled) + { + Debug.Fail("A formatting result was rejected because it was going to change non-whitespace content in the document."); + } + + return Task.FromResult>([]); + } + + return Task.FromResult(changes); + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs similarity index 72% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs index 8f7cfda5c60..818cf7a70d2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs @@ -3,46 +3,29 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class FormattingDiagnosticValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) +internal sealed class FormattingDiagnosticValidationPass(ILoggerFactory loggerFactory) : IFormattingPass { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // We want this to run at the very end. - public override int Order => DefaultOrder + 1000; - - public override bool IsValidationPass => true; - // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) { - if (result.Kind != RazorLanguageKind.Razor) - { - // We don't care about changes to projected documents here. - return result; - } - var originalDiagnostics = context.CodeDocument.GetSyntaxTree().Diagnostics; var text = context.SourceText; - var edits = result.Edits; - var changes = edits.Select(text.GetTextChange); var changedText = text.WithChanges(changes); var changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); var changedDiagnostics = changedContext.CodeDocument.GetSyntaxTree().Diagnostics; @@ -72,10 +55,10 @@ public async override Task ExecuteAsync(FormattingContext cont Debug.Fail("A formatting result was rejected because the formatted text produced different diagnostics compared to the original text."); } - return new FormattingResult([]); + return []; } - return result; + return changes; } private class LocationIgnoringDiagnosticComparer : IEqualityComparer diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs new file mode 100644 index 00000000000..4cb84022a63 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Razor.Logging; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +/// +/// Gets edits in Razor files, and returns edits to Razor files, with nicely formatted Html +/// +internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) +{ +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs similarity index 76% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs index f522ea5790c..9f02ade9e7e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs @@ -2,98 +2,84 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class HtmlFormattingPass( - IDocumentMappingService documentMappingService, - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) +internal abstract class HtmlFormattingPassBase(ILogger logger) : IFormattingPass { - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); - private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + private readonly ILogger _logger = logger; - // We want this to run first because it uses the client HTML formatter. - public override int Order => DefaultOrder - 5; - - public override bool IsValidationPass => false; - - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public virtual async Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) { var originalText = context.SourceText; - TextEdit[] htmlEdits; - - if (context.IsFormatOnType && result.Kind == RazorLanguageKind.Html) - { - htmlEdits = await _htmlFormatter.FormatOnTypeAsync(context, cancellationToken).ConfigureAwait(false); - } - else if (!context.IsFormatOnType) - { - htmlEdits = await _htmlFormatter.FormatAsync(context, cancellationToken).ConfigureAwait(false); - } - else - { - // We don't want to handle on type formatting requests for other languages - return result; - } - var changedText = originalText; var changedContext = context; _logger.LogTestOnly($"Before HTML formatter:\r\n{changedText}"); - if (htmlEdits.Length > 0) + if (changes.Length > 0) { - var changes = htmlEdits.Select(originalText.GetTextChange); - changedText = originalText.WithChanges(changes); + var filteredChanges = FilterIncomingChanges(changedContext, changes); + + changedText = originalText.WithChanges(filteredChanges); // Create a new formatting context for the changed razor document. changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); _logger.LogTestOnly($"After normalizedEdits:\r\n{changedText}"); } - else if (context.IsFormatOnType) - { - // There are no HTML edits for us to apply. No op. - return new FormattingResult(htmlEdits); - } var indentationChanges = AdjustRazorIndentation(changedContext); - if (indentationChanges.Count > 0) + if (indentationChanges.Length > 0) { // Apply the edits that adjust indentation. changedText = changedText.WithChanges(indentationChanges); _logger.LogTestOnly($"After AdjustRazorIndentation:\r\n{changedText}"); } - var finalChanges = changedText.GetTextChanges(originalText); - var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); + return changedText.GetTextChangesArray(originalText); + } + + private static ImmutableArray FilterIncomingChanges(FormattingContext context, ImmutableArray changes) + { + var syntaxTree = context.CodeDocument.GetSyntaxTree(); + + using var changesToKeep = new PooledArrayBuilder(capacity: changes.Length); + + foreach (var change in changes) + { + // Don't keep changes that start inside of a razor comment block. + var comment = syntaxTree.Root.FindInnermostNode(change.Span.Start)?.FirstAncestorOrSelf(); + if (comment is not null) + { + continue; + } + + changesToKeep.Add(change); + } - return new FormattingResult(finalEdits); + return changesToKeep.DrainToImmutable(); } - private static List AdjustRazorIndentation(FormattingContext context) + private static ImmutableArray AdjustRazorIndentation(FormattingContext context) { // Assume HTML formatter has already run at this point and HTML is relatively indented correctly. // But HTML doesn't know about Razor blocks. // Our goal here is to indent each line according to the surrounding Razor blocks. var sourceText = context.SourceText; - var editsToApply = new List(); var indentations = context.GetIndentations(); + using var editsToApply = new PooledArrayBuilder(capacity: sourceText.Lines.Count); for (var i = 0; i < sourceText.Lines.Count; i++) { var line = sourceText.Lines[i]; @@ -199,7 +185,7 @@ private static List AdjustRazorIndentation(FormattingContext context } } - return editsToApply; + return editsToApply.DrainToImmutable(); } private static bool IsPartOfHtmlTag(FormattingContext context, int position) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs new file mode 100644 index 00000000000..f674efe183c --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs @@ -0,0 +1,28 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +/// +/// Gets edits in Html files, and returns edits to Razor files, with nicely formatted Html +/// +internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) +{ + public override Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) + { + if (changes.Length == 0) + { + // There are no HTML edits for us to apply. No op. + return SpecializedTasks.EmptyImmutableArray(); + } + + return base.ExecuteAsync(context, changes, cancellationToken); + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs similarity index 70% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 0fe7872f2d9..ae6af5f5406 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -1,48 +1,34 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; -using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; +using RazorRazorSyntaxNodeList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; +using RazorSyntaxNodeList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class RazorFormattingPass( - IDocumentMappingService documentMappingService, - RazorLSPOptionsMonitor optionsMonitor) - : FormattingPassBase(documentMappingService) +internal sealed class RazorFormattingPass : IFormattingPass { - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - - // Run after the C# formatter pass. - public override int Order => DefaultOrder - 4; - - public override bool IsValidationPass => false; - - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task> ExecuteAsync(FormattingContext context, ImmutableArray changes, CancellationToken cancellationToken) { - if (context.IsFormatOnType) - { - // We don't want to handle OnTypeFormatting here. - return result; - } - // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; var changedContext = context; - if (result.Edits.Length > 0) + if (changes.Length > 0) { - var changes = result.Edits.Select(originalText.GetTextChange).ToArray(); changedText = changedText.WithChanges(changes); changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); @@ -51,46 +37,42 @@ public async override Task ExecuteAsync(FormattingContext cont // Format the razor bits of the file var syntaxTree = changedContext.CodeDocument.GetSyntaxTree(); - var edits = FormatRazor(changedContext, syntaxTree); + var razorChanges = FormatRazor(changedContext, syntaxTree); // Compute the final combined set of edits - var formattingChanges = edits.Select(changedText.GetTextChange); - changedText = changedText.WithChanges(formattingChanges); - - var finalChanges = changedText.GetTextChanges(originalText); - var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); + changedText = changedText.WithChanges(razorChanges); - return new FormattingResult(finalEdits); + return changedText.GetTextChangesArray(originalText); } - private IEnumerable FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) + private static ImmutableArray FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) { - var edits = new List(); + using var changes = new PooledArrayBuilder(); var source = syntaxTree.Source; foreach (var node in syntaxTree.Root.DescendantNodes()) { // Disclaimer: CSharpCodeBlockSyntax is used a _lot_ in razor so these methods are probably // being overly careful to only try to format syntax forms they care about. - TryFormatCSharpBlockStructure(context, edits, source, node); - TryFormatSingleLineDirective(edits, source, node); - TryFormatBlocks(context, edits, source, node); + TryFormatCSharpBlockStructure(context, ref changes.AsRef(), source, node); + TryFormatSingleLineDirective(ref changes.AsRef(), node); + TryFormatBlocks(context, ref changes.AsRef(), source, node); } - return edits; + return changes.ToImmutable(); } - private static void TryFormatBlocks(FormattingContext context, List edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatBlocks(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // We only want to run one of these - _ = TryFormatFunctionsBlock(context, edits, source, node) || - TryFormatCSharpExplicitTransition(context, edits, source, node) || - TryFormatHtmlInCSharp(context, edits, source, node) || - TryFormatComplexCSharpBlock(context, edits, source, node) || - TryFormatSectionBlock(context, edits, source, node); + _ = TryFormatFunctionsBlock(context, ref changes, source, node) || + TryFormatCSharpExplicitTransition(context, ref changes, source, node) || + TryFormatHtmlInCSharp(context, ref changes, source, node) || + TryFormatComplexCSharpBlock(context, ref changes, source, node) || + TryFormatSectionBlock(context, ref changes, source, node); } - private static bool TryFormatSectionBlock(FormattingContext context, List edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatSectionBlock(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // @section Goo { // } @@ -109,16 +91,15 @@ directiveCode.Children is [RazorDirectiveSyntax directive] && if (TryGetWhitespace(children, out var whitespaceBeforeSectionName, out var whitespaceAfterSectionName)) { // For whitespace we normalize it differently depending on if its multi-line or not - FormatWhitespaceBetweenDirectiveAndBrace(whitespaceBeforeSectionName, directive, edits, source, context, forceNewLine: false); - FormatWhitespaceBetweenDirectiveAndBrace(whitespaceAfterSectionName, directive, edits, source, context, forceNewLine: false); + FormatWhitespaceBetweenDirectiveAndBrace(whitespaceBeforeSectionName, directive, ref changes, source, context, forceNewLine: false); + FormatWhitespaceBetweenDirectiveAndBrace(whitespaceAfterSectionName, directive, ref changes, source, context, forceNewLine: false); return true; } else if (children.TryGetOpenBraceToken(out var brace)) { // If there is no whitespace at all we normalize to a single space - var edit = VsLspFactory.CreateTextEdit(brace.GetRange(source).Start, " "); - edits.Add(edit); + changes.Add(new TextChange(new TextSpan(brace.SpanStart, 0), " ")); return true; } @@ -126,7 +107,7 @@ directiveCode.Children is [RazorDirectiveSyntax directive] && return false; - static bool TryGetWhitespace(SyntaxList children, [NotNullWhen(true)] out CSharpStatementLiteralSyntax? whitespaceBeforeSectionName, [NotNullWhen(true)] out UnclassifiedTextLiteralSyntax? whitespaceAfterSectionName) + static bool TryGetWhitespace(RazorRazorSyntaxNodeList children, [NotNullWhen(true)] out CSharpStatementLiteralSyntax? whitespaceBeforeSectionName, [NotNullWhen(true)] out UnclassifiedTextLiteralSyntax? whitespaceAfterSectionName) { // If there is whitespace between the directive and the section name, and the section name and the brace, they will be in the first child // and third child of the 6 total children @@ -147,7 +128,7 @@ children[2] is UnclassifiedTextLiteralSyntax after && } } - private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatFunctionsBlock(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // @functions // { @@ -179,13 +160,13 @@ private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatCSharpExplicitTransition(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -200,13 +181,13 @@ private static bool TryFormatCSharpExplicitTransition(FormattingContext context, var codeNode = csharpStatementBody.CSharpCode; var closeBraceNode = csharpStatementBody.CloseBrace; - return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, edits); + return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, ref changes); } return false; } - private static bool TryFormatComplexCSharpBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatComplexCSharpBlock(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // complex situations like // @{ @@ -222,13 +203,13 @@ csharpRazorBlock.Parent is CSharpCodeBlockSyntax innerCodeBlock && var openBraceNode = outerCodeBlock.Children.PreviousSiblingOrSelf(innerCodeBlock); var closeBraceNode = outerCodeBlock.Children.NextSiblingOrSelf(innerCodeBlock); - return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, edits); + return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, ref changes); } return false; } - private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatHtmlInCSharp(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // void Method() // { @@ -240,13 +221,13 @@ private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatCSharpBlockStructure(FormattingContext context, ref PooledArrayBuilder changes, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -266,7 +247,7 @@ private void TryFormatCSharpBlockStructure(FormattingContext context, List children, [NotNullWhen(true)] out UnclassifiedTextLiteralSyntax? whitespace) + static bool TryGetLeadingWhitespace(RazorRazorSyntaxNodeList children, [NotNullWhen(true)] out UnclassifiedTextLiteralSyntax? whitespace) { // If there is whitespace between the directive and the brace, it will be in the first child // of the 4 total children @@ -306,7 +285,7 @@ children[0] is UnclassifiedTextLiteralSyntax literal && } } - private static void TryFormatSingleLineDirective(List edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatSingleLineDirective(ref PooledArrayBuilder changes, RazorSyntaxNode node) { // Looking for single line directives like // @@ -322,12 +301,12 @@ private static void TryFormatSingleLineDirective(List edits, RazorSour { if (child.ContainsOnlyWhitespace(includingNewLines: false)) { - ShrinkToSingleSpace(child, edits, source); + ShrinkToSingleSpace(child, ref changes); } } } - static bool IsSingleLineDirective(SyntaxNode node, out SyntaxList children) + static bool IsSingleLineDirective(RazorSyntaxNode node, out RazorSyntaxNodeList children) { if (node is CSharpCodeBlockSyntax content && node.Parent?.Parent is RazorDirectiveSyntax directive && @@ -342,45 +321,43 @@ static bool IsSingleLineDirective(SyntaxNode node, out SyntaxList ch } } - private static void FormatWhitespaceBetweenDirectiveAndBrace(SyntaxNode node, RazorDirectiveSyntax directive, List edits, RazorSourceDocument source, FormattingContext context, bool forceNewLine) + private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, ref PooledArrayBuilder changes, RazorSourceDocument source, FormattingContext context, bool forceNewLine) { if (node.ContainsOnlyWhitespace(includingNewLines: false) && !forceNewLine) { - ShrinkToSingleSpace(node, edits, source); + ShrinkToSingleSpace(node, ref changes); } else { // If there is a newline then we want to have just one newline after the directive // and indent the { to match the @ - var edit = VsLspFactory.CreateTextEdit( - node.GetRange(source), - context.NewLineString + FormattingUtilities.GetIndentationString( - directive.GetLinePositionSpan(source).Start.Character, context.Options.InsertSpaces, context.Options.TabSize)); + var newText = context.NewLineString + FormattingUtilities.GetIndentationString( + directive.GetLinePositionSpan(source).Start.Character, context.Options.InsertSpaces, context.Options.TabSize); - edits.Add(edit); + changes.Add(new TextChange(node.Span, newText)); } } - private static void ShrinkToSingleSpace(SyntaxNode node, List edits, RazorSourceDocument source) + private static void ShrinkToSingleSpace(RazorSyntaxNode node, ref PooledArrayBuilder changes) { // If there is anything other than one single space then we replace with one space between directive and brace. // // ie, "@code {" will become "@code {" - var edit = VsLspFactory.CreateTextEdit(node.GetRange(source), " "); - edits.Add(edit); + changes.Add(new TextChange(node.Span, " ")); } - private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, SyntaxNode? directiveNode, SyntaxNode openBraceNode, SyntaxNode codeNode, SyntaxNode closeBraceNode, IList edits) + private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, ref PooledArrayBuilder changes) { var didFormat = false; - var openBraceRange = openBraceNode.GetRangeWithoutWhitespace(source); - var codeRange = codeNode.GetRangeWithoutWhitespace(source); + if (!codeNode.TryGetLinePositionSpanWithoutWhitespace(source, out var codeRange)) + { + return didFormat; + } - if (openBraceRange is not null && - codeRange is not null && + if (openBraceNode.TryGetLinePositionSpanWithoutWhitespace(source, out var openBraceRange) && openBraceRange.End.Line == codeRange.Start.Line && - !RangeHasBeenModified(edits, codeRange)) + !RangeHasBeenModified(ref changes, source.Text, codeRange)) { var additionalIndentationLevel = GetAdditionalIndentationLevel(context, openBraceRange, openBraceNode, codeNode); var newText = context.NewLineString; @@ -389,49 +366,46 @@ codeRange is not null && newText += FormattingUtilities.GetIndentationString(additionalIndentationLevel, context.Options.InsertSpaces, context.Options.TabSize); } - var edit = VsLspFactory.CreateTextEdit(openBraceRange.End, newText); - edits.Add(edit); + changes.Add(new TextChange(source.Text.GetTextSpan(openBraceRange.End, openBraceRange.End), newText)); didFormat = true; } - var closeBraceRange = closeBraceNode.GetRangeWithoutWhitespace(source); - if (codeRange is not null && - closeBraceRange is not null && - !RangeHasBeenModified(edits, codeRange)) + if (closeBraceNode.TryGetLinePositionSpanWithoutWhitespace(source, out var closeBraceRange) && + !RangeHasBeenModified(ref changes, source.Text, codeRange)) { if (directiveNode is not null && directiveNode.GetRange(source).Start.Character < closeBraceRange.Start.Character) { // If we have a directive, then we line the close brace up with it, and ensure // there is a close brace - var edit = VsLspFactory.CreateTextEdit(start: codeRange.End, end: closeBraceRange.Start, - context.NewLineString + FormattingUtilities.GetIndentationString( - directiveNode.GetRange(source).Start.Character, context.Options.InsertSpaces, context.Options.TabSize)); + var span = new LinePositionSpan(codeRange.End, closeBraceRange.Start); + var newText = context.NewLineString + FormattingUtilities.GetIndentationString( + directiveNode.GetRange(source).Start.Character, context.Options.InsertSpaces, context.Options.TabSize); - edits.Add(edit); + changes.Add(new TextChange(source.Text.GetTextSpan(span), newText)); didFormat = true; } else if (codeRange.End.Line == closeBraceRange.Start.Line) { // Add a Newline between the content and the "}" if one doesn't already exist. - var edit = VsLspFactory.CreateTextEdit(codeRange.End, context.NewLineString); - edits.Add(edit); + changes.Add(new TextChange(source.Text.GetTextSpan(codeRange.End, codeRange.End), context.NewLineString)); didFormat = true; } } return didFormat; - static bool RangeHasBeenModified(IList edits, Range range) + static bool RangeHasBeenModified(ref readonly PooledArrayBuilder changes, SourceText sourceText, LinePositionSpan span) { // Because we don't always know what kind of Razor object we're operating on we have to do this to avoid duplicate edits. // The other way to accomplish this would be to apply the edits after every node and function, but that's not in scope for my current work. - var hasBeenModified = edits.Any(e => e.Range.End == range.End); + var endIndex = sourceText.GetRequiredAbsoluteIndex(span.End); + var hasBeenModified = changes.Any(e => e.Span.End == endIndex); return hasBeenModified; } - static int GetAdditionalIndentationLevel(FormattingContext context, Range range, SyntaxNode openBraceNode, SyntaxNode codeNode) + static int GetAdditionalIndentationLevel(FormattingContext context, LinePositionSpan range, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode) { if (!context.TryGetIndentationLevel(codeNode.Position, out var desiredIndentationLevel)) { @@ -446,7 +420,7 @@ static int GetAdditionalIndentationLevel(FormattingContext context, Range range, return desiredIndentationOffset - currentIndentationOffset; - static int GetLeadingWhitespaceLength(SyntaxNode node, FormattingContext context) + static int GetLeadingWhitespaceLength(RazorSyntaxNode node, FormattingContext context) { var tokens = node.GetTokens(); var whitespaceLength = 0; @@ -478,7 +452,7 @@ static int GetLeadingWhitespaceLength(SyntaxNode node, FormattingContext context return whitespaceLength; } - static int GetTrailingWhitespaceLength(SyntaxNode node, FormattingContext context) + static int GetTrailingWhitespaceLength(RazorSyntaxNode node, FormattingContext context) { var tokens = node.GetTokens(); var whitespaceLength = 0; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs new file mode 100644 index 00000000000..6014d3ab78c --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -0,0 +1,47 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Runtime.Serialization; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using RoslynFormattingOptions = Roslyn.LanguageServer.Protocol.FormattingOptions; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +[DataContract] +internal readonly record struct RazorFormattingOptions +{ + [DataMember(Order = 0)] + public bool InsertSpaces { get; init; } = true; + [DataMember(Order = 1)] + public int TabSize { get; init; } = 4; + [DataMember(Order = 2)] + public bool CodeBlockBraceOnNextLine { get; init; } = false; + + public RazorFormattingOptions() + { + } + + public static RazorFormattingOptions From(FormattingOptions options, bool codeBlockBraceOnNextLine) + { + return new RazorFormattingOptions() + { + InsertSpaces = options.InsertSpaces, + TabSize = options.TabSize, + CodeBlockBraceOnNextLine = codeBlockBraceOnNextLine + }; + } + + public RazorIndentationOptions ToIndentationOptions() + => new( + UseTabs: !InsertSpaces, + TabSize: TabSize, + IndentationSize: TabSize); + + public RoslynFormattingOptions ToRoslynFormattingOptions() + => new RoslynFormattingOptions() + { + InsertSpaces = InsertSpaces, + TabSize = TabSize + }; +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs new file mode 100644 index 00000000000..23110dab756 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -0,0 +1,326 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Frozen; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal class RazorFormattingService : IRazorFormattingService +{ + public static readonly string FirstTriggerCharacter = "}"; + public static readonly ImmutableArray MoreTriggerCharacters = [";", "\n", "{"]; + public static readonly FrozenSet AllTriggerCharacterSet = FrozenSet.ToFrozenSet([FirstTriggerCharacter, .. MoreTriggerCharacters], StringComparer.Ordinal); + + private static readonly FrozenSet s_csharpTriggerCharacterSet = FrozenSet.ToFrozenSet(["}", ";"], StringComparer.Ordinal); + private static readonly FrozenSet s_htmlTriggerCharacterSet = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"], StringComparer.Ordinal); + + private readonly IFormattingCodeDocumentProvider _codeDocumentProvider; + + private readonly ImmutableArray _documentFormattingPasses; + private readonly ImmutableArray _validationPasses; + private readonly CSharpOnTypeFormattingPass _csharpOnTypeFormattingPass; + private readonly HtmlOnTypeFormattingPass _htmlOnTypeFormattingPass; + + public RazorFormattingService( + IFormattingCodeDocumentProvider codeDocumentProvider, + IDocumentMappingService documentMappingService, + IHostServicesProvider hostServicesProvider, + ILoggerFactory loggerFactory) + { + _codeDocumentProvider = codeDocumentProvider; + + _htmlOnTypeFormattingPass = new HtmlOnTypeFormattingPass(loggerFactory); + _csharpOnTypeFormattingPass = new CSharpOnTypeFormattingPass(documentMappingService, hostServicesProvider, loggerFactory); + _validationPasses = + [ + new FormattingDiagnosticValidationPass(loggerFactory), + new FormattingContentValidationPass(loggerFactory) + ]; + _documentFormattingPasses = + [ + new HtmlFormattingPass(loggerFactory), + new RazorFormattingPass(), + new CSharpFormattingPass(documentMappingService, hostServicesProvider, loggerFactory), + .. _validationPasses + ]; + } + + public async Task> GetDocumentFormattingChangesAsync( + DocumentContext documentContext, + ImmutableArray htmlChanges, + LinePositionSpan? range, + RazorFormattingOptions options, + CancellationToken cancellationToken) + { + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(documentContext.Snapshot).ConfigureAwait(false); + + // Range formatting happens on every paste, and if there are Razor diagnostics in the file + // that can make some very bad results. eg, given: + // + // | + // @code { + // } + // + // When pasting " d.Span != SourceSpan.Undefined && span.OverlapsWith(sourceText.GetLinePositionSpan(d.Span)))) + { + return []; + } + } + + var uri = documentContext.Uri; + var documentSnapshot = documentContext.Snapshot; + var hostDocumentVersion = documentContext.Snapshot.Version; + var context = FormattingContext.Create( + documentSnapshot, + codeDocument, + options, + _codeDocumentProvider); + var originalText = context.SourceText; + + var result = htmlChanges; + foreach (var pass in _documentFormattingPasses) + { + cancellationToken.ThrowIfCancellationRequested(); + result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); + } + + var filteredChanges = range is not { } linePositionSpan + ? result + : result.Where(e => linePositionSpan.LineOverlapsWith(sourceText.GetLinePositionSpan(e.Span))).ToImmutableArray(); + + var normalizedChanges = NormalizeLineEndings(originalText, filteredChanges); + return originalText.MinimizeTextChanges(normalizedChanges); + } + + public Task> GetCSharpOnTypeFormattingChangesAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + => ApplyFormattedChangesAsync( + documentContext, + generatedDocumentChanges: [], + options, + hostDocumentIndex, + triggerCharacter, + [_csharpOnTypeFormattingPass, .. _validationPasses], + collapseChanges: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken); + + public Task> GetHtmlOnTypeFormattingChangesAsync(DocumentContext documentContext, ImmutableArray htmlChanges, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + => ApplyFormattedChangesAsync( + documentContext, + htmlChanges, + options, + hostDocumentIndex, + triggerCharacter, + [_htmlOnTypeFormattingPass, .. _validationPasses], + collapseChanges: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken); + + public async Task TryGetSingleCSharpEditAsync(DocumentContext documentContext, TextChange csharpEdit, RazorFormattingOptions options, CancellationToken cancellationToken) + { + var razorChanges = await ApplyFormattedChangesAsync( + documentContext, + [csharpEdit], + options, + hostDocumentIndex: 0, + triggerCharacter: '\0', + [_csharpOnTypeFormattingPass, .. _validationPasses], + collapseChanges: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken).ConfigureAwait(false); + return razorChanges.SingleOrDefault(); + } + + public async Task TryGetCSharpCodeActionEditAsync(DocumentContext documentContext, ImmutableArray csharpChanges, RazorFormattingOptions options, CancellationToken cancellationToken) + { + var razorChanges = await ApplyFormattedChangesAsync( + documentContext, + csharpChanges, + options, + hostDocumentIndex: 0, + triggerCharacter: '\0', + [_csharpOnTypeFormattingPass], + collapseChanges: true, + automaticallyAddUsings: true, + cancellationToken: cancellationToken).ConfigureAwait(false); + return razorChanges.SingleOrDefault(); + } + + public async Task TryGetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, ImmutableArray csharpChanges, RazorFormattingOptions options, CancellationToken cancellationToken) + { + csharpChanges = WrapCSharpSnippets(csharpChanges); + + var razorChanges = await ApplyFormattedChangesAsync( + documentContext, + csharpChanges, + options, + hostDocumentIndex: 0, + triggerCharacter: '\0', + [_csharpOnTypeFormattingPass], + collapseChanges: true, + automaticallyAddUsings: false, + cancellationToken: cancellationToken).ConfigureAwait(false); + + razorChanges = UnwrapCSharpSnippets(razorChanges); + + return razorChanges.SingleOrDefault(); + } + + public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) + { + triggerCharacterKind = codeDocument.GetLanguageKind(hostDocumentIndex, rightAssociative: false); + + return triggerCharacterKind switch + { + RazorLanguageKind.CSharp => s_csharpTriggerCharacterSet.Contains(triggerCharacter), + RazorLanguageKind.Html => s_htmlTriggerCharacterSet.Contains(triggerCharacter), + _ => false, + }; + } + + private async Task> ApplyFormattedChangesAsync( + DocumentContext documentContext, + ImmutableArray generatedDocumentChanges, + RazorFormattingOptions options, + int hostDocumentIndex, + char triggerCharacter, + ImmutableArray formattingPasses, + bool collapseChanges, + bool automaticallyAddUsings, + CancellationToken cancellationToken) + { + // If we only received a single edit, let's always return a single edit back. + // Otherwise, merge only if explicitly asked. + collapseChanges |= generatedDocumentChanges.Length == 1; + + var documentSnapshot = documentContext.Snapshot; + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(documentSnapshot).ConfigureAwait(false); + var context = FormattingContext.CreateForOnTypeFormatting( + documentSnapshot, + codeDocument, + options, + _codeDocumentProvider, + automaticallyAddUsings, + hostDocumentIndex, + triggerCharacter); + var result = generatedDocumentChanges; + + foreach (var pass in formattingPasses) + { + cancellationToken.ThrowIfCancellationRequested(); + result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); + } + + var originalText = context.SourceText; + var razorChanges = originalText.MinimizeTextChanges(result); + + if (collapseChanges) + { + var collapsedEdit = MergeChanges(razorChanges, originalText); + if (collapsedEdit.NewText is null or { Length: 0 } && + collapsedEdit.Span.IsEmpty) + { + return []; + } + + return [collapsedEdit]; + } + + return razorChanges; + } + + // Internal for testing + internal static TextChange MergeChanges(ImmutableArray changes, SourceText sourceText) + { + if (changes.Length == 1) + { + return changes[0]; + } + + var changedText = sourceText.WithChanges(changes); + var affectedRange = changedText.GetEncompassingTextChangeRange(sourceText); + var spanBeforeChange = affectedRange.Span; + var spanAfterChange = new TextSpan(spanBeforeChange.Start, affectedRange.NewLength); + var newText = changedText.GetSubTextString(spanAfterChange); + + return new TextChange(spanBeforeChange, newText); + } + + private static ImmutableArray WrapCSharpSnippets(ImmutableArray csharpChanges) + { + // Currently this method only supports wrapping `$0`, any additional markers aren't formatted properly. + + return ReplaceInChanges(csharpChanges, "$0", "/*$0*/"); + } + + private static ImmutableArray UnwrapCSharpSnippets(ImmutableArray razorChanges) + { + return ReplaceInChanges(razorChanges, "/*$0*/", "$0"); + } + + /// + /// This method counts the occurrences of CRLF and LF line endings in the original text. + /// If LF line endings are more prevalent, it removes any CR characters from the text changes + /// to ensure consistency with the LF style. + /// + private static ImmutableArray NormalizeLineEndings(SourceText originalText, ImmutableArray changes) + { + if (originalText.HasLFLineEndings()) + { + return ReplaceInChanges(changes, "\r", ""); + } + + return changes; + } + + private static ImmutableArray ReplaceInChanges(ImmutableArray csharpChanges, string toFind, string replacement) + { + using var changes = new PooledArrayBuilder(csharpChanges.Length); + foreach (var change in csharpChanges) + { + if (change.NewText is not { } newText || + newText.IndexOf(toFind) == -1) + { + changes.Add(change); + continue; + } + + // Formatting doesn't work with syntax errors caused by the cursor marker ($0). + // So, let's avoid the error by wrapping the cursor marker in a comment. + changes.Add(new(change.Span, newText.Replace(toFind, replacement))); + } + + return changes.DrainToImmutable(); + } + + internal static class TestAccessor + { + public static FrozenSet GetCSharpTriggerCharacterSet() => s_csharpTriggerCharacterSet; + public static FrozenSet GetHtmlTriggerCharacterSet() => s_htmlTriggerCharacterSet; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/AbstractRazorComponentDefinitionService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/AbstractRazorComponentDefinitionService.cs new file mode 100644 index 00000000000..789d1fbdc05 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/AbstractRazorComponentDefinitionService.cs @@ -0,0 +1,88 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using LspLocation = Microsoft.VisualStudio.LanguageServer.Protocol.Location; +using LspRange = Microsoft.VisualStudio.LanguageServer.Protocol.Range; + +namespace Microsoft.CodeAnalysis.Razor.GoToDefinition; + +internal abstract class AbstractRazorComponentDefinitionService( + IRazorComponentSearchEngine componentSearchEngine, + IDocumentMappingService documentMappingService, + ILogger logger) : IRazorComponentDefinitionService +{ + private readonly IRazorComponentSearchEngine _componentSearchEngine = componentSearchEngine; + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly ILogger _logger = logger; + + public async Task GetDefinitionAsync(IDocumentSnapshot documentSnapshot, DocumentPositionInfo positionInfo, bool ignoreAttributes, CancellationToken cancellationToken) + { + // If we're in C# then there is no point checking for a component tag, because there won't be one + if (positionInfo.LanguageKind == RazorLanguageKind.CSharp) + { + return null; + } + + if (!FileKinds.IsComponent(documentSnapshot.FileKind)) + { + _logger.LogInformation($"'{documentSnapshot.FileKind}' is not a component type."); + return null; + } + + var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); + + if (!RazorComponentDefinitionHelpers.TryGetBoundTagHelpers(codeDocument, positionInfo.HostDocumentIndex, ignoreAttributes, _logger, out var boundTagHelper, out var boundAttribute)) + { + _logger.LogInformation($"Could not retrieve bound tag helper information."); + return null; + } + + var componentDocument = await _componentSearchEngine.TryLocateComponentAsync(documentSnapshot, boundTagHelper).ConfigureAwait(false); + if (componentDocument is null) + { + _logger.LogInformation($"Could not locate component document."); + return null; + } + + var componentFilePath = componentDocument.FilePath.AssumeNotNull(); + + _logger.LogInformation($"Definition found at file path: {componentFilePath}"); + + var range = await GetNavigateRangeAsync(componentDocument, boundAttribute, cancellationToken).ConfigureAwait(false); + + return VsLspFactory.CreateLocation(componentFilePath, range); + } + + private async Task GetNavigateRangeAsync(IDocumentSnapshot documentSnapshot, BoundAttributeDescriptor? attributeDescriptor, CancellationToken cancellationToken) + { + if (attributeDescriptor is not null) + { + _logger.LogInformation($"Attempting to get definition from an attribute directly."); + + var range = await RazorComponentDefinitionHelpers + .TryGetPropertyRangeAsync(documentSnapshot, attributeDescriptor.GetPropertyName(), _documentMappingService, _logger, cancellationToken) + .ConfigureAwait(false); + + if (range is not null) + { + return range; + } + } + + // When navigating from a start or end tag, we just take the user to the top of the file. + // If we were trying to navigate to a property, and we couldn't find it, we can at least take + // them to the file for the component. If the property was defined in a partial class they can + // at least then press F7 to go there. + return VsLspFactory.DefaultRange; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/IRazorComponentDefinitionService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/IRazorComponentDefinitionService.cs new file mode 100644 index 00000000000..86ebf62d35f --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/IRazorComponentDefinitionService.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using LspLocation = Microsoft.VisualStudio.LanguageServer.Protocol.Location; + +namespace Microsoft.CodeAnalysis.Razor.GoToDefinition; + +/// +/// Go to Definition support for Razor components. +/// +internal interface IRazorComponentDefinitionService +{ + Task GetDefinitionAsync(IDocumentSnapshot documentSnapshot, DocumentPositionInfo positionInfo, bool ignoreAttributes, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/RazorComponentDefinitionHelpers.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/RazorComponentDefinitionHelpers.cs new file mode 100644 index 00000000000..8d5352dc20c --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/GoToDefinition/RazorComponentDefinitionHelpers.cs @@ -0,0 +1,203 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using LspRange = Microsoft.VisualStudio.LanguageServer.Protocol.Range; +using RazorSyntaxKind = Microsoft.AspNetCore.Razor.Language.SyntaxKind; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; +using RazorSyntaxToken = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxToken; + +namespace Microsoft.CodeAnalysis.Razor.GoToDefinition; + +internal static class RazorComponentDefinitionHelpers +{ + public static bool TryGetBoundTagHelpers( + RazorCodeDocument codeDocument, int absoluteIndex, bool ignoreAttributes, ILogger logger, + [NotNullWhen(true)] out TagHelperDescriptor? boundTagHelper, + [MaybeNullWhen(true)] out BoundAttributeDescriptor? boundAttribute) + { + boundTagHelper = null; + boundAttribute = null; + + var syntaxTree = codeDocument.GetSyntaxTree(); + + var innermostNode = syntaxTree.Root.FindInnermostNode(absoluteIndex); + if (innermostNode is null) + { + logger.LogInformation($"Could not locate innermost node at index, {absoluteIndex}."); + return false; + } + + var tagHelperNode = innermostNode.FirstAncestorOrSelf(IsTagHelperNode); + if (tagHelperNode is null) + { + logger.LogInformation($"Could not locate ancestor of type MarkupTagHelperStartTag or MarkupTagHelperEndTag."); + return false; + } + + if (!TryGetTagName(tagHelperNode, out var tagName)) + { + logger.LogInformation($"Could not retrieve name of start or end tag."); + return false; + } + + var nameSpan = tagName.Span; + string? propertyName = null; + + if (!ignoreAttributes && tagHelperNode is MarkupTagHelperStartTagSyntax startTag) + { + // Include attributes where the end index also matches, since GetSyntaxNodeAsync will consider that the start tag but we behave + // as if the user wants to go to the attribute definition. + // ie: + var selectedAttribute = startTag.Attributes.FirstOrDefault(a => a.Span.Contains(absoluteIndex) || a.Span.End == absoluteIndex); + + // If we're on an attribute then just validate against the attribute name + switch (selectedAttribute) + { + case MarkupTagHelperAttributeSyntax attribute: + // Normal attribute, ie + nameSpan = attribute.Name.Span; + propertyName = attribute.TagHelperAttributeInfo.Name; + break; + + case MarkupMinimizedTagHelperAttributeSyntax minimizedAttribute: + // Minimized attribute, ie + nameSpan = minimizedAttribute.Name.Span; + propertyName = minimizedAttribute.TagHelperAttributeInfo.Name; + break; + } + } + + if (!nameSpan.IntersectsWith(absoluteIndex)) + { + logger.LogInformation($"Tag name or attributes' span does not intersect with index, {absoluteIndex}."); + return false; + } + + if (tagHelperNode.Parent is not MarkupTagHelperElementSyntax tagHelperElement) + { + logger.LogInformation($"Parent of start or end tag is not a MarkupTagHelperElement."); + return false; + } + + if (tagHelperElement.TagHelperInfo?.BindingResult is not TagHelperBinding binding) + { + logger.LogInformation($"MarkupTagHelperElement does not contain TagHelperInfo."); + return false; + } + + boundTagHelper = binding.Descriptors.FirstOrDefault(static d => !d.IsAttributeDescriptor()); + if (boundTagHelper is null) + { + logger.LogInformation($"Could not locate bound TagHelperDescriptor."); + return false; + } + + boundAttribute = propertyName is not null + ? boundTagHelper.BoundAttributes.FirstOrDefault(a => a.Name?.Equals(propertyName, StringComparison.Ordinal) == true) + : null; + + return true; + + static bool IsTagHelperNode(RazorSyntaxNode node) + { + return node.Kind is RazorSyntaxKind.MarkupTagHelperStartTag or RazorSyntaxKind.MarkupTagHelperEndTag; + } + + static bool TryGetTagName(RazorSyntaxNode node, [NotNullWhen(true)] out RazorSyntaxToken? tagName) + { + tagName = node switch + { + MarkupTagHelperStartTagSyntax tagHelperStartTag => tagHelperStartTag.Name, + MarkupTagHelperEndTagSyntax tagHelperEndTag => tagHelperEndTag.Name, + _ => null + }; + + return tagName is not null; + } + } + + public static async Task TryGetPropertyRangeAsync( + IDocumentSnapshot documentSnapshot, + string propertyName, + IDocumentMappingService documentMappingService, + ILogger logger, + CancellationToken cancellationToken) + { + // Process the C# tree and find the property that matches the name. + // We don't worry about parameter attributes here for two main reasons: + // 1. We don't have symbolic information, so the best we could do would be checking for any + // attribute named Parameter, regardless of which namespace. It also means we would have + // to do more checks for all of the various ways that the attribute could be specified + // (eg fully qualified, aliased, etc.) + // 2. Since C# doesn't allow multiple properties with the same name, and we're doing a case + // sensitive search, we know the property we find is the one the user is trying to encode in a + // tag helper attribute. If they don't have the [Parameter] attribute then the Razor compiler + // will error, but allowing them to Go To Def on that property regardless, actually helps + // them fix the error. + + var csharpSyntaxTree = await documentSnapshot.GetCSharpSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + var root = await csharpSyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); + var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); + + // Since we know how the compiler generates the C# source we can be a little specific here, and avoid + // long tree walks. If the compiler ever changes how they generate their code, the tests for this will break + // so we'll know about it. + if (TryGetClassDeclaration(root, out var classDeclaration)) + { + var property = classDeclaration + .Members + .OfType() + .Where(p => p.Identifier.ValueText.Equals(propertyName, StringComparison.Ordinal)) + .FirstOrDefault(); + + if (property is null) + { + // The property probably exists in a partial class + logger.LogInformation($"Could not find property in the generated source. Comes from partial?"); + return null; + } + + var csharpText = codeDocument.GetCSharpSourceText(); + var range = csharpText.GetRange(property.Identifier.Span); + if (documentMappingService.TryMapToHostDocumentRange(codeDocument.GetCSharpDocument(), range, out var originalRange)) + { + return originalRange; + } + + logger.LogInformation($"Property found but couldn't map its location."); + } + + logger.LogInformation($"Generated C# was not in expected shape (CompilationUnit [-> Namespace] -> Class)"); + + return null; + + static bool TryGetClassDeclaration(SyntaxNode root, [NotNullWhen(true)] out ClassDeclarationSyntax? classDeclaration) + { + classDeclaration = root switch + { + CompilationUnitSyntax unit => unit switch + { + { Members: [NamespaceDeclarationSyntax { Members: [ClassDeclarationSyntax c, ..] }, ..] } => c, + { Members: [ClassDeclarationSyntax c, ..] } => c, + _ => null, + }, + _ => null, + }; + + return classDeclaration is not null; + } + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/IHostServicesProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IHostServicesProvider.cs similarity index 81% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/IHostServicesProvider.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IHostServicesProvider.cs index ed7b2c2a24b..87860a9fd33 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/IHostServicesProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IHostServicesProvider.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis.Host; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +namespace Microsoft.CodeAnalysis.Razor.Workspaces; internal interface IHostServicesProvider { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs index 8f46e524a91..ced31bd8ea3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Logging/ILoggerExtensions.cs @@ -2,7 +2,10 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Text; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.CodeAnalysis.Razor.Logging; @@ -184,3 +187,56 @@ public static void LogCritical(this ILogger logger, string message) } } } + +internal static class ITestOnlyLoggerExtensions +{ + public static bool TestOnlyLoggingEnabled = false; + + [Conditional("DEBUG")] + public static void LogTestOnly(this ILogger logger, ref TestLogMessageInterpolatedStringHandler handler) + { + if (TestOnlyLoggingEnabled) + { + logger.Log(LogLevel.Debug, handler.ToString(), exception: null); + } + } +} + +[InterpolatedStringHandler] +internal ref struct TestLogMessageInterpolatedStringHandler +{ + private PooledObject _builder; + + public TestLogMessageInterpolatedStringHandler(int literalLength, int _, out bool isEnabled) + { + isEnabled = ITestOnlyLoggerExtensions.TestOnlyLoggingEnabled; + if (isEnabled) + { + _builder = StringBuilderPool.GetPooledObject(); + _builder.Object.EnsureCapacity(literalLength); + } + } + + public void AppendLiteral(string s) + { + _builder.Object.Append(s); + } + + public void AppendFormatted(T t) + { + _builder.Object.Append(t?.ToString() ?? "[null]"); + } + + public void AppendFormatted(T t, string format) + { + _builder.Object.AppendFormat(format, t); + } + + public override string ToString() + { + var result = _builder.Object.ToString(); + _builder.Dispose(); + return result; + } +} + diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj index e47366a1ae2..dd983e0656d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj @@ -5,7 +5,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure. false false - true + true false diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj index d616ecdca89..bbee7f242dc 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj @@ -18,7 +18,7 @@ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - true + true false true @@ -44,7 +44,7 @@ - + diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs index acb9099758a..6c9708a4f60 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs @@ -64,8 +64,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke container.AddService(typeof(RazorLanguageService), (container, type) => { var componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel)); - var breakpointResolver = componentModel.GetService(); - var proximityExpressionResolver = componentModel.GetService(); + var breakpointResolver = componentModel.GetService(); + var proximityExpressionResolver = componentModel.GetService(); var uiThreadOperationExecutor = componentModel.GetService(); var editorAdaptersFactory = componentModel.GetService(); var lspServerActivationTracker = componentModel.GetService(); diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Snippets/SnippetService.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Snippets/SnippetService.cs index ded3433d909..c05789c9698 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Snippets/SnippetService.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/Snippets/SnippetService.cs @@ -29,8 +29,6 @@ internal class SnippetService private readonly IAdvancedSettingsStorage _advancedSettingsStorage; private IVsExpansionManager? _vsExpansionManager; - private readonly object _cacheGuard = new(); - private static readonly Guid s_CSharpLanguageId = new("694dd9b6-b865-4c5b-ad85-86356e9c88dc"); private static readonly Guid s_HtmlLanguageId = new("9bbfd173-9770-47dc-b191-651b7ff493cd"); diff --git a/src/Razor/test/Directory.Build.props b/src/Razor/test/Directory.Build.props index a0207c093ee..0b4ec55df46 100644 --- a/src/Razor/test/Directory.Build.props +++ b/src/Razor/test/Directory.Build.props @@ -2,7 +2,7 @@ - true + true $(DefaultNetCoreTargetFrameworks) $(DeveloperBuildTestTfms) $(StandardTestTfms) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace.Test/RazorProjectInfoSerializerTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace.Test/RazorProjectInfoSerializerTest.cs index 465d490de1f..0b5ea2a7a73 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace.Test/RazorProjectInfoSerializerTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.ExternalAccess.RoslynWorkspace.Test/RazorProjectInfoSerializerTest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Utilities; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs index 0e806675535..3eba6dff3fd 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs @@ -3,8 +3,8 @@ using System; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Xunit; using Xunit.Abstractions; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; @@ -13,8 +13,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; public class AutoClosingTagOnAutoInsertProviderTest(ITestOutputHelper testOutput) : RazorOnAutoInsertProviderTestBase(testOutput) { - private RazorLSPOptions Options { get; set; } = RazorLSPOptions.Default; - private static TagHelperDescriptor CatchAllTagHelper { get @@ -104,19 +102,18 @@ private static TagHelperDescriptor WithoutEndTagTagHelper public void OnTypeCloseAngle_ConflictingAutoClosingBehaviorsChoosesMostSpecific() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly - -$$ -", -expected: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper, CatchAllTagHelper }); + $$ + """, + expected: """ + @addTagHelper *, TestAssembly + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper, CatchAllTagHelper }); } [Fact] @@ -124,18 +121,18 @@ public void OnTypeCloseAngle_ConflictingAutoClosingBehaviorsChoosesMostSpecific( public void OnTypeCloseAngle_TagHelperAlreadyHasEndTag() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -143,18 +140,18 @@ public void OnTypeCloseAngle_TagHelperAlreadyHasEndTag() public void OnTypeCloseAngle_VoidTagHelperHasEndTag_ShouldStillAutoClose() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputTagHelper }); } [Fact] @@ -162,12 +159,12 @@ public void OnTypeCloseAngle_VoidTagHelperHasEndTag_ShouldStillAutoClose() public void OnTypeCloseAngle_TagAlreadyHasEndTag() { RunAutoInsertTest( -input: @" -
$$
-", -expected: @" -
-"); + input: """ +
$$
+ """, + expected: """ +
+ """); } [Fact] @@ -175,33 +172,33 @@ public void OnTypeCloseAngle_TagAlreadyHasEndTag() public void OnTypeCloseAngle_TagDoesNotAutoCloseOutOfScope() { RunAutoInsertTest( -input: @" -
- @if (true) - { -
$$
- } -", -expected: @" -
- @if (true) - { -
- } -"); + input: """ +
+ @if (true) + { +
$$
+ } + """, + expected: """ +
+ @if (true) + { +
+ } + """); } [Fact] [WorkItem("https://github.com/dotnet/aspnetcore/issues/36125")] - public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillAutoClose() + public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillClose() { RunAutoInsertTest( -input: @" -$$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] @@ -209,18 +206,18 @@ public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillAutoClose() public void OnTypeCloseAngle_VoidElementMirroringTagHelper() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputMirroringTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputMirroringTagHelper }); } [Fact] @@ -228,82 +225,82 @@ public void OnTypeCloseAngle_VoidElementMirroringTagHelper() public void OnTypeCloseAngle_VoidHtmlElementCapitalized_SelfCloses() { RunAutoInsertTest( -input: "$$", -expected: "", -fileKind: FileKinds.Legacy, -tagHelpers: Array.Empty()); + input: "$$", + expected: "", + fileKind: FileKinds.Legacy, + tagHelpers: Array.Empty()); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingStructureOverridesVoidTagBehavior() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfclosingInputTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfclosingInputTagHelper }); } [Fact] public void OnTypeCloseAngle_UnspeccifiedStructureInheritsVoidTagBehavior() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputTagHelper }); } [Fact] public void OnTypeCloseAngle_UnspeccifiedTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedTagHelper }); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -311,24 +308,24 @@ public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure() public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -336,24 +333,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement() public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -361,24 +358,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute() public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -386,24 +383,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute_SpaceBe public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -411,24 +408,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttrib public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -436,24 +433,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttrib public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -461,24 +458,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute() public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -486,24 +483,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute_Space public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -511,24 +508,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttr public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -536,24 +533,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttr public void OnTypeCloseAngle_TagHelperInTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); + @if (true) + { + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); } [Fact] @@ -561,24 +558,24 @@ public void OnTypeCloseAngle_TagHelperInTagHelper_NestedStatement() public void OnTypeCloseAngle_TagHelperNextToVoidTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); + @if (true) + { + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); } [Fact] @@ -586,64 +583,64 @@ public void OnTypeCloseAngle_TagHelperNextToVoidTagHelper_NestedStatement() public void OnTypeCloseAngle_TagHelperNextToTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, NormalOrSelfclosingInputTagHelper }); + @if (true) + { + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, NormalOrSelfclosingInputTagHelper }); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure_CodeBlock() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@{ - $$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @{ + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@{ - $0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @{ + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] public void OnTypeCloseAngle_WithSlash_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] @@ -651,130 +648,130 @@ public void OnTypeCloseAngle_WithSlash_WithoutEndTagTagHelperTagStructure() public void OnTypeCloseAngle_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + @if (true) + { +
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithSpace_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithoutEndTagTagHelperTagStructure_CodeBlock() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@{ - $$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @{ + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + @{ + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_MultipleApplicableTagHelperTagStructures() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedTagHelper, NormalOrSelfClosingTagHelper, WithoutEndTagTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedTagHelper, NormalOrSelfClosingTagHelper, WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_EscapedTagTagHelperAutoCompletesWithEscape() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] public void OnTypeCloseAngle_AlwaysClosesStandardHTMLTag() { RunAutoInsertTest( -input: @" -
$$
-", -expected: @" -
$0
-"); + input: """ +
$$
+ """, + expected: """ +
$0
+ """); } [Fact] @@ -782,18 +779,18 @@ public void OnTypeCloseAngle_AlwaysClosesStandardHTMLTag() public void OnTypeCloseAngle_ClosesStandardHTMLTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$

-} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$

+ } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] @@ -801,18 +798,18 @@ public void OnTypeCloseAngle_ClosesStandardHTMLTag_NestedStatement() public void OnTypeCloseAngle_TagNextToTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$

-} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$

+ } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] @@ -820,58 +817,58 @@ public void OnTypeCloseAngle_TagNextToTag_NestedStatement() public void OnTypeCloseAngle_TagNextToVoidTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$ -} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$ + } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] public void OnTypeCloseAngle_ClosesStandardHTMLTag() { RunAutoInsertTest( -input: @" -
$$ -", -expected: @" -
$0
-"); + input: """ +
$$ + """, + expected: """ +
$0
+ """); } [Fact] public void OnTypeCloseAngle_ClosesStandardHTMLTag_CodeBlock() { RunAutoInsertTest( -input: @" -@{ -
$$ -} -", -expected: @" -@{ -
$0
-} -"); + input: """ + @{ +
$$ + } + """, + expected: """ + @{ +
$0
+ } + """); } [Fact] public void OnTypeCloseAngle_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] @@ -879,79 +876,73 @@ public void OnTypeCloseAngle_ClosesVoidHTMLTag() public void OnTypeCloseAngle_ClosesVoidHTMLTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ - $$ -} -", -expected: @" -@if (true) -{ - -} -"); + input: """ + @if (true) + { + $$ + } + """, + expected: """ + @if (true) + { + + } + """); } [Fact] public void OnTypeCloseAngle_ClosesVoidHTMLTag_CodeBlock() { RunAutoInsertTest( -input: @" -@{ - $$ -} -", -expected: @" -@{ - -} -"); + input: """ + @{ + $$ + } + """, + expected: """ + @{ + + } + """); } [Fact] public void OnTypeCloseAngle_WithSlash_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] public void OnTypeCloseAngle_WithSpace_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] public void OnTypeCloseAngle_AutoInsertDisabled_Noops() { - Options = RazorLSPOptions.Default with { AutoClosingTags = false }; RunAutoInsertTest( -input: @" -
$$ -", -expected: @" -
-"); + input: """ +
$$ + """, + expected: """ +
+ """, + enableAutoClosingTags: false); } internal override IOnAutoInsertProvider CreateProvider() - { - var configService = StrictMock.Of(); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, Options); - - var provider = new AutoClosingTagOnAutoInsertProvider(optionsMonitor); - return provider; - } + => new AutoClosingTagOnAutoInsertProvider(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs index 18fed07bd85..74b17456c4c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs @@ -1,8 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Xunit; using Xunit.Abstractions; @@ -14,36 +13,30 @@ public class CloseTextTagOnAutoInsertProviderTest(ITestOutputHelper testOutput) public void OnTypeCloseAngle_ClosesTextTag() { RunAutoInsertTest( -input: @" -@{ - $$ -} -", -expected: @" -@{ - $0 -} -"); + input: """ + @{ + $$ + } + """, + expected: """ + @{ + $0 + } + """); } [Fact] public void OnTypeCloseAngle_OutsideRazorBlock_DoesNotCloseTextTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } - internal override IOnAutoInsertProvider CreateProvider() - { - var configService = StrictMock.Of(); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); - - var provider = new CloseTextTagOnAutoInsertProvider(optionsMonitor); - return provider; - } + internal override IOnAutoInsertProvider CreateProvider() => + new CloseTextTagOnAutoInsertProvider(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs index 7f7e31e9747..65d6063d5b2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs @@ -4,7 +4,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; @@ -27,7 +27,14 @@ public async Task Handle_SingleProvider_InvokesProvider() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -69,7 +76,14 @@ public async Task Handle_MultipleProviderSameTrigger_UsesSuccessful() ResolvedTextEdit = VsLspFactory.CreateTextEdit(position: (0, 0), string.Empty) }; var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider1, insertProvider2]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -114,7 +128,14 @@ public async Task Handle_MultipleProviderSameTrigger_UsesFirstSuccessful() ResolvedTextEdit = VsLspFactory.CreateTextEdit(position: (0, 0), string.Empty) }; var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider1, insertProvider2]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -151,7 +172,14 @@ public async Task Handle_NoApplicableProvider_CallsProviderAndReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -186,7 +214,14 @@ public async Task Handle_OnTypeFormattingOff_Html_CallsLanguageServer() var optionsMonitor = GetOptionsMonitor(formatOnType: false); var insertProvider = new TestOnAutoInsertProvider("<", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -219,7 +254,14 @@ public async Task Handle_AutoInsertAttributeQuotesOff_Html_DoesNotCallLanguageSe var optionsMonitor = GetOptionsMonitor(autoInsertAttributeQuotes: false); var insertProvider = new TestOnAutoInsertProvider("<", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -357,7 +399,14 @@ private async Task VerifyCSharpOnAutoInsertAsync(string input, string expected, var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider("!!!", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + formattingService, + LoggerFactory); var text = codeDocument.Source.Text; var @params = new VSInternalDocumentOnAutoInsertParams() @@ -371,7 +420,7 @@ private async Task VerifyCSharpOnAutoInsertAsync(string input, string expected, InsertSpaces = true }, }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(@params.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(@params.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs index 57a48de76b4..9bd79676417 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs @@ -5,8 +5,7 @@ using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -27,7 +26,15 @@ public async Task Handle_MultipleProviderUnmatchingTrigger_ReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider1 = new TestOnAutoInsertProvider(">", canResolve: true); var insertProvider2 = new TestOnAutoInsertProvider("<", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var autoInsertService = new AutoInsertService([insertProvider1, insertProvider2]); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + autoInsertService, + optionsMonitor, + null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -61,7 +68,14 @@ public async Task Handle_DocumentNotFound_ReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + null!, + LoggerFactory); var uri = new Uri("file://path/test.razor"); var @params = new VSInternalDocumentOnAutoInsertParams() { @@ -97,7 +111,14 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + razorFormattingService: null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -131,7 +152,14 @@ public async Task Handle_OnTypeFormattingOff_CSharp_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var optionsMonitor = GetOptionsMonitor(formatOnType: false); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: false); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + razorFormattingService: null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -161,12 +189,15 @@ private class TestOnAutoInsertProvider(string triggerCharacter, bool canResolve) public string TriggerCharacter { get; } = triggerCharacter; - // Disabling because [NotNullWhen] is available in two Assemblies and causes warnings - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) { Called = true; - edit = ResolvedTextEdit!; - format = default; + autoInsertEdit = canResolve ? new() { TextEdit = ResolvedTextEdit!, TextEditFormat = InsertTextFormat.Plaintext } : null; + return canResolve; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionInfoStrategyTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionInfoStrategyTest.cs index 5b72597e19c..c06d4ba3492 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionInfoStrategyTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/PreferHtmlInAttributeValuesDocumentPositionInfoStrategyTest.cs @@ -3,7 +3,7 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; @@ -46,15 +46,14 @@ internal async Task TryGetPositionInfoAsync_AtVariousPosition_ReturnsCorrectLang var position = codeDocument.Source.Text.GetPosition(cursorPosition); var uri = new Uri(razorFilePath); _ = await CreateLanguageServerAsync(codeDocument, razorFilePath); - var documentContext = CreateDocumentContext(uri, codeDocument); // Act - var result = await PreferHtmlInAttributeValuesDocumentPositionInfoStrategy.Instance.TryGetPositionInfoAsync( - DocumentMappingService, documentContext, position, DisposalToken); + var result = PreferHtmlInAttributeValuesDocumentPositionInfoStrategy.Instance.GetPositionInfo(DocumentMappingService, codeDocument, cursorPosition); // Assert - Assert.NotNull(result); + Assert.NotEqual(default, result); Assert.Equal(expectedLanguage, result.LanguageKind); + if (expectedLanguage != RazorLanguageKind.CSharp) { Assert.Equal(cursorPosition, result.HostDocumentIndex); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs index cef29ea2d43..c5e809d705a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs @@ -6,15 +6,11 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; using Xunit; using Xunit.Abstractions; @@ -29,7 +25,7 @@ protected RazorOnAutoInsertProviderTestBase(ITestOutputHelper testOutput) internal abstract IOnAutoInsertProvider CreateProvider(); - protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, bool insertSpaces = true, string fileKind = default, IReadOnlyList tagHelpers = default) + protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, bool insertSpaces = true, bool enableAutoClosingTags = true, string fileKind = default, IReadOnlyList tagHelpers = default) { // Arrange TestFileMarkupParser.GetPosition(input, out input, out var location); @@ -40,23 +36,14 @@ protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, var path = "file:///path/to/document.razor"; var uri = new Uri(path); var codeDocument = CreateCodeDocument(source, uri.AbsolutePath, tagHelpers, fileKind: fileKind); - var options = new FormattingOptions() - { - TabSize = tabSize, - InsertSpaces = insertSpaces, - }; var provider = CreateProvider(); - using var context = FormattingContext.Create(uri, Mock.Of(MockBehavior.Strict), codeDocument, options, TestAdhocWorkspaceFactory.Instance); // Act - if (!provider.TryResolveInsertion(position, context, out var edit, out _)) - { - edit = null; - } + provider.TryResolveInsertion(position, codeDocument, enableAutoClosingTags: enableAutoClosingTags, out var edit); // Assert - var edited = edit is null ? source : ApplyEdit(source, edit); + var edited = edit is null ? source : ApplyEdit(source, edit.TextEdit); var actual = edited.ToString(); Assert.Equal(expected, actual); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs deleted file mode 100644 index 5ce053f830a..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Test.Common; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; - -public class AddUsingsCodeActionProviderFactoryTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) -{ - [Fact] - public void GetNamespaceFromFQN_Invalid_ReturnsEmpty() - { - // Arrange - var fqn = "Abc"; - - // Act - var namespaceName = AddUsingsCodeActionProviderHelper.GetNamespaceFromFQN(fqn); - - // Assert - Assert.Empty(namespaceName); - } - - [Fact] - public void GetNamespaceFromFQN_Valid_ReturnsNamespace() - { - // Arrange - var fqn = "Abc.Xyz"; - - // Act - var namespaceName = AddUsingsCodeActionProviderHelper.GetNamespaceFromFQN(fqn); - - // Assert - Assert.Equal("Abc", namespaceName); - } - - [Fact] - public void TryCreateAddUsingResolutionParams_CreatesResolutionParams() - { - // Arrange - var fqn = "Abc.Xyz"; - var docUri = new Uri("c:/path"); - - // Act - var result = AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fqn, docUri, additionalEdit: null, out var @namespace, out var resolutionParams); - - // Assert - Assert.True(result); - Assert.Equal("Abc", @namespace); - Assert.NotNull(resolutionParams); - } - - [Fact] - public void TryExtractNamespace_Invalid_ReturnsFalse() - { - // Arrange - var csharpAddUsing = "Abc.Xyz;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.False(res); - Assert.Empty(@namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "using Abc.Xyz;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("Abc.Xyz", @namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_WithStatic_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "using static X.Y.Z;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("static X.Y.Z", @namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_WithTypeNameCorrection_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "Goo - using X.Y.Z;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("X.Y.Z", @namespace); - Assert.Equal("Goo - ", prefix); - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs index 7d22fc8ee82..2808f79a5f3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs @@ -20,6 +20,48 @@ public class AddUsingsCodeActionResolverTest(ITestOutputHelper testOutput) : Lan { private readonly IDocumentContextFactory _emptyDocumentContextFactory = new TestDocumentContextFactory(); + [Fact] + public void GetNamespaceFromFQN_Invalid_ReturnsEmpty() + { + // Arrange + var fqn = "Abc"; + + // Act + var namespaceName = AddUsingsCodeActionResolver.GetNamespaceFromFQN(fqn); + + // Assert + Assert.Empty(namespaceName); + } + + [Fact] + public void GetNamespaceFromFQN_Valid_ReturnsNamespace() + { + // Arrange + var fqn = "Abc.Xyz"; + + // Act + var namespaceName = AddUsingsCodeActionResolver.GetNamespaceFromFQN(fqn); + + // Assert + Assert.Equal("Abc", namespaceName); + } + + [Fact] + public void TryCreateAddUsingResolutionParams_CreatesResolutionParams() + { + // Arrange + var fqn = "Abc.Xyz"; + var docUri = new Uri("c:/path"); + + // Act + var result = AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fqn, docUri, additionalEdit: null, out var @namespace, out var resolutionParams); + + // Assert + Assert.True(result); + Assert.Equal("Abc", @namespace); + Assert.NotNull(resolutionParams); + } + [Fact] public async Task Handle_MissingFile() { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs index 335e5df5f48..2f668586916 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs @@ -326,14 +326,14 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var projectEngine = RazorProjectEngine.Create(builder => builder.AddTagHelpers(tagHelpers)); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, new[] { diagnostic }); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs index 6062be141b2..b9ba1390ed1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using System.Linq; using System.Text.Json; using System.Threading; @@ -9,12 +10,13 @@ using Microsoft.AspNetCore.Mvc.Razor.Extensions; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.CodeActions; +using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -39,7 +41,8 @@ public class DefaultCSharpCodeActionResolverTest(ITestOutputHelper testOutput) : } }; - private static readonly TextEdit[] s_defaultFormattedEdits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Remapped & Formatted Edit")]; + private static readonly TextEdit s_defaultFormattedEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "Remapped & Formatted Edit"); + private static readonly TextChange s_defaultFormattedChange = new TextChange(new TextSpan(0, 0), s_defaultFormattedEdit.NewText); private static readonly CodeAction s_defaultUnresolvedCodeAction = new CodeAction() { @@ -63,7 +66,8 @@ public async Task ResolveAsync_ReturnsResolvedCodeAction() var returnedEdits = returnedCodeAction.Edit.DocumentChanges.Value; Assert.True(returnedEdits.TryGetFirst(out var textDocumentEdits)); var returnedTextDocumentEdit = Assert.Single(textDocumentEdits[0].Edits); - Assert.Equal(s_defaultFormattedEdits.First(), returnedTextDocumentEdit); + Assert.Equal(s_defaultFormattedEdit.NewText, returnedTextDocumentEdit.NewText); + Assert.Equal(s_defaultFormattedEdit.Range, returnedTextDocumentEdit.Range); } [Fact] @@ -188,12 +192,11 @@ private static void CreateCodeActionResolver( private static IRazorFormattingService CreateRazorFormattingService(Uri documentUri) { var razorFormattingService = Mock.Of( - rfs => rfs.FormatCodeActionAsync( + rfs => rfs.TryGetCSharpCodeActionEditAsync( It.Is(c => c.Uri == documentUri), - RazorLanguageKind.CSharp, - It.IsAny(), - It.IsAny(), - It.IsAny()) == Task.FromResult(s_defaultFormattedEdits), MockBehavior.Strict); + It.IsAny>(), + It.IsAny(), + It.IsAny()) == Task.FromResult(s_defaultFormattedChange), MockBehavior.Strict); return razorFormattingService; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs index 7c3c0afff5d..86d1b8239e5 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs @@ -457,14 +457,14 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( }); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, [diagnostic]); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs index 992ff410c0e..df0443e5705 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs @@ -24,6 +24,7 @@ using Microsoft.AspNetCore.Razor.Utilities; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol.CodeActions; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -1240,7 +1241,7 @@ private async Task ValidateCodeActionAsync( Assert.NotNull(codeActionToRun); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentContext.Snapshot, optionsMonitor?.CurrentValue); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, optionsMonitor?.CurrentValue); var changes = await GetEditsAsync( codeActionToRun, requestContext, @@ -1299,7 +1300,7 @@ private async Task ValidateExtractComponentCodeActionAsync( Assert.NotNull(codeActionToRun); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentContext.Snapshot, optionsMonitor?.CurrentValue); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, optionsMonitor?.CurrentValue); var changes = await GetEditsAsync( codeActionToRun, requestContext, @@ -1404,9 +1405,8 @@ private class GenerateMethodResolverDocumentContextFactory : TestDocumentContext public GenerateMethodResolverDocumentContextFactory (string filePath, RazorCodeDocument codeDocument, - TagHelperDescriptor[]? tagHelpers = null, - int? version = null) - : base(filePath, codeDocument, version) + TagHelperDescriptor[]? tagHelpers = null) + : base(filePath, codeDocument) { _tagHelperDescriptors = CreateTagHelperDescriptors(); if (tagHelpers is not null) @@ -1418,7 +1418,6 @@ public GenerateMethodResolverDocumentContextFactory public override bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { if (FilePath is null || CodeDocument is null) @@ -1478,9 +1477,8 @@ private class ExtractToComponentResolverDocumentContextFactory : TestDocumentCon public ExtractToComponentResolverDocumentContextFactory (string filePath, RazorCodeDocument codeDocument, - TagHelperDescriptor[]? tagHelpers = null, - int? version = null) - : base(filePath, codeDocument, version) + TagHelperDescriptor[]? tagHelpers = null) + : base(filePath, codeDocument) { _tagHelperDescriptors = CreateTagHelperDescriptors(); if (tagHelpers is not null) @@ -1492,7 +1490,6 @@ public ExtractToComponentResolverDocumentContextFactory public override bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { if (FilePath is null || CodeDocument is null) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndpointTest.cs index 7c44e564389..882c953ce78 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndpointTest.cs @@ -12,8 +12,8 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.CodeActions; @@ -26,49 +26,17 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; -public class CodeActionEndpointTest : LanguageServerTestBase +public class CodeActionEndpointTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - private readonly IDocumentMappingService _documentMappingService; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions; - private readonly IClientConnection _clientConnection; - - public CodeActionEndpointTest(ITestOutputHelper testOutput) - : base(testOutput) - { - _documentMappingService = Mock.Of( - s => s.TryMapToGeneratedDocumentRange( - It.IsAny(), - It.IsAny(), - out It.Ref.IsAny) == false && - - s.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp, - - MockBehavior.Strict); - - _languageServerFeatureOptions = Mock.Of( - l => l.SupportsFileManipulation == true, - MockBehavior.Strict); - - _clientConnection = Mock.Of(MockBehavior.Strict); - } + private static readonly LinePositionSpan s_defaultRange = new(new(5, 2), new(5, 2)); [Fact] public async Task Handle_NoDocument() { // Arrange var documentPath = new Uri("C:/path/to/Page.razor"); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - Array.Empty(), - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(); + var request = new VSCodeActionParams() { TextDocument = new VSTextDocumentIdentifier { Uri = documentPath }, @@ -79,7 +47,7 @@ public async Task Handle_NoDocument() var requestContext = CreateRazorRequestContext(documentContext: null); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert Assert.Null(commandOrCodeActionContainer); @@ -93,28 +61,19 @@ public async Task Handle_UnsupportedDocument() var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); codeDocument.SetUnsupported(); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - Array.Empty(), - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(); + var request = new VSCodeActionParams() { TextDocument = new VSTextDocumentIdentifier { Uri = documentPath }, Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert Assert.Null(commandOrCodeActionContainer); @@ -127,31 +86,23 @@ public async Task Handle_NoProviders() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - Array.Empty(), - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(); + var request = new VSCodeActionParams() { TextDocument = new VSTextDocumentIdentifier { Uri = documentPath }, Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert - Assert.Empty(commandOrCodeActionContainer!); + Assert.NotNull(commandOrCodeActionContainer); + Assert.Empty(commandOrCodeActionContainer); } [Fact] @@ -161,20 +112,7 @@ public async Task Handle_OneRazorCodeActionProvider() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(razorCodeActionProviders: [CreateRazorCodeActionProvider()]); var request = new VSCodeActionParams() { @@ -182,10 +120,11 @@ public async Task Handle_OneRazorCodeActionProvider() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert Assert.NotNull(commandOrCodeActionContainer); @@ -199,22 +138,11 @@ public async Task Handle_OneCSharpCodeActionProvider() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var documentMappingService = CreateDocumentMappingService(); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - Array.Empty(), - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(s_defaultRange), + csharpCodeActionProviders: [CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance); var request = new VSCodeActionParams() { @@ -222,10 +150,11 @@ public async Task Handle_OneCSharpCodeActionProvider() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert Assert.NotNull(commandOrCodeActionContainer); @@ -239,20 +168,7 @@ public async Task Handle_OneCodeActionProviderWithMultipleCodeActions() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockMultipleRazorCodeActionProvider(), - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(razorCodeActionProviders: [CreateMultipleRazorCodeActionProvider()]); var request = new VSCodeActionParams() { @@ -260,10 +176,11 @@ public async Task Handle_OneCodeActionProviderWithMultipleCodeActions() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); + var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, DisposalToken); // Assert Assert.NotNull(commandOrCodeActionContainer); @@ -277,27 +194,17 @@ public async Task Handle_MultipleCodeActionProvidersWithMultipleCodeActions() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var documentMappingService = CreateDocumentMappingService(); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - new IRazorCodeActionProvider[] { - new MockMultipleRazorCodeActionProvider(), - new MockMultipleRazorCodeActionProvider(), - new MockRazorCodeActionProvider(), - }, - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider(), - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(s_defaultRange), + razorCodeActionProviders: [ + CreateMultipleRazorCodeActionProvider(), + CreateMultipleRazorCodeActionProvider(), + CreateRazorCodeActionProvider()], + csharpCodeActionProviders: [ + CreateCSharpCodeActionProvider(), + CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance); var request = new VSCodeActionParams() { @@ -322,27 +229,17 @@ public async Task Handle_MultipleProviders() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var documentMappingService = CreateDocumentMappingService(); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider(), - new MockRazorCodeActionProvider(), - new MockRazorCodeActionProvider(), - }, - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider(), - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(s_defaultRange), + razorCodeActionProviders: [ + CreateRazorCodeActionProvider(), + CreateRazorCodeActionProvider(), + CreateRazorCodeActionProvider()], + csharpCodeActionProviders: [ + CreateCSharpCodeActionProvider(), + CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance); var request = new VSCodeActionParams() { @@ -350,6 +247,7 @@ public async Task Handle_MultipleProviders() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -367,20 +265,7 @@ public async Task Handle_OneNullReturningProvider() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockEmptyRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(razorCodeActionProviders: [CreateEmptyRazorCodeActionProvider()]); var request = new VSCodeActionParams() { @@ -388,13 +273,15 @@ public async Task Handle_OneNullReturningProvider() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act var commandOrCodeActionContainer = await codeActionEndpoint.HandleRequestAsync(request, requestContext, default); // Assert - Assert.Empty(commandOrCodeActionContainer!); + Assert.NotNull(commandOrCodeActionContainer); + Assert.Empty(commandOrCodeActionContainer); } [Fact] @@ -404,28 +291,18 @@ public async Task Handle_MultipleMixedProvider() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var documentMappingService = CreateDocumentMappingService(); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider(), - new MockEmptyRazorCodeActionProvider(), - new MockRazorCodeActionProvider(), - new MockEmptyRazorCodeActionProvider(), - }, - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider(), - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(s_defaultRange), + razorCodeActionProviders: [ + CreateRazorCodeActionProvider(), + CreateEmptyRazorCodeActionProvider(), + CreateRazorCodeActionProvider(), + CreateEmptyRazorCodeActionProvider()], + csharpCodeActionProviders: [ + CreateCSharpCodeActionProvider(), + CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance); var request = new VSCodeActionParams() { @@ -433,6 +310,7 @@ public async Task Handle_MultipleMixedProvider() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -450,22 +328,13 @@ public async Task Handle_MultipleMixedProvider_SupportsCodeActionResolveTrue() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider(), - new MockRazorCommandProvider(), - new MockEmptyRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = true - }; + + var codeActionEndpoint = CreateEndpoint( + razorCodeActionProviders: [ + CreateRazorCodeActionProvider(), + CreateRazorCommandProvider(), + CreateEmptyRazorCodeActionProvider()], + supportsCodeActionResolve: true); var request = new VSCodeActionParams() { @@ -473,6 +342,7 @@ public async Task Handle_MultipleMixedProvider_SupportsCodeActionResolveTrue() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -500,24 +370,13 @@ public async Task Handle_MixedProvider_SupportsCodeActionResolveTrue_UsesGroups( var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var documentMappingService = CreateDocumentMappingService(); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider(), - }, - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = true - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(s_defaultRange), + razorCodeActionProviders: [CreateRazorCodeActionProvider()], + csharpCodeActionProviders: [CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance, + supportsCodeActionResolve: true); var request = new VSCodeActionParams() { @@ -525,6 +384,7 @@ public async Task Handle_MixedProvider_SupportsCodeActionResolveTrue_UsesGroups( Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -554,22 +414,12 @@ public async Task Handle_MultipleMixedProvider_SupportsCodeActionResolveFalse() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider(), - new MockRazorCommandProvider(), - new MockEmptyRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + razorCodeActionProviders: [ + CreateRazorCodeActionProvider(), + CreateRazorCommandProvider(), + CreateEmptyRazorCodeActionProvider()]); var request = new VSCodeActionParams() { @@ -577,6 +427,7 @@ public async Task Handle_MultipleMixedProvider_SupportsCodeActionResolveFalse() Range = VsLspFactory.CreateZeroWidthRange(0, 1), Context = new VSInternalCodeActionContext() }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -587,14 +438,15 @@ public async Task Handle_MultipleMixedProvider_SupportsCodeActionResolveFalse() Assert.Collection(commandOrCodeActionContainer, c => { - Assert.True(c.TryGetFirst(out var command1)); - var command = Assert.IsType(command1); - var codeActionParamsToken = (JsonObject)command.Arguments!.First(); + Assert.True(c.TryGetFirst(out var first)); + var command = Assert.IsType(first); + Assert.NotNull(command.Arguments); + var codeActionParamsToken = (JsonObject)command.Arguments.First(); var codeActionParams = codeActionParamsToken.Deserialize(); Assert.NotNull(codeActionParams); Assert.Equal(LanguageServerConstants.CodeActions.EditBasedCodeActionCommand, codeActionParams.Action); }, - c => Assert.True(c.TryGetFirst(out var _))); + c => Assert.True(c.TryGetFirst(out _))); } [Fact] @@ -604,20 +456,7 @@ public async Task GenerateRazorCodeActionContextAsync_WithSelectionRange() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(razorCodeActionProviders: [CreateRazorCodeActionProvider()]); var initialRange = VsLspFactory.CreateZeroWidthRange(0, 1); var selectionRange = VsLspFactory.CreateZeroWidthRange(0, 5); @@ -646,20 +485,7 @@ public async Task GenerateRazorCodeActionContextAsync_WithoutSelectionRange() var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - var codeActionEndpoint = new CodeActionEndpoint( - _documentMappingService, - new IRazorCodeActionProvider[] { - new MockRazorCodeActionProvider() - }, - Array.Empty(), - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + var codeActionEndpoint = CreateEndpoint(razorCodeActionProviders: [CreateRazorCodeActionProvider()]); var initialRange = VsLspFactory.CreateZeroWidthRange(0, 1); var request = new VSCodeActionParams() @@ -687,24 +513,8 @@ public async Task GetCSharpCodeActionsFromLanguageServerAsync_InvalidRangeMappin var documentPath = new Uri("C:/path/to/Page.razor"); var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); - LinePositionSpan projectedRange = default; - var documentMappingService = Mock.Of( - d => d.TryMapToGeneratedDocumentRange(It.IsAny(), It.IsAny(), out projectedRange) == false - , MockBehavior.Strict); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - Array.Empty(), - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - _clientConnection, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint(csharpCodeActionProviders: [CreateCSharpCodeActionProvider()]); var initialRange = VsLspFactory.CreateZeroWidthRange(0, 1); var request = new VSCodeActionParams() @@ -733,22 +543,11 @@ public async Task GetCSharpCodeActionsFromLanguageServerAsync_ReturnsCodeActions var codeDocument = CreateCodeDocument("@code {}"); var documentContext = CreateDocumentContext(documentPath, codeDocument); var projectedRange = VsLspFactory.CreateZeroWidthRange(15, 2); - var documentMappingService = CreateDocumentMappingService(projectedRange.ToLinePositionSpan()); - var languageServer = CreateLanguageServer(); - var codeActionEndpoint = new CodeActionEndpoint( - documentMappingService, - Array.Empty(), - new ICSharpCodeActionProvider[] { - new MockCSharpCodeActionProvider() - }, - Array.Empty(), - languageServer, - _languageServerFeatureOptions, - LoggerFactory, - telemetryReporter: null) - { - _supportsCodeActionResolve = false - }; + + var codeActionEndpoint = CreateEndpoint( + documentMappingService: CreateDocumentMappingService(projectedRange.ToLinePositionSpan()), + csharpCodeActionProviders: [CreateCSharpCodeActionProvider()], + clientConnection: TestClientConnection.Instance); var initialRange = VsLspFactory.CreateZeroWidthRange(0, 1); var request = new VSCodeActionParams() @@ -765,11 +564,12 @@ public async Task GetCSharpCodeActionsFromLanguageServerAsync_ReturnsCodeActions Assert.NotNull(context); // Act - var results = await codeActionEndpoint.GetCodeActionsFromLanguageServerAsync(RazorLanguageKind.CSharp, documentContext, context, Guid.Empty, cancellationToken: default); + var results = await codeActionEndpoint.GetCodeActionsFromLanguageServerAsync(RazorLanguageKind.CSharp, documentContext, context, Guid.Empty, cancellationToken: DisposalToken); // Assert var result = Assert.Single(results); - var diagnostics = result.Diagnostics!.ToArray(); + Assert.NotNull(result.Diagnostics); + var diagnostics = result.Diagnostics.ToArray(); Assert.Equal(2, diagnostics.Length); // Diagnostic ranges contain the projected range for @@ -782,136 +582,142 @@ public async Task GetCSharpCodeActionsFromLanguageServerAsync_ReturnsCodeActions Assert.Equal(projectedRange, diagnostics[1].Range); } - private static IDocumentMappingService CreateDocumentMappingService(LinePositionSpan projectedRange = default) + private CodeActionEndpoint CreateEndpoint( + IDocumentMappingService? documentMappingService = null, + ImmutableArray razorCodeActionProviders = default, + ImmutableArray csharpCodeActionProviders = default, + ImmutableArray htmlCodeActionProviders = default, + IClientConnection? clientConnection = null, + LanguageServerFeatureOptions? languageServerFeatureOptions = null, + bool supportsCodeActionResolve = false) { - if (projectedRange == default) + return new CodeActionEndpoint( + documentMappingService ?? CreateDocumentMappingService(), + razorCodeActionProviders.NullToEmpty(), + csharpCodeActionProviders.NullToEmpty(), + htmlCodeActionProviders.NullToEmpty(), + clientConnection ?? StrictMock.Of(), + languageServerFeatureOptions ?? StrictMock.Of(x => x.SupportsFileManipulation == true), + LoggerFactory, + telemetryReporter: null) { - projectedRange = new LinePositionSpan(new(5, 2), new(5, 2)); - } - - var documentMappingService = Mock.Of( - d => d.TryMapToGeneratedDocumentRange(It.IsAny(), It.IsAny(), out projectedRange) == true && - d.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp - , MockBehavior.Strict); - return documentMappingService; + _supportsCodeActionResolve = supportsCodeActionResolve + }; } - private static IClientConnection CreateLanguageServer() + private static IDocumentMappingService CreateDocumentMappingService(LinePositionSpan? projectedRange = null) { - return new TestLanguageServer(); + var mock = new StrictMock(); + + // If a range was provided, use that and return true; otherwise, return false. + var (outRange, result) = projectedRange is LinePositionSpan + ? (projectedRange.GetValueOrDefault(), true) + : (It.Ref.IsAny, false); + + mock.Setup(x => x.TryMapToGeneratedDocumentRange(It.IsAny(), It.IsAny(), out outRange)) + .Returns(result); + + return mock.Object; } private static RazorCodeDocument CreateCodeDocument(string text) { - var codeDocument = TestRazorCodeDocument.Create(text); var sourceDocument = TestRazorSourceDocument.Create(text); - var syntaxTree = RazorSyntaxTree.Parse(sourceDocument); - codeDocument.SetSyntaxTree(syntaxTree); - return codeDocument; - } + var projectEngine = RazorProjectEngine.Create(builder => { }); - private class MockRazorCodeActionProvider : IRazorCodeActionProvider - { - public Task> ProvideAsync(RazorCodeActionContext context, CancellationToken cancellationToken) - { - return Task.FromResult>([new RazorVSInternalCodeAction()]); - } + return projectEngine.ProcessDesignTime(sourceDocument, "mvc", importSources: [], tagHelpers: []); } - private class MockMultipleRazorCodeActionProvider : IRazorCodeActionProvider - { - public Task> ProvideAsync(RazorCodeActionContext context, CancellationToken cancellationToken) - { - return Task.FromResult>( - [ - new RazorVSInternalCodeAction(), - new RazorVSInternalCodeAction() - ]); - } - } + private static IRazorCodeActionProvider CreateEmptyRazorCodeActionProvider() + => CreateRazorCodeActionProvider([]); - private class MockCSharpCodeActionProvider : ICSharpCodeActionProvider + private static IRazorCodeActionProvider CreateRazorCodeActionProvider() + => CreateRazorCodeActionProvider(new RazorVSInternalCodeAction()); + + private static IRazorCodeActionProvider CreateMultipleRazorCodeActionProvider() + => CreateRazorCodeActionProvider( + new RazorVSInternalCodeAction(), + new RazorVSInternalCodeAction()); + + private static IRazorCodeActionProvider CreateRazorCommandProvider() + => CreateRazorCodeActionProvider( + new RazorVSInternalCodeAction() + { + Title = "SomeTitle", + Data = JsonSerializer.SerializeToElement(new AddUsingsCodeActionParams() + { + Namespace = "Test", + Uri = new Uri("C:/path/to/Page.razor") + }) + }); + + private static IRazorCodeActionProvider CreateRazorCodeActionProvider(params ImmutableArray codeActions) { - public Task> ProvideAsync(RazorCodeActionContext _1, ImmutableArray _2, CancellationToken _3) - { - return Task.FromResult>( - [ - new RazorVSInternalCodeAction() - ]); - } + var mock = new StrictMock(); + + mock.Setup(x => x.ProvideAsync(It.IsAny(), It.IsAny())) + .ReturnsAsync(() => codeActions); + + return mock.Object; } - private class MockRazorCommandProvider : IRazorCodeActionProvider + private static ICSharpCodeActionProvider CreateCSharpCodeActionProvider() + => CreateCSharpCodeActionProvider([new RazorVSInternalCodeAction()]); + + private static ICSharpCodeActionProvider CreateCSharpCodeActionProvider(params ImmutableArray codeActions) { - public Task> ProvideAsync(RazorCodeActionContext _1, CancellationToken _2) - { - // O# Code Actions don't have `Data`, but `Commands` do - return Task.FromResult>( - [ - new RazorVSInternalCodeAction() { - Title = "SomeTitle", - Data = JsonSerializer.SerializeToElement(new AddUsingsCodeActionParams() - { - Namespace="Test", - Uri = new Uri("C:/path/to/Page.razor") - }) - } - ]); - } + var mock = new StrictMock(); + + mock.Setup(x => x.ProvideAsync(It.IsAny(), It.IsAny>(), It.IsAny())) + .ReturnsAsync(() => codeActions); + + return mock.Object; } - private class MockEmptyRazorCodeActionProvider : IRazorCodeActionProvider + private sealed class TestClientConnection : IClientConnection { - public Task> ProvideAsync(RazorCodeActionContext _1, CancellationToken _2) + public static readonly IClientConnection Instance = new TestClientConnection(); + + private static readonly string[] s_customTags = ["CodeActionName"]; + + private TestClientConnection() { - return SpecializedTasks.EmptyImmutableArray(); } - } - private class TestLanguageServer : IClientConnection - { public Task SendNotificationAsync(string method, TParams @params, CancellationToken cancellationToken) { - if (method != CustomMessageNames.RazorProvideCodeActionsEndpoint) - { - throw new InvalidOperationException($"Unexpected method {method}"); - } + Assert.Equal(CustomMessageNames.RazorProvideCodeActionsEndpoint, method); return Task.CompletedTask; } public Task SendNotificationAsync(string method, CancellationToken cancellationToken) - { - throw new NotImplementedException(); - } + => throw new NotImplementedException(); public Task SendRequestAsync(string method, TParams @params, CancellationToken cancellationToken) { - if (method != CustomMessageNames.RazorProvideCodeActionsEndpoint) - { - throw new InvalidOperationException($"Unexpected method {method}"); - } + Assert.Equal(CustomMessageNames.RazorProvideCodeActionsEndpoint, method); - if (@params is not DelegatedCodeActionParams delegatedCodeActionParams || - delegatedCodeActionParams.CodeActionParams is not VSCodeActionParams codeActionParams || - codeActionParams.Context is not VSInternalCodeActionContext codeActionContext) - { - throw new InvalidOperationException(@params!.GetType().FullName); - } + Assert.NotNull(@params); + var delegatedCodeActionParams = Assert.IsType(@params); + + Assert.NotNull(delegatedCodeActionParams.CodeActionParams); + Assert.NotNull(delegatedCodeActionParams.CodeActionParams.Context); var diagnostics = new List { - new Diagnostic() + new() { - Range = codeActionParams.Range, + Range = delegatedCodeActionParams.CodeActionParams.Range, Message = "Range" } }; - if (codeActionContext.SelectionRange is not null) + + if (delegatedCodeActionParams.CodeActionParams.Context.SelectionRange is { } selectionRange) { - diagnostics.Add(new Diagnostic() + diagnostics.Add(new() { - Range = codeActionContext.SelectionRange, + Range = selectionRange, Message = "Selection Range" }); } @@ -922,12 +728,12 @@ delegatedCodeActionParams.CodeActionParams is not VSCodeActionParams codeActionP // is correct rather than providing specific test hooks in the CodeActionEndpoint var result = new[] { - new RazorVSInternalCodeAction() - { - Data = JsonSerializer.SerializeToElement(new { CustomTags = new object[] { "CodeActionName" } }), - Diagnostics = diagnostics.ToArray() - } - }; + new RazorVSInternalCodeAction() + { + Data = JsonSerializer.SerializeToElement(new { CustomTags = s_customTags }), + Diagnostics = [.. diagnostics] + } + }; return Task.FromResult((TResponse)(object)result); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs index bddb160495e..8bcc81013b1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs @@ -84,9 +84,8 @@ public async Task ProvideAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(documentPath), - Version = 1 }, - Edits = [VsLspFactory.CreateTextEdit(context.SourceText.GetRange(span), "Goo ~~~~~~~~~~~~~~~ Bar")] + Edits = [VsLspFactory.CreateTextEdit(context.SourceText.GetRange(span), "Goo /*~~~~~~~~~~~*/ Bar")] } } }; @@ -111,7 +110,6 @@ public async Task ProvideAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri("c:/Test.razor.html"), - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Goo")] } @@ -154,7 +152,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs index 480c4c9c633..7dfe4321f1a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs @@ -43,9 +43,8 @@ public async Task ResolveAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = documentUri, - Version = 1 }, - Edits = [VsLspFactory.CreateTextEdit(sourceText.GetRange(span), "Goo ~~~~~~~~~~~~~~~ Bar")] + Edits = [VsLspFactory.CreateTextEdit(sourceText.GetRange(span), "Goo /*~~~~~~~~~~~*/ Bar")] } } }; @@ -74,7 +73,6 @@ public async Task ResolveAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri("c:/Test.razor.html"), - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Goo")] } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs index 7d4ca269ff6..2a0e033c4b5 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs @@ -457,14 +457,14 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP var projectEngine = RazorProjectEngine.Create(builder => builder.AddTagHelpers(tagHelpers)); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, new[] { diagnostic }); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs index a0995f885a9..698d462b310 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs @@ -396,7 +396,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP codeDocument.SetSyntaxTree(syntaxTree); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text), MockBehavior.Strict); var sourceText = SourceText.From(text); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToComponentCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToComponentCodeActionProviderTest.cs index d884dc9c0b9..7a8463b3626 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToComponentCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToComponentCodeActionProviderTest.cs @@ -299,7 +299,6 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP codeDocument.SetSyntaxTree(syntaxTree); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text), MockBehavior.Strict); var sourceText = SourceText.From(text); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs index e3f63cfb270..e793aa35659 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs @@ -27,7 +27,7 @@ public class CompletionListProviderTest : LanguageServerTestBase private readonly RazorCompletionListProvider _razorCompletionProvider; private readonly DelegatedCompletionListProvider _delegatedCompletionProvider; private readonly VSInternalCompletionContext _completionContext; - private readonly VersionedDocumentContext _documentContext; + private readonly DocumentContext _documentContext; private readonly VSInternalClientCapabilities _clientCapabilities; public CompletionListProviderTest(ITestOutputHelper testOutput) @@ -38,7 +38,7 @@ public CompletionListProviderTest(ITestOutputHelper testOutput) _razorCompletionProvider = new TestRazorCompletionListProvider(_completionList1, new[] { SharedTriggerCharacter, }, LoggerFactory); _delegatedCompletionProvider = new TestDelegatedCompletionListProvider(_completionList2, new[] { SharedTriggerCharacter, CompletionList2OnlyTriggerCharacter }); _completionContext = new VSInternalCompletionContext(); - _documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", hostDocumentVersion: 0); + _documentContext = TestDocumentContext.From("C:/path/to/file.cshtml"); _clientCapabilities = new VSInternalClientCapabilities(); } @@ -89,7 +89,7 @@ public TestDelegatedCompletionListProvider(VSInternalCompletionList completionLi public override Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) @@ -117,7 +117,7 @@ public TestRazorCompletionListProvider( public override Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, HashSet existingCompletions, CancellationToken cancellationToken) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs index 90b3f93b7db..8aeefbf6e87 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Test; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Testing; @@ -25,7 +25,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; -[UseExportProvider] public class DelegatedCompletionItemResolverTest : LanguageServerTestBase { private readonly VSInternalClientCapabilities _clientCapabilities; @@ -51,7 +50,7 @@ public DelegatedCompletionItemResolverTest(ITestOutputHelper testOutput) } }; - var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml"); _csharpCompletionParams = new DelegatedCompletionParams( documentContext.GetTextDocumentIdentifierAndVersion(), VsLspFactory.CreatePosition(10, 6), @@ -79,7 +78,8 @@ public async Task ResolveAsync_CanNotFindCompletionItem_Noops() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var notContainingCompletionList = new VSInternalCompletionList(); var originalRequestContext = new object(); @@ -97,7 +97,8 @@ public async Task ResolveAsync_UnknownRequestContext_Noops() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, } }; var originalRequestContext = new object(); @@ -115,7 +116,8 @@ public async Task ResolveAsync_UsesItemsData() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var expectedData = new object(); var item = new VSInternalCompletionItem() { @@ -137,7 +139,8 @@ public async Task ResolveAsync_InheritsOriginalCompletionListData() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, }, Data = new object() }; var expectedData = new object(); @@ -200,7 +203,8 @@ public async Task ResolveAsync_Html_Resolves() // Arrange var expectedResolvedItem = new VSInternalCompletionItem(); var server = TestDelegatedCompletionItemResolverServer.Create(expectedResolvedItem); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, } }; var originalRequestContext = new DelegatedCompletionResolutionContext(_htmlCompletionParams, new object()); @@ -222,8 +226,9 @@ private async Task ResolveCompletionItemAsync(string c await using var csharpServer = await CreateCSharpServerAsync(codeDocument); var server = TestDelegatedCompletionItemResolverServer.Create(csharpServer, DisposalToken); - var documentContextFactory = new TestDocumentContextFactory("C:/path/to/file.razor", codeDocument, version: 123); - var resolver = new DelegatedCompletionItemResolver(documentContextFactory, _formattingService.GetValue(), server); + var documentContextFactory = new TestDocumentContextFactory("C:/path/to/file.razor", codeDocument); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var (containingCompletionList, csharpCompletionParams) = await GetCompletionListAndOriginalParamsAsync( cursorPosition, codeDocument, csharpServer); @@ -268,7 +273,7 @@ private async Task CreateCSharpServerAsync(RazorCodeDocumen CSharpTestLspServer csharpServer) { var completionContext = new VSInternalCompletionContext() { TriggerKind = CompletionTriggerKind.Invoked }; - var documentContext = TestDocumentContext.From("C:/path/to/file.razor", codeDocument, hostDocumentVersion: 1337); + var documentContext = TestDocumentContext.From("C:/path/to/file.razor", codeDocument); var provider = TestDelegatedCompletionListProvider.Create(csharpServer, LoggerFactory, DisposalToken); var completionList = await provider.GetCompletionListAsync( diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionListProviderTest.cs index cc82c40eb4d..faf9392f1f1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionListProviderTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Testing; @@ -21,7 +20,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; -[UseExportProvider] public class DelegatedCompletionListProviderTest : LanguageServerTestBase { private readonly TestDelegatedCompletionListProvider _provider; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs index 66225461c0c..b338d8d03a1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs @@ -27,7 +27,7 @@ private protected async Task GetRewrittenCompletionLis { var completionContext = new VSInternalCompletionContext(); var codeDocument = CreateCodeDocument(documentContent); - var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", codeDocument); var provider = TestDelegatedCompletionListProvider.Create(initialCompletionList, LoggerFactory, rewriter ?? Rewriter); var clientCapabilities = new VSInternalClientCapabilities(); var completionList = await provider.GetCompletionListAsync(absoluteIndex, completionContext, documentContext, clientCapabilities, correlationId: Guid.Empty, cancellationToken: DisposalToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs index cd809b718d3..1f80264a23c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs @@ -364,7 +364,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletionItems(string var documentPath = "C:/path/to/document.cshtml"; TestFileMarkupParser.GetPosition(documentText, out documentText, out var cursorPosition); var codeDocument = CreateCodeDocument(documentText); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); // Act @@ -385,7 +385,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletions_Incomplete // Arrange var documentPath = "C:/path/to/document.cshtml"; var codeDocument = CreateCodeDocument("@"); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var completionContext = new VSInternalCompletionContext() { TriggerKind = CompletionTriggerKind.TriggerForIncompleteCompletions, @@ -418,7 +418,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete_KeywordIn() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@in"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -447,7 +447,7 @@ public async Task GetCompletionListAsync_DoesNotProvideInjectOnInvoked() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@inje"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -475,7 +475,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@inje"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -505,7 +505,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperElementCompletionItems var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("<"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); // Act @@ -535,7 +535,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperAttributeItems() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument(" GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, IEnumerable generatedDocumentEdits) + public IEnumerable GetHostDocumentEdits(IRazorGeneratedDocument generatedDocument, ImmutableArray generatedDocumentEdits) => []; public RazorLanguageKind GetLanguageKind(RazorCodeDocument codeDocument, int hostDocumentIndex, bool rightAssociative) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs index 718cbcfc0d5..7fa3f0ae3e8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs @@ -39,7 +39,8 @@ public async Task Handle_UnsupportedDocument_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; codeDocument.SetUnsupported(); var requestContext = CreateRazorRequestContext(documentContext); @@ -64,7 +65,8 @@ public async Task Handle_StartsInHtml_BreakpointMoved() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 14); var requestContext = CreateRazorRequestContext(documentContext); @@ -89,7 +91,8 @@ public async Task Handle_ImplicitExpression_StartsInHtml_BreakpointMoved() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 4, length: 12); var requestContext = CreateRazorRequestContext(documentContext); @@ -114,7 +117,8 @@ public async Task Handle_StartsInHtml_BreakpointMoved_Razor() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 14); var requestContext = CreateRazorRequestContext(documentContext); @@ -139,7 +143,8 @@ public async Task Handle_ImplicitExpression_StartsInHtml_BreakpointMoved_Razor() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 4, length: 12); var requestContext = CreateRazorRequestContext(documentContext); @@ -165,7 +170,8 @@ public async Task Handle_StartsInHtml_InvalidBreakpointSpan_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -189,7 +195,8 @@ public async Task Handle_StartInHtml_NoCSharpOnLine_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -216,7 +223,8 @@ public async Task Handle_StartInHtml_NoActualCSharp_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -243,7 +251,8 @@ public async Task Handle_InvalidBreakpointSpan_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(2, 0) + Position = VsLspFactory.CreatePosition(2, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -258,7 +267,7 @@ private static RazorCodeDocument CreateCodeDocument(string text, string? fileKin { var sourceDocument = TestRazorSourceDocument.Create(text); var projectEngine = RazorProjectEngine.Create(builder => { }); - var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind ?? FileKinds.Legacy, importSources: default, Array.Empty()); + var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind ?? FileKinds.Legacy, importSources: default, tagHelpers: []); return codeDocument; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs index 66f45a89fc0..092d8731e68 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs @@ -40,6 +40,7 @@ public async Task Handle_UnsupportedDocument_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; codeDocument.SetUnsupported(); var requestContext = CreateRazorRequestContext(documentContext); @@ -65,6 +66,7 @@ public async Task Handle_ReturnsValidExpressions() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 8), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -90,6 +92,7 @@ public async Task Handle_StartsInHtml_ReturnsValidExpressions() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -115,6 +118,7 @@ public async Task Handle_StartInHtml_NoCSharpOnLine_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -142,6 +146,7 @@ public async Task Handle_InvalidLocation_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.DefaultPosition, + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/ValidateBreakpointRangeEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/ValidateBreakpointRangeEndpointTest.cs index 1bc93112012..d13e3dfc828 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/ValidateBreakpointRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/ValidateBreakpointRangeEndpointTest.cs @@ -152,13 +152,13 @@ private async Task VerifyBreakpointRangeAsync(string input) Range = codeDocument.Source.Text.GetRange(breakpointSpan) }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateValidateBreakpointRangeRequestContext(documentContext); return await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); } - private RazorRequestContext CreateValidateBreakpointRangeRequestContext(VersionedDocumentContext documentContext) + private RazorRequestContext CreateValidateBreakpointRangeRequestContext(DocumentContext documentContext) { var lspServices = new Mock(MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs index 2711a8dc359..2f56371bdcc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs @@ -15,8 +15,8 @@ using Xunit; using Xunit.Abstractions; using DefinitionResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation, - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation[], + Microsoft.VisualStudio.LanguageServer.Protocol.Location, + Microsoft.VisualStudio.LanguageServer.Protocol.Location[], Microsoft.VisualStudio.LanguageServer.Protocol.DocumentLink[]>; namespace Microsoft.AspNetCore.Razor.LanguageServer.Definition; @@ -27,17 +27,17 @@ public class DefinitionEndpointDelegationTest(ITestOutputHelper testOutput) : Si public async Task Handle_SingleServer_CSharp_Method() { var input = """ -
- @{ - var x = Ge$$tX(); - } - @functions +
+ @{ + var x = Ge$$tX(); + } + @functions + { + void [|GetX|]() { - void [|GetX|]() - { - } } - """; + } + """; await VerifyCSharpGoToDefinitionAsync(input); } @@ -46,19 +46,19 @@ public async Task Handle_SingleServer_CSharp_Method() public async Task Handle_SingleServer_CSharp_Local() { var input = """ -
- @{ - var x = GetX(); - } - @functions +
+ @{ + var x = GetX(); + } + @functions + { + private string [|_name|]; + string GetX() { - private string [|_name|]; - string GetX() - { - return _na$$me; - } + return _na$$me; } - """; + } + """; await VerifyCSharpGoToDefinitionAsync(input); } @@ -67,12 +67,12 @@ string GetX() public async Task Handle_SingleServer_CSharp_MetadataReference() { var input = """ -
- @functions - { - private stri$$ng _name; - } - """; +
+ @functions + { + private stri$$ng _name; + } + """; // Arrange TestFileMarkupParser.GetPosition(input, out var output, out var cursorPosition); @@ -104,15 +104,15 @@ public async Task Handle_SingleServer_CSharp_MetadataReference() public async Task Handle_SingleServer_Attribute_SameFile(string method) { var input = $$""" -
+
- @code + @code + { + void [|IncrementCount|]() { - void [|IncrementCount|]() - { - } } - """; + } + """; await VerifyCSharpGoToDefinitionAsync(input, "test.razor"); } @@ -146,30 +146,30 @@ public async Task Handle_SingleServer_AttributeValue_BindAfter() public async Task Handle_SingleServer_ComponentAttribute_OtherRazorFile(string attribute) { var input = $$""" - + - @code - { - private string? InputValue { get; set; } + @code + { + private string? InputValue { get; set; } - private void BindAfter() - { - } + private void BindAfter() + { } - """; + } + """; // Need to put this in the right namespace, to match the tag helper defined in our test json var surveyPrompt = """ - @namespace BlazorApp1.Shared + @namespace BlazorApp1.Shared -
+
- @code - { - [Parameter] - public string [|Title|] { get; set; } - } - """; + @code + { + [Parameter] + public string [|Title|] { get; set; } + } + """; TestFileMarkupParser.GetSpan(surveyPrompt, out surveyPrompt, out var expectedSpan); var additionalRazorDocuments = new[] @@ -237,13 +237,14 @@ await projectManager.UpdateAsync(updater => rootNamespace: "project")); }); - var searchEngine = new RazorComponentSearchEngine(projectManager, LoggerFactory); + var componentSearchEngine = new RazorComponentSearchEngine(projectManager, LoggerFactory); + var componentDefinitionService = new RazorComponentDefinitionService(componentSearchEngine, DocumentMappingService, LoggerFactory); var razorUri = new Uri(razorFilePath); - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(razorUri, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(razorUri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); - var endpoint = new DefinitionEndpoint(searchEngine, DocumentMappingService, LanguageServerFeatureOptions, languageServer, LoggerFactory); + var endpoint = new DefinitionEndpoint(componentDefinitionService, DocumentMappingService, LanguageServerFeatureOptions, languageServer, LoggerFactory); var request = new TextDocumentPositionParams { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs deleted file mode 100644 index 02ae91c9c9b..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointTest.cs +++ /dev/null @@ -1,418 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -#nullable disable - -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Completion; -using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Definition; - -public class DefinitionEndpointTest(ITestOutputHelper testOutput) : TagHelperServiceTestBase(testOutput) -{ - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_Element() - { - var content = """ - @addTagHelper *, TestAssembly - - """; - - await VerifyOriginTagHelperBindingAsync(content, "Test1TagHelper", isRazorFile: false); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_StartTag_WithAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_EndTag_WithAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_Attribute_ReturnsNull() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_AttributeValue_ReturnsNull() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_AfterAttributeEquals_ReturnsNull() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_AttributeEnd_ReturnsNull() - { - var content = """ - @addTagHelper *, TestAssembly - $$ - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MultipleAttributes() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MalformedElement() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MalformedAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - -

- """; - - await VerifyOriginTagHelperBindingAsync(content); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_IgnoreAttribute_PropertyAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, ignoreAttributes: true, tagHelperDescriptorName: null, attributeDescriptorPropertyName: null); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_PropertyAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper", "BoolVal"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MinimizedPropertyAttribute() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper", "BoolVal"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MinimizedPropertyAttributeEdge1() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper", "BoolVal"); - } - - [Fact] - public async Task GetOriginTagHelperBindingAsync_TagHelper_MinimizedPropertyAttributeEdge2() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper", "BoolVal"); - } - - [Fact, WorkItem("https://github.com/dotnet/razor-tooling/issues/6775")] - public async Task GetOriginTagHelperBindingAsync_TagHelper_PropertyAttributeEdge() - { - var content = """ - @addTagHelper *, TestAssembly - - @code { - public void Increment() - { - } - } - """; - - await VerifyOriginTagHelperBindingAsync(content, "Component1TagHelper", "BoolVal"); - } - - [Fact] - public async Task GetNavigatePositionAsync_TagHelperProperty_CorrectRange1() - { - var content = """ -
@Title
- - @code - { - [Parameter] - public string NotTitle { get; set; } - - [Parameter] - public string [|Title|] { get; set; } - } - """; - - await VerifyNavigatePositionAsync(content, "Title"); - } - - [Fact] - public async Task GetNavigatePositionAsync_TagHelperProperty_CorrectRange2() - { - var content = """ -
@Title
- - @code - { - [Microsoft.AspNetCore.Components.Parameter] - public string [|Title|] { get; set; } - } - """; - - await VerifyNavigatePositionAsync(content, "Title"); - } - - [Fact] - public async Task GetNavigatePositionAsync_TagHelperProperty_CorrectRange3() - { - var content = """ -
@Title
- - @code - { - [Components.ParameterAttribute] - public string [|Title|] { get; set; } - } - """; - - await VerifyNavigatePositionAsync(content, "Title"); - } - - [Fact] - public async Task GetNavigatePositionAsync_TagHelperProperty_IgnoreInnerProperty() - { - var content = """ -
@Title
- - @code - { - private class NotTheDroidsYoureLookingFor - { - public string Title { get; set; } - } - - public string [|Title|] { get; set; } - } - """; - - await VerifyNavigatePositionAsync(content, "Title"); - } - - #region Helpers - private async Task VerifyOriginTagHelperBindingAsync(string content, string tagHelperDescriptorName = null, string attributeDescriptorPropertyName = null, bool isRazorFile = true, bool ignoreAttributes = false) - { - TestFileMarkupParser.GetPosition(content, out content, out var position); - - SetupDocument(out _, out var documentSnapshot, content, isRazorFile); - var documentContext = CreateDocumentContext(new Uri(@"C:\file.razor"), documentSnapshot); - - var (descriptor, attributeDescriptor) = await DefinitionEndpoint.GetOriginTagHelperBindingAsync( - documentContext, position, ignoreAttributes, LoggerFactory.GetOrCreateLogger("RazorDefinitionEndpoint"), DisposalToken); - - if (tagHelperDescriptorName is null) - { - Assert.Null(descriptor); - } - else - { - Assert.NotNull(descriptor); - Assert.Equal(tagHelperDescriptorName, descriptor!.Name); - } - - if (attributeDescriptorPropertyName is null) - { - Assert.Null(attributeDescriptor); - } - else - { - Assert.NotNull(attributeDescriptor); - Assert.Equal(attributeDescriptorPropertyName, attributeDescriptor.GetPropertyName()); - } - } - - private async Task VerifyNavigatePositionAsync(string content, string propertyName) - { - TestFileMarkupParser.GetSpan(content, out content, out var selection); - - SetupDocument(out var codeDocument, out _, content); - var expectedRange = codeDocument.Source.Text.GetRange(selection); - - var mappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); - - var range = await DefinitionEndpoint.TryGetPropertyRangeAsync(codeDocument, propertyName, mappingService, Logger, DisposalToken); - Assert.NotNull(range); - Assert.Equal(expectedRange, range); - } - - private void SetupDocument(out RazorCodeDocument codeDocument, out IDocumentSnapshot documentSnapshot, string content, bool isRazorFile = true) - { - var sourceText = SourceText.From(content); - codeDocument = CreateCodeDocument(content, isRazorFile, DefaultTagHelpers); - var outDoc = codeDocument; - documentSnapshot = Mock.Of( - d => d.GetTextAsync() == Task.FromResult(sourceText), - MockBehavior.Strict); - Mock.Get(documentSnapshot) - .Setup(s => s.GetGeneratedOutputAsync()) - .ReturnsAsync(outDoc); - } - #endregion -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/RazorComponentDefinitionHelpersTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/RazorComponentDefinitionHelpersTest.cs new file mode 100644 index 00000000000..8f18f575019 --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/RazorComponentDefinitionHelpersTest.cs @@ -0,0 +1,404 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer.Completion; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; +using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.GoToDefinition; +using Microsoft.CodeAnalysis.Testing; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Definition; + +public class RazorComponentDefinitionHelpersTest(ITestOutputHelper testOutput) : TagHelperServiceTestBase(testOutput) +{ + [Fact] + public void TryGetBoundTagHelpers_TagHelper_Element() + { + var content = """ + @addTagHelper *, TestAssembly + + """; + + VerifyTryGetBoundTagHelpers(content, "Test1TagHelper", isRazorFile: false); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_StartTag_WithAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_EndTag_WithAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_Attribute_ReturnsNull() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_AttributeValue_ReturnsNull() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_AfterAttributeEquals_ReturnsNull() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_AttributeEnd_ReturnsNull() + { + var content = """ + @addTagHelper *, TestAssembly + $$ + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MultipleAttributes() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MalformedElement() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MalformedAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + +

+ """; + + VerifyTryGetBoundTagHelpers(content); + } + + [Fact] + public void TryGetBoundTagHelpers_IgnoreAttribute_PropertyAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, ignoreAttributes: true); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_PropertyAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper", "BoolVal"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MinimizedPropertyAttribute() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper", "BoolVal"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MinimizedPropertyAttributeEdge1() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper", "BoolVal"); + } + + [Fact] + public void TryGetBoundTagHelpers_TagHelper_MinimizedPropertyAttributeEdge2() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper", "BoolVal"); + } + + [Fact, WorkItem("https://github.com/dotnet/razor-tooling/issues/6775")] + public void TryGetBoundTagHelpers_TagHelper_PropertyAttributeEdge() + { + var content = """ + @addTagHelper *, TestAssembly + + @code { + public void Increment() + { + } + } + """; + + VerifyTryGetBoundTagHelpers(content, "Component1TagHelper", "BoolVal"); + } + + [Fact] + public async Task TryGetPropertyRangeAsync_TagHelperProperty_CorrectRange1() + { + var content = """ +
@Title
+ + @code + { + [Parameter] + public string NotTitle { get; set; } + + [Parameter] + public string [|Title|] { get; set; } + } + """; + + await VerifyTryGetPropertyRangeAsync(content, "Title"); + } + + [Fact] + public async Task TryGetPropertyRangeAsync_TagHelperProperty_CorrectRange2() + { + var content = """ +
@Title
+ + @code + { + [Microsoft.AspNetCore.Components.Parameter] + public string [|Title|] { get; set; } + } + """; + + await VerifyTryGetPropertyRangeAsync(content, "Title"); + } + + [Fact] + public async Task TryGetPropertyRangeAsync_TagHelperProperty_CorrectRange3() + { + var content = """ +
@Title
+ + @code + { + [Components.ParameterAttribute] + public string [|Title|] { get; set; } + } + """; + + await VerifyTryGetPropertyRangeAsync(content, "Title"); + } + + [Fact] + public async Task TryGetPropertyRangeAsync_TagHelperProperty_IgnoreInnerProperty() + { + var content = """ +
@Title
+ + @code + { + private class NotTheDroidsYoureLookingFor + { + public string Title { get; set; } + } + + public string [|Title|] { get; set; } + } + """; + + await VerifyTryGetPropertyRangeAsync(content, "Title"); + } + + private void VerifyTryGetBoundTagHelpers( + string content, + string? tagHelperDescriptorName = null, + string? attributeDescriptorPropertyName = null, + bool isRazorFile = true, + bool ignoreAttributes = false) + { + TestFileMarkupParser.GetPosition(content, out content, out var position); + + var codeDocument = CreateCodeDocument(content, isRazorFile); + + var result = RazorComponentDefinitionHelpers.TryGetBoundTagHelpers(codeDocument, position, ignoreAttributes, Logger, out var boundTagHelper, out var boundAttribute); + + if (tagHelperDescriptorName is null) + { + Assert.False(result); + } + else + { + Assert.True(result); + Assert.NotNull(boundTagHelper); + Assert.Equal(tagHelperDescriptorName, boundTagHelper.Name); + } + + if (attributeDescriptorPropertyName is not null) + { + Assert.True(result); + Assert.NotNull(boundAttribute); + Assert.Equal(attributeDescriptorPropertyName, boundAttribute.GetPropertyName()); + } + } + + private async Task VerifyTryGetPropertyRangeAsync(string content, string propertyName) + { + TestFileMarkupParser.GetSpan(content, out content, out var selection); + + var codeDocument = CreateCodeDocument(content); + var expectedRange = codeDocument.Source.Text.GetRange(selection); + var snapshot = TestDocumentSnapshot.Create("test.razor", content).With(codeDocument); + + var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); + + var range = await RazorComponentDefinitionHelpers.TryGetPropertyRangeAsync(snapshot, propertyName, documentMappingService, Logger, DisposalToken); + Assert.NotNull(range); + Assert.Equal(expectedRange, range); + } + + private RazorCodeDocument CreateCodeDocument(string content, bool isRazorFile = true) + => CreateCodeDocument(content, isRazorFile, DefaultTagHelpers); +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/CSharpDiagnosticsEndToEndTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/CSharpDiagnosticsEndToEndTest.cs index 8122d21ac0e..6a650134e75 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/CSharpDiagnosticsEndToEndTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/CSharpDiagnosticsEndToEndTest.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/DocumentPullDiagnosticsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/DocumentPullDiagnosticsEndpointTest.cs index ecbadccdd23..c930ee00dd7 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/DocumentPullDiagnosticsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/DocumentPullDiagnosticsEndpointTest.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticConverterTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticConverterTest.cs index 4e670005541..b62496963d5 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticConverterTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticConverterTest.cs @@ -6,6 +6,7 @@ using System.Globalization; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs index 4cdbc79137d..c3f9cf2eb0a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs @@ -2,6 +2,8 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,6 +14,7 @@ using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Razor.Diagnostics; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -523,10 +526,10 @@ public void ClearClosedDocuments_RestartsTimerIfDocumentsStillOpen() Assert.True(publisherAccessor.IsWaitingToClearClosedDocuments); } - private static RazorCodeDocument CreateCodeDocument(RazorDiagnostic[] diagnostics) + private static RazorCodeDocument CreateCodeDocument(IEnumerable diagnostics) { var codeDocument = TestRazorCodeDocument.Create("hello"); - var razorCSharpDocument = RazorCSharpDocument.Create(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics); + var razorCSharpDocument = new RazorCSharpDocument(codeDocument, "hello", RazorCodeGenerationOptions.Default, diagnostics.ToImmutableArray()); codeDocument.SetCSharpDocument(razorCSharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs index 31394f347d2..a202af3d35c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs @@ -21,13 +21,11 @@ public class DocumentContextFactoryTest : LanguageServerTestBase private static readonly string s_baseDirectory = PathUtilities.CreateRootedPath("path", "to"); private readonly TestProjectSnapshotManager _projectManager; - private readonly IDocumentVersionCache _documentVersionCache; public DocumentContextFactoryTest(ITestOutputHelper testOutput) : base(testOutput) { _projectManager = CreateProjectSnapshotManager(); - _documentVersionCache = new DocumentVersionCache(_projectManager); } [Fact] @@ -37,7 +35,7 @@ public void TryCreateAsync_CanNotResolveDocument_ReturnsNull() var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.False(factory.TryCreate(uri, out _)); @@ -50,30 +48,10 @@ public void TryCreateForOpenDocumentAsync_CanNotResolveDocument_ReturnsNull() var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act - Assert.False(factory.TryCreateForOpenDocument(uri, out _)); - } - - [Fact] - public async Task TryCreateForOpenDocumentAsync_CanNotResolveVersion_ReturnsNull() - { - // Arrange - var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); - var uri = new Uri(filePath); - - var hostDocument = new HostDocument(filePath, "file.cshtml"); - - await _projectManager.UpdateAsync(updater => - { - updater.DocumentAdded(MiscFilesHostProject.Instance.Key, hostDocument, TestMocks.CreateTextLoader(filePath, "")); - }); - - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); - - // Act - Assert.False(factory.TryCreateForOpenDocument(uri, out _)); + Assert.False(factory.TryCreate(uri, out _)); } [Fact] @@ -94,7 +72,7 @@ await _projectManager.UpdateAsync(updater => var documentSnapshot = miscFilesProject.GetDocument(filePath); Assert.NotNull(documentSnapshot); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.True(factory.TryCreate(uri, out var documentContext)); @@ -113,7 +91,7 @@ public async Task TryCreateAsync_WithProjectContext_Resolves() var projectFilePath = Path.Combine(s_baseDirectory, "project.csproj"); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); var hostProject = new HostProject(projectFilePath, intermediateOutputPath, RazorConfiguration.Default, rootNamespace: null); var hostDocument = new HostDocument(filePath, "file.cshtml"); @@ -149,14 +127,13 @@ await _projectManager.UpdateAsync(updater => var documentSnapshot = miscFilesProject.GetDocument(filePath); Assert.NotNull(documentSnapshot); - _documentVersionCache.TrackDocumentVersion(documentSnapshot, version: 1337); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act - Assert.True(factory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(factory.TryCreate(uri, out var documentContext)); // Assert - Assert.Equal(1337, documentContext.Version); + Assert.Equal(1, documentContext.Snapshot.Version); Assert.Equal(uri, documentContext.Uri); Assert.Same(documentSnapshot, documentContext.Snapshot); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs index 060c282439d..6510f2dd7ee 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Testing; @@ -23,7 +22,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.DocumentHighlighting; -[UseExportProvider] public class DocumentHighlightEndpointTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { [Fact] @@ -112,7 +110,7 @@ private async Task VerifyHighlightingRangesAsync(string input) await csharpServer.OpenDocumentAsync(csharpDocumentUri, csharpSourceText.ToString()); var razorFilePath = "C:/path/to/file.razor"; - var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); + var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); var languageServerFeatureOptions = Mock.Of(options => options.SupportsFileManipulation == true && options.SingleServerSupport == true && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentTextPresentationEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentTextPresentationEndpointTests.cs index 7c36bf571c9..9490c6ad034 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentTextPresentationEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentTextPresentationEndpointTests.cs @@ -2,15 +2,14 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.DocumentPresentation; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; @@ -24,116 +23,83 @@ public class TextDocumentTextPresentationEndpointTests(ITestOutputHelper testOut public async Task Handle_Html_MakesRequest() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); + TestCode code = "<[|d|]iv>
"; + + var codeDocument = CreateCodeDocument(code.Text); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorTextPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response) - .Verifiable(); - - var endpoint = new TextDocumentTextPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null, verifiable: true); + var endpoint = CreateEndpoint(clientConnection); var parameters = new TextPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, - Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), + TextDocument = new() { Uri = uri }, + Range = codeDocument.Source.Text.GetRange(code.Span), Text = "Hi there" }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var result = await endpoint.HandleRequestAsync(parameters, requestContext, DisposalToken); + _ = await endpoint.HandleRequestAsync(parameters, requestContext, DisposalToken); // Assert - clientConnection.Verify(); + Mock.Get(clientConnection).Verify(); } [Fact] public async Task Handle_CSharp_DoesNotMakeRequest() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("@counter"); - var csharpDocument = codeDocument.GetCSharpDocument(); + TestCode code = "@[|c|]ounter"; + + var codeDocument = CreateCodeDocument(code.Text); + var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var projectedRange = It.IsAny(); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp && - s.TryMapToGeneratedDocumentRange(csharpDocument, It.IsAny(), out projectedRange) == true, MockBehavior.Strict); - - var clientConnection = new Mock(MockBehavior.Strict); - var endpoint = new TextDocumentTextPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - LoggerFactory); + var clientConnection = StrictMock.Of(); + var endpoint = CreateEndpoint(clientConnection); var parameters = new TextPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, - Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), + TextDocument = new() { Uri = uri }, + Range = codeDocument.Source.Text.GetRange(code.Span), Text = "Hi there" }; + var requestContext = CreateRazorRequestContext(documentContext); // Act - var result = await endpoint.HandleRequestAsync(parameters, requestContext, DisposalToken); + _ = await endpoint.HandleRequestAsync(parameters, requestContext, DisposalToken); // Assert - clientConnection.Verify(); + Mock.Get(clientConnection) + .VerifySendRequest(CustomMessageNames.RazorTextPresentationEndpoint, Times.Never); } [Fact] public async Task Handle_DocumentNotFound_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); + TestCode code = "<[|d|]iv>
"; + + var codeDocument = CreateCodeDocument(code.Text); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorTextPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentTextPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(clientConnection); var parameters = new TextPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, - Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), + TextDocument = new() { Uri = uri }, + Range = codeDocument.Source.Text.GetRange(code.Span), Text = "Hi there" }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -147,35 +113,24 @@ public async Task Handle_DocumentNotFound_ReturnsNull() public async Task Handle_UnsupportedCodeDocument_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); + TestCode code = "<[|d|]iv>
"; + + var codeDocument = CreateCodeDocument(code.Text); codeDocument.SetUnsupported(); + var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - - var response = new WorkspaceEdit(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorTextPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentTextPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - LoggerFactory); + var clientConnection = CreateClientConnection(response: new WorkspaceEdit()); + var endpoint = CreateEndpoint(clientConnection); var parameters = new TextPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, - Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), + TextDocument = new() { Uri = uri }, + Range = codeDocument.Source.Text.GetRange(code.Span), Text = "Hi there" }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -184,4 +139,13 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() // Assert Assert.Null(result); } + + private TextDocumentTextPresentationEndpoint CreateEndpoint(IClientConnection clientConnection) + => new(StrictMock.Of(), clientConnection, FilePathService, LoggerFactory); + + private static IClientConnection CreateClientConnection(WorkspaceEdit? response, bool verifiable = false) + => TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(CustomMessageNames.RazorTextPresentationEndpoint, response, verifiable); + }); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs index 318436e546a..123764dc623 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs @@ -2,11 +2,11 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.ProjectSystem; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.CodeAnalysis.Razor.DocumentMapping; @@ -15,7 +15,6 @@ using Microsoft.CodeAnalysis.Razor.Protocol.DocumentPresentation; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; using Xunit; using Xunit.Abstractions; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; @@ -30,48 +29,43 @@ public async Task Handle_SimpleComponent_ReturnsResult() // Arrange var projectManager = CreateProjectSnapshotManager(); - var project = await projectManager.UpdateAsync(updater => updater.CreateAndAddProject("c:/path/project.csproj")); + var project = await projectManager.UpdateAsync(updater => + { + return updater.CreateAndAddProject("c:/path/project.csproj"); + }); + await projectManager.CreateAndAddDocumentAsync(project, "c:/path/index.razor"); await projectManager.CreateAndAddDocumentAsync(project, "c:/path/MyTagHelper.razor"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var droppedUri = new Uri("file:///c:/path/MyTagHelper.razor"); var builder = TagHelperDescriptorBuilder.Create("MyTagHelper", "MyAssembly"); builder.SetMetadata(TypeNameIdentifier("MyTagHelper"), TypeNamespace("TestRootNamespace")); - var tagHelperDescriptor = builder.Build(); - await projectManager.UpdateAsync(updater => updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([tagHelperDescriptor]))); + await projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([builder.Build()])); + }); var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); - await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); - var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + await projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
")); + }); - var clientConnection = new Mock(MockBehavior.Strict); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); + Assert.True(documentContextFactory.TryCreate(uri, projectContext: null, out var documentContext)); - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var endpoint = CreateEndpoint(documentContextFactory); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [droppedUri] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -79,7 +73,12 @@ public async Task Handle_SimpleComponent_ReturnsResult() // Assert Assert.NotNull(result); - Assert.Equal("", result.DocumentChanges!.Value.First[0].Edits[0].NewText); + Assert.NotNull(result.DocumentChanges); + + var documentChanges = result.DocumentChanges.GetValueOrDefault(); + Assert.True(documentChanges.TryGetFirst(out var documentEdits)); + + Assert.Equal("", documentEdits[0].Edits[0].NewText); } [OSSkipConditionFact(["OSX", "Linux"])] @@ -88,45 +87,39 @@ public async Task Handle_SimpleComponentWithChildFile_ReturnsResult() // Arrange var projectManager = CreateProjectSnapshotManager(); - var project = await projectManager.UpdateAsync(updater => updater.CreateAndAddProject("c:/path/project.csproj")); + var project = await projectManager.UpdateAsync(updater => + { + return updater.CreateAndAddProject("c:/path/project.csproj"); + }); + await projectManager.CreateAndAddDocumentAsync(project, "c:/path/index.razor"); await projectManager.CreateAndAddDocumentAsync(project, "c:/path/MyTagHelper.razor"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var droppedUri = new Uri("file:///c:/path/MyTagHelper.razor"); var builder = TagHelperDescriptorBuilder.Create("MyTagHelper", "MyAssembly"); builder.SetMetadata(TypeNameIdentifier("MyTagHelper"), TypeNamespace("TestRootNamespace")); - var tagHelperDescriptor = builder.Build(); - await projectManager.UpdateAsync(updater => updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([tagHelperDescriptor]))); + await projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([builder.Build()])); + }); var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); - await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); - var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + await projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
")); + }); - var clientConnection = new Mock(MockBehavior.Strict); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var endpoint = CreateEndpoint(documentContextFactory); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [ @@ -135,6 +128,7 @@ public async Task Handle_SimpleComponentWithChildFile_ReturnsResult() droppedUri, ] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -142,7 +136,12 @@ public async Task Handle_SimpleComponentWithChildFile_ReturnsResult() // Assert Assert.NotNull(result); - Assert.Equal("", result!.DocumentChanges!.Value.First[0].Edits[0].NewText); + Assert.NotNull(result.DocumentChanges); + + var documentChanges = result.DocumentChanges.GetValueOrDefault(); + Assert.True(documentChanges.TryGetFirst(out var documentEdits)); + + Assert.Equal("", documentEdits[0].Edits[0].NewText); } [OSSkipConditionFact(["OSX", "Linux"])] @@ -151,13 +150,14 @@ public async Task Handle_ComponentWithRequiredAttribute_ReturnsResult() // Arrange var projectManager = CreateProjectSnapshotManager(); - var project = await projectManager.UpdateAsync(updater => updater.CreateAndAddProject("c:/path/project.csproj")); + var project = await projectManager.UpdateAsync(updater => + { + return updater.CreateAndAddProject("c:/path/project.csproj"); + }); + await projectManager.CreateAndAddDocumentAsync(project, "c:/path/index.razor"); await projectManager.CreateAndAddDocumentAsync(project, "c:/path/fetchdata.razor"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var droppedUri = new Uri("file:///c:/path/fetchdata.razor"); var builder = TagHelperDescriptorBuilder.Create("FetchData", "MyAssembly"); builder.SetMetadata(TypeNameIdentifier("FetchData"), TypeNamespace("TestRootNamespace")); @@ -167,38 +167,32 @@ public async Task Handle_ComponentWithRequiredAttribute_ReturnsResult() b.Name = "MyAttribute"; }); builder.BindAttribute(b => b.Name = "MyNonRequiredAttribute"); - var tagHelperDescriptor = builder.Build(); - await projectManager.UpdateAsync(updater => updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([tagHelperDescriptor]))); + await projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([builder.Build()])); + }); var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); - await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); - var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + await projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
")); + }); - var clientConnection = new Mock(MockBehavior.Strict); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var endpoint = CreateEndpoint(documentContextFactory); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [droppedUri] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -206,51 +200,35 @@ public async Task Handle_ComponentWithRequiredAttribute_ReturnsResult() // Assert Assert.NotNull(result); - Assert.Equal("", result.DocumentChanges!.Value.First[0].Edits[0].NewText); + Assert.NotNull(result.DocumentChanges); + + var documentChanges = result.DocumentChanges.GetValueOrDefault(); + Assert.True(documentChanges.TryGetFirst(out var documentEdits)); + + Assert.Equal("", documentEdits[0].Edits[0].NewText); } [Fact] public async Task Handle_NoTypeNameIdentifier_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - - var componentCodeDocument = TestRazorCodeDocument.Create("
"); + var codeDocument = CreateCodeDocument("
"); + var uri = new Uri("file://path/test.razor"); var droppedUri = new Uri("file:///c:/path/MyTagHelper.razor"); - var builder = TagHelperDescriptorBuilder.Create("MyTagHelper", "MyAssembly"); - var tagHelperDescriptor = builder.Build(); - - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(componentCodeDocument), MockBehavior.Strict); - var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [droppedUri] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -264,36 +242,18 @@ public async Task Handle_NoTypeNameIdentifier_ReturnsNull() public async Task Handle_MultipleUris_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var codeDocument = CreateCodeDocument("
"); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [ @@ -302,6 +262,7 @@ public async Task Handle_MultipleUris_ReturnsNull() new Uri("file:///c:/path/MyTagHelper.razor"), ] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -315,40 +276,23 @@ public async Task Handle_MultipleUris_ReturnsNull() public async Task Handle_NotComponent_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var codeDocument = CreateCodeDocument("
"); var droppedUri = new Uri("file:///c:/path/MyTagHelper.cshtml"); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [droppedUri] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -364,49 +308,49 @@ public async Task Handle_ComponentWithNestedFiles_ReturnsResult() // Arrange var projectManager = CreateProjectSnapshotManager(); - var project = await projectManager.UpdateAsync(updater => updater.CreateAndAddProject("c:/path/project.csproj")); + var project = await projectManager.UpdateAsync(updater => + { + return updater.CreateAndAddProject("c:/path/project.csproj"); + }); + await projectManager.CreateAndAddDocumentAsync(project, "c:/path/index.razor"); await projectManager.CreateAndAddDocumentAsync(project, "c:/path/fetchdata.razor"); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var droppedUri1 = new Uri("file:///c:/path/fetchdata.razor.cs"); var droppedUri2 = new Uri("file:///c:/path/fetchdata.razor"); var builder = TagHelperDescriptorBuilder.Create("FetchData", "MyAssembly"); builder.SetMetadata(TypeNameIdentifier("FetchData"), TypeNamespace("TestRootNamespace")); - var tagHelperDescriptor = builder.Build(); - await projectManager.UpdateAsync(updater => updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([tagHelperDescriptor]))); + await projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(project.Key, ProjectWorkspaceState.Create([builder.Build()])); + }); var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); - await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); - var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + await projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
")); + }); - var clientConnection = new Mock(MockBehavior.Strict); + var documentSnapshot = projectManager + .GetLoadedProject(project.Key) + .GetDocument(razorFilePath); + Assert.NotNull(documentSnapshot); - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); + Assert.True(documentContextFactory.TryCreate(uri, projectContext: null, out var documentContext)); + + var endpoint = CreateEndpoint(documentContextFactory); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1), Uris = [droppedUri1, droppedUri2] }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -414,47 +358,32 @@ public async Task Handle_ComponentWithNestedFiles_ReturnsResult() // Assert Assert.NotNull(result); - Assert.Equal("", result!.DocumentChanges!.Value.First[0].Edits[0].NewText); + Assert.NotNull(result.DocumentChanges); + + var documentChanges = result.DocumentChanges.GetValueOrDefault(); + Assert.True(documentChanges.TryGetFirst(out var documentEdits)); + + Assert.Equal("", documentEdits[0].Edits[0].NewText); } [Fact] public async Task Handle_CSharp_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("@counter"); - var csharpDocument = codeDocument.GetCSharpDocument(); + var codeDocument = CreateCodeDocument("@counter"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var projectedRange = It.IsAny(); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp && - s.TryMapToGeneratedDocumentRange(csharpDocument, It.IsAny(), out projectedRange) == true, MockBehavior.Strict); - - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1) }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -468,37 +397,21 @@ public async Task Handle_CSharp_ReturnsNull() public async Task Handle_DocumentNotFound_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); + var codeDocument = CreateCodeDocument("
"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1) }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -512,38 +425,22 @@ public async Task Handle_DocumentNotFound_ReturnsNull() public async Task Handle_UnsupportedCodeDocument_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); + var codeDocument = CreateCodeDocument("
"); codeDocument.SetUnsupported(); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); - var response = new WorkspaceEdit(); - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: new WorkspaceEdit()); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1) }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -557,37 +454,21 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() public async Task Handle_NoUris_ReturnsNull() { // Arrange - var codeDocument = TestRazorCodeDocument.Create("
"); + var codeDocument = CreateCodeDocument("
"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); - var response = (WorkspaceEdit?)null; - - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(CustomMessageNames.RazorUriPresentationEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); - - var endpoint = new TextDocumentUriPresentationEndpoint( - documentMappingService, - clientConnection.Object, - FilePathService, - documentContextFactory, - LoggerFactory); + var clientConnection = CreateClientConnection(response: null); + var endpoint = CreateEndpoint(documentContextFactory, clientConnection); var parameters = new UriPresentationParams() { - TextDocument = new TextDocumentIdentifier - { - Uri = uri - }, + TextDocument = new() { Uri = uri }, Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 1) }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -596,4 +477,22 @@ public async Task Handle_NoUris_ReturnsNull() // Assert Assert.Null(result); } + + private TextDocumentUriPresentationEndpoint CreateEndpoint( + IDocumentContextFactory documentContextFactory, + IClientConnection? clientConnection = null) + { + return new TextDocumentUriPresentationEndpoint( + StrictMock.Of(), + clientConnection ?? StrictMock.Of(), + FilePathService, + documentContextFactory, + LoggerFactory); + } + + private static IClientConnection CreateClientConnection(WorkspaceEdit? response) + => TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(CustomMessageNames.RazorUriPresentationEndpoint, response); + }); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs index f8cbf5683e3..5f08b7394d3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.DocumentSymbols; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol.DocumentSymbols; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -24,7 +25,7 @@ public Task DocumentSymbols_CSharpClassWithMethods(bool hierarchical) => VerifyDocumentSymbolsAsync( """ @functions { - class {|AspNetCore.test.C:C|} + class {|AspNetCoreGeneratedDocument.test.C:C|} { private void {|HandleString(string s):HandleString|}(string s) { @@ -83,7 +84,8 @@ public async Task DocumentSymbols_DisabledWhenNotSingleServer() // This test requires the SingleServerSupport to be disabled Assert.False(TestLanguageServerFeatureOptions.Instance.SingleServerSupport); - var endpoint = new DocumentSymbolEndpoint(languageServer, DocumentMappingService, TestLanguageServerFeatureOptions.Instance); + var documentSymbolService = new DocumentSymbolService(DocumentMappingService); + var endpoint = new DocumentSymbolEndpoint(languageServer, documentSymbolService, TestLanguageServerFeatureOptions.Instance); var serverCapabilities = new VSInternalServerCapabilities(); var clientCapabilities = new VSInternalClientCapabilities(); @@ -102,7 +104,8 @@ private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = var languageServer = await CreateLanguageServerAsync(codeDocument, razorFilePath, capabilitiesUpdater: c => c.TextDocument!.DocumentSymbol = new DocumentSymbolSetting() { HierarchicalDocumentSymbolSupport = hierarchical }); - var endpoint = new DocumentSymbolEndpoint(languageServer, DocumentMappingService, TestLanguageServerFeatureOptions.Instance); + var documentSymbolService = new DocumentSymbolService(DocumentMappingService); + var endpoint = new DocumentSymbolEndpoint(languageServer, documentSymbolService, TestLanguageServerFeatureOptions.Instance); var request = new DocumentSymbolParams() { @@ -117,7 +120,7 @@ private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = } } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); var result = await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs index baf947911fb..93e144b75a4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs @@ -33,7 +33,7 @@ public void ApplyContentChanges_SingleChange() }; // Act - var result = endpoint.ApplyContentChanges(new[] { change }, sourceText); + var result = endpoint.ApplyContentChanges([change], sourceText); // Assert Assert.Equal("Hello! World", result.ToString()); @@ -98,13 +98,12 @@ public async Task Handle_DidChangeTextDocument_UpdatesDocument() var documentContext = CreateDocumentContext(documentPath, codeDocument); var projectService = new StrictMock(); projectService - .Setup(service => service.UpdateDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(service => service.UpdateDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask) - .Callback((string path, SourceText text, int version, CancellationToken cancellationToken) => + .Callback((string path, SourceText text, CancellationToken cancellationToken) => { Assert.Equal("

", text.ToString()); Assert.Equal(documentPath.OriginalString, path); - Assert.Equal(1337, version); }); var endpoint = new DocumentDidChangeEndpoint(projectService.Object, LoggerFactory); var change = new TextDocumentContentChangeEvent() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs index 4867629a6f9..a2067331373 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs @@ -25,13 +25,12 @@ public async Task Handle_DidOpenTextDocument_AddsDocument() var documentPath = "C:/path/to/document.cshtml"; var projectService = new StrictMock(); projectService - .Setup(service => service.OpenDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(service => service.OpenDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask) - .Callback((string path, SourceText text, int version, CancellationToken cancellationToken) => + .Callback((string path, SourceText text, CancellationToken cancellationToken) => { Assert.Equal("hello", text.ToString()); Assert.Equal(documentPath, path); - Assert.Equal(1337, version); }); var endpoint = new DocumentDidOpenEndpoint(projectService.Object); var request = new DidOpenTextDocumentParams() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs deleted file mode 100644 index acad8a273e2..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -#if NETFRAMEWORK -using System; -using System.Collections.Generic; -#endif -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; -using Microsoft.CodeAnalysis; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -public class DocumentVersionCacheTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) -{ - [Fact] - public void MarkAsLatestVersion_UntrackedDocument_Noops() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(document, 123); - var untrackedDocument = TestDocumentSnapshot.Create("C:/other.cshtml"); - - // Act - cacheAccessor.MarkAsLatestVersion(untrackedDocument); - - // Assert - Assert.False(cache.TryGetDocumentVersion(untrackedDocument, out var version)); - Assert.Null(version); - } - - [Fact] - public void MarkAsLatestVersion_KnownDocument_TracksNewDocumentAsLatest() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var documentInitial = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(documentInitial, 123); - var documentLatest = TestDocumentSnapshot.Create(documentInitial.FilePath); - - // Act - cacheAccessor.MarkAsLatestVersion(documentLatest); - - // Assert - Assert.True(cache.TryGetDocumentVersion(documentLatest, out var version)); - Assert.Equal(123, version); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_DocumentRemoved_DoesNotEvictDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, TextLoader.From(textAndVersion)); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentRemoved(document.ProjectInternal.Key, document.State.HostDocument)); - result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 2 - Assert.True(result); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_OpenDocumentRemoved_DoesNotEvictDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, TextLoader.From(textAndVersion)); - updater.DocumentOpened(document.ProjectInternal.Key, document.FilePath, textAndVersion.Text); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - Assert.True(projectManager.IsDocumentOpen(document.FilePath)); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentRemoved(document.ProjectInternal.Key, document.State.HostDocument)); - result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 2 - Assert.True(result); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_DocumentClosed_EvictsDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - var textLoader = TextLoader.From(textAndVersion); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, textLoader); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentClosed(document.ProjectInternal.HostProject.Key, document.State.HostDocument.FilePath, textLoader)); - result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - 2 - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TrackDocumentVersion_AddsFirstEntry() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - // Act - cache.TrackDocumentVersion(document, 1337); - - // Assert - var entries = cacheAccessor.GetEntries(); - var (filePath, entry) = Assert.Single(entries); - Assert.Equal(document.FilePath, filePath); - var (actualDocument, actualVersion) = Assert.Single(entry); - Assert.Same(document, actualDocument); - Assert.Equal(1337, actualVersion); - } - - [Fact] - public void TrackDocumentVersion_EvictsOldEntries() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - for (var i = 0; i < DocumentVersionCache.MaxDocumentTrackingCount; i++) - { - cache.TrackDocumentVersion(document, i); - } - - // Act - cache.TrackDocumentVersion(document, 1337); - - // Assert - var (_, entry) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(DocumentVersionCache.MaxDocumentTrackingCount, entry.Length); - Assert.Equal(1337, entry[^1].Version); - } - - [Fact] - public void TryGetDocumentVersion_UntrackedDocumentPath_ReturnsFalse() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - // Act - var result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TryGetDocumentVersion_EvictedDocument_ReturnsFalse() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - var evictedDocument = TestDocumentSnapshot.Create(document.FilePath); - cache.TrackDocumentVersion(document, 1337); - - // Act - var result = cache.TryGetDocumentVersion(evictedDocument, out var version); - - // Assert - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TryGetDocumentVersion_KnownDocument_ReturnsTrue() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(document, 1337); - - // Act - var result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - Assert.True(result); - Assert.Equal(1337, version); - } - - [Fact] - public async Task ProjectSnapshotManager_KnownDocumentAdded_TracksNewDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - - var project1 = TestProjectSnapshot.Create( - "C:/path/to/project1.csproj", - intermediateOutputPath: "C:/path/to/obj1", - documentFilePaths: [], - RazorConfiguration.Default, - projectWorkspaceState: null); - - var document1 = await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(project1.HostProject); - return updater.CreateAndAddDocument(project1, @"C:\path\to\file.razor"); - }); - - // Act - cache.TrackDocumentVersion(document1, 1337); - - // Assert - var (filePath, entries) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(document1.FilePath, filePath); - var (actualDocument, actualVersion) = Assert.Single(entries); - Assert.Same(document1, actualDocument); - Assert.Equal(1337, actualVersion); - - // Act II - var project2 = TestProjectSnapshot.Create( - "C:/path/to/project2.csproj", - intermediateOutputPath: "C:/path/to/obj2", - documentFilePaths: [], - RazorConfiguration.Default, - projectWorkspaceState: null); - - var document2 = await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(project2.HostProject); - updater.CreateAndAddDocument(project2, @"C:\path\to\file.razor"); - - return updater - .GetLoadedProject(project2.Key) - .GetDocument(document1.FilePath); - }); - - // Assert II - (filePath, entries) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(document1.FilePath, filePath); - Assert.Equal(2, entries.Length); - - // Should still be tracking document 1 with no changes - (actualDocument, actualVersion) = entries[0]; - Assert.Same(document1, actualDocument); - Assert.Equal(1337, actualVersion); - - (actualDocument, actualVersion) = entries[1]; - Assert.Same(document2, actualDocument); - Assert.Equal(1337, actualVersion); - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindNodeTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindNodeTests.cs index 4b55819c919..5adc6703356 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindNodeTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindNodeTests.cs @@ -75,8 +75,9 @@ protected override async Task OnInitializedAsync() [InlineData(5, 20, SyntaxKind.MarkupTextLiteral, true)] [InlineData(20, 21, SyntaxKind.CSharpTransition, false)] [InlineData(20, 21, SyntaxKind.CSharpTransition, true)] - [InlineData(21, 43, SyntaxKind.CSharpStatementLiteral, false)] - [InlineData(21, 43, SyntaxKind.CSharpStatementLiteral, true)] + [InlineData(21, 41, SyntaxKind.CSharpStatementLiteral, false)] + [InlineData(21, 41, SyntaxKind.CSharpStatementLiteral, true)] + [InlineData(41, 43, SyntaxKind.RazorMetaCode, true)] [InlineData(43, 44, SyntaxKind.CSharpTransition, false)] [InlineData(43, 44, SyntaxKind.CSharpTransition, true)] [InlineData(44, 50, SyntaxKind.CSharpExpressionLiteral, false)] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs index ff0cc641c58..8436afc4d0e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs @@ -64,7 +64,7 @@ private async Task VerifyCSharpFindAllReferencesAsyncAsync(string input) }, Position = sourceText.GetPosition(cursorPosition) }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs index 4bafb189d06..1cff2a0d10f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs @@ -222,7 +222,7 @@ private async Task VerifyRazorFoldsAsync(string input, string? filePath = null) } } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs index 648e368f8a8..8b29589d7d2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/TestRazorFormattingService.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CSharpStatementBlockOnTypeFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CSharpStatementBlockOnTypeFormattingTest.cs index 9e769c37366..9354fecb02c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CSharpStatementBlockOnTypeFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CSharpStatementBlockOnTypeFormattingTest.cs @@ -4,12 +4,15 @@ #nullable disable using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class CSharpStatementBlockOnTypeFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class CSharpStatementBlockOnTypeFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(fixture.Service, testOutput) { [Fact] public async Task CloseCurly_IfBlock_SingleLineAsync() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeActionFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeActionFormattingTest.cs index c7067eae067..b5f33ec5aa6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeActionFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeActionFormattingTest.cs @@ -4,12 +4,15 @@ #nullable disable using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class CodeActionFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class CodeActionFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(fixture.Service, testOutput) { [Fact] public async Task AddDebuggerDisplay() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs index 80589eb18ff..fbccac31ee2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs @@ -5,12 +5,15 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class CodeDirectiveFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class CodeDirectiveFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(fixture.Service, testOutput) { internal override bool UseTwoPhaseCompilation => true; @@ -1699,7 +1702,8 @@ await RunFormattingTestAsync( private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; } """, - tagHelpers: GetComponentWithCascadingTypeParameter()); + tagHelpers: GetComponentWithCascadingTypeParameter(), + skipFlipLineEndingTest: true); } [Fact] @@ -1789,7 +1793,8 @@ await RunFormattingTestAsync( private IEnumerable _items2 = new long[] { 1, 2, 3, 4, 5 }; } """, - tagHelpers: GetComponentWithTwoCascadingTypeParameter()); + tagHelpers: GetComponentWithTwoCascadingTypeParameter(), + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveOnTypeFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveOnTypeFormattingTest.cs index e879f2b59cd..37992612a07 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveOnTypeFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveOnTypeFormattingTest.cs @@ -5,12 +5,15 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class CodeDirectiveOnTypeFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class CodeDirectiveOnTypeFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(fixture.Service, testOutput) { [Fact] public async Task FormatsIfStatementInComponent() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 17177a8e49c..7d313bfffa3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -2,15 +2,11 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; using Xunit; using Xunit.Abstractions; @@ -24,11 +20,11 @@ public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() // Arrange var uri = new Uri("file://path/test.razor"); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams { TextDocument = new TextDocumentIdentifier { Uri = uri, } }; var requestContext = CreateRazorRequestContext(documentContext: null); @@ -47,17 +43,16 @@ public async Task Handle_OnTypeFormatting_DocumentNotFound_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(new Uri("file://path/testDifferentFile.razor"), codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -82,17 +77,16 @@ public async Task Handle_OnTypeFormatting_RemapFailed_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: []); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -117,18 +111,16 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var formattingService = new DummyRazorFormattingService(); + var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Html); - var documentMappingService = new Mock(MockBehavior.Strict); - documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -153,18 +145,16 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var formattingService = new DummyRazorFormattingService(); + var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Razor); - var documentMappingService = new Mock(MockBehavior.Strict); - documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -189,17 +179,16 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -207,7 +196,7 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull Position = VsLspFactory.CreatePosition(2, 11), Options = new FormattingOptions { InsertSpaces = true, TabSize = 4 } }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs index 964ed2d0ef8..bd667e180a8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs @@ -22,12 +22,15 @@ public async Task Handle_FormattingEnabled_InvokesFormattingService() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); + var htmlFormatter = new TestHtmlFormatter(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var endpoint = new DocumentRangeFormattingEndpoint( - formattingService, optionsMonitor); + formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams() { - TextDocument = new TextDocumentIdentifier { Uri = uri, } + TextDocument = new TextDocumentIdentifier { Uri = uri, }, + Options = new FormattingOptions(), + Range = VsLspFactory.DefaultRange }; var requestContext = CreateRazorRequestContext(documentContext); @@ -45,7 +48,8 @@ public async Task Handle_DocumentNotFound_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var uri = new Uri("file://path/test.razor"); var @params = new DocumentRangeFormattingParams() { @@ -71,7 +75,8 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, } @@ -91,7 +96,8 @@ public async Task Handle_FormattingDisabled_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams(); var requestContext = CreateRazorRequestContext(documentContext: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index d42f0778dc8..69ef7632120 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -6,12 +6,11 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; using Xunit; using Xunit.Abstractions; @@ -20,65 +19,22 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class FormattingContentValidationPassTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - [Fact] - public async Task Execute_LanguageKindCSharp_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var input = new FormattingResult([], RazorLanguageKind.CSharp); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - - [Fact] - public async Task Execute_LanguageKindHtml_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var input = new FormattingResult([], RazorLanguageKind.Html); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - [Fact] public async Task Execute_NonDestructiveEdit_Allowed() { // Arrange - var source = SourceText.From(@" -@code { -public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var edits = new[] - { - VsLspFactory.CreateTextEdit(2, 0, " ") - }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + TestCode source = """ + @code { + [||]public class Foo { } + } + """; + var context = CreateFormattingContext(source); + var edits = ImmutableArray.Create(new TextChange(source.Span, " ")); + var input = edits; var pass = GetPass(); // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); + var result = await pass.ExecuteAsync(context, edits, DisposalToken); // Assert Assert.Equal(input, result); @@ -88,31 +44,26 @@ public class Foo { } public async Task Execute_DestructiveEdit_Rejected() { // Arrange - var source = SourceText.From(@" -@code { -public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var edits = new[] - { - VsLspFactory.CreateTextEdit(2, 0, 3, 0, " ") // Nukes a line - }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + TestCode source = """ + @code { + [|public class Foo { } + |]} + """; + var context = CreateFormattingContext(source); + var edits = ImmutableArray.Create(new TextChange(source.Span, " ")); + var input = edits; var pass = GetPass(); // Act var result = await pass.ExecuteAsync(context, input, DisposalToken); // Assert - Assert.Empty(result.Edits); + Assert.Empty(result); } private FormattingContentValidationPass GetPass() { - var mappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); - - var pass = new FormattingContentValidationPass(mappingService, LoggerFactory) + var pass = new FormattingContentValidationPass(LoggerFactory) { DebugAssertsEnabled = false }; @@ -120,18 +71,23 @@ private FormattingContentValidationPass GetPass() return pass; } - private static FormattingContext CreateFormattingContext(SourceText source, int tabSize = 4, bool insertSpaces = true, string? fileKind = null) + private static FormattingContext CreateFormattingContext(TestCode input, int tabSize = 4, bool insertSpaces = true, string? fileKind = null) { + var source = SourceText.From(input.Text); var path = "file:///path/to/document.razor"; var uri = new Uri(path); var (codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, fileKind: fileKind); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, }; - var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, TestAdhocWorkspaceFactory.Instance); + var context = FormattingContext.Create( + documentSnapshot, + codeDocument, + options, + new LspFormattingCodeDocumentProvider()); return context; } @@ -145,7 +101,7 @@ private static (RazorCodeDocument, IDocumentSnapshot) CreateCodeDocumentAndSnaps var documentSnapshot = new Mock(MockBehavior.Strict); documentSnapshot - .Setup(d => d.GetGeneratedOutputAsync()) + .Setup(d => d.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(codeDocument); documentSnapshot .Setup(d => d.TargetPath) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index c0f06e9831e..85801cf1020 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -5,12 +5,11 @@ using System.Collections.Immutable; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -18,63 +17,18 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class FormattingDiagnosticValidationPassTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - [Fact] - public async Task ExecuteAsync_LanguageKindCSharp_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); - var input = new FormattingResult([badEdit], RazorLanguageKind.CSharp); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - - [Fact] - public async Task ExecuteAsync_LanguageKindHtml_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); - var input = new FormattingResult([badEdit], RazorLanguageKind.Html); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - [Fact] public async Task ExecuteAsync_NonDestructiveEdit_Allowed() { // Arrange - var source = SourceText.From(@" -@code { -public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var edits = new[] - { - VsLspFactory.CreateTextEdit(2, 0, " ") - }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + TestCode source = """ + @code { + [||]public class Foo { } + } + """; + var context = CreateFormattingContext(source); + var edits = ImmutableArray.Create(new TextChange(source.Span, " ")); + var input = edits; var pass = GetPass(); // Act @@ -88,28 +42,26 @@ public class Foo { } public async Task ExecuteAsync_DestructiveEdit_Rejected() { // Arrange - var source = SourceText.From(@" -@code { -public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); // Creates a diagnostic - var input = new FormattingResult([badEdit], RazorLanguageKind.Razor); + // Arrange + TestCode source = """ + [||]@code { + public class Foo { } + } + """; + var context = CreateFormattingContext(source); + var badEdit = new TextChange(source.Span, "@ "); // Creates a diagnostic var pass = GetPass(); // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); + var result = await pass.ExecuteAsync(context, [badEdit], DisposalToken); // Assert - Assert.Empty(result.Edits); + Assert.Empty(result); } private FormattingDiagnosticValidationPass GetPass() { - var mappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); - - var pass = new FormattingDiagnosticValidationPass(mappingService, LoggerFactory) + var pass = new FormattingDiagnosticValidationPass(LoggerFactory) { DebugAssertsEnabled = false }; @@ -117,18 +69,23 @@ private FormattingDiagnosticValidationPass GetPass() return pass; } - private static FormattingContext CreateFormattingContext(SourceText source, int tabSize = 4, bool insertSpaces = true, string? fileKind = null) + private static FormattingContext CreateFormattingContext(TestCode input, int tabSize = 4, bool insertSpaces = true, string? fileKind = null) { + var source = SourceText.From(input.Text); var path = "file:///path/to/document.razor"; var uri = new Uri(path); var (codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, fileKind: fileKind); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, }; - var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, TestAdhocWorkspaceFactory.Instance); + var context = FormattingContext.Create( + documentSnapshot, + codeDocument, + options, + new LspFormattingCodeDocumentProvider()); return context; } @@ -140,7 +97,7 @@ private static (RazorCodeDocument, IDocumentSnapshot) CreateCodeDocumentAndSnaps var projectEngine = RazorProjectEngine.Create(builder => builder.SetRootNamespace("Test")); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, importSources: default, tagHelpers); - var documentSnapshot = FormattingTestBase.CreateDocumentSnapshot(path, tagHelpers, fileKind, [], [], projectEngine, codeDocument); + var documentSnapshot = FormattingTestBase.CreateDocumentSnapshot(path, tagHelpers, fileKind, importsDocuments: [], imports: [], projectEngine, codeDocument); return (codeDocument, documentSnapshot); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs index 5c77e198d46..5779ad5aa30 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs @@ -3,31 +3,24 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.AspNetCore.Razor.Utilities; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Formatting; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Utilities; -using Microsoft.WebTools.Languages.Shared.ContentTypes; using Newtonsoft.Json.Linq; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -internal class FormattingLanguageServerClient(ILoggerFactory loggerFactory) : IClientConnection +internal class FormattingLanguageServerClient(HtmlFormattingService htmlFormattingService, ILoggerFactory loggerFactory) : IClientConnection { + private readonly HtmlFormattingService _htmlFormattingService = htmlFormattingService; private readonly Dictionary _documents = []; private readonly ILoggerFactory _loggerFactory = loggerFactory; @@ -40,52 +33,28 @@ public void AddCodeDocument(RazorCodeDocument codeDocument) _documents.Add("/" + path, codeDocument); } - private Task FormatAsync(DocumentOnTypeFormattingParams @params) + private async Task FormatAsync(DocumentOnTypeFormattingParams @params) { var generatedHtml = GetGeneratedHtml(@params.TextDocument.Uri); - var generatedHtmlSource = SourceText.From(generatedHtml, Encoding.UTF8); - var absoluteIndex = generatedHtmlSource.GetRequiredAbsoluteIndex(@params.Position); - - var request = $$""" - { - "Options": - { - "UseSpaces": {{(@params.Options.InsertSpaces ? "true" : "false")}}, - "TabSize": {{@params.Options.TabSize}}, - "IndentSize": {{@params.Options.TabSize}} - }, - "Uri": "{{@params.TextDocument.Uri}}", - "GeneratedChanges": [], - "OperationType": "FormatOnType", - "SpanToFormat": - { - "Start": {{absoluteIndex}}, - "End": {{absoluteIndex}} - } - } - """; - - return CallWebToolsApplyFormattedEditsHandlerAsync(request, @params.TextDocument.Uri, generatedHtml); + + var edits = await _htmlFormattingService.GetOnTypeFormattingEditsAsync(_loggerFactory, @params.TextDocument.Uri, generatedHtml, @params.Position, @params.Options.InsertSpaces, @params.Options.TabSize); + + return new() + { + Edits = edits + }; } - private Task FormatAsync(DocumentFormattingParams @params) + private async Task FormatAsync(DocumentFormattingParams @params) { var generatedHtml = GetGeneratedHtml(@params.TextDocument.Uri); - var request = $$""" - { - "Options": - { - "UseSpaces": {{(@params.Options.InsertSpaces ? "true" : "false")}}, - "TabSize": {{@params.Options.TabSize}}, - "IndentSize": {{@params.Options.TabSize}} - }, - "Uri": "{{@params.TextDocument.Uri}}", - "GeneratedChanges": [], - } - """; - - return CallWebToolsApplyFormattedEditsHandlerAsync(request, @params.TextDocument.Uri, generatedHtml); + var edits = await _htmlFormattingService.GetDocumentFormattingEditsAsync(_loggerFactory, @params.TextDocument.Uri, generatedHtml, @params.Options.InsertSpaces, @params.Options.TabSize); + + return new() + { + Edits = edits + }; } private string GetGeneratedHtml(Uri uri) @@ -95,51 +64,6 @@ private string GetGeneratedHtml(Uri uri) return generatedHtml.Replace("\r", "").Replace("\n", "\r\n"); } - private async Task CallWebToolsApplyFormattedEditsHandlerAsync(string serializedValue, Uri documentUri, string generatedHtml) - { - var exportProvider = TestComposition.Editor.ExportProviderFactory.CreateExportProvider(); - var contentTypeService = exportProvider.GetExportedValue(); - - if (!contentTypeService.ContentTypes.Any(t => t.TypeName == HtmlContentTypeDefinition.HtmlContentType)) - { - contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, new[] { StandardContentTypeNames.Text }); - } - - var textBufferFactoryService = (ITextBufferFactoryService3)exportProvider.GetExportedValue(); - var bufferManager = WebTools.BufferManager.New(contentTypeService, textBufferFactoryService, []); - var logger = new ClaspLoggingBridge(_loggerFactory); - var applyFormatEditsHandler = WebTools.ApplyFormatEditsHandler.New(textBufferFactoryService, bufferManager, logger); - - // Make sure the buffer manager knows about the source document - var textSnapshot = bufferManager.CreateBuffer( - documentUri: documentUri, - contentTypeName: HtmlContentTypeDefinition.HtmlContentType, - initialContent: generatedHtml, - snapshotVersionFromLSP: 0); - - var requestContext = WebTools.RequestContext.New(textSnapshot); - - var request = WebTools.ApplyFormatEditsParam.DeserializeFrom(serializedValue); - var response = await applyFormatEditsHandler.HandleRequestAsync(request, requestContext, CancellationToken.None); - - var sourceText = SourceText.From(generatedHtml); - - using var edits = new PooledArrayBuilder(); - - foreach (var textChange in response.TextChanges) - { - var span = new TextSpan(textChange.Position, textChange.Length); - var edit = VsLspFactory.CreateTextEdit(sourceText.GetRange(span), textChange.NewText); - - edits.Add(edit); - } - - return new() - { - Edits = edits.ToArray() - }; - } - public async Task SendRequestAsync(string method, TParams @params, CancellationToken cancellationToken) { if (@params is DocumentFormattingParams formattingParams && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 25a4ba44e63..10e9266ccef 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -2,60 +2,74 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.CodeAnalysis.Text; using Xunit.Abstractions; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public abstract class FormattingLanguageServerTestBase(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - internal static RazorCodeDocument CreateCodeDocument(string content, IReadOnlyList sourceMappings) + internal static RazorCodeDocument CreateCodeDocument(string content, ImmutableArray sourceMappings) { var sourceDocument = TestRazorSourceDocument.Create(content); var codeDocument = RazorCodeDocument.Create(sourceDocument); var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, RazorParserOptions.CreateDefault()); - var razorCSharpDocument = RazorCSharpDocument.Create( - codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), Array.Empty(), sourceMappings.ToImmutableArray(), Array.Empty()); + var razorCSharpDocument = new RazorCSharpDocument( + codeDocument, content, RazorCodeGenerationOptions.Default, diagnostics: [], sourceMappings, linePragmas: []); codeDocument.SetSyntaxTree(syntaxTree); codeDocument.SetCSharpDocument(razorCSharpDocument); return codeDocument; } - internal class DummyRazorFormattingService : IRazorFormattingService + internal class DummyRazorFormattingService(RazorLanguageKind? languageKind = null) : IRazorFormattingService { public bool Called { get; private set; } - public Task FormatAsync(VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) + public Task> GetDocumentFormattingChangesAsync(DocumentContext documentContext, ImmutableArray htmlChanges, LinePositionSpan? span, RazorFormattingOptions options, CancellationToken cancellationToken) { Called = true; - return SpecializedTasks.EmptyArray(); + return SpecializedTasks.EmptyImmutableArray(); } - public Task FormatCodeActionAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task TryGetCSharpCodeActionEditAsync(DocumentContext documentContext, ImmutableArray formattedChanges, RazorFormattingOptions options, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); } - public Task FormatOnTypeAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task> GetCSharpOnTypeFormattingChangesAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); } - public Task FormatSnippetAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task TryGetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, ImmutableArray edits, RazorFormattingOptions options, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); + } + + public Task> GetHtmlOnTypeFormattingChangesAsync(DocumentContext documentContext, ImmutableArray htmlChanges, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + { + return Task.FromResult(htmlChanges); + } + + public Task TryGetSingleCSharpEditAsync(DocumentContext documentContext, TextChange initialEdit, RazorFormattingOptions options, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) + { + triggerCharacterKind = languageKind.GetValueOrDefault(); + return languageKind is not null; } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 112e7ae0016..6a4ae7846fc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -18,6 +18,8 @@ using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Testing; @@ -32,10 +34,14 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class FormattingTestBase : RazorToolingIntegrationTestBase { - public FormattingTestBase(ITestOutputHelper testOutput) + private readonly HtmlFormattingService _htmlFormattingService; + + internal FormattingTestBase(HtmlFormattingService htmlFormattingService, ITestOutputHelper testOutput) : base(testOutput) { - ILoggerExtensions.TestOnlyLoggingEnabled = true; + ITestOnlyLoggerExtensions.TestOnlyLoggingEnabled = true; + + _htmlFormattingService = htmlFormattingService; } private protected async Task RunFormattingTestAsync( @@ -47,14 +53,26 @@ private protected async Task RunFormattingTestAsync( ImmutableArray tagHelpers = default, bool allowDiagnostics = false, RazorLSPOptions? razorLSPOptions = null, - bool inGlobalNamespace = false) + bool inGlobalNamespace = false, + bool skipFlipLineEndingTest = false) { // Run with and without forceRuntimeCodeGeneration - await RunFormattingTestAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); - await RunFormattingTestAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + + // some tests are failing, skip for now, tracked by https://github.com/dotnet/razor/issues/10836 + if (!skipFlipLineEndingTest) + { + // flip the line endings of the stings (LF to CRLF and vice versa) and run again + input = FlipLineEndings(input); + expected = FlipLineEndings(expected); + + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + } } - private async Task RunFormattingTestAsync(string input, string expected, int tabSize, bool insertSpaces, string? fileKind, ImmutableArray tagHelpers, bool allowDiagnostics, RazorLSPOptions? razorLSPOptions, bool inGlobalNamespace, bool forceRuntimeCodeGeneration) + private async Task RunFormattingTestInternalAsync(string input, string expected, int tabSize, bool insertSpaces, string? fileKind, ImmutableArray tagHelpers, bool allowDiagnostics, RazorLSPOptions? razorLSPOptions, bool inGlobalNamespace, bool forceRuntimeCodeGeneration) { // Arrange fileKind ??= FileKinds.Component; @@ -63,9 +81,9 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab TestFileMarkupParser.GetSpans(input, out input, out ImmutableArray spans); var source = SourceText.From(input); - var range = spans.IsEmpty + LinePositionSpan? range = spans.IsEmpty ? null - : source.GetRange(spans.Single()); + : source.GetLinePositionSpan(spans.Single()); var path = "file:///path/to/Document." + fileKind; var uri = new Uri(path); @@ -75,22 +93,29 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab TabSize = tabSize, InsertSpaces = insertSpaces, }; + var razorOptions = RazorFormattingOptions.From(options, codeBlockBraceOnNextLine: razorLSPOptions?.CodeBlockBraceOnNextLine ?? false); + + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); + + var client = new FormattingLanguageServerClient(_htmlFormattingService, LoggerFactory); + client.AddCodeDocument(codeDocument); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var htmlFormatter = new HtmlFormatter(client); + var htmlChanges = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); // Act - var edits = await formattingService.FormatAsync(documentContext, range, options, DisposalToken); + var changes = await formattingService.GetDocumentFormattingChangesAsync(documentContext, htmlChanges, range, razorOptions, DisposalToken); // Assert - var edited = ApplyEdits(source, edits); + var edited = source.WithChanges(changes); var actual = edited.ToString(); AssertEx.EqualOrDiff(expected, actual); if (input.Equals(expected)) { - Assert.Empty(edits); + Assert.Empty(changes); } } @@ -118,36 +143,50 @@ private protected async Task RunOnTypeFormattingTestAsync( var filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); var mappingService = new LspDocumentMappingService( filePathService, new TestDocumentContextFactory(), LoggerFactory); - var languageKind = mappingService.GetLanguageKind(codeDocument, positionAfterTrigger, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(positionAfterTrigger, rightAssociative: false); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync( - LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var options = new FormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, }; - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var razorOptions = RazorFormattingOptions.From(options, codeBlockBraceOnNextLine: razorLSPOptions?.CodeBlockBraceOnNextLine ?? false); + + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); // Act - var edits = await formattingService.FormatOnTypeAsync(documentContext, languageKind, Array.Empty(), options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + ImmutableArray changes; + if (languageKind == RazorLanguageKind.CSharp) + { + changes = await formattingService.GetCSharpOnTypeFormattingChangesAsync(documentContext, razorOptions, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + } + else + { + var client = new FormattingLanguageServerClient(_htmlFormattingService, LoggerFactory); + client.AddCodeDocument(codeDocument); + + var htmlFormatter = new HtmlFormatter(client); + var htmlChanges = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); + changes = await formattingService.GetHtmlOnTypeFormattingChangesAsync(documentContext, htmlChanges, razorOptions, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + } // Assert - var edited = ApplyEdits(razorSourceText, edits); + var edited = razorSourceText.WithChanges(changes); var actual = edited.ToString(); AssertEx.EqualOrDiff(expected, actual); if (input.Equals(expected)) { - Assert.Empty(edits); + Assert.Empty(changes); } if (expectedChangedLines is not null) { - var firstLine = edits.Min(e => e.Range.Start.Line); - var lastLine = edits.Max(e => e.Range.End.Line); - var delta = lastLine - firstLine + edits.Count(e => e.NewText.Contains(Environment.NewLine)); + var firstLine = changes.Min(e => razorSourceText.GetLinePositionSpan(e.Span).Start.Line); + var lastLine = changes.Max(e => razorSourceText.GetLinePositionSpan(e.Span).End.Line); + var delta = lastLine - firstLine + changes.Count(e => e.NewText.Contains(Environment.NewLine)); Assert.Equal(expectedChangedLines.Value, delta + 1); } } @@ -161,11 +200,6 @@ protected async Task RunCodeActionFormattingTestAsync( string? fileKind = null, bool inGlobalNamespace = false) { - if (codeActionEdits is null) - { - throw new NotImplementedException("Code action formatting must provide edits."); - } - // Arrange fileKind ??= FileKinds.Component; @@ -178,7 +212,7 @@ protected async Task RunCodeActionFormattingTestAsync( var filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); var mappingService = new LspDocumentMappingService(filePathService, new TestDocumentContextFactory(), LoggerFactory); - var languageKind = mappingService.GetLanguageKind(codeDocument, positionAfterTrigger, rightAssociative: false); + var languageKind = codeDocument.GetLanguageKind(positionAfterTrigger, rightAssociative: false); if (languageKind == RazorLanguageKind.Html) { throw new NotImplementedException("Code action formatting is not yet supported for HTML in Razor."); @@ -190,18 +224,20 @@ protected async Task RunCodeActionFormattingTestAsync( } var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, }; - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); // Act - var edits = await formattingService.FormatCodeActionAsync(documentContext, languageKind, codeActionEdits, options, DisposalToken); + var csharpSourceText = codeDocument.GetCSharpSourceText(); + var changes = codeActionEdits.SelectAsArray(csharpSourceText.GetTextChange); + var edit = await formattingService.TryGetCSharpCodeActionEditAsync(documentContext, changes, options, DisposalToken); // Assert - var edited = ApplyEdits(razorSourceText, edits); + var edited = razorSourceText.WithChanges(edit.Value); var actual = edited.ToString(); AssertEx.EqualOrDiff(expected, actual); @@ -210,12 +246,6 @@ protected async Task RunCodeActionFormattingTestAsync( protected static TextEdit Edit(int startLine, int startChar, int endLine, int endChar, string newText) => VsLspFactory.CreateTextEdit(startLine, startChar, endLine, endChar, newText); - private static SourceText ApplyEdits(SourceText source, TextEdit[] edits) - { - var changes = edits.Select(source.GetTextChange); - return source.WithChanges(changes); - } - private static (RazorCodeDocument, IDocumentSnapshot) CreateCodeDocumentAndSnapshot(SourceText text, string path, ImmutableArray tagHelpers = default, string? fileKind = default, bool allowDiagnostics = false, bool inGlobalNamespace = false, bool forceRuntimeCodeGeneration = false) { fileKind ??= FileKinds.Component; @@ -260,7 +290,7 @@ @using Microsoft.AspNetCore.Components.Web ]); var projectEngine = RazorProjectEngine.Create( - new RazorConfiguration(RazorLanguageVersion.Latest, "TestConfiguration", ImmutableArray.Empty, new LanguageServerFlags(forceRuntimeCodeGeneration)), + new RazorConfiguration(RazorLanguageVersion.Latest, "TestConfiguration", Extensions: [], LanguageServerFlags: new LanguageServerFlags(forceRuntimeCodeGeneration)), projectFileSystem, builder => { @@ -269,7 +299,7 @@ @using Microsoft.AspNetCore.Components.Web RazorExtensions.Register(builder); }); - var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, ImmutableArray.Create(importsDocument), tagHelpers); + var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, [importsDocument], tagHelpers); if (!allowDiagnostics) { @@ -287,7 +317,7 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA { var documentSnapshot = new Mock(MockBehavior.Strict); documentSnapshot - .Setup(d => d.GetGeneratedOutputAsync()) + .Setup(d => d.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(codeDocument); documentSnapshot .Setup(d => d.FilePath) @@ -313,6 +343,9 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA documentSnapshot .Setup(d => d.FileKind) .Returns(fileKind); + documentSnapshot + .Setup(d => d.Version) + .Returns(1); documentSnapshot .Setup(d => d.WithText(It.IsAny())) .Returns(text => @@ -325,4 +358,26 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA }); return documentSnapshot.Object; } + + private static string FlipLineEndings(string input) + { + if (string.IsNullOrEmpty(input)) + { + return input; + } + + var hasCRLF = input.Contains("\r\n"); + var hasLF = !hasCRLF && input.Contains("\n"); + + if (hasCRLF) + { + return input.Replace("\r\n", "\n"); + } + else if (hasLF) + { + return input.Replace("\n", "\r\n"); + } + + return input; + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingCollection.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingCollection.cs new file mode 100644 index 00000000000..c8eacf6f87d --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingCollection.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Razor.Formatting; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +[CollectionDefinition(Name)] +public class HtmlFormattingCollection : ICollectionFixture +{ + public const string Name = nameof(HtmlFormattingCollection); +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs index e38685d7468..593b32dd64e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs @@ -8,12 +8,15 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class HtmlFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class HtmlFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) + : FormattingTestBase(fixture.Service, testOutput) { internal override bool UseTwoPhaseCompilation => true; @@ -210,6 +213,38 @@ This is heavily nested """); } + [Fact] + public async Task FormatAttributeStyles() + { + await RunFormattingTestAsync( + input: """ +
Some Text
+
Some Text
+
Some Text
+
Some Text
+
Some Text
+ +
+
+
+
+
+ """, + expected: """ +
Some Text
+
Some Text
+
Some Text
+
Some Text
+
Some Text
+ +
+
+
+
+
+ """); + } + [Fact] public async Task FormatsMixedRazorBlock() { @@ -454,7 +489,8 @@ await RunFormattingTestAsync( } """, - tagHelpers: tagHelpers); + tagHelpers: tagHelpers, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -562,7 +598,8 @@ await RunFormattingTestAsync( @{

} - """); + """, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1283,7 +1320,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1395,7 +1433,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1453,7 +1492,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1761,7 +1801,8 @@ await RunFormattingTestAsync( } """, - tagHelpers: CreateTagHelpers()); + tagHelpers: CreateTagHelpers(), + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 ImmutableArray CreateTagHelpers() { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs index 889ecd2cfaa..0c59e06a1a1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs @@ -3,10 +3,10 @@ #nullable disable -using System.Linq; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -15,28 +15,46 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class RazorFormattingServiceTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) { [Fact] - public void MergeEdits_ReturnsSingleEditAsExpected() + public void MergeChanges_ReturnsSingleEditAsExpected() { // Arrange - var source = @" -@code { -public class Foo{} -} -"; - var sourceText = SourceText.From(source); - var edits = new[] - { - VsLspFactory.CreateTextEdit(VsLspFactory.CreateSingleLineRange(line: 2, character: 13, length: 3), "Bar"), - VsLspFactory.CreateTextEdit(2, 0, " ") - }; + TestCode source = """ + @code { + [||]public class [|Foo|]{} + } + """; + var sourceText = SourceText.From(source.Text); + var changes = ImmutableArray.CreateRange( + [ + new TextChange(source.Spans[0], " "), + new TextChange(source.Spans[1], "Bar") + ]); // Act - var collapsedEdit = RazorFormattingService.MergeEdits(edits, sourceText); + var collapsedEdit = RazorFormattingService.MergeChanges(changes, sourceText); // Assert - var multiEditChange = sourceText.WithChanges(edits.Select(sourceText.GetTextChange)); - var singleEditChange = sourceText.WithChanges(sourceText.GetTextChange(collapsedEdit)); + var multiEditChange = sourceText.WithChanges(changes); + var singleEditChange = sourceText.WithChanges(collapsedEdit); Assert.Equal(multiEditChange.ToString(), singleEditChange.ToString()); } + + [Fact] + public void AllTriggerCharacters_IncludesCSharpTriggerCharacters() + { + foreach (var character in RazorFormattingService.TestAccessor.GetCSharpTriggerCharacterSet()) + { + Assert.Contains(character, RazorFormattingService.AllTriggerCharacterSet); + } + } + + [Fact] + public void AllTriggerCharacters_IncludesHtmlTriggerCharacters() + { + foreach (var character in RazorFormattingService.TestAccessor.GetHtmlTriggerCharacterSet()) + { + Assert.Contains(character, RazorFormattingService.AllTriggerCharacterSet); + } + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingTest.cs index 27bb6dc6e7c..aa1400fbe62 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingTest.cs @@ -7,12 +7,14 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Formatting; using Xunit; using Xunit.Abstractions; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -public class RazorFormattingTest(ITestOutputHelper testOutput) : FormattingTestBase(testOutput) +[Collection(HtmlFormattingCollection.Name)] +public class RazorFormattingTest(HtmlFormattingFixture fixture, ITestOutputHelper testOutput) : FormattingTestBase(fixture.Service, testOutput) { [Fact] public async Task Section_BraceOnNextLine() @@ -705,6 +707,31 @@ await RunFormattingTestAsync( fileKind: FileKinds.Legacy); } + [Fact] + public async Task MultiLineComment_WithinHtml () + { + await RunFormattingTestAsync( + input: """ +
+ @*
+ This comment's opening at-star will be aligned, and the + indentation of the rest of its lines will be preserved. +
+ *@ +
+ """, + expected: """ +
+ @*
+ This comment's opening at-star will be aligned, and the + indentation of the rest of its lines will be preserved. +
+ *@ +
+ """, + fileKind: FileKinds.Legacy); + } + // Regression prevention tests: [Fact] public async Task Using() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs new file mode 100644 index 00000000000..8652e6efe71 --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +internal class TestHtmlFormatter : IHtmlFormatter +{ + public Task> GetDocumentFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, FormattingOptions options, CancellationToken cancellationToken) + { + return SpecializedTasks.EmptyImmutableArray(); + } + + public Task> GetOnTypeFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, Position position, string triggerCharacter, FormattingOptions options, CancellationToken cancellationToken) + { + return SpecializedTasks.EmptyImmutableArray(); + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 12c22645152..217024e2dca 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -1,17 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Moq; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -21,7 +18,6 @@ internal static class TestRazorFormattingService public static async Task CreateWithFullSupportAsync( ILoggerFactory loggerFactory, RazorCodeDocument? codeDocument = null, - IDocumentSnapshot? documentSnapshot = null, RazorLSPOptions? razorLSPOptions = null) { codeDocument ??= TestRazorCodeDocument.CreateEmpty(); @@ -29,16 +25,6 @@ public static async Task CreateWithFullSupportAsync( var filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); var mappingService = new LspDocumentMappingService(filePathService, new TestDocumentContextFactory(), loggerFactory); - var projectManager = StrictMock.Of(); - var versionCache = new DocumentVersionCache(projectManager); - if (documentSnapshot is not null) - { - versionCache.TrackDocumentVersion(documentSnapshot, version: 1); - } - - var client = new FormattingLanguageServerClient(loggerFactory); - client.AddCodeDocument(codeDocument); - var configurationSyncService = new Mock(MockBehavior.Strict); configurationSyncService .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) @@ -52,16 +38,9 @@ public static async Task CreateWithFullSupportAsync( await optionsMonitor.UpdateAsync(CancellationToken.None); } - var passes = new List() - { - new HtmlFormattingPass(mappingService, client, versionCache, loggerFactory), - new CSharpFormattingPass(mappingService, loggerFactory), - new CSharpOnTypeFormattingPass(mappingService, loggerFactory), - new RazorFormattingPass(mappingService, optionsMonitor), - new FormattingDiagnosticValidationPass(mappingService, loggerFactory), - new FormattingContentValidationPass(mappingService, loggerFactory), - }; + var formattingCodeDocumentProvider = new LspFormattingCodeDocumentProvider(); + var hostServicesProvider = new DefaultHostServicesProvider(); - return new RazorFormattingService(passes, TestAdhocWorkspaceFactory.Instance); + return new RazorFormattingService(formattingCodeDocumentProvider, mappingService, hostServicesProvider, loggerFactory); } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs index cd462b579ec..bba790b36ae 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs @@ -1,9 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.ProjectSystem; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; @@ -16,50 +16,76 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; public class GeneratedDocumentSynchronizerTest : LanguageServerTestBase { - private readonly DocumentVersionCache _cache; + private static readonly HostProject s_hostProject = new("/path/to/project.csproj", "/path/to/obj", RazorConfiguration.Default, "TestRootNamespace"); + private static readonly HostDocument s_hostDocument = new("/path/to/file.razor", "file.razor"); + private readonly GeneratedDocumentSynchronizer _synchronizer; private readonly TestGeneratedDocumentPublisher _publisher; + private readonly TestProjectSnapshotManager _projectManager; private readonly IDocumentSnapshot _document; private readonly RazorCodeDocument _codeDocument; public GeneratedDocumentSynchronizerTest(ITestOutputHelper testOutput) : base(testOutput) { - var projectManager = StrictMock.Of(); - _cache = new DocumentVersionCache(projectManager); _publisher = new TestGeneratedDocumentPublisher(); - _synchronizer = new GeneratedDocumentSynchronizer(_publisher, _cache, TestLanguageServerFeatureOptions.Instance); - _document = TestDocumentSnapshot.Create("C:/path/to/file.razor"); + _projectManager = CreateProjectSnapshotManager(); + _synchronizer = new GeneratedDocumentSynchronizer(_publisher, TestLanguageServerFeatureOptions.Instance, _projectManager); + _document = TestDocumentSnapshot.Create(s_hostDocument.FilePath); _codeDocument = CreateCodeDocument("

Hello World

"); } + protected override async Task InitializeAsync() + { + await _projectManager.UpdateAsync(updater => + { + updater.ProjectAdded(s_hostProject); + updater.DocumentAdded(s_hostProject.Key, s_hostDocument, new EmptyTextLoader(s_hostDocument.FilePath)); + }); + } + [Fact] - public void DocumentProcessed_UnknownVersion_Noops() + public async Task DocumentProcessed_OpenDocument_Publishes() { // Arrange + await _projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(s_hostProject.Key, s_hostDocument.FilePath, SourceText.From("

Hello World

")); + }); // Act _synchronizer.DocumentProcessed(_codeDocument, _document); // Assert - Assert.False(_publisher.PublishedCSharp); - Assert.False(_publisher.PublishedHtml); + Assert.True(_publisher.PublishedCSharp); + Assert.True(_publisher.PublishedHtml); } [Fact] - public void DocumentProcessed_KnownVersion_Publishes() + public void DocumentProcessed_CloseDocument_WithOption_Publishes() { - // Arrange - _cache.TrackDocumentVersion(_document, version: 1337); + var options = new TestLanguageServerFeatureOptions(updateBuffersForClosedDocuments: true); + var synchronizer = new GeneratedDocumentSynchronizer(_publisher, options, _projectManager); // Act - _synchronizer.DocumentProcessed(_codeDocument, _document); + synchronizer.DocumentProcessed(_codeDocument, _document); // Assert Assert.True(_publisher.PublishedCSharp); Assert.True(_publisher.PublishedHtml); } + [Fact] + public void DocumentProcessed_CloseDocument_DoesntPublish() + { + // Act + _synchronizer.DocumentProcessed(_codeDocument, _document); + + // Assert + Assert.False(_publisher.PublishedCSharp); + Assert.False(_publisher.PublishedHtml); + } + private class TestGeneratedDocumentPublisher : IGeneratedDocumentPublisher { public bool PublishedCSharp { get; private set; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs index d7a1c2bc4a2..c884946e106 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -#nullable disable - using System; using System.Linq; using System.Threading; @@ -13,14 +11,13 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hover; using Microsoft.AspNetCore.Razor.LanguageServer.Tooltip; using Microsoft.AspNetCore.Razor.ProjectSystem; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; -using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Text.Adornments; @@ -31,7 +28,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Test.Hover; -[UseExportProvider] public class HoverServiceTest(ITestOutputHelper testOutput) : TagHelperServiceTestBase(testOutput) { private static VSInternalClientCapabilities CreateMarkDownCapabilities() @@ -56,21 +52,22 @@ private static VSInternalClientCapabilities CreateCapabilities(MarkupKind markup public async Task GetHoverInfo_TagHelper_Element() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - <$$test1> - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + <$$test1> + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**Test1TagHelper**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 1, length: 5); Assert.Equal(expectedRange, hover.Range); @@ -80,23 +77,24 @@ public async Task GetHoverInfo_TagHelper_Element() public async Task GetHoverInfo_TagHelper_Element_WithParent() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); - - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + TestCode code = """ + @addTagHelper *, TestAssembly + + + + """; + + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**SomeChild**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 2, character: 5, length: 9); Assert.Equal(expectedRange, hover.Range); @@ -106,25 +104,26 @@ public async Task GetHoverInfo_TagHelper_Element_WithParent() public async Task GetHoverInfo_TagHelper_Attribute_WithParent() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - - - """; - TestFileMarkupParser.GetPositionAndSpan(txt, out txt, out var cursorPosition, out var span); - - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + TestCode code = """ + @addTagHelper *, TestAssembly + + + + """; + + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**Attribute**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); - var expectedRange = codeDocument.Source.Text.GetRange(span); + var expectedRange = codeDocument.Source.Text.GetRange(code.Span); Assert.Equal(expectedRange, hover.Range); } @@ -132,21 +131,22 @@ public async Task GetHoverInfo_TagHelper_Attribute_WithParent() public async Task GetHoverInfo_TagHelper_Element_EndTag() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**Test1TagHelper**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 9, length: 5); Assert.Equal(expectedRange, hover.Range); @@ -156,21 +156,22 @@ public async Task GetHoverInfo_TagHelper_Element_EndTag() public async Task GetHoverInfo_TagHelper_Attribute() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**BoolVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.DoesNotContain("**IntVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 7, length: 8); @@ -181,22 +182,23 @@ public async Task GetHoverInfo_TagHelper_Attribute() public async Task GetHoverInfo_TagHelper_AttributeTrailingEdge() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var edgeLocation = cursorPosition; - var location = new SourceLocation(edgeLocation, 0, edgeLocation); + var edgeLocation = code.Position; + var location = new SourceLocation(edgeLocation, lineIndex: 0, edgeLocation); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**BoolVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.DoesNotContain("**IntVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 7, length: 8); @@ -207,16 +209,15 @@ public async Task GetHoverInfo_TagHelper_AttributeTrailingEdge() public async Task GetHoverInfo_TagHelper_AttributeValue_ReturnsNull() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); @@ -229,16 +230,15 @@ public async Task GetHoverInfo_TagHelper_AttributeValue_ReturnsNull() public async Task GetHoverInfo_TagHelper_AfterAttributeEquals_ReturnsNull() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); @@ -251,16 +251,15 @@ public async Task GetHoverInfo_TagHelper_AfterAttributeEquals_ReturnsNull() public async Task GetHoverInfo_TagHelper_AttributeEnd_ReturnsNull() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); @@ -273,21 +272,22 @@ public async Task GetHoverInfo_TagHelper_AttributeEnd_ReturnsNull() public async Task GetHoverInfo_TagHelper_MinimizedAttribute() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**BoolVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.DoesNotContain("**IntVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 7, length: 8); @@ -298,26 +298,26 @@ public async Task GetHoverInfo_TagHelper_MinimizedAttribute() public async Task GetHoverInfo_DirectiveAttribute_HasResult() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - @code{ - public void Increment(){ - } + TestCode code = """ + @addTagHelper *, TestAssembly + + @code{ + public void Increment(){ } - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + } + """; - var codeDocument = CreateCodeDocument(txt, "text.razor", DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, "text.razor", DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**Test**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 5); Assert.Equal(expectedRange, hover.Range); @@ -327,21 +327,22 @@ public void Increment(){ public async Task GetHoverInfo_TagHelper_MalformedElement() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - <$$test1 - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("**BoolVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.DoesNotContain("**IntVal**", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 7, length: 8); @@ -376,16 +378,15 @@ public async Task GetHoverInfo_TagHelper_MalformedAttribute() public async Task GetHoverInfo_HTML_MarkupElement() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly -

<$$strong>

- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly +

<$$strong>

+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreateMarkDownCapabilities(), DisposalToken); @@ -398,22 +399,23 @@ public async Task GetHoverInfo_HTML_MarkupElement() public async Task GetHoverInfo_TagHelper_PlainTextElement() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - <$$test1>
- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + <$$test1>
+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); - var service = GetHoverService(); + var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("Test1TagHelper", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 1, length: 5); @@ -424,22 +426,23 @@ public async Task GetHoverInfo_TagHelper_PlainTextElement() public async Task GetHoverInfo_TagHelper_PlainTextElement_EndTag() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("Test1TagHelper", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 9, length: 5); @@ -450,21 +453,22 @@ public async Task GetHoverInfo_TagHelper_PlainTextElement_EndTag() public async Task GetHoverInfo_TagHelper_TextComponent() { // Arrange - var txt = """ - <$$Text> - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + <$$Text> + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: true, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: true, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.razor", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("Text", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 0, character: 1, length: 4); @@ -475,23 +479,24 @@ public async Task GetHoverInfo_TagHelper_TextComponent() public async Task GetHoverInfo_TagHelper_TextComponent_NestedInHtml() { // Arrange - var txt = """ -
- <$$Text> -
- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ +
+ <$$Text> +
+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: true, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: true, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.razor", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("Text", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 4); @@ -502,19 +507,18 @@ public async Task GetHoverInfo_TagHelper_TextComponent_NestedInHtml() public async Task GetHoverInfo_TagHelper_TextComponent_NestedInCSharp() { // Arrange - var txt = """ - @if (true) - { - <$$Text> - } - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @if (true) + { + <$$Text> + } + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: true, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: true, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.razor", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); @@ -527,26 +531,27 @@ public async Task GetHoverInfo_TagHelper_TextComponent_NestedInCSharp() public async Task GetHoverInfo_TagHelper_TextComponent_NestedInCSharpAndText() { // Arrange - var txt = """ - @if (true) - { - - <$$Text> - - } - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @if (true) + { + + <$$Text> + + } + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: true, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: true, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.razor", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("Text", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 3, character: 9, length: 4); @@ -557,22 +562,23 @@ public async Task GetHoverInfo_TagHelper_TextComponent_NestedInCSharpAndText() public async Task GetHoverInfo_TagHelper_PlainTextAttribute() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); // Assert + Assert.NotNull(hover); + Assert.NotNull(hover.Contents); Assert.Contains("BoolVal", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.DoesNotContain("IntVal", ((MarkupContent)hover.Contents).Value, StringComparison.Ordinal); Assert.Equal(MarkupKind.PlainText, ((MarkupContent)hover.Contents).Kind); @@ -584,17 +590,16 @@ public async Task GetHoverInfo_TagHelper_PlainTextAttribute() public async Task GetHoverInfo_HTML_PlainTextElement() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly -

<$$strong>

- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly +

<$$strong>

+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); @@ -607,18 +612,17 @@ public async Task GetHoverInfo_HTML_PlainTextElement() public async Task GetHoverInfo_HTML_PlainTextAttribute() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly -

- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly +

+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); // Act var hover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, CreatePlainTextCapabilities(), DisposalToken); @@ -631,16 +635,15 @@ public async Task GetHoverInfo_HTML_PlainTextAttribute() public async Task GetHoverInfo_TagHelper_Element_VSClient_ReturnVSHover() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - <$$test1>
- """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + <$$test1>
+ """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); var clientCapabilities = CreateMarkDownCapabilities(); clientCapabilities.SupportsVisualStudioExtensions = true; @@ -648,11 +651,14 @@ public async Task GetHoverInfo_TagHelper_Element_VSClient_ReturnVSHover() var vsHover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, clientCapabilities, DisposalToken); // Assert + Assert.NotNull(vsHover); + Assert.NotNull(vsHover.Contents); Assert.False(vsHover.Contents.Value.TryGetFourth(out var _)); Assert.True(vsHover.Contents.Value.TryGetThird(out var _) && !vsHover.Contents.Value.Third.Any()); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 1, length: 5); Assert.Equal(expectedRange, vsHover.Range); + Assert.NotNull(vsHover.RawContent); var container = (ContainerElement)vsHover.RawContent; var containerElements = container.Elements.ToList(); Assert.Equal(ContainerElementStyle.Stacked, container.Style); @@ -671,17 +677,16 @@ public async Task GetHoverInfo_TagHelper_Element_VSClient_ReturnVSHover() public async Task GetHoverInfo_TagHelper_Attribute_VSClient_ReturnVSHover() { // Arrange - var txt = """ - @addTagHelper *, TestAssembly - - """; - TestFileMarkupParser.GetPosition(txt, out txt, out var cursorPosition); + TestCode code = """ + @addTagHelper *, TestAssembly + + """; - var codeDocument = CreateCodeDocument(txt, isRazorFile: false, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, isRazorFile: false, DefaultTagHelpers); var service = GetHoverService(); var serviceAccessor = service.GetTestAccessor(); - var location = new SourceLocation(cursorPosition, -1, -1); + var location = new SourceLocation(code.Position, lineIndex: -1, characterIndex: -1); var clientCapabilities = CreateMarkDownCapabilities(); clientCapabilities.SupportsVisualStudioExtensions = true; @@ -689,11 +694,14 @@ public async Task GetHoverInfo_TagHelper_Attribute_VSClient_ReturnVSHover() var vsHover = await serviceAccessor.GetHoverInfoAsync("file.cshtml", codeDocument, location, clientCapabilities, DisposalToken); // Assert - Assert.False(vsHover.Contents.Value.TryGetFourth(out var _)); + Assert.NotNull(vsHover); + Assert.NotNull(vsHover.Contents); + Assert.False(vsHover.Contents.Value.TryGetFourth(out _)); Assert.True(vsHover.Contents.Value.TryGetThird(out var markedStrings) && !markedStrings.Any()); var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 7, length: 8); Assert.Equal(expectedRange, vsHover.Range); + Assert.NotNull(vsHover.RawContent); var container = (ContainerElement)vsHover.RawContent; var containerElements = container.Elements.ToList(); Assert.Equal(ContainerElementStyle.Stacked, container.Style); @@ -716,43 +724,40 @@ public async Task GetHoverInfo_TagHelper_Attribute_VSClient_ReturnVSHover() public async Task Handle_Hover_SingleServer_CallsDelegatedLanguageServer() { // Arrange - var languageServerFeatureOptions = Mock.Of(options => options.SingleServerSupport == true && options.UseRazorCohostServer == false, MockBehavior.Strict); + var languageServerFeatureOptions = StrictMock.Of(options => + options.SingleServerSupport == true && + options.UseRazorCohostServer == false); var delegatedHover = new VSInternalHover(); - var clientConnectionMock = new Mock(MockBehavior.Strict); - clientConnectionMock - .Setup(c => c.SendRequestAsync(CustomMessageNames.RazorHoverEndpointName, It.IsAny(), It.IsAny())) - .ReturnsAsync(delegatedHover); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(CustomMessageNames.RazorHoverEndpointName, response: delegatedHover); + }); - var documentMappingServiceMock = new Mock(MockBehavior.Strict); - documentMappingServiceMock - .Setup(c => c.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(RazorLanguageKind.CSharp); + var documentMappingServiceMock = new StrictMock(); var outRange = new LinePositionSpan(); documentMappingServiceMock - .Setup(c => c.TryMapToGeneratedDocumentRange(It.IsAny(), It.IsAny(), out outRange)) + .Setup(x => x.TryMapToGeneratedDocumentRange(It.IsAny(), It.IsAny(), out outRange)) .Returns(true); var projectedPosition = new LinePosition(1, 1); var projectedIndex = 1; - documentMappingServiceMock.Setup( - c => c.TryMapToGeneratedDocumentPosition(It.IsAny(), It.IsAny(), out projectedPosition, out projectedIndex)) + documentMappingServiceMock + .Setup(x => x.TryMapToGeneratedDocumentPosition(It.IsAny(), It.IsAny(), out projectedPosition, out projectedIndex)) .Returns(true); - var endpoint = CreateEndpoint(languageServerFeatureOptions, documentMappingServiceMock.Object, clientConnectionMock.Object); + var endpoint = CreateEndpoint(languageServerFeatureOptions, documentMappingServiceMock.Object, clientConnection); + + var (documentContext, position) = CreateDefaultDocumentContext(); + var requestContext = CreateRazorRequestContext(documentContext); var request = new TextDocumentPositionParams { - TextDocument = new TextDocumentIdentifier - { - Uri = new Uri("C:/text.razor") - }, - Position = VsLspFactory.CreatePosition(1, 0), + TextDocument = new() { Uri = new Uri("C:/text.razor") }, + Position = position, }; - var documentContext = CreateDefaultDocumentContext(); - var requestContext = CreateRazorRequestContext(documentContext: documentContext); // Act var result = await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); @@ -765,25 +770,27 @@ public async Task Handle_Hover_SingleServer_CallsDelegatedLanguageServer() public async Task Handle_Hover_SingleServer_CSharpVariable() { // Arrange - var input = """ -
+ TestCode code = """ +
- @{ - var $$myVariable = "Hello"; + @{ + var $$myVariable = "Hello"; - var length = myVariable.Length; - } - """; + var length = myVariable.Length; + } + """; // Act - var result = await GetResultFromSingleServerEndpointAsync(input); + var result = await GetResultFromSingleServerEndpointAsync(code); // Assert + Assert.NotNull(result); var range = result.Range; var expected = VsLspFactory.CreateSingleLineRange(line: 3, character: 8, length: 10); Assert.Equal(expected, range); + Assert.NotNull(result.RawContent); var rawContainer = (ContainerElement)result.RawContent; var embeddedContainerElement = (ContainerElement)rawContainer.Elements.Single(); @@ -799,21 +806,23 @@ public async Task Handle_Hover_SingleServer_CSharpVariable() public async Task Handle_Hover_SingleServer_Component() { // Arrange - var input = """ - @addTagHelper *, TestAssembly + TestCode code = """ + @addTagHelper *, TestAssembly - <$$test1>
- """; + <$$test1> + """; // Act - var result = await GetResultFromSingleServerEndpointAsync(input); + var result = await GetResultFromSingleServerEndpointAsync(code); // Assert + Assert.NotNull(result); var range = result.Range; var expected = VsLspFactory.CreateSingleLineRange(line: 2, character: 1, length: 5); Assert.Equal(expected, range); + Assert.NotNull(result.RawContent); var rawContainer = (ContainerElement)result.RawContent; var embeddedContainerElement = (ContainerElement)rawContainer.Elements.Single(); @@ -826,21 +835,23 @@ public async Task Handle_Hover_SingleServer_Component() public async Task Handle_Hover_SingleServer_AddTagHelper() { // Arrange - var input = """ + TestCode code = """ @addTagHelper *, Test$$Assembly """; // Act - var result = await GetResultFromSingleServerEndpointAsync(input); + var result = await GetResultFromSingleServerEndpointAsync(code); // Assert // Roslyn returns us a range that is outside of our source mappings, so we expect the endpoint // to return null, so as not to confuse the client + Assert.NotNull(result); Assert.Null(result.Range); + Assert.NotNull(result.RawContent); var rawContainer = (ContainerElement)result.RawContent; var embeddedContainerElement = (ContainerElement)rawContainer.Elements.Single(); @@ -855,10 +866,9 @@ public async Task Handle_Hover_SingleServer_AddTagHelper() Assert.StartsWith("class System.String", text); } - private async Task GetResultFromSingleServerEndpointAsync(string input) + private async Task GetResultFromSingleServerEndpointAsync(TestCode code) { - TestFileMarkupParser.GetPosition(input, out var output, out var cursorPosition); - var codeDocument = CreateCodeDocument(output, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, DefaultTagHelpers); var csharpSourceText = codeDocument.GetCSharpSourceText(); var csharpDocumentUri = new Uri("C:/path/to/file.razor__virtual.g.cs"); var serverCapabilities = new VSInternalServerCapabilities() @@ -871,14 +881,13 @@ private async Task GetResultFromSingleServerEndpointAsync(strin await csharpServer.OpenDocumentAsync(csharpDocumentUri, csharpSourceText.ToString()); var razorFilePath = "C:/path/to/file.razor"; - var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); - var languageServerFeatureOptions = Mock.Of(options => + var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); + var languageServerFeatureOptions = StrictMock.Of(options => options.SupportsFileManipulation == true && options.SingleServerSupport == true && options.CSharpVirtualDocumentSuffix == ".g.cs" && options.HtmlVirtualDocumentSuffix == ".g.html" && - options.UseRazorCohostServer == false - , MockBehavior.Strict); + options.UseRazorCohostServer == false); var languageServer = new HoverLanguageServer(csharpServer, csharpDocumentUri, DisposalToken); var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory); @@ -894,60 +903,70 @@ private async Task GetResultFromSingleServerEndpointAsync(strin var razorFileUri = new Uri(razorFilePath); var request = new TextDocumentPositionParams { - TextDocument = new TextDocumentIdentifier - { - Uri = razorFileUri, - }, - Position = codeDocument.Source.Text.GetPosition(cursorPosition) + TextDocument = new() { Uri = razorFileUri, }, + Position = codeDocument.Source.Text.GetPosition(code.Position) }; + var documentContext = CreateDocumentContext(razorFileUri, codeDocument); var requestContext = CreateRazorRequestContext(documentContext: documentContext); return await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); } - private VersionedDocumentContext CreateDefaultDocumentContext() + private (DocumentContext, Position) CreateDefaultDocumentContext() { - var txt = """ - @addTagHelper *, TestAssembly - - @code{ - public void Increment(){ - } + TestCode code = """ + @addTagHelper *, TestAssembly + + @code{ + public void $$Increment(){ } - """; + } + """; + var path = "C:/text.razor"; - var codeDocument = CreateCodeDocument(txt, path, DefaultTagHelpers); + var codeDocument = CreateCodeDocument(code.Text, path, DefaultTagHelpers); var projectWorkspaceState = ProjectWorkspaceState.Create(DefaultTagHelpers); var projectSnapshot = TestProjectSnapshot.Create("C:/project.csproj", projectWorkspaceState); - var sourceText = SourceText.From(txt); - - var snapshot = Mock.Of(d => - d.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && - d.FilePath == path && - d.FileKind == FileKinds.Component && - d.GetTextAsync() == Task.FromResult(sourceText) && - d.Project == projectSnapshot, MockBehavior.Strict); - - var documentContext = new VersionedDocumentContext(new Uri(path), snapshot, projectContext: null, 1337); - return documentContext; + var documentSnapshotMock = new StrictMock(); + documentSnapshotMock + .Setup(x => x.GetGeneratedOutputAsync(It.IsAny())) + .ReturnsAsync(codeDocument); + documentSnapshotMock + .Setup(x => x.GetTextAsync()) + .ReturnsAsync(codeDocument.Source.Text); + documentSnapshotMock + .SetupGet(x => x.FilePath) + .Returns(path); + documentSnapshotMock + .SetupGet(x => x.FileKind) + .Returns(FileKinds.Component); + documentSnapshotMock + .SetupGet(x => x.Version) + .Returns(0); + documentSnapshotMock + .SetupGet(x => x.Project) + .Returns(projectSnapshot); + + var documentContext = new DocumentContext(new Uri(path), documentSnapshotMock.Object, projectContext: null); + var position = codeDocument.Source.Text.GetPosition(code.Position); + + return (documentContext, position); } private HoverEndpoint CreateEndpoint( - LanguageServerFeatureOptions languageServerFeatureOptions = null, - IDocumentMappingService documentMappingService = null, - IClientConnection clientConnection = null) + LanguageServerFeatureOptions? languageServerFeatureOptions = null, + IDocumentMappingService? documentMappingService = null, + IClientConnection? clientConnection = null) { - languageServerFeatureOptions ??= Mock.Of(options => options.SupportsFileManipulation == true && options.SingleServerSupport == false, MockBehavior.Strict); + languageServerFeatureOptions ??= StrictMock.Of(options => + options.SupportsFileManipulation == true && + options.SingleServerSupport == false); - var documentMappingServiceMock = new Mock(MockBehavior.Strict); - documentMappingServiceMock - .Setup(c => c.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(RazorLanguageKind.Html); - documentMappingService ??= documentMappingServiceMock.Object; + documentMappingService ??= StrictMock.Of(); - clientConnection ??= Mock.Of(MockBehavior.Strict); + clientConnection ??= StrictMock.Of(); var service = GetHoverService(); @@ -961,7 +980,7 @@ private HoverEndpoint CreateEndpoint( return endpoint; } - private HoverService GetHoverService(IDocumentMappingService mappingService = null) + private HoverService GetHoverService(IDocumentMappingService? mappingService = null) { var projectManager = CreateProjectSnapshotManager(); var lspTagHelperTooltipFactory = new DefaultLSPTagHelperTooltipFactory(projectManager); @@ -970,6 +989,9 @@ private HoverService GetHoverService(IDocumentMappingService mappingService = nu var clientCapabilities = CreateMarkDownCapabilities(); clientCapabilities.SupportsVisualStudioExtensions = true; var clientCapabilitiesService = new TestClientCapabilitiesService(clientCapabilities); + + mappingService ??= StrictMock.Of(); + return new HoverService(lspTagHelperTooltipFactory, vsLspTagHelperTooltipFactory, mappingService, clientCapabilitiesService); } @@ -1006,14 +1028,11 @@ public async Task SendRequestAsync(string method, var hoverRequest = new TextDocumentPositionParams() { - TextDocument = new VSTextDocumentIdentifier() - { - Uri = _csharpDocumentUri, - }, + TextDocument = new() { Uri = _csharpDocumentUri, }, Position = hoverParams.ProjectedPosition }; - var result = await _csharpServer.ExecuteRequestAsync( + var result = await _csharpServer.ExecuteRequestAsync( Methods.TextDocumentHoverName, hoverRequest, _cancellationToken); return result; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs index 0dedf24fcda..6ff8c8f61ac 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs @@ -105,7 +105,7 @@ private async Task VerifyCSharpGoToImplementationAsync(string input) }, Position = codeDocument.Source.Text.GetPosition(cursorPosition) }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs index 49e8758c700..9b964c0898a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs @@ -106,7 +106,7 @@ private async Task VerifyInlayHintsAsync(string input, Dictionary sourceMappings) + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { - var codeDocument = CreateCodeDocument(razorSource, ImmutableArray.Empty); - var csharpDocument = RazorCSharpDocument.Create( + var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), - Enumerable.Empty(), - sourceMappings.ToImmutableArray(), - Enumerable.Empty()); + RazorCodeGenerationOptions.Default, + diagnostics: [], + sourceMappings, + linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index 271ebda9975..deb4ddbea52 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -36,13 +35,9 @@ public async Task Handle_MapToDocumentRanges_CSharp() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -61,7 +56,6 @@ public async Task Handle_MapToDocumentRanges_CSharp() // Assert Assert.NotNull(response); Assert.Equal(expectedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -70,13 +64,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_Unmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -94,7 +84,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_Unmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -103,13 +92,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_LeadingOverlapsUnmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -127,7 +112,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_LeadingOverlapsUnmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -136,13 +120,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_TrailingOverlapsUnmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -160,7 +140,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_TrailingOverlapsUnmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -186,7 +165,6 @@ public async Task Handle_MapToDocumentRanges_Html() // Assert Assert.NotNull(response); Assert.Equal(request.ProjectedRanges[0], response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -212,7 +190,6 @@ public async Task Handle_MapToDocumentRanges_Razor() // Assert Assert.NotNull(response); Assert.Equal(request.ProjectedRanges[0], response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -221,13 +198,9 @@ public async Task Handle_MapToDocumentRanges_Unsupported() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); codeDocument.SetUnsupported(); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); @@ -246,18 +219,17 @@ public async Task Handle_MapToDocumentRanges_Unsupported() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } - private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, IEnumerable sourceMappings) + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); - var csharpDocument = RazorCSharpDocument.Create( + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), + RazorCodeGenerationOptions.Default, diagnostics: [], - sourceMappings.ToImmutableArray(), + sourceMappings, linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj index ab200262e88..685173189f4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj @@ -6,18 +6,6 @@ $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES - - - 4.7.0-1.23178.15 @@ -25,29 +13,6 @@ - - - - - - - - - - - - - - - - - - - true - LegacyClasp - - - diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs index 8a17f7af7d4..1ebfb541ed6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs @@ -39,7 +39,7 @@ public async Task GetProjectContexts_ReturnsExpected() } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument.Uri, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument.Uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); var results = await endpoint.HandleRequestAsync(request, requestContext, default); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs index 453c64f7064..3f372b9f668 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs @@ -48,8 +48,6 @@ protected override async Task InitializeAsync() { _projectManager = CreateProjectSnapshotManager(); - var documentVersionCache = new DocumentVersionCache(_projectManager); - var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock .Setup(x => x.Create(It.IsAny())) @@ -65,7 +63,6 @@ protected override async Task InitializeAsync() var projectService = new TestRazorProjectService( remoteTextLoaderFactoryMock.Object, - documentVersionCache, _projectManager, LoggerFactory); @@ -78,10 +75,10 @@ await projectService.AddProjectAsync( DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath1, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(""), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(""), DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath2, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From("@namespace Test"), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From("@namespace Test"), DisposalToken); await projectService.AddProjectAsync( s_projectFilePath2, @@ -92,7 +89,7 @@ await projectService.AddProjectAsync( DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath3, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(""), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(""), DisposalToken); } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index 8bd5c180295..f5eb72e2a2f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -2,12 +2,8 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; -using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; @@ -21,15 +17,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -public class RazorDocumentMappingServiceTest : ToolingTestBase +public class RazorDocumentMappingServiceTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) { - private readonly IFilePathService _filePathService; - - public RazorDocumentMappingServiceTest(ITestOutputHelper testOutput) - : base(testOutput) - { - _filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); - } + private readonly IFilePathService _filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); [Fact] public void TryMapToHostDocumentRange_Strict_StartOnlyMaps_ReturnsFalse() @@ -37,9 +27,9 @@ public void TryMapToHostDocumentRange_Strict_StartOnlyMaps_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 19)); // Act @@ -60,9 +50,9 @@ public void TryMapToHostDocumentRange_Strict_EndOnlyMaps_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 12)); // Act @@ -83,9 +73,9 @@ public void TryMapToHostDocumentRange_Strict_StartAndEndMap_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -107,9 +97,9 @@ public void TryMapToHostDocumentRange_Inclusive_DirectlyMaps_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -131,9 +121,9 @@ public void TryMapToHostDocumentRange_Inclusive_StartSinglyIntersects_ReturnsTru // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 19)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -155,9 +145,9 @@ public void TryMapToHostDocumentRange_Inclusive_EndSinglyIntersects_ReturnsTrue( // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 10)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -179,13 +169,12 @@ public void TryMapToHostDocumentRange_Inclusive_StartDoublyIntersects_ReturnsFal // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 14), new LinePosition(0, 19)); // Act @@ -206,13 +195,12 @@ public void TryMapToHostDocumentRange_Inclusive_EndDoublyIntersects_ReturnsFalse // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 14)); // Act @@ -233,9 +221,9 @@ public void TryMapToHostDocumentRange_Inclusive_OverlapsSingleMapping_ReturnsTru // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -257,13 +245,12 @@ public void TryMapToHostDocumentRange_Inclusive_OverlapsTwoMappings_ReturnsFalse // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); // Act @@ -284,9 +271,9 @@ public void TryMapToHostDocumentRange_Inferred_DirectlyMaps_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -308,9 +295,9 @@ public void TryMapToHostDocumentRange_Inferred_BeginningOfDocAndProjection_Retur // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@

@DateTime.Now

", - "(__builder) => { };__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(26, 12), new SourceSpan(25, 12)) }); + razorSource: "@

@DateTime.Now

", + projectedCSharpSource: "(__builder) => { };__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(26, 12), new SourceSpan(25, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); // Act @@ -326,17 +313,17 @@ public void TryMapToHostDocumentRange_Inferred_BeginningOfDocAndProjection_Retur } [Fact] - public void TryMapToHostDocumentRange_Inferred_InbetweenProjections_ReturnsTrue() + public void TryMapToHostDocumentRange_Inferred_InBetweenProjections_ReturnsTrue() { // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @ }", - " var abc = (__builder) => { } ", - new[] { + razorSource: "@{ var abc = @ }", + projectedCSharpSource: " var abc = (__builder) => { } ", + sourceMappings: [ new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), - new SourceMapping(new SourceSpan(35, 1), new SourceSpan(30, 1)), - }); + new SourceMapping(new SourceSpan(35, 1), new SourceSpan(30, 1)) + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 12), new LinePosition(0, 29)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 13), new LinePosition(0, 35)); @@ -353,14 +340,14 @@ public void TryMapToHostDocumentRange_Inferred_InbetweenProjections_ReturnsTrue( } [Fact] - public void TryMapToHostDocumentRange_Inferred_InbetweenProjectionAndEndOfDoc_ReturnsTrue() + public void TryMapToHostDocumentRange_Inferred_InBetweenProjectionAndEndOfDoc_ReturnsTrue() { // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new[] { new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 12), new LinePosition(0, 29)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 13), new LinePosition(0, 35)); @@ -382,9 +369,9 @@ public void TryMapToHostDocumentRange_Inferred_OutsideDoc_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new[] { new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11))]); var projectedRange = new LinePositionSpan(new LinePosition(2, 12), new LinePosition(2, 29)); // Act @@ -392,14 +379,14 @@ public void TryMapToHostDocumentRange_Inferred_OutsideDoc_ReturnsFalse() codeDoc.GetCSharpDocument(), projectedRange, MappingBehavior.Inferred, - out var originalRange); + out _); // Assert Assert.False(result); } [Fact] - public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() + public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesNotThrow() { // Real world repo is something like: // @@ -418,9 +405,9 @@ public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new SourceMapping[] { new(new(30, 1), new (2, 1)), new(new(28, 2), new(30, 2)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new(new(30, 1), new(2, 1)), new(new(28, 2), new(30, 2))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 25), new LinePosition(0, 25)); // Act @@ -431,7 +418,7 @@ public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() out var originalRange); // Assert - // We're really just happy this doesn't throw an exception. The behaviour is to map to the end of the file + // We're really just happy this doesn't throw an exception. The behavior is to map to the end of the file Assert.True(result); Assert.Equal(0, originalRange.Start.Line); Assert.Equal(31, originalRange.Start.Character); @@ -445,21 +432,19 @@ public void TryMapToGeneratedDocumentPosition_NotMatchingAnyMapping() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "test razor source", - "test C# source", - new[] { new SourceMapping(new SourceSpan(2, 100), new SourceSpan(0, 100)) }); + razorSource: "test razor source", + projectedCSharpSource: "test C# source", + sourceMappings: [new SourceMapping(new SourceSpan(2, 100), new SourceSpan(0, 100))]); // Act var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 1, - out var projectedPosition, - out var projectedPositionIndex); + hostDocumentIndex: 1, + out _, + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedPosition); - Assert.Equal(default, projectedPositionIndex); } [Fact] @@ -468,28 +453,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_OnLeadingEdge() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 16, + hostDocumentIndex: 16, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(2, projectedPosition.Line); - Assert.Equal(0, projectedPosition.Character); - Assert.Equal(11, projectedPositionIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToGeneratedDocumentPosition)} should have returned true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(2, projectedPosition.Line); + Assert.Equal(0, projectedPosition.Character); + Assert.Equal(11, projectedPositionIndex); } [Fact] @@ -498,28 +479,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_InMiddle() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 28, + hostDocumentIndex: 28, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(3, projectedPosition.Line); - Assert.Equal(2, projectedPosition.Character); - Assert.Equal(23, projectedPositionIndex); - } - else - { - Assert.Fail("TryMapToGeneratedDocumentPosition should have been true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(3, projectedPosition.Line); + Assert.Equal(2, projectedPosition.Character); + Assert.Equal(23, projectedPositionIndex); } [Fact] @@ -528,28 +505,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_OnTrailingEdge() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 35, + hostDocumentIndex: 35, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(3, projectedPosition.Line); - Assert.Equal(9, projectedPosition.Character); - Assert.Equal(30, projectedPositionIndex); - } - else - { - Assert.Fail("TryMapToGeneratedDocumentPosition should have returned true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(3, projectedPosition.Line); + Assert.Equal(9, projectedPosition.Character); + Assert.Equal(30, projectedPositionIndex); } [Fact] @@ -560,19 +533,17 @@ public void TryMapToHostDocumentPosition_NotMatchingAnyMapping() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "test razor source", projectedCSharpSource: "projectedCSharpSource: test C# source", - new[] { new SourceMapping(new SourceSpan(2, 100), new SourceSpan(2, 100)) }); + sourceMappings: [new SourceMapping(new SourceSpan(2, 100), new SourceSpan(2, 100))]); // Act var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 1, - out var hostDocumentPosition, - out var hostDocumentIndex); + generatedDocumentIndex: 1, + out _, + out _); // Assert Assert.False(result); - Assert.Equal(default, hostDocumentPosition); - Assert.Equal(default, hostDocumentIndex); } [Fact] @@ -583,26 +554,22 @@ public void TryMapToHostDocumentPosition_CSharp_OnLeadingEdge() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 11, // @{| + generatedDocumentIndex: 11, // @{| out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(1, hostDocumentPosition.Line); - Assert.Equal(9, hostDocumentPosition.Character); - Assert.Equal(16, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(1, hostDocumentPosition.Line); + Assert.Equal(9, hostDocumentPosition.Character); + Assert.Equal(16, hostDocumentIndex); } [Fact] @@ -613,26 +580,22 @@ public void TryMapToHostDocumentPosition_CSharp_InMiddle() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 21, // |var def + generatedDocumentIndex: 21, // |var def out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(2, hostDocumentPosition.Line); - Assert.Equal(0, hostDocumentPosition.Character); - Assert.Equal(26, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(2, hostDocumentPosition.Line); + Assert.Equal(0, hostDocumentPosition.Character); + Assert.Equal(26, hostDocumentIndex); } [Fact] @@ -643,26 +606,22 @@ public void TryMapToHostDocumentPosition_CSharp_OnTrailingEdge() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 30, // def; |} + generatedDocumentIndex: 30, // def; |} out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(2, hostDocumentPosition.Line); - Assert.Equal(9, hostDocumentPosition.Character); - Assert.Equal(35, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(2, hostDocumentPosition.Line); + Assert.Equal(9, hostDocumentPosition.Character); + Assert.Equal(35, hostDocumentIndex); } [Fact] @@ -673,27 +632,23 @@ public void TryMapToGeneratedDocumentRange_CSharp() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act & Assert - if (service.TryMapToGeneratedDocumentRange( + var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange)) - { - Assert.Equal(2, projectedRange.Start.Line); - Assert.Equal(1, projectedRange.Start.Character); - Assert.Equal(2, projectedRange.End.Line); - Assert.Equal(4, projectedRange.End.Character); - } - else - { - Assert.Fail($"{nameof(service.TryMapToGeneratedDocumentRange)} should have returned true"); - } + out var projectedRange); + + Assert.True(result); + Assert.Equal(2, projectedRange.Start.Line); + Assert.Equal(1, projectedRange.Start.Character); + Assert.Equal(2, projectedRange.End.Line); + Assert.Equal(4, projectedRange.End.Character); } [Fact] @@ -704,20 +659,17 @@ public void TryMapToGeneratedDocumentRange_CSharp_MissingSourceMappings() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { - new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), - }); + sourceMappings: [new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1))]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange); + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedRange); } [Fact] @@ -728,364 +680,36 @@ public void TryMapToGeneratedDocumentRange_CSharp_End_LessThan_Start() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 3), new SourceSpan(11, 3)), new SourceMapping(new SourceSpan(19, 10), new SourceSpan(5, 10)) - }); + ]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange); + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedRange); - } - - [Fact] - public void GetLanguageKindCore_TagHelperElementOwnsName() - { - // Arrange - var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); - descriptor.TagMatchingRule(rule => rule.TagName = "test"); - descriptor.SetMetadata(TypeName("TestTagHelper")); - var text = """ - @addTagHelper *, TestAssembly - @Name - """; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text, new[] { descriptor.Build() }); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 32 + Environment.NewLine.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - [Fact] - public void GetLanguageKindCore_TagHelpersDoNotOwnTrailingEdge() - { - // Arrange - var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); - descriptor.TagMatchingRule(rule => rule.TagName = "test"); - descriptor.SetMetadata(TypeName("TestTagHelper")); - var text = """ - @addTagHelper *, TestAssembly - @DateTime.Now - """; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text, new[] { descriptor.Build() }); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 42 + Environment.NewLine.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Razor, languageKind); - } - - [Fact] - public void GetLanguageKindCore_TagHelperNestedCSharpAttribute() - { - // Arrange - var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); - descriptor.TagMatchingRule(rule => rule.TagName = "test"); - descriptor.BindAttribute(builder => - { - builder.Name = "asp-int"; - builder.TypeName = typeof(int).FullName; - builder.SetMetadata(PropertyName("AspInt")); - }); - descriptor.SetMetadata(TypeName("TestTagHelper")); - var text = """ - @addTagHelper *, TestAssembly - - """; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text, new[] { descriptor.Build() }); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 46 + Environment.NewLine.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_CSharp() - { - // Arrange - var text = "

@Name

"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 5, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_Html() - { - // Arrange - var text = "

Hello World

"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 5, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - [Fact] - public void GetLanguageKindCore_DefaultsToRazorLanguageIfCannotLocateOwner() - { - // Arrange - var text = "

Hello World

"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, text.Length + 1, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Razor, languageKind); - } - - [Fact] - public void GetLanguageKindCore_GetsLastClassifiedSpanLanguageIfAtEndOfDocument() - { - // Arrange - var text = """ - Something - - """; - var classifiedSpans = ImmutableArray.Create( - new(new SourceSpan(0, 0), - blockSpan: new SourceSpan(absoluteIndex: 0, lineIndex: 0, characterIndex: 0, length: text.Length), - SpanKindInternal.Transition, - blockKind: default, - acceptedCharacters: default), - new(new SourceSpan(0, 26), - blockSpan: default, - SpanKindInternal.Markup, - blockKind: default, - acceptedCharacters: default)); - var tagHelperSpans = ImmutableArray.Empty; - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, text.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - [Fact] - public void GetLanguageKindCore_HtmlEdgeEnd() - { - // Arrange - var text = "Hello World"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, text.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - [Fact] - public void GetLanguageKindCore_CSharpEdgeEnd() - { - // Arrange - var text = "@Name"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, text.Length, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_RazorEdgeWithCSharp() - { - // Arrange - var text = "@{}"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 2, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_CSharpEdgeWithCSharpMarker() - { - // Arrange - var text = "@{var x = 1;}"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 12, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_ExplicitExpressionStartCSharp() - { - // Arrange - var text = "@()"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 2, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_ExplicitExpressionInProgressCSharp() - { - // Arrange - var text = "@(Da)"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 4, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_ImplicitExpressionStartCSharp() - { - // Arrange - var text = "@"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 1, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_ImplicitExpressionInProgressCSharp() - { - // Arrange - var text = "@Da"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 3, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_RazorEdgeWithHtml() - { - // Arrange - var text = "@{
}"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 2, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); } - [Fact] - public void GetLanguageKindCore_HtmlInCSharpLeftAssociative() + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { - // Arrange - var text = "@if (true) {
}"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 13, text.Length, rightAssociative: false); - - // Assert - Assert.Equal(RazorLanguageKind.CSharp, languageKind); - } - - [Fact] - public void GetLanguageKindCore_HtmlInCSharpRightAssociative() - { - // Arrange - var text = "@if (true) {
}"; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text); - - // Act\ - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 13, text.Length, rightAssociative: true); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - [Fact] - public void GetLanguageKindCore_TagHelperInCSharpRightAssociative() - { - // Arrange - var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); - descriptor.TagMatchingRule(rule => rule.TagName = "test"); - descriptor.SetMetadata(TypeName("TestTagHelper")); - var text = """ - @addTagHelper *, TestAssembly - @if { - @Name - } - """; - var (classifiedSpans, tagHelperSpans) = GetClassifiedSpans(text, new[] { descriptor.Build() }); - - // Act\ - var languageKind = LspDocumentMappingService.GetLanguageKindCore(classifiedSpans, tagHelperSpans, 40, text.Length, rightAssociative: true); - - // Assert - Assert.Equal(RazorLanguageKind.Html, languageKind); - } - - private static (ImmutableArray classifiedSpans, ImmutableArray tagHelperSpans) GetClassifiedSpans(string text, IReadOnlyList? tagHelpers = null) - { - var codeDocument = CreateCodeDocument(text, tagHelpers); - var syntaxTree = codeDocument.GetSyntaxTree(); - var classifiedSpans = syntaxTree.GetClassifiedSpans(); - var tagHelperSpans = syntaxTree.GetTagHelperSpans(); - return (classifiedSpans, tagHelperSpans); - } - - private static RazorCodeDocument CreateCodeDocument(string text, IReadOnlyList? tagHelpers = null) - { - tagHelpers ??= Array.Empty(); - var sourceDocument = TestRazorSourceDocument.Create(text); + var sourceDocument = TestRazorSourceDocument.Create(razorSource); var projectEngine = RazorProjectEngine.Create(builder => { }); - var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, "mvc", importSources: default, tagHelpers); - return codeDocument; - } + var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, "mvc", importSources: default, tagHelpers: []); - private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, IEnumerable sourceMappings) - { - var codeDocument = CreateCodeDocument(razorSource, Array.Empty()); - var csharpDocument = RazorCSharpDocument.Create( + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), - Enumerable.Empty(), - sourceMappings.ToImmutableArray(), - Enumerable.Empty()); + RazorCodeGenerationOptions.Default, + diagnostics: [], + sourceMappings, + linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs index 0802a4cf61d..84a83312b8e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs @@ -32,7 +32,6 @@ public class RazorProjectServiceTest(ITestOutputHelper testOutput) : LanguageSer // Each of these is initialized by InitializeAsync() below. #nullable disable private TestProjectSnapshotManager _projectManager; - private DocumentVersionCache _documentVersionCache; private TestRazorProjectService _projectService; #nullable enable @@ -41,7 +40,6 @@ protected override Task InitializeAsync() var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); var projectEngineFactoryProvider = new LspProjectEngineFactoryProvider(optionsMonitor); _projectManager = CreateProjectSnapshotManager(projectEngineFactoryProvider); - _documentVersionCache = new DocumentVersionCache(_projectManager); var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock @@ -50,7 +48,6 @@ protected override Task InitializeAsync() _projectService = new TestRazorProjectService( remoteTextLoaderFactoryMock.Object, - _documentVersionCache, _projectManager, LoggerFactory); @@ -478,7 +475,7 @@ public async Task CloseDocument_ClosesDocumentInOwnerProject() var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); @@ -511,7 +508,7 @@ public async Task CloseDocument_ClosesDocumentInAllOwnerProjects() var ownerProjectKey2 = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath2, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject1 = _projectManager.GetLoadedProject(ownerProjectKey1); var ownerProject2 = _projectManager.GetLoadedProject(ownerProjectKey2); @@ -538,7 +535,7 @@ public async Task CloseDocument_ClosesDocumentInMiscellaneousProject() const string DocumentFilePath = "document.cshtml"; await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -576,7 +573,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInOwnerProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -609,7 +606,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInAllOwnerProjects() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -634,7 +631,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInMiscellaneousProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); // Assert listener.AssertNotifications( @@ -660,7 +657,7 @@ public async Task OpenDocument_OpensAndAddsDocumentToMiscellaneousProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -733,6 +730,47 @@ public async Task AddDocumentToMiscProjectAsync_AddsDocumentToMiscellaneousProje Assert.False(_projectManager.IsDocumentOpen(DocumentFilePath)); } + [Fact] + public async Task AddDocumentToMiscProjectAsync_IgnoresKnownDocument() + { + // Arrange + const string ProjectFilePath = "C:/path/to/project.csproj"; + const string IntermediateOutputPath = "C:/path/to/obj"; + const string RootNamespace = "TestRootNamespace"; + const string DocumentFilePath = "C:/path/to/document.cshtml"; + + await _projectService.AddProjectAsync( + ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); + await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); + + // Act + using var listener = _projectManager.ListenToNotifications(); + + // Act + await _projectService.AddDocumentToMiscProjectAsync(DocumentFilePath, DisposalToken); + + // Assert + listener.AssertNoNotifications(); + } + + [Fact] + public async Task AddDocumentToMiscProjectAsync_IgnoresKnownDocument_InMiscFiles() + { + // Arrange + const string DocumentFilePath = "C:/path/to/document.cshtml"; + + await _projectService.AddDocumentToMiscProjectAsync(DocumentFilePath, DisposalToken); + + // Act + using var listener = _projectManager.ListenToNotifications(); + + // Act + await _projectService.AddDocumentToMiscProjectAsync(DocumentFilePath, DisposalToken); + + // Assert + listener.AssertNoNotifications(); + } + [Fact] public async Task RemoveDocument_RemovesDocumentFromOwnerProject() { @@ -804,7 +842,7 @@ public async Task RemoveOpenDocument_RemovesDocumentFromOwnerProject_MovesToMisc var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -850,14 +888,8 @@ public async Task RemoveDocument_RemovesDocumentFromMiscellaneousProject() public async Task RemoveDocument_NoopsIfOwnerProjectDoesNotContainDocument() { // Arrange - const string ProjectFilePath = "C:/path/to/project.csproj"; - const string IntermediateOutputPath = "C:/path/to/obj"; - const string RootNamespace = "TestRootNamespace"; const string DocumentFilePath = "C:/path/to/document.cshtml"; - var ownerProjectKey = await _projectService.AddProjectAsync( - ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); - using var listener = _projectManager.ListenToNotifications(); // Act @@ -896,7 +928,7 @@ public async Task UpdateDocument_ChangesDocumentInOwnerProject() var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); @@ -905,7 +937,7 @@ public async Task UpdateDocument_ChangesDocumentInOwnerProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -929,7 +961,7 @@ public async Task UpdateDocument_ChangesDocumentInAllOwnerProjects() var ownerProjectKey2 = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath2, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject1 = _projectManager.GetLoadedProject(ownerProjectKey1); var ownerProject2 = _projectManager.GetLoadedProject(ownerProjectKey2); @@ -939,7 +971,7 @@ public async Task UpdateDocument_ChangesDocumentInAllOwnerProjects() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -956,7 +988,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() const string DocumentFilePath = "document.cshtml"; await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -965,7 +997,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -975,7 +1007,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() } [Fact] - public async Task UpdateDocument_TracksKnownDocumentVersion() + public async Task UpdateDocument_DocumentVersionUpdated() { // Arrange const string ProjectFilePath = "C:/path/to/project.csproj"; @@ -992,33 +1024,14 @@ public async Task UpdateDocument_TracksKnownDocumentVersion() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( x => x.DocumentChanged(DocumentFilePath, ownerProject.Key)); - var latestVersion = _documentVersionCache.GetLatestDocumentVersion(DocumentFilePath); - Assert.Equal(43, latestVersion); - } - - [Fact] - public async Task UpdateDocument_ThrowsForUnknownDocument() - { - // Arrange - const string ProjectFilePath = "C:/path/to/project.csproj"; - const string IntermediateOutputPath = "C:/path/to/obj"; - const string RootNamespace = "TestRootNamespace"; - const string DocumentFilePath = "C:/path/to/document.cshtml"; - - await _projectService.AddProjectAsync( - ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); - - // Act - await Assert.ThrowsAnyAsync(() => - { - return _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); - }); + var latestVersion = _projectManager.GetLoadedProject(ownerProjectKey).GetDocument(DocumentFilePath)!.Version; + Assert.Equal(2, latestVersion); } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs index 620a6bba2fe..0a06da92a94 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Rename; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -19,7 +18,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Refactoring; -[UseExportProvider] public class RenameEndpointDelegationTest(ITestOutputHelper testOutput) : SingleServerDelegatingEndpointTestBase(testOutput) { [Fact] @@ -86,7 +84,7 @@ await projectManager.UpdateAsync(updater => Position = codeDocument.Source.Text.GetPosition(cursorPosition), NewName = newName }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs index 3aa916de91a..2bb699fdf80 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs @@ -17,7 +17,6 @@ using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -33,7 +32,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Refactoring; -[UseExportProvider] public class RenameEndpointTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { private static readonly string s_project1BasePath = PathUtilities.CreateRootedPath("First"); @@ -110,7 +108,7 @@ @namespace Test.Components public async Task Handle_Rename_FileManipulationNotSupported_ReturnsNull() { // Arrange - var options = StrictMock.Of(o => + var options = StrictMock.Of(static o => o.SupportsFileManipulation == false && o.ReturnCodeActionAndRenamePathsWithPrefixedSlash == false); var (endpoint, documentContextFactory) = await CreateEndpointAndDocumentContextFactoryAsync(options); @@ -122,7 +120,7 @@ public async Task Handle_Rename_FileManipulationNotSupported_ReturnsNull() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -145,7 +143,7 @@ public async Task Handle_Rename_WithNamespaceDirective() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -186,7 +184,7 @@ public async Task Handle_Rename_OnComponentParameter_ReturnsNull() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -209,7 +207,7 @@ public async Task Handle_Rename_OnOpeningBrace_ReturnsNull() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -232,7 +230,7 @@ public async Task Handle_Rename_OnComponentNameLeadingEdge_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -255,7 +253,30 @@ public async Task Handle_Rename_OnComponentName_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); + var requestContext = CreateRazorRequestContext(documentContext); + + // Act + var result = await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); + + // Assert + Assert.NotNull(result); + } + + [Fact] + public async Task Handle_Rename_OnComponentEndTag_ReturnsResult() + { + // Arrange + var (endpoint, documentContextFactory) = await CreateEndpointAndDocumentContextFactoryAsync(); + var uri = PathUtilities.GetUri(s_componentWithParamFilePath); + var request = new RenameParams + { + TextDocument = new() { Uri = uri }, + Position = VsLspFactory.CreatePosition(1, 36), + NewName = "Test2" + }; + + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -278,7 +299,7 @@ public async Task Handle_Rename_OnComponentNameTrailingEdge_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -301,7 +322,7 @@ public async Task Handle_Rename_ComponentInSameFile() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -387,7 +408,7 @@ public async Task Handle_Rename_FullyQualifiedAndNot() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -433,7 +454,7 @@ public async Task Handle_Rename_MultipleFileUsages() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -486,7 +507,7 @@ public async Task Handle_Rename_DifferentDirectories() NewName = "TestComponent" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -515,39 +536,36 @@ public async Task Handle_Rename_DifferentDirectories() public async Task Handle_Rename_SingleServer_CallsDelegatedLanguageServer() { // Arrange - var options = StrictMock.Of(o => + var options = StrictMock.Of(static o => o.SupportsFileManipulation == true && o.SingleServerSupport == true && o.ReturnCodeActionAndRenamePathsWithPrefixedSlash == false); var delegatedEdit = new WorkspaceEdit(); - var clientConnectionMock = new StrictMock(); - clientConnectionMock - .Setup(c => c.SendRequestAsync(CustomMessageNames.RazorRenameEndpointName, It.IsAny(), It.IsAny())) - .ReturnsAsync(delegatedEdit); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(CustomMessageNames.RazorRenameEndpointName, response: delegatedEdit); + }); var documentMappingServiceMock = new StrictMock(); - documentMappingServiceMock - .Setup(c => c.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(RazorLanguageKind.CSharp); var projectedPosition = new LinePosition(1, 1); var projectedIndex = 1; documentMappingServiceMock - .Setup(c => c.TryMapToGeneratedDocumentPosition(It.IsAny(), It.IsAny(), out projectedPosition, out projectedIndex)) + .Setup(x => x.TryMapToGeneratedDocumentPosition(It.IsAny(), It.IsAny(), out projectedPosition, out projectedIndex)) .Returns(true); var editMappingServiceMock = new StrictMock(); editMappingServiceMock - .Setup(c => c.RemapWorkspaceEditAsync(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.RemapWorkspaceEditAsync(It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync(delegatedEdit); var (endpoint, documentContextFactory) = await CreateEndpointAndDocumentContextFactoryAsync( options, documentMappingServiceMock.Object, editMappingServiceMock.Object, - clientConnectionMock.Object); + clientConnection); var uri = PathUtilities.GetUri(s_componentWithParamFilePath); var request = new RenameParams @@ -557,7 +575,7 @@ public async Task Handle_Rename_SingleServer_CallsDelegatedLanguageServer() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -571,33 +589,23 @@ public async Task Handle_Rename_SingleServer_CallsDelegatedLanguageServer() public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() { // Arrange - var options = StrictMock.Of(o => + var options = StrictMock.Of(static o => o.SupportsFileManipulation == true && o.SingleServerSupport == true && o.ReturnCodeActionAndRenamePathsWithPrefixedSlash == false); - var clientConnection = StrictMock.Of(); - var documentMappingServiceMock = new StrictMock(); - documentMappingServiceMock - .Setup(c => c.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(RazorLanguageKind.Razor); - - var editMappingService = StrictMock.Of(); + var documentMappingService = StrictMock.Of(); - var (endpoint, documentContextFactory) = await CreateEndpointAndDocumentContextFactoryAsync( - options, - documentMappingServiceMock.Object, - editMappingService, - clientConnection); + var (endpoint, documentContextFactory) = await CreateEndpointAndDocumentContextFactoryAsync(options, documentMappingService); var request = new RenameParams { TextDocument = new() { Uri = PathUtilities.GetUri(s_componentWithParamFilePath) }, - Position = VsLspFactory.CreatePosition(1, 0), + Position = VsLspFactory.CreatePosition(0, 1), // This is right after the '@' in '@namespace' NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(request.TextDocument.Uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(request.TextDocument.Uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -625,8 +633,7 @@ public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() var projectManager = CreateProjectSnapshotManager(); - var documentVersionCache = new DocumentVersionCache(projectManager); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock @@ -641,11 +648,11 @@ public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() return textLoaderMock.Object; }); - var projectService = new TestRazorProjectService( - remoteTextLoaderFactoryMock.Object, - documentVersionCache, - projectManager, - LoggerFactory); + var projectService = AddDisposable( + new TestRazorProjectService( + remoteTextLoaderFactoryMock.Object, + projectManager, + LoggerFactory)); var projectKey1 = await projectService.AddProjectAsync( s_projectFilePath1, s_intermediateOutputPath1, RazorConfiguration.Default, RootNamespace1, displayName: null, DisposalToken); @@ -662,12 +669,12 @@ await projectManager.UpdateAsync(updater => await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath1337, DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_indexFilePath1, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(ComponentText1), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From(ComponentText2), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_directoryFilePath1, SourceText.From(DirectoryText1), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_directoryFilePath2, SourceText.From(DirectoryText2), version: 4, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1337, SourceText.From(ComponentText1337), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_indexFilePath1, SourceText.From(IndexText1), version: 42, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(ComponentText1), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From(ComponentText2), DisposalToken); + await projectService.UpdateDocumentAsync(s_directoryFilePath1, SourceText.From(DirectoryText1), DisposalToken); + await projectService.UpdateDocumentAsync(s_directoryFilePath2, SourceText.From(DirectoryText2), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1337, SourceText.From(ComponentText1337), DisposalToken); + await projectService.UpdateDocumentAsync(s_indexFilePath1, SourceText.From(IndexText1), DisposalToken); var projectKey2 = await projectService.AddProjectAsync( s_projectFilePath2, s_intermediateOutputPath2, RazorConfiguration.Default, RootNamespace2, displayName: null, DisposalToken); @@ -681,12 +688,12 @@ await projectManager.UpdateAsync(updater => await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath4, DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentWithParamFilePath, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(ComponentText3), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath4, SourceText.From(ComponentText4), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentWithParamFilePath, SourceText.From(ComponentWithParamText), version: 42, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(ComponentText3), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath4, SourceText.From(ComponentText4), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentWithParamFilePath, SourceText.From(ComponentWithParamText), DisposalToken); var searchEngine = new RazorComponentSearchEngine(projectManager, LoggerFactory); - options ??= StrictMock.Of(o => + options ??= StrictMock.Of(static o => o.SupportsFileManipulation == true && o.SingleServerSupport == false && o.ReturnCodeActionAndRenamePathsWithPrefixedSlash == false); @@ -694,9 +701,7 @@ await projectManager.UpdateAsync(updater => if (documentMappingService == null) { var documentMappingServiceMock = new StrictMock(); - documentMappingServiceMock - .Setup(c => c.GetLanguageKind(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(RazorLanguageKind.Html); + var projectedPosition = new LinePosition(1, 1); var projectedIndex = 1; documentMappingServiceMock diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs index 0bcf1c28d4e..3f0365de187 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs @@ -19,7 +19,6 @@ using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -35,7 +34,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Semantic; -[UseExportProvider] public partial class SemanticTokensTest(ITestOutputHelper testOutput) : TagHelperServiceTestBase(testOutput) { private readonly Mock _clientConnection = new(MockBehavior.Strict); @@ -919,7 +917,7 @@ private async Task AssertSemanticTokensAsync( AssertSemanticTokensMatchesBaseline(sourceText, tokens, testName.AssumeNotNull()); } - private static VersionedDocumentContext CreateDocumentContext( + private static DocumentContext CreateDocumentContext( string documentText, bool isRazorFile, ImmutableArray tagHelpers, @@ -937,21 +935,23 @@ private static VersionedDocumentContext CreateDocumentContext( .SetupGet(x => x.Project) .Returns(projectSnapshot.Object); documentSnapshotMock - .Setup(x => x.GetGeneratedOutputAsync()) + .Setup(x => x.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(document); documentSnapshotMock .Setup(x => x.GetTextAsync()) .ReturnsAsync(document.Source.Text); + documentSnapshotMock + .SetupGet(x => x.Version) + .Returns(version); - return new VersionedDocumentContext( + return new DocumentContext( uri: new Uri($@"c:\${GetFileName(isRazorFile)}"), snapshot: documentSnapshotMock.Object, - projectContext: null, - version); + projectContext: null); } private async Task CreateServiceAsync( - VersionedDocumentContext documentSnapshot, + DocumentContext documentSnapshot, ProvideSemanticTokensResponse? csharpTokens, bool withCSharpBackground, bool serverSupportsPreciseRanges, @@ -1198,12 +1198,11 @@ private static string GetFileRepresentationOfTokens(SourceText sourceText, int[] return builder.ToString(); } - private class TestDocumentContextFactory(VersionedDocumentContext? documentContext = null) : IDocumentContextFactory + private class TestDocumentContextFactory(DocumentContext? documentContext = null) : IDocumentContextFactory { public bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { context = documentContext; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs index b794fc1ece3..646b2085413 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs @@ -113,7 +113,7 @@ private async Task VerifySignatureHelpWithContextAndOptionsAsync(string input, R Context = signatureHelpContext }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.TestLanguageServer.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.TestLanguageServer.cs index f8d2fdd96b6..5561c00bb84 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.TestLanguageServer.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.TestLanguageServer.cs @@ -16,8 +16,8 @@ using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using DefinitionResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation, - Microsoft.VisualStudio.LanguageServer.Protocol.VSInternalLocation[], + Microsoft.VisualStudio.LanguageServer.Protocol.Location, + Microsoft.VisualStudio.LanguageServer.Protocol.Location[], Microsoft.VisualStudio.LanguageServer.Protocol.DocumentLink[]>; using ImplementationResult = Microsoft.VisualStudio.LanguageServer.Protocol.SumType< Microsoft.VisualStudio.LanguageServer.Protocol.Location[], @@ -216,17 +216,18 @@ private Task HandleProvideCodeActionsAsync private Task HandleReferencesAsync(TParams @params) { var delegatedParams = Assert.IsType(@params); - var delegatedRequest = new TextDocumentPositionParams() + var delegatedRequest = new ReferenceParams() { TextDocument = new VSTextDocumentIdentifier() { Uri = _csharpDocumentUri, ProjectContext = delegatedParams.Identifier.TextDocumentIdentifier.GetProjectContext(), }, - Position = delegatedParams.ProjectedPosition + Position = delegatedParams.ProjectedPosition, + Context = new ReferenceContext() }; - return _csharpServer.ExecuteRequestAsync( + return _csharpServer.ExecuteRequestAsync( Methods.TextDocumentReferencesName, delegatedRequest, _cancellationToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs index 4b2e2f3e871..c2c8405e394 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -19,7 +18,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -[UseExportProvider] public abstract partial class SingleServerDelegatingEndpointTestBase(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { private protected IDocumentContextFactory? DocumentContextFactory { get; private set; } @@ -56,7 +54,7 @@ private protected async Task CreateLanguageServerAsync( } } - DocumentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); + DocumentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); LanguageServerFeatureOptions = Mock.Of(options => options.SupportsFileManipulation == true && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs index 72f9c894e4f..a81ed10c7f1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -174,7 +175,9 @@ private async Task ValidateSpellCheckRangesAsync(string originalInput, string? f var documentContext = CreateDocumentContext(uri, codeDocument); var requestContext = new RazorRequestContext(documentContext, null!, "lsp/method", uri: null); - var endpoint = new DocumentSpellCheckEndpoint(DocumentMappingService, LanguageServerFeatureOptions, languageServer); + var csharpSpellCheckService = new LspCSharpSpellCheckRangeProvider(LanguageServerFeatureOptions, languageServer); + var spellCheckService = new SpellCheckService(csharpSpellCheckService, DocumentMappingService); + var endpoint = new DocumentSpellCheckEndpoint(spellCheckService); var request = new VSInternalDocumentSpellCheckableParams { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestAdhocWorkspaceFactory.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestAdhocWorkspaceFactory.cs deleted file mode 100644 index c90a7f4a3b2..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestAdhocWorkspaceFactory.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Linq; -using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Test; - -internal class TestAdhocWorkspaceFactory : IAdhocWorkspaceFactory -{ - public static readonly TestAdhocWorkspaceFactory Instance = new(); - - private TestAdhocWorkspaceFactory() - { - } - - public AdhocWorkspace Create(params IWorkspaceService[] workspaceServices) - { - var services = TestServices.Create(workspaceServices, Enumerable.Empty()); - var workspace = TestWorkspace.Create(services); - return workspace; - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs index f0acf1af497..e4f29f50c72 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs @@ -19,13 +19,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; internal class TestRazorProjectService( RemoteTextLoaderFactory remoteTextLoaderFactory, - IDocumentVersionCache documentVersionCache, IProjectSnapshotManager projectManager, ILoggerFactory loggerFactory) : RazorProjectService( projectManager, CreateProjectInfoDriver(), - documentVersionCache, remoteTextLoaderFactory, loggerFactory) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs index 80a563b38d4..53072c32790 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs @@ -8,8 +8,8 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -28,24 +28,19 @@ public async Task Handle_Html_ReturnsResult() var codeDocument = CreateCodeDocument("
"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = new WrapWithTagResponse(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(LanguageServerConstants.RazorWrapWithTagEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint( - clientConnection.Object, - documentMappingService, - LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) { Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 2), }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -53,7 +48,7 @@ public async Task Handle_Html_ReturnsResult() // Assert Assert.NotNull(result); - clientConnection.Verify(); + Mock.Get(clientConnection).Verify(); } [Fact] @@ -63,24 +58,19 @@ public async Task Handle_CSharp_ReturnsNull() var codeDocument = CreateCodeDocument("@(counter)"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = new WrapWithTagResponse(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(LanguageServerConstants.RazorWrapWithTagEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint( - clientConnection.Object, - documentMappingService, - LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) { - Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 2), + Range = VsLspFactory.CreateSingleLineRange(start: (0, 1), length: 2), }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -88,7 +78,8 @@ public async Task Handle_CSharp_ReturnsNull() // Assert Assert.Null(result); - clientConnection.Verify(); + Mock.Get(clientConnection) + .VerifySendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, Times.Never); } [Fact] @@ -98,23 +89,54 @@ public async Task Handle_CSharp_WholeImplicitStatement_ReturnsResult() var codeDocument = CreateCodeDocument("@counter"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); + + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); + + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); + + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) + { + Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 8), + }; + + var requestContext = CreateRazorRequestContext(documentContext); + + // Act + var result = await endpoint.HandleRequestAsync(wrapWithDivParams, requestContext, DisposalToken); + + // Assert + Assert.NotNull(result); + Mock.Get(clientConnection).Verify(); + } + + [Fact] + public async Task Handle_RazorBlockStart_ReturnsResult() + { + // Arrange + var input = new TestCode(""" + [|@if (true) { } +
+
|] + """); + var codeDocument = CreateCodeDocument(input.Text); + var uri = new Uri("file://path/test.razor"); + var documentContext = CreateDocumentContext(uri, codeDocument); var response = new WrapWithTagResponse(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(LanguageServerConstants.RazorWrapWithTagEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint( - clientConnection.Object, - documentMappingService, - LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); + var range = codeDocument.Source.Text.GetRange(input.Span); var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) { - Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 8), + Range = range }; var requestContext = CreateRazorRequestContext(documentContext); @@ -123,7 +145,7 @@ public async Task Handle_CSharp_WholeImplicitStatement_ReturnsResult() // Assert Assert.NotNull(result); - clientConnection.Verify(); + Mock.Get(clientConnection).Verify(); } [Fact] @@ -133,24 +155,19 @@ public async Task Handle_CSharp_PartOfImplicitStatement_ReturnsNull() var codeDocument = CreateCodeDocument("@counter"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = new WrapWithTagResponse(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(LanguageServerConstants.RazorWrapWithTagEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint( - clientConnection.Object, - documentMappingService, - LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) { Range = VsLspFactory.CreateSingleLineRange(line: 0, character: 2, length: 2), }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -158,7 +175,8 @@ public async Task Handle_CSharp_PartOfImplicitStatement_ReturnsNull() // Assert Assert.Null(result); - clientConnection.Verify(); + Mock.Get(clientConnection) + .VerifySendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, Times.Never); } [Fact] @@ -168,24 +186,19 @@ public async Task Handle_CSharp_InImplicitStatement_ReturnsResult() var codeDocument = CreateCodeDocument("@counter"); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var response = new WrapWithTagResponse(); - var clientConnection = new Mock(MockBehavior.Strict); - clientConnection - .Setup(l => l.SendRequestAsync(LanguageServerConstants.RazorWrapWithTagEndpoint, It.IsAny(), It.IsAny())) - .ReturnsAsync(response); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint( - clientConnection.Object, - documentMappingService, - LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) { Range = VsLspFactory.CreateZeroWidthRange(0, 4), }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -193,27 +206,27 @@ public async Task Handle_CSharp_InImplicitStatement_ReturnsResult() // Assert Assert.NotNull(result); - clientConnection.Verify(); + Mock.Get(clientConnection).Verify(); } [Fact] public async Task Handle_DocumentNotFound_ReturnsNull() { // Arrange - var codeDocument = CreateCodeDocument("
"); - var realUri = new Uri("file://path/test.razor"); var missingUri = new Uri("file://path/nottest.razor"); - var clientConnection = new Mock(MockBehavior.Strict); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint(clientConnection.Object, documentMappingService, LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = missingUri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = missingUri }) { Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 2), }; + var requestContext = CreateRazorRequestContext(documentContext: null); // Act @@ -221,6 +234,8 @@ public async Task Handle_DocumentNotFound_ReturnsNull() // Assert Assert.Null(result); + Mock.Get(clientConnection) + .VerifySendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, Times.Never); } [Fact] @@ -232,16 +247,18 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var clientConnection = new Mock(MockBehavior.Strict); + var clientConnection = TestMocks.CreateClientConnection(builder => + { + builder.SetupSendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, response: new(), verifiable: true); + }); - var documentMappingService = Mock.Of( - s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var endpoint = new WrapWithTagEndpoint(clientConnection.Object, documentMappingService, LoggerFactory); + var endpoint = new WrapWithTagEndpoint(clientConnection, LoggerFactory); - var wrapWithDivParams = new WrapWithTagParams(new TextDocumentIdentifier { Uri = uri }) + var wrapWithDivParams = new WrapWithTagParams(new() { Uri = uri }) { Range = VsLspFactory.CreateSingleLineRange(start: (0, 0), length: 2), }; + var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -249,28 +266,31 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() // Assert Assert.Null(result); + Mock.Get(clientConnection) + .VerifySendRequest(LanguageServerConstants.RazorWrapWithTagEndpoint, Times.Never); } [Fact] public async Task CleanUpTextEdits_NoTilde() { var input = """ + @if (true) + { + } + """; + + var expected = """ +
@if (true) { } - """; - var expected = """ -
- @if (true) - { - } -
- """; +
+ """; var uri = new Uri("file://path.razor"); var factory = CreateDocumentContextFactory(uri, input); Assert.True(factory.TryCreate(uri, out var context)); - var inputSourceText = await context!.GetSourceTextAsync(DisposalToken); + var inputSourceText = await context.GetSourceTextAsync(DisposalToken); var computedEdits = new TextEdit[] { @@ -281,8 +301,8 @@ public async Task CleanUpTextEdits_NoTilde() newText: " }" + Environment.NewLine + "
"), }; - var htmlSourceText = await context!.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var htmlSourceText = await context.GetHtmlSourceTextAsync(DisposalToken); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.Same(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); @@ -293,23 +313,23 @@ public async Task CleanUpTextEdits_NoTilde() public async Task CleanUpTextEdits_BadEditWithTilde() { var input = """ + @if (true) + { + } + """; + + var expected = """ +
@if (true) { } - """; - - var expected = """ -
- @if (true) - { - } -
- """; +
+ """; var uri = new Uri("file://path.razor"); var factory = CreateDocumentContextFactory(uri, input); Assert.True(factory.TryCreate(uri, out var context)); - var inputSourceText = await context!.GetSourceTextAsync(DisposalToken); + var inputSourceText = await context.GetSourceTextAsync(DisposalToken); var computedEdits = new TextEdit[] { @@ -321,8 +341,8 @@ public async Task CleanUpTextEdits_BadEditWithTilde() newText: " ~" + Environment.NewLine + "
") }; - var htmlSourceText = await context!.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var htmlSourceText = await context.GetHtmlSourceTextAsync(DisposalToken); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.NotSame(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); @@ -333,18 +353,18 @@ public async Task CleanUpTextEdits_BadEditWithTilde() public async Task CleanUpTextEdits_GoodEditWithTilde() { var input = """ + @if (true) + { + ~ + """; + + var expected = """ +
@if (true) { ~ - """; - - var expected = """ -
- @if (true) - { - ~ -
- """; +
+ """; var uri = new Uri("file://path.razor"); var factory = CreateDocumentContextFactory(uri, input); @@ -362,7 +382,7 @@ public async Task CleanUpTextEdits_GoodEditWithTilde() }; var htmlSourceText = await context.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.NotSame(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs index 4072d5b13d7..6b0c2f43966 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/ProjectEngineFactoryProviderTest.cs @@ -103,7 +103,7 @@ public void Create_CreatesDesignTimeTemplateEngine_ForVersion2_1() Assert.Single(engine.Engine.Features.OfType()); Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); + Assert.Single(engine.Engine.Features.OfType()); } [Fact] @@ -122,7 +122,7 @@ public void Create_CreatesDesignTimeTemplateEngine_ForVersion2_0() Assert.Single(engine.Engine.Features.OfType()); Assert.Single(engine.Engine.Features.OfType()); Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); + Assert.Single(engine.Engine.Features.OfType()); } [Fact] @@ -141,7 +141,7 @@ public void Create_CreatesTemplateEngine_ForVersion1_1() Assert.Single(engine.Engine.Features.OfType()); Assert.Single(engine.Engine.Features.OfType()); Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); + Assert.Single(engine.Engine.Features.OfType()); } [Fact] @@ -166,10 +166,10 @@ public void Create_DoesNotSupportViewComponentTagHelpers_ForVersion1_0() Assert.Empty(engine.Engine.Features.OfType()); Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); + Assert.Empty(engine.Engine.Features.OfType()); Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); + Assert.Empty(engine.Engine.Features.OfType()); } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingFixture.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingFixture.cs new file mode 100644 index 00000000000..13881a19c93 --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingFixture.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +public class HtmlFormattingFixture : IDisposable +{ + private readonly HtmlFormattingService _htmlFormattingService = new(); + + internal HtmlFormattingService Service => _htmlFormattingService; + + public void Dispose() + { + _htmlFormattingService.Dispose(); + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingService.cs new file mode 100644 index 00000000000..7c082b276cc --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormattingService.cs @@ -0,0 +1,123 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Composition; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Utilities; +using Microsoft.WebTools.Languages.Shared.ContentTypes; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal sealed class HtmlFormattingService : IDisposable +{ + private ExportProvider? _exportProvider; + + private ExportProvider ExportProvider => _exportProvider ?? (_exportProvider = TestComposition.Editor.ExportProviderFactory.CreateExportProvider()); + + public void Dispose() + { + if (_exportProvider is not null) + { + _exportProvider.Dispose(); + } + } + + public Task GetDocumentFormattingEditsAsync(ILoggerFactory loggerFactory, Uri uri, string generatedHtml, bool insertSpaces, int tabSize) + { + var request = $$""" + { + "Options": + { + "UseSpaces": {{(insertSpaces ? "true" : "false")}}, + "TabSize": {{tabSize}}, + "IndentSize": {{tabSize}} + }, + "Uri": "{{uri}}", + "GeneratedChanges": [], + } + """; + + return CallWebToolsApplyFormattedEditsHandlerAsync(loggerFactory, request, uri, generatedHtml); + } + + public Task GetOnTypeFormattingEditsAsync(ILoggerFactory loggerFactory, Uri uri, string generatedHtml, Position position, bool insertSpaces, int tabSize) + { + var generatedHtmlSource = SourceText.From(generatedHtml, Encoding.UTF8); + var absoluteIndex = generatedHtmlSource.GetRequiredAbsoluteIndex(position); + + var request = $$""" + { + "Options": + { + "UseSpaces": {{(insertSpaces ? "true" : "false")}}, + "TabSize": {{tabSize}}, + "IndentSize": {{tabSize}} + }, + "Uri": "{{uri}}", + "GeneratedChanges": [], + "OperationType": "FormatOnType", + "SpanToFormat": + { + "Start": {{absoluteIndex}}, + "End": {{absoluteIndex}} + } + } + """; + + return CallWebToolsApplyFormattedEditsHandlerAsync(loggerFactory, request, uri, generatedHtml); + } + + private async Task CallWebToolsApplyFormattedEditsHandlerAsync(ILoggerFactory loggerFactory, string serializedValue, Uri documentUri, string generatedHtml) + { + var contentTypeService = ExportProvider.GetExportedValue(); + + lock (contentTypeService) + { + if (!contentTypeService.ContentTypes.Any(t => t.TypeName == HtmlContentTypeDefinition.HtmlContentType)) + { + contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, [StandardContentTypeNames.Text]); + } + } + + var textBufferFactoryService = (ITextBufferFactoryService3)ExportProvider.GetExportedValue(); + var bufferManager = WebTools.BufferManager.New(contentTypeService, textBufferFactoryService, []); + var logger = loggerFactory.GetOrCreateLogger("ApplyFormattedEditsHandler"); + var applyFormatEditsHandler = WebTools.ApplyFormatEditsHandler.New(textBufferFactoryService, bufferManager, logger); + + // Make sure the buffer manager knows about the source document + var textSnapshot = bufferManager.CreateBuffer( + documentUri: documentUri, + contentTypeName: HtmlContentTypeDefinition.HtmlContentType, + initialContent: generatedHtml, + snapshotVersionFromLSP: 0); + + var requestContext = WebTools.RequestContext.New(textSnapshot); + + var request = WebTools.ApplyFormatEditsParam.DeserializeFrom(serializedValue); + var response = await applyFormatEditsHandler.HandleRequestAsync(request, requestContext, CancellationToken.None); + + var sourceText = SourceText.From(generatedHtml); + + using var edits = new PooledArrayBuilder(); + + foreach (var textChange in response.TextChanges) + { + var span = new TextSpan(textChange.Position, textChange.Length); + var edit = VsLspFactory.CreateTextEdit(sourceText.GetRange(span), textChange.NewText); + + edits.Add(edit); + } + + return edits.ToArray(); + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs similarity index 81% rename from src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs rename to src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs index e29535214fa..1077a3b09ec 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs @@ -1,23 +1,23 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -extern alias LegacyClasp; - using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.VisualStudio.Settings.Internal; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Utilities; using Microsoft.WebTools.Languages.Shared.Editor.Composition; using Microsoft.WebTools.Languages.Shared.Editor.Text; using Newtonsoft.Json; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; /// /// Provides reflection-based access to the Web Tools LSP infrastructure needed for tests. @@ -32,6 +32,7 @@ internal static class WebTools private const string ApplyFormatEditsParamTypeName = "Microsoft.WebTools.Languages.Shared.Editor.LanguageServer.ContainedLanguage.ApplyFormatEditsParam"; private const string ApplyFormatEditsResponseTypeName = "Microsoft.WebTools.Languages.Shared.Editor.LanguageServer.ContainedLanguage.ApplyFormatEditsResponse"; private const string TextChangeTypeName = "Microsoft.WebTools.Languages.Shared.Editor.EditorHelpers.TextChange"; + private const string LspLoggerTypeName = "Microsoft.WebTools.Languages.LanguageServer.Server.Shared.Clasp.LspLogger"; private static Assembly? s_serverAssembly; private static Assembly? s_editorAssembly; @@ -240,29 +241,56 @@ public async Task HandleRequestAsync( public static ApplyFormatEditsHandler New( ITextBufferFactoryService3 textBufferFactoryService, BufferManager bufferManager, - ILspLogger logger) + ILogger logger) { - var instance = CreateInstance(Type, textBufferFactoryService, bufferManager.Instance, new LegacyClaspILspLogger(logger)); + var instance = CreateInstance(Type, textBufferFactoryService, bufferManager.Instance, LspLogger.New(logger).Instance); return new(instance); } + } - /// - /// Wraps the razor logger (from the clasp source package) into the binary clasp logger that webtools uses. - /// - /// - private class LegacyClaspILspLogger(ILspLogger logger) : LegacyClasp.Microsoft.CommonLanguageServerProtocol.Framework.ILspLogger - { - public void LogEndContext(string message, params object[] @params) => logger.LogEndContext(message, @params); + public sealed class LspLogger(object instance) : ReflectedObject(instance) + { + private static Type? s_type; - public void LogError(string message, params object[] @params) => logger.LogError(message, @params); + public static Type Type + => s_type ?? InterlockedOperations.Initialize(ref s_type, + WebTools.GetType(ServerAssembly, LspLoggerTypeName)); - public void LogException(Exception exception, string? message = null, params object[] @params) => logger.LogException(exception, message, @params); + public static RequestContext New(ILogger logger) + { + var instance = CreateInstance(Type, new MicrosoftExtensionsLoggerWrapper(logger)); + return new(instance); + } - public void LogInformation(string message, params object[] @params) => logger.LogInformation(message, @params); + private class MicrosoftExtensionsLoggerWrapper(ILogger logger) : Microsoft.Extensions.Logging.ILogger + { + public IDisposable? BeginScope(TState state) where TState : notnull + { + return NoOpDisposable.Instance; + } - public void LogStartContext(string message, params object[] @params) => logger.LogStartContext(message, @params); + public bool IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel) + { + return true; + } - public void LogWarning(string message, params object[] @params) => logger.LogWarning(message, @params); + public void Log(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, Exception? exception, Func formatter) + { + var message = formatter(state, exception); + var level = logLevel switch + { + Microsoft.Extensions.Logging.LogLevel.Trace => LogLevel.Trace, + Microsoft.Extensions.Logging.LogLevel.Debug => LogLevel.Debug, + Microsoft.Extensions.Logging.LogLevel.Information => LogLevel.Information, + Microsoft.Extensions.Logging.LogLevel.Warning => LogLevel.Warning, + Microsoft.Extensions.Logging.LogLevel.Error => LogLevel.Error, + Microsoft.Extensions.Logging.LogLevel.Critical => LogLevel.Critical, + Microsoft.Extensions.Logging.LogLevel.None => LogLevel.None, + _ => throw new NotImplementedException() + }; + + logger.Log(level, message); + } } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs index d473acb5ccc..c7ad99dc1b7 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs @@ -10,10 +10,8 @@ using System.Reflection; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Test.Common; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Razor; @@ -23,7 +21,6 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests; -[UseExportProvider] public class RazorToolingIntegrationTestBase : ToolingTestBase { internal const string ArbitraryWindowsPath = "x:\\dir\\subdir\\Test"; @@ -117,7 +114,7 @@ private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, if (LineEnding != null) { - b.Phases.Insert(0, new ForceLineEndingPhase(LineEnding)); + b.Features.Add(new SetNewLineOptionFeature(LineEnding)); } b.Features.Add(new DefaultTypeNameFeature()); @@ -430,20 +427,13 @@ public void Configure(RazorCodeGenerationOptionsBuilder options) } } - private class ForceLineEndingPhase : RazorEnginePhaseBase + private sealed class SetNewLineOptionFeature(string newLine) : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature { - public ForceLineEndingPhase(string lineEnding) - { - LineEnding = lineEnding; - } + public int Order { get; } - public string LineEnding { get; } - - protected override void ExecuteCore(RazorCodeDocument codeDocument) + public void Configure(RazorCodeGenerationOptionsBuilder options) { - var field = typeof(CodeRenderingContext).GetField("NewLineString", BindingFlags.Static | BindingFlags.NonPublic); - var key = field.GetValue(null); - codeDocument.Items[key] = LineEnding; + options.NewLine = newLine; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs index 64c89e2de7a..083441aba04 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs @@ -180,13 +180,13 @@ internal RazorSyntaxTree ParseDocument(string document, bool designTime = false, internal virtual RazorSyntaxTree ParseDocument(RazorLanguageVersion version, string document, IEnumerable directives, bool designTime = false, RazorParserFeatureFlags featureFlags = null, string fileKind = null) { - directives ??= Array.Empty(); + directives ??= []; var source = TestRazorSourceDocument.Create(document, filePath: null, relativePath: null, normalizeNewLines: true); var options = CreateParserOptions(version, directives, designTime, EnableSpanEditHandlers, featureFlags, fileKind); - var context = new ParserContext(source, options); + using var context = new ParserContext(source, options); var codeParser = new CSharpCodeParser(directives, context); var markupParser = new HtmlMarkupParser(context); @@ -195,11 +195,11 @@ internal virtual RazorSyntaxTree ParseDocument(RazorLanguageVersion version, str var root = markupParser.ParseDocument().CreateRed(); - var diagnostics = context.ErrorSink.Errors; + var diagnostics = context.ErrorSink.GetErrorsAndClear(); var codeDocument = RazorCodeDocument.Create(source); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, options); + var syntaxTree = new RazorSyntaxTree(root, source, diagnostics, options); codeDocument.SetSyntaxTree(syntaxTree); var defaultDirectivePass = new DefaultDirectiveSyntaxTreePass(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs index 2b20c842cf4..f095947c978 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; public sealed class CSharpTestLspServer : IAsyncDisposable { private readonly AdhocWorkspace _testWorkspace; - private readonly IRazorLanguageServerTarget _languageServer; + private readonly ExportProvider _exportProvider; private readonly JsonRpc _clientRpc; private readonly JsonRpc _serverRpc; @@ -41,6 +41,7 @@ private CSharpTestLspServer( CancellationToken cancellationToken) { _testWorkspace = testWorkspace; + _exportProvider = exportProvider; _cancellationToken = cancellationToken; var (clientStream, serverStream) = FullDuplexStream.CreatePair(); @@ -67,7 +68,7 @@ private CSharpTestLspServer( _clientRpc.StartListening(); - _languageServer = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializerOptions, testWorkspace, languageServerFactory, exportProvider, serverCapabilities); + _ = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializerOptions, testWorkspace, languageServerFactory, exportProvider, serverCapabilities); static SystemTextJsonFormatter CreateSystemTextJsonMessageFormatter(AbstractRazorLanguageServerFactoryWrapper languageServerFactory) { @@ -146,6 +147,7 @@ internal Task ExecuteRequestAsync( public async ValueTask DisposeAsync() { _testWorkspace.Dispose(); + _exportProvider.Dispose(); _clientRpc.Dispose(); _clientMessageFormatter.Dispose(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServerHelpers.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServerHelpers.cs index ecf351fe1e8..b91d512c39c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServerHelpers.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServerHelpers.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -14,9 +13,7 @@ using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.ExternalAccess.Razor; -using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; @@ -109,8 +106,7 @@ private static AdhocWorkspace CreateCSharpTestWorkspace( IRazorSpanMappingService razorSpanMappingService, bool multiTargetProject) { - var hostServices = MefHostServices.Create(exportProvider.AsCompositionContext()); - var workspace = TestWorkspace.Create(hostServices); + var workspace = TestWorkspace.CreateWithDiagnosticAnalyzers(exportProvider); // Add project and solution to workspace var projectInfoNet60 = ProjectInfo.Create( @@ -135,14 +131,10 @@ private static AdhocWorkspace CreateCSharpTestWorkspace( ? [projectInfoNet60, projectInfoNet80] : [projectInfoNet80]; - var solutionInfo = SolutionInfo.Create( - id: SolutionId.CreateNewId("TestSolution"), - version: VersionStamp.Default, - projects: projectInfos); - - workspace.AddSolution(solutionInfo); - - AddAnalyzersToWorkspace(workspace, exportProvider); + foreach (var projectInfo in projectInfos) + { + workspace.AddProject(projectInfo); + } // Add document to workspace. We use an IVT method to create the DocumentInfo variable because there's // a special constructor in Roslyn that will help identify the document as belonging to Razor. @@ -172,30 +164,6 @@ private static AdhocWorkspace CreateCSharpTestWorkspace( return workspace; } - private static void AddAnalyzersToWorkspace(Workspace workspace, ExportProvider exportProvider) - { - var analyzerLoader = RazorTestAnalyzerLoader.CreateAnalyzerAssemblyLoader(); - - var analyzerPaths = new DirectoryInfo(AppContext.BaseDirectory).GetFiles("*.dll") - .Where(f => f.Name.StartsWith("Microsoft.CodeAnalysis.", StringComparison.Ordinal) && !f.Name.Contains("LanguageServer") && !f.Name.Contains("Test.Utilities")) - .Select(f => f.FullName) - .ToImmutableArray(); - var references = new List(); - foreach (var analyzerPath in analyzerPaths) - { - if (File.Exists(analyzerPath)) - { - references.Add(new AnalyzerFileReference(analyzerPath, analyzerLoader)); - } - } - - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(references)); - - // Make sure Roslyn is producing diagnostics for our workspace - var razorTestAnalyzerLoader = exportProvider.GetExportedValue(); - razorTestAnalyzerLoader.InitializeDiagnosticsServices(workspace); - } - private record CSharpFile(Uri DocumentUri, SourceText CSharpSourceText); private class EmptyMappingService : IRazorSpanMappingService diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs index e7e0f6e87e2..95ab0722b98 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs @@ -58,7 +58,7 @@ private protected TestProjectSnapshotManager CreateProjectSnapshotManager( initializer: static updater => updater.ProjectAdded(MiscFilesHostProject.Instance)); private protected static RazorRequestContext CreateRazorRequestContext( - VersionedDocumentContext? documentContext, + DocumentContext? documentContext, ILspServices? lspServices = null) => new(documentContext, lspServices ?? StrictMock.Of(), "lsp/method", uri: null); @@ -108,9 +108,9 @@ private protected static IDocumentContextFactory CreateDocumentContextFactory(Ur return CreateDocumentContextFactory(documentPath, codeDocument); } - private protected static VersionedDocumentContext CreateDocumentContext(Uri documentPath, RazorCodeDocument codeDocument) + private protected static DocumentContext CreateDocumentContext(Uri documentPath, RazorCodeDocument codeDocument) { - return TestDocumentContext.From(documentPath.GetAbsoluteOrUNCPath(), codeDocument, hostDocumentVersion: 1337); + return TestDocumentContext.From(documentPath.GetAbsoluteOrUNCPath(), codeDocument); } private protected static IDocumentContextFactory CreateDocumentContextFactory( @@ -119,15 +119,15 @@ private protected static IDocumentContextFactory CreateDocumentContextFactory( bool documentFound = true) { var documentContextFactory = documentFound - ? new TestDocumentContextFactory(documentPath.GetAbsoluteOrUNCPath(), codeDocument, version: 1337) + ? new TestDocumentContextFactory(documentPath.GetAbsoluteOrUNCPath(), codeDocument) : new TestDocumentContextFactory(); return documentContextFactory; } - private protected static VersionedDocumentContext CreateDocumentContext(Uri uri, IDocumentSnapshot snapshot) + private protected static DocumentContext CreateDocumentContext(Uri uri, IDocumentSnapshot snapshot) { - return new VersionedDocumentContext(uri, snapshot, projectContext: null, version: 0); + return new DocumentContext(uri, snapshot, projectContext: null); } private protected static RazorLSPOptionsMonitor GetOptionsMonitor(bool enableFormatting = true, bool autoShowCompletion = true, bool autoListParams = true, bool formatOnType = true, bool autoInsertAttributeQuotes = true, bool colorBackground = false, bool codeBlockBraceOnNextLine = false, bool commitElementsWithSpace = true) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs index 27d2273b814..e6e60acffe2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs @@ -19,13 +19,13 @@ public static DocumentContext Create(Uri uri, string text) return new DocumentContext(uri, snapshot, projectContext: null); } - public static VersionedDocumentContext From(string filePath, RazorCodeDocument codeDocument, int hostDocumentVersion) + public static DocumentContext From(string filePath, RazorCodeDocument codeDocument, int hostDocumentVersion) { var content = codeDocument.Source.Text.ToString(); - var documentSnapshot = TestDocumentSnapshot.Create(filePath, content); + var documentSnapshot = TestDocumentSnapshot.Create(filePath, content, hostDocumentVersion); documentSnapshot.With(codeDocument); var uri = new Uri(filePath); - return new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, hostDocumentVersion); + return new DocumentContext(uri, documentSnapshot, projectContext: null); } public static DocumentContext From(string filePath, RazorCodeDocument codeDocument) @@ -45,7 +45,7 @@ public static DocumentContext From(string filePath) return From(filePath, codeDocument); } - public static VersionedDocumentContext From(string filePath, int hostDocumentVersion) + public static DocumentContext From(string filePath, int hostDocumentVersion) { var properties = RazorSourceDocumentProperties.Create(filePath, filePath); var sourceDocument = RazorSourceDocument.Create(content: string.Empty, properties); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs index 591df7ed021..7a0aa4ba27d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs @@ -13,23 +13,20 @@ internal class TestDocumentContextFactory : IDocumentContextFactory { private protected readonly string? FilePath; private protected readonly RazorCodeDocument? CodeDocument; - private readonly int? _version; public TestDocumentContextFactory() { } - public TestDocumentContextFactory(string filePath, RazorCodeDocument codeDocument, int? version = null) + public TestDocumentContextFactory(string filePath, RazorCodeDocument codeDocument) { FilePath = filePath; CodeDocument = codeDocument; - _version = version; } public virtual bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { if (FilePath is null || CodeDocument is null) @@ -38,18 +35,6 @@ public virtual bool TryCreate( return false; } - if (versioned) - { - if (_version is null) - { - context = null; - return false; - } - - context = TestDocumentContext.From(FilePath, CodeDocument, _version.Value); - return true; - } - context = TestDocumentContext.From(FilePath, CodeDocument); return true; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderCache.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderCache.cs index 2b2a62815a7..e8937fd4a96 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderCache.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderCache.cs @@ -2,14 +2,10 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Collections.Immutable; using System.Linq; using System.Reflection; -using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Composition; namespace Microsoft.AspNetCore.Razor.Test.Common.Mef; @@ -18,60 +14,6 @@ public static class ExportProviderCache { private static readonly PartDiscovery s_partDiscovery = CreatePartDiscovery(Resolver.DefaultInstance); - private static readonly TestComposition s_defaultHostExportProviderComposition = TestComposition.Empty - .AddAssemblies(MefHostServices.DefaultAssemblies); - private static readonly ConcurrentDictionary s_scopes = new(); - private const string DefaultScope = "default"; - - private static readonly object s_lock = new(); - - internal static bool Enabled { get; private set; } - - internal static ExportProvider[] ExportProvidersForCleanup - { - get - { - var scopes = s_scopes.Values.ToArray(); - var defaultScope = scopes.Where(scope => scope.Name == DefaultScope); - var allButDefault = scopes.Where(scope => scope.Name != DefaultScope); - - // Make sure to return the default scope as the last element - return allButDefault.Concat(defaultScope) - .Where(scope => scope._currentExportProvider is { }) - .Select(scope => scope._currentExportProvider!) - .ToArray(); - } - } - - internal static void SetEnabled_OnlyUseExportProviderAttributeCanCall(bool value) - { - lock (s_lock) - { - Enabled = value; - if (!Enabled) - { - foreach (var scope in s_scopes.Values.ToArray()) - { - scope.Clear(); - } - } - } - } - - /// - /// Use to create for default instances of . - /// - public static IExportProviderFactory GetOrCreateExportProviderFactory(IEnumerable assemblies) - { - if (assemblies is ImmutableArray assembliesArray && - assembliesArray == MefHostServices.DefaultAssemblies) - { - return s_defaultHostExportProviderComposition.ExportProviderFactory; - } - - return CreateExportProviderFactory(CreateAssemblyCatalog(assemblies), scopeName: DefaultScope); - } - public static ComposableCatalog CreateAssemblyCatalog(IEnumerable assemblies, Resolver? resolver = null) { var discovery = resolver is null ? s_partDiscovery : CreatePartDiscovery(resolver); @@ -125,151 +67,48 @@ bool IsExcludedPart(ComposablePartDefinition part) } } - public static IExportProviderFactory CreateExportProviderFactory(ComposableCatalog catalog, string? scopeName = null) + public static IExportProviderFactory CreateExportProviderFactory(ComposableCatalog catalog) { - var scope = s_scopes.GetOrAdd(scopeName ?? DefaultScope, scopeName => new Scope(scopeName)); var configuration = CompositionConfiguration.Create(catalog.WithCompositionService()); + ValidateConfiguration(configuration); + var runtimeComposition = RuntimeComposition.CreateRuntimeComposition(configuration); var exportProviderFactory = runtimeComposition.CreateExportProviderFactory(); - return new SingleExportProviderFactory(scope, catalog, configuration, exportProviderFactory); + return exportProviderFactory; } - private sealed class SingleExportProviderFactory : IExportProviderFactory + private static void ValidateConfiguration(CompositionConfiguration configuration) { - private readonly Scope _scope; - private readonly ComposableCatalog _catalog; - private readonly CompositionConfiguration _configuration; - private readonly IExportProviderFactory _exportProviderFactory; - - public SingleExportProviderFactory(Scope scope, ComposableCatalog catalog, CompositionConfiguration configuration, IExportProviderFactory exportProviderFactory) + foreach (var errorCollection in configuration.CompositionErrors) { - _scope = scope; - _catalog = catalog; - _configuration = configuration; - _exportProviderFactory = exportProviderFactory; - } - - private ExportProvider GetOrCreateExportProvider() - { - if (!Enabled) - { - // The [UseExportProvider] attribute on tests ensures that the pre- and post-conditions of methods - // in this type are met during test conditions. - throw new InvalidOperationException($"{nameof(ExportProviderCache)} may only be used from tests marked with {nameof(UseExportProviderAttribute)}"); - } - - var expectedCatalog = Interlocked.CompareExchange(ref _scope._expectedCatalog, _catalog, null) ?? _catalog; - RequireForSingleExportProvider(expectedCatalog == _catalog); - - var expected = _scope._expectedProviderForCatalog; - if (expected is null) + foreach (var error in errorCollection) { - foreach (var errorCollection in _configuration.CompositionErrors) + foreach (var part in error.Parts) { - foreach (var error in errorCollection) + foreach (var pair in part.SatisfyingExports) { - foreach (var part in error.Parts) + var (importBinding, exportBindings) = (pair.Key, pair.Value); + if (exportBindings.Count <= 1) { - foreach (var pair in part.SatisfyingExports) - { - var (importBinding, exportBindings) = (pair.Key, pair.Value); - if (exportBindings.Count <= 1) - { - // Ignore composition errors for missing parts - continue; - } + // Ignore composition errors for missing parts + continue; + } - if (importBinding.ImportDefinition.Cardinality != ImportCardinality.ZeroOrMore) - { - // This failure occurs when a binding fails because multiple exports were - // provided but only a single one (at most) is expected. This typically occurs - // when a test ExportProvider is created with a mock implementation without - // first removing a value provided by default. - throw new InvalidOperationException( - "Failed to construct the MEF catalog for testing. Multiple exports were found for a part for which only one export is expected:" + Environment.NewLine - + error.Message); - } - } + if (importBinding.ImportDefinition.Cardinality != ImportCardinality.ZeroOrMore) + { + // This failure occurs when a binding fails because multiple exports were + // provided but only a single one (at most) is expected. This typically occurs + // when a test ExportProvider is created with a mock implementation without + // first removing a value provided by default. + throw new InvalidOperationException( + "Failed to construct the MEF catalog for testing. Multiple exports were found for a part for which only one export is expected:" + Environment.NewLine + + error.Message); } } } - - expected = _exportProviderFactory.CreateExportProvider(); - expected = Interlocked.CompareExchange(ref _scope._expectedProviderForCatalog, expected, null) ?? expected; - Interlocked.CompareExchange(ref _scope._currentExportProvider, expected, null); - } - - var exportProvider = _scope._currentExportProvider; - RequireForSingleExportProvider(exportProvider == expected); - - return exportProvider!; - } - - ExportProvider IExportProviderFactory.CreateExportProvider() - { - // Currently this implementation deviates from the typical behavior of IExportProviderFactory. For the - // duration of a single test, an instance of SingleExportProviderFactory will continue returning the - // same ExportProvider instance each time this method is called. - // - // It may be clearer to refactor the implementation to only allow one call to CreateExportProvider in - // the context of a single test. https://github.com/dotnet/roslyn/issues/25863 - lock (s_lock) - { - return GetOrCreateExportProvider(); } } - - private void RequireForSingleExportProvider(bool condition) - { - if (!condition) - { - // The ExportProvider provides services that act as singleton instances in the context of an - // application (this include cases of multiple exports, where the 'singleton' is the list of all - // exports matching the contract). When reasoning about the behavior of test code, it is valuable to - // know service instances will be used in a consistent manner throughout the execution of a test, - // regardless of whether they are passed as arguments or obtained through requests to the - // ExportProvider. - // - // Restricting a test to a single ExportProvider guarantees that objects that *look* like singletons - // will *behave* like singletons for the duration of the test. Each test is expected to create and - // use its ExportProvider in a consistent manner. - // - // A test that validates remote services is allowed to create a couple of ExportProviders: - // one for local workspace and the other for the remote one. - // - // When this exception is thrown by a test, it typically means one of the following occurred: - // - // * A test failed to pass an ExportProvider via an optional argument to a method, resulting in the - // method attempting to create a default ExportProvider which did not match the one assigned to - // the test. - // * A test attempted to perform multiple test sequences in the context of a single test method, - // rather than break up the test into distinct tests for each case. - // * A test referenced different predefined ExportProvider instances within the context of a test. - // Each test is expected to use the same ExportProvider throughout the test. - throw new InvalidOperationException($"Only one {_scope.Name} {nameof(ExportProvider)} can be created in the context of a single test."); - } - } - } - - private sealed class Scope - { - public readonly string Name; - public ExportProvider? _currentExportProvider; - public ComposableCatalog? _expectedCatalog; - public ExportProvider? _expectedProviderForCatalog; - - public Scope(string name) - { - Name = name; - } - - public void Clear() - { - _currentExportProvider = null; - _expectedCatalog = null; - _expectedProviderForCatalog = null; - } } private sealed class SimpleAssemblyLoader : IAssemblyLoader diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderExtensions.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderExtensions.cs index 05540f3862b..18d5c5dd654 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderExtensions.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/ExportProviderExtensions.cs @@ -3,12 +3,12 @@ using System; using System.Collections.Generic; -using System.Composition.Hosting.Core; using System.Composition; +using System.Composition.Hosting.Core; using System.Diagnostics.CodeAnalysis; using System.Linq; -using Microsoft.VisualStudio.Composition; using System.Reflection; +using Microsoft.VisualStudio.Composition; namespace Microsoft.AspNetCore.Razor.Test.Common.Mef; @@ -31,43 +31,55 @@ public CompositionContextShim(ExportProvider exportProvider) public override bool TryGetExport(CompositionContract contract, [NotNullWhen(true)] out object? export) { var importMany = contract.MetadataConstraints.Contains(new KeyValuePair("IsImportMany", true)); - var (contractType, metadataType) = GetContractType(contract.ContractType, importMany); + var (contractType, metadataType, isLazy) = GetContractType(contract.ContractType, importMany); - if (metadataType != null) + var method = (metadataType, isLazy) switch { - var methodInfo = (from method in _exportProvider.GetType().GetTypeInfo().GetMethods() - where method.Name == nameof(ExportProvider.GetExports) - where method.IsGenericMethod && method.GetGenericArguments().Length == 2 - where method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType == typeof(string) - select method).Single(); - var parameterizedMethod = methodInfo.MakeGenericMethod(contractType, metadataType); - export = parameterizedMethod.Invoke(_exportProvider, new[] { contract.ContractName }); - Assumes.NotNull(export); + (not null, true) => GetExportProviderGenericMethod(nameof(ExportProvider.GetExports), contractType, metadataType), + (null, true) => GetExportProviderGenericMethod(nameof(ExportProvider.GetExports), contractType), + (null, false) => GetExportProviderGenericMethod(nameof(ExportProvider.GetExportedValues), contractType), + _ => null + }; + + if (method is null) + { + export = null; + return false; } - else + + export = method.Invoke(_exportProvider, [contract.ContractName]); + Assumes.NotNull(export); + + return true; + + static MethodInfo GetExportProviderGenericMethod(string methodName, params Type[] typeArguments) { - var methodInfo = (from method in _exportProvider.GetType().GetTypeInfo().GetMethods() - where method.Name == nameof(ExportProvider.GetExports) - where method.IsGenericMethod && method.GetGenericArguments().Length == 1 + var methodInfo = (from method in typeof(ExportProvider).GetTypeInfo().GetMethods() + where method.Name == methodName + where method.IsGenericMethod && method.GetGenericArguments().Length == typeArguments.Length where method.GetParameters().Length == 1 && method.GetParameters()[0].ParameterType == typeof(string) select method).Single(); - var parameterizedMethod = methodInfo.MakeGenericMethod(contractType); - export = parameterizedMethod.Invoke(_exportProvider, new[] { contract.ContractName }); - Assumes.NotNull(export); - } - return true; + return methodInfo.MakeGenericMethod(typeArguments); + } } - private static (Type exportType, Type? metadataType) GetContractType(Type contractType, bool importMany) + private static (Type exportType, Type? metadataType, bool isLazy) GetContractType(Type contractType, bool importMany) { - if (importMany && contractType.IsConstructedGenericType) + if (importMany) { - if (contractType.GetGenericTypeDefinition() == typeof(IList<>) - || contractType.GetGenericTypeDefinition() == typeof(ICollection<>) - || contractType.GetGenericTypeDefinition() == typeof(IEnumerable<>)) + if (contractType.IsConstructedGenericType) + { + if (contractType.GetGenericTypeDefinition() == typeof(IList<>) + || contractType.GetGenericTypeDefinition() == typeof(ICollection<>) + || contractType.GetGenericTypeDefinition() == typeof(IEnumerable<>)) + { + contractType = contractType.GenericTypeArguments[0]; + } + } + else if (contractType.IsArray) { - contractType = contractType.GenericTypeArguments[0]; + contractType = contractType.GetElementType().AssumeNotNull(); } } @@ -75,11 +87,11 @@ private static (Type exportType, Type? metadataType) GetContractType(Type contra { if (contractType.GetGenericTypeDefinition() == typeof(Lazy<>)) { - return (contractType.GenericTypeArguments[0], null); + return (contractType.GenericTypeArguments[0], null, true); } else if (contractType.GetGenericTypeDefinition() == typeof(Lazy<,>)) { - return (contractType.GenericTypeArguments[0], contractType.GenericTypeArguments[1]); + return (contractType.GenericTypeArguments[0], contractType.GenericTypeArguments[1], true); } else { @@ -87,7 +99,7 @@ private static (Type exportType, Type? metadataType) GetContractType(Type contra } } - throw new NotSupportedException(); + return (contractType, null, false); } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs index 4144af3544b..d73f291ca9c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs @@ -22,8 +22,7 @@ public sealed partial class TestComposition public static readonly TestComposition Empty = new( ImmutableHashSet.Empty, ImmutableHashSet.Empty, - ImmutableHashSet.Empty, - scope: null); + ImmutableHashSet.Empty); public static readonly TestComposition Roslyn = Empty .AddAssemblies(MefHostServices.DefaultAssemblies) @@ -102,32 +101,17 @@ public override int GetHashCode() /// public readonly ImmutableHashSet Parts; - /// - /// The scope in which to create the export provider, or to use the default scope. - /// - public readonly string? Scope; - private readonly Lazy _exportProviderFactory; - private TestComposition(ImmutableHashSet assemblies, ImmutableHashSet parts, ImmutableHashSet excludedPartTypes, string? scope) + private TestComposition(ImmutableHashSet assemblies, ImmutableHashSet parts, ImmutableHashSet excludedPartTypes) { Assemblies = assemblies; Parts = parts; ExcludedPartTypes = excludedPartTypes; - Scope = scope; _exportProviderFactory = new Lazy(GetOrCreateFactory); } -#if false -/// -/// Returns a new instance of for the composition. This will either be a MEF composition or VS MEF composition host, -/// depending on what layer the composition is for. Editor Features and VS layers use VS MEF composition while anything else uses System.Composition. -/// -public HostServices GetHostServices() - => VisualStudioMefHostServices.Create(ExportProviderFactory.CreateExportProvider()); -#endif - /// /// VS MEF . /// @@ -145,7 +129,7 @@ private IExportProviderFactory GetOrCreateFactory() } } - var newFactory = ExportProviderCache.CreateExportProviderFactory(GetCatalog(), Scope); + var newFactory = ExportProviderCache.CreateExportProviderFactory(GetCatalog()); lock (s_factoryCache) { @@ -215,7 +199,7 @@ public TestComposition WithAssemblies(ImmutableHashSet assemblies) var testAssembly = assemblies.FirstOrDefault(IsTestAssembly); Verify.Operation(testAssembly is null, $"Test assemblies are not allowed in test composition: {testAssembly}. Specify explicit test parts instead."); - return new TestComposition(assemblies, Parts, ExcludedPartTypes, Scope); + return new TestComposition(assemblies, Parts, ExcludedPartTypes); static bool IsTestAssembly(Assembly assembly) { @@ -230,13 +214,10 @@ static bool IsTestAssembly(Assembly assembly) } public TestComposition WithParts(ImmutableHashSet parts) - => parts == Parts ? this : new TestComposition(Assemblies, parts, ExcludedPartTypes, Scope); + => parts == Parts ? this : new TestComposition(Assemblies, parts, ExcludedPartTypes); public TestComposition WithExcludedPartTypes(ImmutableHashSet excludedPartTypes) - => excludedPartTypes == ExcludedPartTypes ? this : new TestComposition(Assemblies, Parts, excludedPartTypes, Scope); - - public TestComposition WithScope(string? scope) - => scope == Scope ? this : new TestComposition(Assemblies, Parts, ExcludedPartTypes, scope); + => excludedPartTypes == ExcludedPartTypes ? this : new TestComposition(Assemblies, Parts, excludedPartTypes); /// /// Use for VS MEF composition troubleshooting. diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/UseExportProviderAttribute.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/UseExportProviderAttribute.cs deleted file mode 100644 index 8f2d7ba28f3..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/UseExportProviderAttribute.cs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Composition; -using Xunit.Sdk; - -namespace Microsoft.AspNetCore.Razor.Test.Common.Mef; - -/// -/// This attribute supports tests that need to use a MEF container () directly or -/// indirectly during the test sequence. It ensures production code uniformly handles the export provider created -/// during a test, and cleans up the state before the test completes. -/// -/// -/// This attribute serves several important functions for tests that use state variables which are otherwise -/// shared at runtime: -/// -/// Ensures implementations all use the same , which is -/// the one created by the test. -/// Clears static cached values in production code holding instances of , or any -/// object obtained from it or one of its related interfaces such as . -/// Isolates tests by waiting for asynchronous operations to complete before a test is considered -/// complete. -/// When required, provides a separate for the -/// executing in the test process. If this provider is created during testing, it is cleaned up with the primary -/// export provider during test teardown. -/// -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] -public class UseExportProviderAttribute : BeforeAfterTestAttribute -{ - /// - /// Asynchronous operations are expected to be cancelled at the end of the test that started them. Operations - /// cancelled by the test are cleaned up immediately. The remaining operations are given an opportunity to run - /// to completion. If this timeout is exceeded by the asynchronous operations running after a test completes, - /// the test is failed. - /// - private static readonly TimeSpan s_cleanupTimeout = TimeSpan.FromMinutes(1); - -#if false -private MefHostServices? _hostServices; -#endif - - public override void Before(MethodInfo? methodUnderTest) - { -#if false - MefHostServices.TestAccessor.HookServiceCreation(CreateMefHostServices); - - // make sure we enable this for all unit tests - AsynchronousOperationListenerProvider.Enable(enable: true, diagnostics: true); -#endif - - ExportProviderCache.SetEnabled_OnlyUseExportProviderAttributeCanCall(true); - } - - /// - /// To the extent reasonably possible, this method resets the state of the test environment to the same state as - /// it started, ensuring that tests running in sequence cannot influence the outcome of later tests. - /// - /// - /// The test cleanup runs in two primary steps: - /// - /// Waiting for asynchronous operations started by the test to complete. - /// Disposing of mutable resources created by the test. - /// Clearing static state variables related to the use of MEF during a test. - /// - /// - public override void After(MethodInfo? methodUnderTest) - { - try - { - foreach (var exportProvider in ExportProviderCache.ExportProvidersForCleanup) - { - DisposeExportProvider(exportProvider); - } - } - finally - { -#if false - // Replace hooks with ones that always throw exceptions. These hooks detect cases where code executing - // after the end of a test attempts to create an ExportProvider. - MefHostServices.TestAccessor.HookServiceCreation(DenyMefHostServicesCreationBetweenTests); -#endif - - // Reset static state variables. -#if false - _hostServices = null; -#endif - ExportProviderCache.SetEnabled_OnlyUseExportProviderAttributeCanCall(false); - } - } - - private static void DisposeExportProvider(ExportProvider? exportProvider) - { - if (exportProvider is null) - { - return; - } - - // Dispose of the export provider, including calling Dispose for any IDisposable services created during the test. - using var _ = exportProvider; - -#if false - if (exportProvider.GetExportedValues().SingleOrDefault() is { } listenerProvider) - { - if (exportProvider.GetExportedValues().SingleOrDefault()?.HasMainThread ?? false) - { - // Immediately clear items from the foreground notification service for which cancellation is - // requested. This service maintains a queue separately from Tasks, and work items scheduled for - // execution after a delay are not immediately purged when cancellation is requested. This code - // instructs the service to walk the list of queued work items and immediately cancel and purge any - // which are already cancelled. - var foregroundNotificationService = exportProvider.GetExportedValues().SingleOrDefault() as ForegroundNotificationService; - foregroundNotificationService?.ReleaseCancelledItems(); - } - - // Verify the synchronization context was not used incorrectly - var testExportJoinableTaskContext = exportProvider.GetExportedValues().SingleOrDefault(); - var denyExecutionSynchronizationContext = testExportJoinableTaskContext?.SynchronizationContext as TestExportJoinableTaskContext.DenyExecutionSynchronizationContext; - - // Join remaining operations with a timeout - using (var timeoutTokenSource = new CancellationTokenSource(s_cleanupTimeout)) - { - if (denyExecutionSynchronizationContext is object) - { - // Immediately cancel the test if the synchronization context is improperly used - denyExecutionSynchronizationContext.InvalidSwitch += delegate { timeoutTokenSource.CancelAfter(0); }; - denyExecutionSynchronizationContext.ThrowIfSwitchOccurred(); - } - - try - { - // This attribute cleans up the in-process and out-of-process export providers separately, so we - // don't need to provide a workspace when waiting for operations to complete. - var waiter = ((AsynchronousOperationListenerProvider)listenerProvider).WaitAllDispatcherOperationAndTasksAsync(workspace: null); - waiter.JoinUsingDispatcher(timeoutTokenSource.Token); - } - catch (OperationCanceledException ex) when (timeoutTokenSource.IsCancellationRequested) - { - // If the failure was caused by an invalid thread change, throw that exception - denyExecutionSynchronizationContext?.ThrowIfSwitchOccurred(); - - var messageBuilder = new StringBuilder("Failed to clean up listeners in a timely manner."); - foreach (var token in ((AsynchronousOperationListenerProvider)listenerProvider).GetTokens()) - { - messageBuilder.AppendLine().Append($" {token}"); - } - - throw new TimeoutException(messageBuilder.ToString(), ex); - } - } - - denyExecutionSynchronizationContext?.ThrowIfSwitchOccurred(); - - foreach (var testErrorHandler in exportProvider.GetExportedValues()) - { - var exceptions = testErrorHandler.Exceptions; - if (exceptions.Count > 0) - { - throw new AggregateException("Tests threw unexpected exceptions", exceptions); - } - } - } -#endif - } - -#if false -private MefHostServices CreateMefHostServices(IEnumerable assemblies) -{ - ExportProvider exportProvider; - - if (assemblies is ImmutableArray array && - array == MefHostServices.DefaultAssemblies && - ExportProviderCache.LocalExportProviderForCleanup != null) - { - if (_hostServices != null) - { - return _hostServices; - } - - exportProvider = ExportProviderCache.LocalExportProviderForCleanup; - } - else - { - exportProvider = ExportProviderCache.GetOrCreateExportProviderFactory(assemblies).CreateExportProvider(); - } - - Interlocked.CompareExchange( - ref _hostServices, - new ExportProviderMefHostServices(exportProvider), - null); - - return _hostServices; -} - -private static MefHostServices DenyMefHostServicesCreationBetweenTests(IEnumerable assemblies) -{ - // If you hit this, one of three situations occurred: - // - // 1. A test method that uses ExportProvider is not marked with UseExportProviderAttribute (can also be - // applied to the containing type or a base type. - // 2. A test attempted to create an ExportProvider during the test cleanup operations after the - // ExportProvider was already disposed. - // 3. A test attempted to use an ExportProvider in the constructor of the test, or during the initialization - // of a field in the test class. - throw new InvalidOperationException("Cannot create host services after test tear down."); -} - -private class ExportProviderMefHostServices : MefHostServices, IMefHostExportProvider -{ - private readonly VisualStudioMefHostServices _vsHostServices; - - public ExportProviderMefHostServices(ExportProvider exportProvider) - : base(new ContainerConfiguration().CreateContainer()) - { - _vsHostServices = VisualStudioMefHostServices.Create(exportProvider); - } - - protected internal override HostWorkspaceServices CreateWorkspaceServices(Workspace workspace) - => _vsHostServices.CreateWorkspaceServices(workspace); - - IEnumerable> IMefHostExportProvider.GetExports() - => _vsHostServices.GetExports(); - - IEnumerable> IMefHostExportProvider.GetExports() - => _vsHostServices.GetExports(); -} -#endif -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj index 6caeb6b2982..6683bf95cdb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj @@ -35,6 +35,19 @@ + + + + + + + + + + + + + @@ -76,10 +89,6 @@ - - - - diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs index 707786555aa..645bec36bae 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs @@ -20,16 +20,16 @@ internal class TestDocumentSnapshot : DocumentSnapshot public static TestDocumentSnapshot Create(string filePath) => Create(filePath, string.Empty); - public static TestDocumentSnapshot Create(string filePath, VersionStamp version) - => Create(filePath, string.Empty, version); + public static TestDocumentSnapshot Create(string filePath, VersionStamp textVersion) + => Create(filePath, string.Empty, textVersion); - public static TestDocumentSnapshot Create(string filePath, string text) - => Create(filePath, text, VersionStamp.Default); + public static TestDocumentSnapshot Create(string filePath, string text, int version = 0) + => Create(filePath, text, VersionStamp.Default, version: version); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, ProjectWorkspaceState? projectWorkspaceState = null) - => Create(filePath, text, version, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState)); + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp textVersion, ProjectWorkspaceState? projectWorkspaceState = null, int version = 0) + => Create(filePath, text, textVersion, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState), version); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, TestProjectSnapshot projectSnapshot) + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp textVersion, TestProjectSnapshot projectSnapshot, int version) { var targetPath = Path.GetDirectoryName(projectSnapshot.FilePath) is string projectDirectory && filePath.StartsWith(projectDirectory) ? filePath[projectDirectory.Length..] @@ -40,8 +40,9 @@ public static TestDocumentSnapshot Create(string filePath, string text, VersionS var documentState = new DocumentState( hostDocument, SourceText.From(text), + textVersion, version, - () => Task.FromResult(TextAndVersion.Create(sourceText, version))); + () => Task.FromResult(TextAndVersion.Create(sourceText, textVersion))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); return testDocument; @@ -64,6 +65,7 @@ internal static TestDocumentSnapshot Create(ProjectSnapshot projectSnapshot, str hostDocument, SourceText.From(text), version, + version: 1, () => Task.FromResult(TextAndVersion.Create(sourceText, version.Value))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); @@ -77,7 +79,7 @@ public TestDocumentSnapshot(ProjectSnapshot projectSnapshot, DocumentState docum public HostDocument HostDocument => State.HostDocument; - public override Task GetGeneratedOutputAsync() + public override Task GetGeneratedOutputAsync(bool _) { if (_codeDocument is null) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs new file mode 100644 index 00000000000..9374bd108ab --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs @@ -0,0 +1,61 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Linq; +using Microsoft.CodeAnalysis.Testing; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.AspNetCore.Razor.Test.Common; + +internal readonly struct TestCode +{ + public string OriginalInput { get; } + public string Text { get; } + public ImmutableArray Positions { get; } + + private readonly ImmutableDictionary> _nameToSpanMap; + + public TestCode(string input, bool treatPositionIndicatorsAsCode = false) + { + OriginalInput = input; + + if (treatPositionIndicatorsAsCode) + { + TestFileMarkupParser.GetSpans(input, treatPositionIndicatorsAsCode, out var text, out var nameToSpanMap); + + Text = text; + Positions = []; + _nameToSpanMap = nameToSpanMap; + } + else + { + TestFileMarkupParser.GetPositionsAndSpans(input, out var text, out var positions, out var spans); + + Text = text; + Positions = positions; + _nameToSpanMap = spans; + } + } + + public int Position + => Positions.Single(); + + public TextSpan Span + => Spans.Single(); + + public ImmutableArray Spans + => GetNamedSpans(string.Empty); + + public ImmutableDictionary> NamedSpans + => _nameToSpanMap; + + public ImmutableArray GetNamedSpans(string name) + => _nameToSpanMap[name]; + + public bool TryGetNamedSpans(string name, out ImmutableArray spans) + => _nameToSpanMap.TryGetValue(name, out spans); + + public static implicit operator TestCode(string input) + => new(input); +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestMocks.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestMocks.cs index 1e0a3dbd2e7..c8f8e987ec4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestMocks.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestMocks.cs @@ -1,10 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Text; using Moq; +using Moq.Language.Flow; namespace Microsoft.AspNetCore.Razor.Test.Common; @@ -26,4 +30,58 @@ public static TextLoader CreateTextLoader(string filePath, SourceText text) return mock.Object; } + + public interface IClientConnectionBuilder + { + void SetupSendRequest(string method, TResponse response, bool verifiable = false); + void SetupSendRequest(string method, TParams @params, TResponse response, bool verifiable = false); + } + + private sealed class ClientConnectionBuilder : IClientConnectionBuilder + { + public StrictMock Mock { get; } = new(); + + public void SetupSendRequest(string method, TResponse response, bool verifiable = false) + { + var returnsResult = Mock + .Setup(x => x.SendRequestAsync(method, It.IsAny(), It.IsAny())) + .ReturnsAsync(response); + + if (verifiable) + { + returnsResult.Verifiable(); + } + } + + public void SetupSendRequest(string method, TParams @params, TResponse response, bool verifiable = false) + { + var returnsResult = Mock + .Setup(x => x.SendRequestAsync(method, @params, It.IsAny())) + .ReturnsAsync(response); + + if (verifiable) + { + returnsResult.Verifiable(); + } + } + } + + public static IClientConnection CreateClientConnection(Action configure) + { + var builder = new ClientConnectionBuilder(); + configure?.Invoke(builder); + return builder.Mock.Object; + } + + public static void VerifySendRequest(this Mock mock, string method, Times times) + => mock.Verify(x => x.SendRequestAsync(method, It.IsAny(), It.IsAny()), times); + + public static void VerifySendRequest(this Mock mock, string method, Func times) + => mock.Verify(x => x.SendRequestAsync(method, It.IsAny(), It.IsAny()), times); + + public static void VerifySendRequest(this Mock mock, string method, TParams @params, Times times) + => mock.Verify(x => x.SendRequestAsync(method, @params, It.IsAny()), times); + + public static void VerifySendRequest(this Mock mock, string method, TParams @params, Func times) + => mock.Verify(x => x.SendRequestAsync(method, @params, It.IsAny()), times); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs index 8d8c9786f81..6e4babb9bc2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs @@ -7,7 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.Workspaces; internal class TestLanguageServerFeatureOptions( bool includeProjectKeyInGeneratedFilePath = false, - bool forceRuntimeCodeGeneration = false) : LanguageServerFeatureOptions + bool forceRuntimeCodeGeneration = false, + bool updateBuffersForClosedDocuments = false) : LanguageServerFeatureOptions { public static readonly LanguageServerFeatureOptions Instance = new TestLanguageServerFeatureOptions(); @@ -27,7 +28,7 @@ internal class TestLanguageServerFeatureOptions( public override bool UsePreciseSemanticTokenRanges => true; - public override bool UpdateBuffersForClosedDocuments => false; + public override bool UpdateBuffersForClosedDocuments => updateBuffersForClosedDocuments; public override bool IncludeProjectKeyInGeneratedFilePath => includeProjectKeyInGeneratedFilePath; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestWorkspace.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestWorkspace.cs index cae18632e56..57042c42c99 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestWorkspace.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestWorkspace.cs @@ -2,8 +2,17 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Linq; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.VisualStudio.Composition; namespace Microsoft.AspNetCore.Razor.Test.Common.Workspaces; @@ -14,6 +23,17 @@ public static class TestWorkspace public static Workspace Create(Action? configure = null) => Create(services: null, configure: configure); + public static AdhocWorkspace CreateWithDiagnosticAnalyzers(ExportProvider exportProvider) + { + var hostServices = MefHostServices.Create(exportProvider.AsCompositionContext()); + + var workspace = Create(hostServices); + + AddAnalyzersToWorkspace(workspace, exportProvider); + + return workspace; + } + public static AdhocWorkspace Create(HostServices? services, Action? configure = null) { lock (s_workspaceLock) @@ -27,4 +47,24 @@ public static AdhocWorkspace Create(HostServices? services, Action f.Name.StartsWith("Microsoft.CodeAnalysis.", StringComparison.Ordinal) && !f.Name.Contains("LanguageServer") && !f.Name.Contains("Test.Utilities")) + .Select(f => f.FullName) + .ToImmutableArray(); + var references = new List(); + foreach (var analyzerPath in analyzerPaths) + { + if (File.Exists(analyzerPath)) + { + references.Add(new AnalyzerFileReference(analyzerPath, analyzerLoader)); + } + } + + workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences(references)); + } } diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Extensions/RazorCodeDocumentExtensionsTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Extensions/RazorCodeDocumentExtensionsTest.cs new file mode 100644 index 00000000000..64b1d1c9da1 --- /dev/null +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Extensions/RazorCodeDocumentExtensionsTest.cs @@ -0,0 +1,340 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Xunit; +using Xunit.Abstractions; +using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; + +namespace Microsoft.CodeAnalysis.Razor.Workspaces.Test.Extensions; + +public class RazorCodeDocumentExtensionsTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) +{ + [Fact] + public void GetLanguageKind_TagHelperElementOwnsName() + { + // Arrange + var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); + descriptor.TagMatchingRule(rule => rule.TagName = "test"); + descriptor.SetMetadata(TypeName("TestTagHelper")); + + TestCode code = """ + @addTagHelper *, TestAssembly + @Name + """; + + var codeDocument = CreateCodeDocument(code, descriptor.Build()); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_TagHelpersDoNotOwnTrailingEdge() + { + // Arrange + var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); + descriptor.TagMatchingRule(rule => rule.TagName = "test"); + descriptor.SetMetadata(TypeName("TestTagHelper")); + + TestCode code = """ + @addTagHelper *, TestAssembly + $$@DateTime.Now + """; + + var codeDocument = CreateCodeDocument(code, descriptor.Build()); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Razor, languageKind); + } + + [Fact] + public void GetLanguageKind_TagHelperNestedCSharpAttribute() + { + // Arrange + var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); + descriptor.TagMatchingRule(rule => rule.TagName = "test"); + descriptor.BindAttribute(builder => + { + builder.Name = "asp-int"; + builder.TypeName = typeof(int).FullName; + builder.SetMetadata(PropertyName("AspInt")); + }); + descriptor.SetMetadata(TypeName("TestTagHelper")); + + TestCode code = """ + @addTagHelper *, TestAssembly + + """; + + var codeDocument = CreateCodeDocument(code, descriptor.Build()); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_CSharp() + { + // Arrange + TestCode code = "

@N$$ame

"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_Html() + { + // Arrange + TestCode code = "

He$$llo World

"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_DefaultsToRazorLanguageIfCannotLocateOwner() + { + // Arrange + TestCode code = "

Hello World

$$"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position + 1, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Razor, languageKind); + } + + [Fact] + public void GetLanguageKind_GetsLastClassifiedSpanLanguageIfAtEndOfDocument() + { + // Arrange + TestCode code = """ + Something + $$ + """; + + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_HtmlEdgeEnd() + { + // Arrange + TestCode code = "Hello World$$"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_CSharpEdgeEnd() + { + // Arrange + TestCode code = "@Name$$"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_RazorEdgeWithCSharp() + { + // Arrange + TestCode code = "@{$$}"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_CSharpEdgeWithCSharpMarker() + { + // Arrange + TestCode code = "@{var x = 1;$$}"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_ExplicitExpressionStartCSharp() + { + // Arrange + TestCode code = "@($$)"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_ExplicitExpressionInProgressCSharp() + { + // Arrange + TestCode code = "@(Da$$)"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_ImplicitExpressionStartCSharp() + { + // Arrange + TestCode code = "@$$"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_ImplicitExpressionInProgressCSharp() + { + // Arrange + TestCode code = "@Da$$"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_RazorEdgeWithHtml() + { + // Arrange + TestCode code = "@{$$
}"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_HtmlInCSharpLeftAssociative() + { + // Arrange + TestCode code = "@if (true) { $$
}"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: false); + + // Assert + Assert.Equal(RazorLanguageKind.CSharp, languageKind); + } + + [Fact] + public void GetLanguageKind_HtmlInCSharpRightAssociative() + { + // Arrange + TestCode code = "@if (true) { $$
}"; + var codeDocument = CreateCodeDocument(code); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: true); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + [Fact] + public void GetLanguageKind_TagHelperInCSharpRightAssociative() + { + // Arrange + var descriptor = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly"); + descriptor.TagMatchingRule(rule => rule.TagName = "test"); + descriptor.SetMetadata(TypeName("TestTagHelper")); + + TestCode code = """ + @addTagHelper *, TestAssembly + @if { + $$@Name + } + """; + + var codeDocument = CreateCodeDocument(code, descriptor.Build()); + + // Act + var languageKind = codeDocument.GetLanguageKind(code.Position, rightAssociative: true); + + // Assert + Assert.Equal(RazorLanguageKind.Html, languageKind); + } + + private static RazorCodeDocument CreateCodeDocument(TestCode code, params ImmutableArray tagHelpers) + { + tagHelpers = tagHelpers.NullToEmpty(); + + var sourceDocument = TestRazorSourceDocument.Create(code.Text); + var projectEngine = RazorProjectEngine.Create(builder => { }); + + return projectEngine.ProcessDesignTime(sourceDocument, "mvc", importSources: default, tagHelpers); + } +} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs new file mode 100644 index 00000000000..3f2b2066886 --- /dev/null +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs @@ -0,0 +1,71 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Test.Common; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +public class AddUsingsHelperTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) +{ + [Fact] + public void TryExtractNamespace_Invalid_ReturnsFalse() + { + // Arrange + var csharpAddUsing = "Abc.Xyz;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.False(res); + Assert.Empty(@namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "using Abc.Xyz;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("Abc.Xyz", @namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_WithStatic_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "using static X.Y.Z;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("static X.Y.Z", @namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_WithTypeNameCorrection_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "Goo - using X.Y.Z;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("X.Y.Z", @namespace); + Assert.Equal("Goo - ", prefix); + } +} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj index e8a6418c986..232456c3724 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs index 4c8734c90c7..b661352b3e0 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs @@ -61,43 +61,6 @@ public void ProjectSnapshot_CachesDocumentSnapshots() d => Assert.Same(d.Value, snapshot.GetDocument(d.Key))); } - [Fact] - public void IsImportDocument_NonImportDocument_ReturnsFalse() - { - // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) - .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader); - var snapshot = new ProjectSnapshot(state); - - var document = snapshot.GetDocument(_documents[0].FilePath); - Assert.NotNull(document); - - // Act - var result = snapshot.IsImportDocument(document); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsImportDocument_ImportDocument_ReturnsTrue() - { - // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) - .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader) - .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); - var snapshot = new ProjectSnapshot(state); - - var document = snapshot.GetDocument(TestProjectData.SomeProjectImportFile.FilePath); - Assert.NotNull(document); - - // Act - var result = snapshot.IsImportDocument(document); - - // Assert - Assert.True(result); - } - [Fact] public void GetRelatedDocuments_NonImportDocument_ReturnsEmpty() { diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs index 77fd4a8f7b2..5f5c1a8e422 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs @@ -1000,8 +1000,6 @@ public static TestDocumentState Create( { return new TestDocumentState( hostDocument, - null, - null, loader, onTextChange, onTextLoaderChange, @@ -1018,15 +1016,13 @@ public static TestDocumentState Create( private TestDocumentState( HostDocument hostDocument, - SourceText? text, - VersionStamp? version, Func>? loader, Action? onTextChange, Action? onTextLoaderChange, Action? onConfigurationChange, Action? onImportsChange, Action? onProjectWorkspaceStateChange) - : base(hostDocument, text, version, loader) + : base(hostDocument, text: null, textVersion: null, version: 1, loader) { _onTextChange = onTextChange; _onTextLoaderChange = onTextLoaderChange; @@ -1035,10 +1031,10 @@ private TestDocumentState( _onProjectWorkspaceStateChange = onProjectWorkspaceStateChange; } - public override DocumentState WithText(SourceText sourceText, VersionStamp version) + public override DocumentState WithText(SourceText sourceText, VersionStamp textVersion) { _onTextChange?.Invoke(); - return base.WithText(sourceText, version); + return base.WithText(sourceText, textVersion); } public override DocumentState WithTextLoader(Func> loader) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs new file mode 100644 index 00000000000..7370b711fc1 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs @@ -0,0 +1,144 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[Collection(HtmlFormattingCollection.Name)] +public class CohostDocumentFormattingEndpointTest(HtmlFormattingFixture htmlFormattingFixture, ITestOutputHelper testOutputHelper) + : CohostEndpointTestBase(testOutputHelper) +{ + // All of the formatting tests in the language server exercise the formatting engine and cover various edge cases + // and provide regression prevention. The tests here are not exhaustive, but they validate the the cohost endpoints + // call into the formatting engine at least, and handles C#, Html and Razor formatting changes correctly. + + [Fact] + public Task Formatting() + => VerifyDocumentFormattingAsync( + input: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + + """, + expected: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + + """); + + private async Task VerifyDocumentFormattingAsync(string input, string expected) + { + var document = await CreateProjectAndRazorDocumentAsync(input); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await htmlFormattingFixture.Service.GetDocumentFormattingEditsAsync(LoggerFactory, uri, generatedHtml, insertSpaces: true, tabSize: 4); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentFormattingName, htmlEdits)]); + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostDocumentFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + } + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentHighlightEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentHighlightEndpointTest.cs index ce044474c00..65de7ed10a9 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentHighlightEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentHighlightEndpointTest.cs @@ -147,7 +147,7 @@ @inject [|IDis$$posable|] Disposable private async Task VerifyDocumentHighlightsAsync(string input, DocumentHighlight[]? htmlResponse = null) { TestFileMarkupParser.GetPositionAndSpans(input, out var source, out int cursorPosition, out ImmutableArray spans); - var document = CreateProjectAndRazorDocument(source); + var document = await CreateProjectAndRazorDocumentAsync(source); var inputText = await document.GetTextAsync(DisposalToken); var position = inputText.GetPosition(cursorPosition); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs new file mode 100644 index 00000000000..1bc8fd332cc --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentPullDiagnosticsTest.cs @@ -0,0 +1,121 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostDocumentPullDiagnosticsTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public Task CSharp() + => VerifyDiagnosticsAsync(""" +
+ + @code + { + public void IJustMetYou() + { + {|CS0103:CallMeMaybe|}(); + } + } + """); + + [Fact] + public Task Razor() + => VerifyDiagnosticsAsync(""" +
+ + {|RZ10012:|} + +
+ """); + + [Fact] + public Task Html() + { + TestCode input = """ +
+ + {|HTM1337:|} + +
+ """; + + return VerifyDiagnosticsAsync(input, + htmlResponse: [new VSInternalDiagnosticReport + { + Diagnostics = + [ + new Diagnostic + { + Code = "HTM1337", + Range = SourceText.From(input.Text).GetRange(input.NamedSpans.First().Value.First()) + } + ] + }]); + } + + [Fact] + public Task CombinedAndNestedDiagnostics() + => VerifyDiagnosticsAsync(""" + @using System.Threading.Tasks; + +
+ + {|RZ10012:|} + + @code + { + public void IJustMetYou() + { + {|CS0103:CallMeMaybe|}(); + } + } + +
+ @{ + {|CS4033:await Task.{|CS1501:Delay|}()|}; + } + + {|RZ9980:

|} +

+ +
+ """); + + private async Task VerifyDiagnosticsAsync(TestCode input, VSInternalDiagnosticReport[]? htmlResponse = null) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text, createSeparateRemoteAndLocalWorkspaces: true); + var inputText = await document.GetTextAsync(DisposalToken); + + var requestInvoker = new TestLSPRequestInvoker([(VSInternalMethods.DocumentPullDiagnosticName, htmlResponse)]); + + var endpoint = new CohostDocumentPullDiagnosticsEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, FilePathService, LoggerFactory); + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(document, DisposalToken); + + var markers = result!.SelectMany(d => d.Diagnostics.AssumeNotNull()).SelectMany(d => + new[] { + (index: inputText.GetTextSpan(d.Range).Start, text: $"{{|{d.Code!.Value.Second}:"), + (index: inputText.GetTextSpan(d.Range).End, text:"|}") + }); + + var testOutput = input.Text; + foreach (var (index, text) in markers.OrderByDescending(i => i.index)) + { + testOutput = testOutput.Insert(index, text); + } + + AssertEx.EqualOrDiff(input.OriginalInput, testOutput); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs new file mode 100644 index 00000000000..51c5d3d28a9 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs @@ -0,0 +1,100 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostDocumentSpellCheckEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task Handle() + { + var input = """ + @page [|"this is csharp"|] + +
[| + + Eat more chickin. + + |]
+ + + + + + @{ var [|x|] = [|"csharp"|]; + + @*[| Eat more chickin. |]*@ + +
+ + @code + { + void [|M|]() + { + [|// Eat more chickin|] + } + } + """; + + await VerifySemanticTokensAsync(input); + } + + private async Task VerifySemanticTokensAsync(TestCode input) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var sourceText = await document.GetTextAsync(DisposalToken); + + var endpoint = new CohostDocumentSpellCheckEndpoint(RemoteServiceInvoker); + + var span = new LinePositionSpan(new(0, 0), new(sourceText.Lines.Count, 0)); + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(document, DisposalToken); + + var ranges = result.First().Ranges.AssumeNotNull(); + + // To make for easier test failure analysis, we convert the ranges back to the test input, so we can show a diff + // rather than "Expected 23, got 53" and leave the developer to deal with what that means. + // As a bonus, this also ensures the ranges array has the right number of elements (ie, multiple of 3) + var absoluteRanges = new List<(int Start, int End)>(); + var absoluteStart = 0; + for (var i = 0; i < ranges.Length; i += 3) + { + var kind = ranges[i]; + var start = ranges[i + 1]; + var length = ranges[i + 2]; + + absoluteStart += start; + absoluteRanges.Add((absoluteStart, absoluteStart + length)); + absoluteStart += length; + } + + // Make sure the response is sorted correctly, or the IDE will complain + Assert.True(absoluteRanges.SequenceEqual(absoluteRanges.OrderBy(r => r.Start)), "Results are not in order!"); + + absoluteRanges.Reverse(); + + var actual = input.Text; + foreach (var (start, end) in absoluteRanges) + { + actual = actual.Insert(end, "|]").Insert(start, "[|"); + } + + AssertEx.EqualOrDiff(input.OriginalInput, actual); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs new file mode 100644 index 00000000000..2cc98c4c923 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSymbolEndpointTest.cs @@ -0,0 +1,118 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis.Testing; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostDocumentSymbolEndpointTest(ITestOutputHelper testOutput) : CohostEndpointTestBase(testOutput) +{ + [Theory] + [CombinatorialData] + public Task DocumentSymbols_CSharpClassWithMethods(bool hierarchical) + => VerifyDocumentSymbolsAsync( + """ + @functions { + class {|SomeProject.File1.C:C|} + { + private void {|HandleString(string s):HandleString|}(string s) + { + s += "Hello"; + } + + private void {|M(int i):M|}(int i) + { + i++; + } + + private string {|ObjToString(object o):ObjToString|}(object o) + { + return o.ToString(); + } + } + } + + """, hierarchical); + + [Theory] + [CombinatorialData] + public Task DocumentSymbols_CSharpMethods(bool hierarchical) + => VerifyDocumentSymbolsAsync( + """ + @functions { + private void {|HandleString(string s):HandleString|}(string s) + { + s += "Hello"; + } + + private void {|M(int i):M|}(int i) + { + i++; + } + + private string {|ObjToString(object o):ObjToString|}(object o) + { + return o.ToString(); + } + } + + """, hierarchical); + + private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = false) + { + TestFileMarkupParser.GetSpans(input, out input, out ImmutableDictionary> spansDict); + var document = await CreateProjectAndRazorDocumentAsync(input); + + var endpoint = new CohostDocumentSymbolEndpoint(RemoteServiceInvoker); + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(document, hierarchical, DisposalToken); + + if (hierarchical) + { + var documentSymbols = result.Value.First; + var sourceText = SourceText.From(input); + var seen = 0; + + VerifyDocumentSymbols(spansDict, documentSymbols, sourceText, ref seen); + + Assert.Equal(spansDict.Values.Count(), seen); + } + else + { + var symbolsInformations = result.Value.Second; + Assert.Equal(spansDict.Values.Count(), symbolsInformations.Length); + + var sourceText = SourceText.From(input); + foreach (var symbolInformation in symbolsInformations) + { + Assert.True(spansDict.TryGetValue(symbolInformation.Name, out var spans), $"Expected {symbolInformation.Name} to be in test provided markers"); + var expectedRange = sourceText.GetRange(Assert.Single(spans)); + Assert.Equal(expectedRange, symbolInformation.Location.Range); + } + } + } + + private static void VerifyDocumentSymbols(ImmutableDictionary> spansDict, DocumentSymbol[] documentSymbols, SourceText sourceText, ref int seen) + { + foreach (var symbol in documentSymbols) + { + seen++; + Assert.True(spansDict.TryGetValue(symbol.Detail.AssumeNotNull(), out var spans), $"Expected {symbol.Detail} to be in test provided markers"); + var expectedRange = sourceText.GetRange(Assert.Single(spans)); + Assert.Equal(expectedRange, symbol.SelectionRange); + + if (symbol.Children is not null) + { + VerifyDocumentSymbols(spansDict, symbol.Children, sourceText, ref seen); + } + } + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs index 3573e1badf6..bec19c8cbab 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostEndpointTestBase.cs @@ -9,10 +9,13 @@ using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.Remote; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Remote.Razor; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Composition; using Xunit.Abstractions; @@ -68,7 +71,7 @@ private protected void UpdateClientInitializationOptions(Func CreateProjectAndRazorDocumentAsync(string contents, string? fileKind = null, (string fileName, string contents)[]? additionalFiles = null, bool createSeparateRemoteAndLocalWorkspaces = false) { // Using IsLegacy means null == component, so easier for test authors var isComponent = !FileKinds.IsLegacy(fileKind); @@ -82,6 +85,56 @@ protected TextDocument CreateProjectAndRazorDocument(string contents, string? fi var projectId = ProjectId.CreateNewId(debugName: projectName); var documentId = DocumentId.CreateNewId(projectId, debugName: documentFilePath); + var remoteWorkspace = RemoteWorkspaceAccessor.GetWorkspace(); + var remoteDocument = CreateProjectAndRazorDocument(remoteWorkspace, projectId, projectName, documentId, documentFilePath, contents, additionalFiles); + + if (createSeparateRemoteAndLocalWorkspaces) + { + // Usually its fine to just use the remote workspace, but sometimes we need to also have things available in the + // "devenv" side of Roslyn, which is a different workspace with a different set of services. We don't have any + // actual solution syncing set up for testing, and don't really use a service broker, but since we also would + // expect to never make changes to a workspace, it should be fine to simply create duplicated solutions as part + // of test setup. + return CreateLocalProjectAndRazorDocumentAsync(remoteDocument.Project.Solution, projectId, projectName, documentId, documentFilePath, contents, additionalFiles); + } + + // If we're just creating one workspace, then its the remote one and we just return the remote document + // and assume that the endpoint under test doesn't need to do anything on the devenv side. This makes it + // easier for tests to mutate solutions + return Task.FromResult(remoteDocument); + } + + private async Task CreateLocalProjectAndRazorDocumentAsync(Solution remoteSolution, ProjectId projectId, string projectName, DocumentId documentId, string documentFilePath, string contents, (string fileName, string contents)[]? additionalFiles) + { + var exportProvider = TestComposition.Roslyn.ExportProviderFactory.CreateExportProvider(); + AddDisposable(exportProvider); + var workspace = TestWorkspace.CreateWithDiagnosticAnalyzers(exportProvider); + AddDisposable(workspace); + + var razorDocument = CreateProjectAndRazorDocument(workspace, projectId, projectName, documentId, documentFilePath, contents, additionalFiles); + + // Until the source generator is hooked up, the workspace representing "local" projects doesn't have anything + // to actually compile the Razor to C#, so we just do it now at creation + var solution = razorDocument.Project.Solution; + // We're cheating a bit here and using the remote export provider to get something to do the compilation + var factory = _exportProvider.AssumeNotNull().GetExportedValue(); + var snapshot = factory.GetOrCreate(razorDocument); + // Compile the Razor file + var codeDocument = await snapshot.GetGeneratedOutputAsync(false); + // Update the generated doc contents + var generatedDocumentIds = solution.GetDocumentIdsWithFilePath(documentFilePath + CSharpVirtualDocumentSuffix); + solution = solution.WithDocumentText(generatedDocumentIds, codeDocument.GetCSharpSourceText()); + razorDocument = solution.GetAdditionalDocument(documentId).AssumeNotNull(); + + // If we're creating remote and local workspaces, then we'll return the local document, and have to allow + // the remote service invoker to map from the local solution to the remote one. + RemoteServiceInvoker.MapSolutionIdToRemote(razorDocument.Project.Solution.Id, remoteSolution); + + return razorDocument; + } + + private static TextDocument CreateProjectAndRazorDocument(CodeAnalysis.Workspace workspace, ProjectId projectId, string projectName, DocumentId documentId, string documentFilePath, string contents, (string fileName, string contents)[]? additionalFiles) + { var projectInfo = ProjectInfo .Create( projectId, @@ -93,9 +146,6 @@ protected TextDocument CreateProjectAndRazorDocument(string contents, string? fi .WithDefaultNamespace(TestProjectData.SomeProject.RootNamespace) .WithMetadataReferences(AspNet80.ReferenceInfos.All.Select(r => r.Reference)); - // Importantly, we use Roslyn's remote workspace here so that when our OOP services call into Roslyn, their code - // will be able to access their services. - var workspace = RemoteWorkspaceAccessor.GetWorkspace(); var solution = workspace.CurrentSolution.AddProject(projectInfo); solution = solution diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs index 08ad6977496..1bfb8b299cd 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostFoldingRangeEndpointTest.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -218,7 +217,7 @@ public void M() {[| private async Task VerifyFoldingRangesAsync(string input, string? fileKind = null) { TestFileMarkupParser.GetSpans(input, out var source, out ImmutableDictionary> spans); - var document = CreateProjectAndRazorDocument(source, fileKind); + var document = await CreateProjectAndRazorDocumentAsync(source, fileKind); var inputText = await document.GetTextAsync(DisposalToken); var htmlSpans = spans.GetValueOrDefault("html").NullToEmpty(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs new file mode 100644 index 00000000000..f5b8b6e77e3 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs @@ -0,0 +1,377 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; +using RoslynDocumentLink = Roslyn.LanguageServer.Protocol.DocumentLink; +using RoslynLocation = Roslyn.LanguageServer.Protocol.Location; +using RoslynLspExtensions = Roslyn.LanguageServer.Protocol.RoslynLspExtensions; +using TextDocument = Microsoft.CodeAnalysis.TextDocument; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostGoToDefinitionEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task CSharp_Method() + { + var input = """ +
+ @{ + var x = Ge$$tX(); + } + @functions + { + void [|GetX|]() + { + } + } + """; + + await VerifyGoToDefinitionAsync(input); + } + + [Fact] + public async Task CSharp_Local() + { + var input = """ +
+ @{ + var x = GetX(); + } + @functions + { + private string [|_name|]; + string GetX() + { + return _na$$me; + } + } + """; + + await VerifyGoToDefinitionAsync(input); + } + + [Fact] + public async Task CSharp_MetadataReference() + { + var input = """ +
+ @functions + { + private stri$$ng _name; + } + """; + + var result = await GetGoToDefinitionResultAsync(input); + + Assert.NotNull(result.Value.Second); + var locations = result.Value.Second; + var location = Assert.Single(locations); + Assert.EndsWith("String.cs", location.Uri.ToString()); + + // Note: The location is in a generated C# "metadata-as-source" file, which has a different + // number of using directives in .NET Framework vs. .NET Core, so rather than relying on line + // numbers we do some vague notion of actual navigation and test the actual source line that + // the user would see. + var line = File.ReadLines(location.Uri.LocalPath).ElementAt(location.Range.Start.Line); + Assert.Contains("public sealed class String", line); + } + + [Theory] + [InlineData("$$IncrementCount")] + [InlineData("In$$crementCount")] + [InlineData("IncrementCount$$")] + public async Task Attribute_SameFile(string method) + { + var input = $$""" +
+ + @code + { + void [|IncrementCount|]() + { + } + } + """; + + await VerifyGoToDefinitionAsync(input, FileKinds.Component); + } + + [Fact] + public async Task AttributeValue_BindAfter() + { + var input = """ + + + @code + { + public string InputValue { get; set; } + + public void [|After|]() + { + } + } + """; + + await VerifyGoToDefinitionAsync(input, FileKinds.Component); + } + + [Fact] + public async Task Component() + { + TestCode input = """ + + """; + + TestCode surveyPrompt = """ + [||]@namespace SomeProject + +
+ + @code + { + [Parameter] + public string Title { get; set; } + } + """; + + TestCode surveyPromptGeneratedCode = """ + using Microsoft.AspNetCore.Components; + + namespace SomeProject + { + public partial class SurveyPrompt : ComponentBase + { + [Parameter] + public string Title { get; set; } + } + } + """; + + var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); + + Assert.NotNull(result.Value.Second); + var locations = result.Value.Second; + var location = Assert.Single(locations); + + var text = SourceText.From(surveyPrompt.Text); + var range = RoslynLspExtensions.GetRange(text, surveyPrompt.Span); + Assert.Equal(range, location.Range); + } + + [Theory] + [InlineData("Ti$$tle")] + [InlineData("$$@bind-Title")] + [InlineData("@$$bind-Title")] + [InlineData("@bi$$nd-Title")] + [InlineData("@bind$$-Title")] + [InlineData("@bind-Ti$$tle")] + public async Task OtherRazorFile(string attribute) + { + TestCode input = $$""" + + + @code + { + private string? InputValue { get; set; } + + private void BindAfter() + { + } + } + """; + + TestCode surveyPrompt = """ + @namespace SomeProject + +
+ + @code + { + [Parameter] + public string [|Title|] { get; set; } + } + """; + + #region surveyPromptGeneratedCode + TestCode surveyPromptGeneratedCode = """ + // + #pragma warning disable 1591 + namespace SomeProject + { + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + #nullable restore + #line 1 "c:\users\example\src\SomeProject\_Imports.razor" + using Microsoft.AspNetCore.Components; + + #nullable disable + #nullable restore + #line 2 "c:\users\example\src\SomeProject\_Imports.razor" + using Microsoft.AspNetCore.Components.Authorization; + + #nullable disable + #nullable restore + #line 3 "c:\users\example\src\SomeProject\_Imports.razor" + using Microsoft.AspNetCore.Components.Forms; + + #nullable disable + #nullable restore + #line 4 "c:\users\example\src\SomeProject\_Imports.razor" + using Microsoft.AspNetCore.Components.Routing; + + #nullable disable + #nullable restore + #line 5 "c:\users\example\src\SomeProject\_Imports.razor" + using Microsoft.AspNetCore.Components.Web; + + #line default + #line hidden + #nullable disable + #nullable restore + public partial class SurveyPrompt : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((global::System.Action)(() => { + #nullable restore + #line 1 "c:\users\example\src\SomeProject\SurveyPrompt.razor" + global::System.Object __typeHelper = nameof(SomeProject); + + #line default + #line hidden + #nullable disable + } + ))(); + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + } + #pragma warning restore 1998 + #nullable restore + #line 6 "c:\users\example\src\SomeProject\SurveyPrompt.razor" + + [Parameter] + public string Title { get; set; } + + #line default + #line hidden + #nullable disable + } + } + #pragma warning restore 1591 + """; + #endregion + + var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); + + Assert.NotNull(result.Value.Second); + var locations = result.Value.Second; + var location = Assert.Single(locations); + + var text = SourceText.From(surveyPrompt.Text); + var range = RoslynLspExtensions.GetRange(text, surveyPrompt.Span); + Assert.Equal(range, location.Range); + } + + [Fact] + public async Task Html() + { + // This really just validates Uri remapping, the actual response is largely arbitrary + + TestCode input = """ +
+ + + """; + + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlResponse = new SumType?(new Location[] + { + new Location + { + Uri = new Uri(document.CreateUri(), document.Name + FeatureOptions.HtmlVirtualDocumentSuffix), + Range = inputText.GetRange(input.Span), + }, + }); + + await VerifyGoToDefinitionAsync(input, htmlResponse: htmlResponse); + } + + private static string FileName(string projectRelativeFileName) + => Path.Combine(TestProjectData.SomeProjectPath, projectRelativeFileName); + + private async Task VerifyGoToDefinitionAsync(TestCode input, string? fileKind = null, SumType? htmlResponse = null) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text, fileKind); + var result = await GetGoToDefinitionResultAsync(document, input, htmlResponse); + + Assumes.NotNull(result); + + Assert.NotNull(result.Value.Second); + var locations = result.Value.Second; + var location = Assert.Single(locations); + + var text = SourceText.From(input.Text); + var range = RoslynLspExtensions.GetRange(text, input.Span); + Assert.Equal(range, location.Range); + + Assert.Equal(document.CreateUri(), location.Uri); + } + + private async Task?> GetGoToDefinitionResultAsync( + TestCode input, string? fileKind = null, params (string fileName, string contents)[]? additionalFiles) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text, fileKind, additionalFiles); + return await GetGoToDefinitionResultAsync(document, input, htmlResponse: null); + } + + private async Task?> GetGoToDefinitionResultAsync( + TextDocument document, TestCode input, SumType? htmlResponse) + { + var inputText = await document.GetTextAsync(DisposalToken); + var position = inputText.GetPosition(input.Position); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentDefinitionName, htmlResponse)]); + + var filePathService = new VisualStudioFilePathService(FeatureOptions); + var endpoint = new CohostGoToDefinitionEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, filePathService); + + var textDocumentPositionParams = new TextDocumentPositionParams + { + Position = position, + TextDocument = new TextDocumentIdentifier { Uri = document.CreateUri() }, + }; + + return await endpoint.GetTestAccessor().HandleRequestAsync(textDocumentPositionParams, document, DisposalToken); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs new file mode 100644 index 00000000000..b6c91a29bea --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs @@ -0,0 +1,166 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Remote.Razor; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; +using LspLocation = Microsoft.VisualStudio.LanguageServer.Protocol.Location; +using RoslynLspExtensions = Roslyn.LanguageServer.Protocol.RoslynLspExtensions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostGoToImplementationEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task CSharp_Method() + { + var input = """ +
+ + @{ + var x = Ge$$tX(); + } + + @code + { + void [|GetX|]() + { + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task CSharp_Field() + { + var input = """ +
+ + @{ + var x = GetX(); + } + + @code + { + private string [|_name|]; + + string GetX() + { + return _na$$me; + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task CSharp_Multiple() + { + var input = """ +
+ + @code + { + class [|Base|] { } + class [|Derived1|] : Base { } + class [|Derived2|] : Base { } + + void M(Ba$$se b) + { + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task Html() + { + // This really just validates Uri remapping, the actual response is largely arbitrary + + TestCode input = """ +
+ + + """; + + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlResponse = new SumType?(new LspLocation[] + { + new LspLocation + { + Uri = new Uri(document.CreateUri(), document.Name + FeatureOptions.HtmlVirtualDocumentSuffix), + Range = inputText.GetRange(input.Span), + }, + }); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentImplementationName, htmlResponse)]); + + await VerifyGoToImplementationResultAsync(input, document, requestInvoker); + } + + private async Task VerifyCSharpGoToImplementationAsync(TestCode input) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + + var requestInvoker = new TestLSPRequestInvoker(); + + await VerifyGoToImplementationResultAsync(input, document, requestInvoker); + } + + private async Task VerifyGoToImplementationResultAsync(TestCode input, TextDocument document, TestLSPRequestInvoker requestInvoker) + { + var inputText = await document.GetTextAsync(DisposalToken); + + var filePathService = new RemoteFilePathService(FeatureOptions); + var endpoint = new CohostGoToImplementationEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, filePathService); + + var position = inputText.GetPosition(input.Position); + var textDocumentPositionParams = new TextDocumentPositionParams + { + Position = position, + TextDocument = new TextDocumentIdentifier { Uri = document.CreateUri() }, + }; + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(textDocumentPositionParams, document, DisposalToken); + + if (result.Value.TryGetFirst(out var roslynLocations)) + { + var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + var actual = roslynLocations.Select(l => RoslynLspExtensions.ToLinePositionSpan(l.Range)).OrderBy(r => r.Start.Line).ToArray(); + Assert.Equal(expected, actual); + + Assert.All(roslynLocations, l => l.Uri.Equals(document.CreateUri())); + } + else if (result.Value.TryGetSecond(out var vsLocations)) + { + var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + var actual = vsLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + Assert.Equal(expected, actual); + + Assert.All(vsLocations, l => l.Uri.Equals(document.CreateUri())); + } + else + { + Assert.Fail($"Unsupported result type: {result.Value.GetType()}"); + } + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostInlayHintEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostInlayHintEndpointTest.cs index f7a3df1d975..05c9b4486ec 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostInlayHintEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostInlayHintEndpointTest.cs @@ -131,7 +131,7 @@ public Task InlayHints_ComponentAttributes() private async Task VerifyInlayHintsAsync(string input, Dictionary toolTipMap, string output, bool displayAllOverride = false) { TestFileMarkupParser.GetSpans(input, out input, out ImmutableDictionary> spansDict); - var document = CreateProjectAndRazorDocument(input); + var document = await CreateProjectAndRazorDocumentAsync(input); var inputText = await document.GetTextAsync(DisposalToken); var endpoint = new CohostInlayHintEndpoint(RemoteServiceInvoker); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostLinkedEditingRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostLinkedEditingRangeEndpointTest.cs index 28c05827166..865f5101125 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostLinkedEditingRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostLinkedEditingRangeEndpointTest.cs @@ -159,7 +159,7 @@ The end. private async Task VerifyLinkedEditingRangeAsync(string input) { TestFileMarkupParser.GetPositionAndSpans(input, out input, out int cursorPosition, out ImmutableArray spans); - var document = CreateProjectAndRazorDocument(input); + var document = await CreateProjectAndRazorDocumentAsync(input); var sourceText = await document.GetTextAsync(DisposalToken); var endpoint = new CohostLinkedEditingRangeEndpoint(RemoteServiceInvoker); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnAutoInsertEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnAutoInsertEndpointTest.cs new file mode 100644 index 00000000000..74d5036d454 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnAutoInsertEndpointTest.cs @@ -0,0 +1,268 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodBeAnalysis.Remote.Razor.AutoInsert; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.AutoInsert; +using Microsoft.CodeAnalysis.Razor.Settings; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.LanguageServices.Razor.LanguageClient.Cohost; +using Microsoft.VisualStudio.Razor.Settings; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostOnAutoInsertEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Theory] + [InlineData("PageTitle")] + [InlineData("div")] + [InlineData("text")] + public async Task EndTag(string startTag) + { + await VerifyOnAutoInsertAsync( + input: $""" + This is a Razor document. + + <{startTag}>$$ + + The end. + """, + output: $""" + This is a Razor document. + + <{startTag}>$0 + + The end. + """, + triggerCharacter: ">"); + } + + [Theory] + [InlineData("PageTitle")] + [InlineData("div")] + [InlineData("text")] + public async Task DoNotAutoInsertEndTag_DisabledAutoClosingTags(string startTag) + { + await VerifyOnAutoInsertAsync( + input: $""" + This is a Razor document. + + <{startTag}>$$ + + The end. + """, + output: null, + triggerCharacter: ">", + autoClosingTags: false); + } + + [Fact] + public async Task AttributeQuotes() + { + await VerifyOnAutoInsertAsync( + input: $""" + This is a Razor document. + + + + The end. + """, + output: $""" + This is a Razor document. + + + + The end. + """, + triggerCharacter: "=", + delegatedResponseText: "\"$0\""); + } + + [Fact] + public async Task CSharp_OnForwardSlash() + { + await VerifyOnAutoInsertAsync( + input: """ + @code { + ///$$ + void TestMethod() {} + } + """, + output: """ + @code { + /// + /// $0 + /// + void TestMethod() {} + } + """, + triggerCharacter: "/"); + } + + [Fact] + public async Task DoNotAutoInsertCSharp_OnForwardSlashWithFormatOnTypeDisabled() + { + await VerifyOnAutoInsertAsync( + input: """ + @code { + ///$$ + void TestMethod() {} + } + """, + output: null, + triggerCharacter: "/", + formatOnType: false); + } + + [Fact] + public async Task CSharp_OnEnter() + { + await VerifyOnAutoInsertAsync( + input: """ + @code { + void TestMethod() { + $$} + } + """, + output: """ + @code { + void TestMethod() + { + $0 + } + } + """, + triggerCharacter: "\n"); + } + + [Fact] + public async Task CSharp_OnEnter_TwoSpaceIndent() + { + await VerifyOnAutoInsertAsync( + input: """ + @code { + void TestMethod() { + $$} + } + """, + output: """ + @code { + void TestMethod() + { + $0 + } + } + """, + triggerCharacter: "\n", + tabSize: 2); + } + + [Fact] + public async Task CSharp_OnEnter_UseTabs() + { + const char tab = '\t'; + await VerifyOnAutoInsertAsync( + input: """ + @code { + void TestMethod() { + $$} + } + """, + output: $$""" + @code { + {{tab}}void TestMethod() + {{tab}}{ + {{tab}}{{tab}}$0 + {{tab}}} + } + """, + triggerCharacter: "\n", + insertSpaces: false); + } + + private async Task VerifyOnAutoInsertAsync( + TestCode input, + string? output, + string triggerCharacter, + string? delegatedResponseText = null, + bool insertSpaces = true, + int tabSize = 4, + bool formatOnType = true, + bool autoClosingTags = true) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var sourceText = await document.GetTextAsync(DisposalToken); + + var clientSettingsManager = new ClientSettingsManager([], null, null); + clientSettingsManager.Update(ClientAdvancedSettings.Default with { FormatOnType = formatOnType, AutoClosingTags = autoClosingTags }); + + IOnAutoInsertTriggerCharacterProvider[] onAutoInsertTriggerCharacterProviders = [ + new RemoteAutoClosingTagOnAutoInsertProvider(), + new RemoteCloseTextTagOnAutoInsertProvider()]; + + VSInternalDocumentOnAutoInsertResponseItem? response = null; + if (delegatedResponseText is not null) + { + var start = sourceText.GetPosition(input.Position); + var end = start; + response = new VSInternalDocumentOnAutoInsertResponseItem() + { + TextEdit = new TextEdit() { NewText = delegatedResponseText, Range = new() { Start = start, End = end } }, + TextEditFormat = InsertTextFormat.Snippet + }; + } + + var requestInvoker = new TestLSPRequestInvoker([(VSInternalMethods.OnAutoInsertName, response)]); + + var endpoint = new CohostOnAutoInsertEndpoint( + RemoteServiceInvoker, + clientSettingsManager, + onAutoInsertTriggerCharacterProviders, + TestHtmlDocumentSynchronizer.Instance, + requestInvoker, + LoggerFactory); + + var formattingOptions = new FormattingOptions() + { + InsertSpaces = insertSpaces, + TabSize = tabSize + }; + + var request = new VSInternalDocumentOnAutoInsertParams() + { + TextDocument = new TextDocumentIdentifier() + { + Uri = document.CreateUri() + }, + Position = sourceText.GetPosition(input.Position), + Character = triggerCharacter, + Options = formattingOptions + }; + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + if (output is not null) + { + Assert.NotNull(result); + } + else + { + Assert.Null(result); + return; + } + + if (result is not null) + { + var change = sourceText.GetTextChange(result.TextEdit); + sourceText = sourceText.WithChanges(change); + } + + AssertEx.EqualOrDiff(output, sourceText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs new file mode 100644 index 00000000000..1919956dad4 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs @@ -0,0 +1,157 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[Collection(HtmlFormattingCollection.Name)] +public class CohostOnTypeFormattingEndpointTest(HtmlFormattingFixture htmlFormattingFixture, ITestOutputHelper testOutputHelper) + : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task InvalidTrigger() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if(true){} + } + """, + triggerCharacter: 'h'); + } + + [Fact] + public async Task CSharp_InvalidTrigger() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if(true){} + } + """, + triggerCharacter: '\n'); + } + + [Fact] + public async Task CSharp() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if (true) { } + } + """, + triggerCharacter: '}'); + } + + [Fact] + public async Task FormatsSimpleHtmlTag_OnType() + { + await VerifyOnTypeFormattingAsync( + input: """ + + + Hello + + + + """, + expected: """ + + + Hello + + + + """, + triggerCharacter: ';', + html: true); + } + + private async Task VerifyOnTypeFormattingAsync(TestCode input, string expected, char triggerCharacter, bool html = false) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + var position = inputText.GetPosition(input.Position); + + LSPRequestInvoker requestInvoker; + if (html) + { + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await htmlFormattingFixture.Service.GetOnTypeFormattingEditsAsync(LoggerFactory, uri, generatedHtml, position, insertSpaces: true, tabSize: 4); + + requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentOnTypeFormattingName, htmlEdits)]); + } + else + { + // We use a mock here so that it will throw if called + requestInvoker = StrictMock.Of(); + } + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostOnTypeFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentOnTypeFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + }, + Character = triggerCharacter.ToString(), + Position = position + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + if (edits is null) + { + Assert.Equal(expected, input.Text); + return; + } + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs new file mode 100644 index 00000000000..97b3db3fd79 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs @@ -0,0 +1,139 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[Collection(HtmlFormattingCollection.Name)] +public class CohostRangeFormattingEndpointTest(HtmlFormattingFixture htmlFormattingFixture, ITestOutputHelper testOutputHelper) + : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public Task RangeFormatting() + => VerifyRangeFormattingAsync( + input: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+ [|
+ @{ +
+
+ This is heavily nested +
+
+ } +
|] + } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + """, + expected: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + """); + + private async Task VerifyRangeFormattingAsync(TestCode input, string expected) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await htmlFormattingFixture.Service.GetDocumentFormattingEditsAsync(LoggerFactory, uri, generatedHtml, insertSpaces: true, tabSize: 4); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentFormattingName, htmlEdits)]); + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostRangeFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentRangeFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + }, + Range = inputText.GetRange(input.Span) + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs index c273c9d63a7..6e1af1d4f06 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRenameEndpointTest.cs @@ -112,62 +112,62 @@ The end. """, renames: [("Component.razor", "DifferentName.razor")]); - [Theory(Skip = "https://github.com/dotnet/razor/issues/10717")] + [Theory] [InlineData("$$Component")] [InlineData("Com$$ponent")] [InlineData("Component$$")] public Task Component_EndTag(string endTag) - => VerifyRenamesAsync( - input: $""" - This is a Razor document. - - + => VerifyRenamesAsync( + input: $""" + This is a Razor document. -
- - +
- + +
+ + + +
-
- The end. - """, - additionalFiles: [ - // The source generator isn't hooked up to our test project, so we have to manually "compile" the razor file - (File("Component.cs"), """ - namespace SomeProject; + The end. + """, + additionalFiles: [ + // The source generator isn't hooked up to our test project, so we have to manually "compile" the razor file + (File("Component.cs"), """ + namespace SomeProject; + + public class Component : Microsoft.AspNetCore.Components.ComponentBase + { + } + """), + // The above will make the component exist, but the .razor file needs to exist too for Uri presentation + (File("Component.razor"), "") + ], + newName: "DifferentName", + expected: """ + This is a Razor document. - public class Component : Microsoft.AspNetCore.Components.ComponentBase - { - } - """), - // The above will make the component exist, but the .razor file needs to exist too for Uri presentation - (File("Component.razor"), "") - ], - newName: "DifferentName", - expected: """ - This is a Razor document. - - - -
- - +
+
+ + + +
-
- The end. - """, - renames: [("Component.razor", "DifferentName.razor")]); + The end. + """, + renames: [("Component.razor", "DifferentName.razor")]); [Fact] public Task Mvc() @@ -198,7 +198,7 @@ public class Component : Microsoft.AspNetCore.Components.ComponentBase private async Task VerifyRenamesAsync(string input, string newName, string expected, string? fileKind = null, (string fileName, string contents)[]? additionalFiles = null, (string oldName, string newName)[]? renames = null) { TestFileMarkupParser.GetPosition(input, out var source, out var cursorPosition); - var document = CreateProjectAndRazorDocument(source, fileKind, additionalFiles); + var document = await CreateProjectAndRazorDocumentAsync(source, fileKind, additionalFiles); var inputText = await document.GetTextAsync(DisposalToken); var position = inputText.GetPosition(cursorPosition); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs index 42b792b7ad5..7f841c9b12d 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSemanticTokensRangeEndpointTest.cs @@ -90,7 +90,7 @@ @section MySection { private async Task VerifySemanticTokensAsync(string input, bool colorBackground, bool precise, string? fileKind = null, [CallerMemberName] string? testName = null) { - var document = CreateProjectAndRazorDocument(input, fileKind); + var document = await CreateProjectAndRazorDocumentAsync(input, fileKind); var sourceText = await document.GetTextAsync(DisposalToken); var legend = TestRazorSemanticTokensLegendService.Instance; diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSignatureHelpEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSignatureHelpEndpointTest.cs index 276e1de71a1..8facef4127a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSignatureHelpEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostSignatureHelpEndpointTest.cs @@ -91,7 +91,7 @@ void Act() private async Task VerifySignatureHelpAsync(string input, string expected, bool autoListParams = true, SignatureHelpTriggerKind? triggerKind = null) { TestFileMarkupParser.GetPosition(input, out input, out var cursorPosition); - var document = CreateProjectAndRazorDocument(input); + var document = await CreateProjectAndRazorDocumentAsync(input); var sourceText = await document.GetTextAsync(DisposalToken); var clientSettingsManager = new ClientSettingsManager([], null, null); @@ -99,7 +99,7 @@ private async Task VerifySignatureHelpAsync(string input, string expected, bool var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentSignatureHelpName, null)]); - var endpoint = new CohostSignatureHelpEndpoint(RemoteServiceInvoker, clientSettingsManager, TestHtmlDocumentSynchronizer.Instance, requestInvoker, LoggerFactory); + var endpoint = new CohostSignatureHelpEndpoint(RemoteServiceInvoker, clientSettingsManager, TestHtmlDocumentSynchronizer.Instance, requestInvoker); var signatureHelpContext = new SignatureHelpContext() { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostTextPresentationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostTextPresentationEndpointTest.cs new file mode 100644 index 00000000000..f2a4acc5b67 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostTextPresentationEndpointTest.cs @@ -0,0 +1,89 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Testing; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostTextPresentationEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task HtmlResponse_TranslatesVirtualDocumentUri() + { + await VerifyUriPresentationAsync( + input: """ + This is a Razor document. + +
+ [||] +
+ + The end. + """, + text: "Hello World", + htmlResponse: new WorkspaceEdit + { + DocumentChanges = new TextDocumentEdit[] + { + new() + { + TextDocument = new() + { + Uri = FileUri("File1.razor.g.html") + }, + Edits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Hello World")] + } + } + }, + expected: "Hello World"); + } + + private static Uri FileUri(string projectRelativeFileName) + => new(File(projectRelativeFileName)); + + private static string File(string projectRelativeFileName) + => Path.Combine(TestProjectData.SomeProjectPath, projectRelativeFileName); + + private async Task VerifyUriPresentationAsync(string input, string text, string? expected, WorkspaceEdit? htmlResponse = null) + { + TestFileMarkupParser.GetSpan(input, out input, out var span); + var document = await CreateProjectAndRazorDocumentAsync(input); + var sourceText = await document.GetTextAsync(DisposalToken); + + var requestInvoker = new TestLSPRequestInvoker([(VSInternalMethods.TextDocumentTextPresentationName, htmlResponse)]); + + var endpoint = new CohostTextPresentationEndpoint(TestHtmlDocumentSynchronizer.Instance, FilePathService, requestInvoker); + + var request = new VSInternalTextPresentationParams() + { + TextDocument = new TextDocumentIdentifier() + { + Uri = document.CreateUri() + }, + Range = sourceText.GetRange(span), + Text = text + }; + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + if (expected is null) + { + Assert.Null(result); + } + else + { + Assert.NotNull(result); + Assert.NotNull(result.DocumentChanges); + Assert.Equal(expected, result.DocumentChanges.Value.First[0].Edits[0].NewText); + Assert.Equal(document.CreateUri(), result.DocumentChanges.Value.First[0].TextDocument.Uri); + } + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs index 981e8f7a8b9..68b3be9565a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs @@ -97,6 +97,26 @@ public class Component : Microsoft.AspNetCore.Components.ComponentBase expected: ""); } + [Fact] + public async Task ImportsFile() + { + await VerifyUriPresentationAsync( + input: """ + This is a Razor document. + +
+ [||] +
+ + The end. + """, + additionalFiles: [ + (File("_Imports.razor"), "") + ], + uris: [FileUri("_Imports.razor")], + expected: null); + } + [Fact] public async Task Html_IntoCSharp_NoTag() { @@ -266,7 +286,7 @@ private static string File(string projectRelativeFileName) private async Task VerifyUriPresentationAsync(string input, Uri[] uris, string? expected, WorkspaceEdit? htmlResponse = null, (string fileName, string contents)[]? additionalFiles = null) { TestFileMarkupParser.GetSpan(input, out input, out var span); - var document = CreateProjectAndRazorDocument(input, additionalFiles: additionalFiles); + var document = await CreateProjectAndRazorDocumentAsync(input, additionalFiles: additionalFiles); var sourceText = await document.GetTextAsync(DisposalToken); var requestInvoker = new TestLSPRequestInvoker([(VSInternalMethods.TextDocumentUriPresentationName, htmlResponse)]); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/HtmlFormattingCollection.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/HtmlFormattingCollection.cs new file mode 100644 index 00000000000..0380b2d5675 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/HtmlFormattingCollection.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Razor.Formatting; +using Xunit; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[CollectionDefinition(Name)] +public class HtmlFormattingCollection : ICollectionFixture +{ + public const string Name = nameof(HtmlFormattingCollection); +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs new file mode 100644 index 00000000000..c7b1fd79b4c --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs @@ -0,0 +1,100 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.GoToDefinition; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class RazorComponentDefinitionServiceTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + // PREAMBLE: Right now these tests are about ensuring we don't accidentally introduce a future bug + // in the generated document handling code in the RazorComponentDefinitionService in OOP. + // Right now in cohosting none of the code under test is actually used. This is because + // the logic for manually looking up properties from attributes is only necessary when + // "Single Server Mode" is off, which is currently only VS Code. When cohosting comes to + // VS Code, that will no longer be true, and VS Code will use the same code paths as VS, + // even then these tests will be exercising uncalled code. + // The tests, and the "ignoreAttributes" parameter in the call to GetDefinitionAsync, should + // be deleted entirely at that point. "ignoreAttributes" will essentially always be true, + // as directly calling Roslyn provides better results. + + [Fact] + public async Task Do() + { + TestCode input = """ + + + @code + { + private string? InputValue { get; set; } + + private void BindAfter() + { + } + } + """; + + TestCode surveyPrompt = """ + @namespace SomeProject + +
+ + @code + { + [Parameter] + public string [|Title|] { get; set; } + } + """; + + TestCode surveyPromptGeneratedCode = """ + using Microsoft.AspNetCore.Components; + + namespace SomeProject + { + public partial class SurveyPrompt : ComponentBase + { + [Parameter] + public string Title { get; set; } + } + } + """; + + await VerifyDefinitionAsync(input, surveyPrompt, (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); + } + + private async Task VerifyDefinitionAsync(TestCode input, TestCode expectedDocument, params (string fileName, string contents)[]? additionalFiles) + { + var document = await CreateProjectAndRazorDocumentAsync(input.Text, FileKinds.Component, additionalFiles); + + var service = OOPExportProvider.GetExportedValue(); + var documentSnapshotFactory = OOPExportProvider.GetExportedValue(); + var documentMappingService = OOPExportProvider.GetExportedValue(); + + var documentSnapshot = documentSnapshotFactory.GetOrCreate(document); + var codeDocument = await documentSnapshot.GetGeneratedOutputAsync(); + var positionInfo = documentMappingService.GetPositionInfo(codeDocument, input.Position); + + var location = await service.GetDefinitionAsync(documentSnapshot, positionInfo, ignoreAttributes: false, DisposalToken); + + Assert.NotNull(location); + + var text = SourceText.From(expectedDocument.Text); + var range = text.GetRange(expectedDocument.Span); + Assert.Equal(range, location.Range); + } + + private static string FileName(string projectRelativeFileName) + => Path.Combine(TestProjectData.SomeProjectPath, projectRelativeFileName); +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestBrokeredServiceInterceptor.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestBrokeredServiceInterceptor.cs index 7d0da662311..fffa4b394c6 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestBrokeredServiceInterceptor.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestBrokeredServiceInterceptor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; @@ -14,6 +15,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; internal sealed class TestBrokeredServiceInterceptor : IRazorBrokeredServiceInterceptor { private readonly TestSolutionStore _solutionStore = new(); + private readonly Dictionary _localToRemoteSolutionMap = []; public Task GetSolutionInfoAsync(Solution solution, CancellationToken cancellationToken) => _solutionStore.AddAsync(solution, cancellationToken); @@ -32,6 +34,18 @@ public ValueTask RunServiceAsync( Assert.NotNull(solution); + // Rather than actually syncing assets, we just let the test author directly map from a local solution + // to a remote solution; + if (_localToRemoteSolutionMap.TryGetValue(solution.Id, out var remoteSolution)) + { + solution = remoteSolution; + } + return implementation(solution); } + + internal void MapSolutionIdToRemote(SolutionId localSolutionId, Solution remoteSolution) + { + _localToRemoteSolutionMap.Add(localSolutionId, remoteSolution); + } } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestRemoteServiceInvoker.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestRemoteServiceInvoker.cs index 9e5c8651aac..581d08f35a4 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestRemoteServiceInvoker.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/TestRemoteServiceInvoker.cs @@ -57,6 +57,11 @@ private async Task GetOrCreateServiceAsync() return await invocation(service, solutionInfo, cancellationToken); } + public void MapSolutionIdToRemote(SolutionId localSolutionId, Solution remoteSolution) + { + _serviceInterceptor.MapSolutionIdToRemote(localSolutionId, remoteSolution); + } + public void Dispose() { _reentrantSemaphore.Dispose(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs similarity index 85% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs index f52c195fd07..5116954c420 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -public class DefaultRazorBreakpointResolverTest : ToolingTestBase +public class RazorBreakpointResolverTest : ToolingTestBase { private const string ValidBreakpointCSharp = "private int foo = 123;"; private const string InvalidBreakpointCSharp = "private int bar;"; @@ -27,9 +27,9 @@ public class DefaultRazorBreakpointResolverTest : ToolingTestBase private readonly ITextBuffer _csharpTextBuffer; private readonly Uri _documentUri; private readonly Uri _csharpDocumentUri; - private readonly ITextBuffer _hostTextbuffer; + private readonly ITextBuffer _hostTextBuffer; - public DefaultRazorBreakpointResolverTest(ITestOutputHelper testOutput) + public RazorBreakpointResolverTest(ITestOutputHelper testOutput) : base(testOutput) { _documentUri = new Uri("file://C:/path/to/file.razor", UriKind.Absolute); @@ -51,7 +51,7 @@ public class SomeRazorFile {{InvalidBreakpointCSharp}} } """); - _hostTextbuffer = new TestTextBuffer(textBufferSnapshot); + _hostTextBuffer = new TestTextBuffer(textBufferSnapshot); } [Fact] @@ -77,7 +77,7 @@ public async Task TryResolveBreakpointRangeAsync_UnknownRazorDocument_ReturnsNul var resolver = CreateResolverWith(documentManager: documentManager); // Act - var result = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var result = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(result); @@ -94,7 +94,7 @@ public async Task TryResolveBreakpointRangeAsync_UnsynchronizedCSharpDocument_Re var resolver = CreateResolverWith(documentManager: documentManager); // Act - var expressions = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var expressions = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(expressions); @@ -107,7 +107,7 @@ public async Task TryResolveBreakpointRangeAsync_UnprojectedLocation_ReturnsNull var resolver = CreateResolverWith(); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(breakpointRange); @@ -117,11 +117,11 @@ public async Task TryResolveBreakpointRangeAsync_UnprojectedLocation_ReturnsNull public async Task TryResolveBreakpointRangeAsync_NotValidBreakpointLocation_ReturnsNull() { // Arrange - var hostDocumentPosition = GetPosition(InvalidBreakpointCSharp, _hostTextbuffer); + var hostDocumentPosition = GetPosition(InvalidBreakpointCSharp, _hostTextBuffer); var resolver = CreateResolverWith(); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); // Assert Assert.Null(breakpointRange); @@ -131,7 +131,7 @@ public async Task TryResolveBreakpointRangeAsync_NotValidBreakpointLocation_Retu public async Task TryResolveBreakpointRangeAsync_MappableCSharpBreakpointLocation_ReturnsHostBreakpointLocation() { // Arrange - var hostDocumentPosition = GetPosition(ValidBreakpointCSharp, _hostTextbuffer); + var hostDocumentPosition = GetPosition(ValidBreakpointCSharp, _hostTextBuffer); var hostBreakpointRange = VsLspFactory.CreateSingleLineRange(start: hostDocumentPosition, length: ValidBreakpointCSharp.Length); var projectionProvider = new TestLSPBreakpointSpanProvider( _documentUri, @@ -142,34 +142,35 @@ public async Task TryResolveBreakpointRangeAsync_MappableCSharpBreakpointLocatio var resolver = CreateResolverWith(projectionProvider: projectionProvider); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); // Assert Assert.Equal(hostBreakpointRange, breakpointRange); } - private RazorBreakpointResolver CreateResolverWith( + private IRazorBreakpointResolver CreateResolverWith( FileUriProvider uriProvider = null, LSPDocumentManager documentManager = null, - LSPBreakpointSpanProvider projectionProvider = null) + ILSPBreakpointSpanProvider projectionProvider = null) { var documentUri = _documentUri; - uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextbuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextbuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); + uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextBuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextBuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); var csharpVirtualDocumentSnapshot = new CSharpVirtualDocumentSnapshot(projectKey: default, _csharpDocumentUri, _csharpTextBuffer.CurrentSnapshot, hostDocumentSyncVersion: 0); LSPDocumentSnapshot documentSnapshot = new TestLSPDocumentSnapshot(_documentUri, 0, csharpVirtualDocumentSnapshot); documentManager ??= Mock.Of(manager => manager.TryGetDocument(_documentUri, out documentSnapshot) == true, MockBehavior.Strict); if (projectionProvider is null) { - projectionProvider = new Mock(MockBehavior.Strict).Object; + projectionProvider = new Mock(MockBehavior.Strict).Object; Mock.Get(projectionProvider) .Setup(projectionProvider => projectionProvider.GetBreakpointSpanAsync( It.IsAny(), + It.IsAny(), It.IsAny(), DisposalToken)) .ReturnsAsync(value: null); } - var razorBreakpointResolver = new DefaultRazorBreakpointResolver(uriProvider, documentManager, projectionProvider); + var razorBreakpointResolver = new RazorBreakpointResolver(uriProvider, documentManager, projectionProvider); return razorBreakpointResolver; } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs similarity index 83% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs index b107a2fb3fc..23bc07fd62c 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs @@ -20,16 +20,16 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -public class DefaultRazorProximityExpressionResolverTest : ToolingTestBase +public class RazorProximityExpressionResolverTest : ToolingTestBase { private readonly string _validProximityExpressionRoot; private readonly string _invalidProximityExpressionRoot; private readonly ITextBuffer _csharpTextBuffer; private readonly Uri _documentUri; private readonly Uri _csharpDocumentUri; - private readonly ITextBuffer _hostTextbuffer; + private readonly ITextBuffer _hostTextBuffer; - public DefaultRazorProximityExpressionResolverTest(ITestOutputHelper testOutput) + public RazorProximityExpressionResolverTest(ITestOutputHelper testOutput) : base(testOutput) { _documentUri = new Uri("file://C:/path/to/file.razor", UriKind.Absolute); @@ -51,7 +51,7 @@ public void Render() _csharpTextBuffer = new TestTextBuffer(csharpTextSnapshot); var textBufferSnapshot = new StringTextSnapshot($$"""@{{{_invalidProximityExpressionRoot}}} @code {{{_validProximityExpressionRoot}}}"""); - _hostTextbuffer = new TestTextBuffer(textBufferSnapshot); + _hostTextBuffer = new TestTextBuffer(textBufferSnapshot); } [Fact] @@ -79,7 +79,7 @@ public async Task TryResolveProximityExpressionsAsync_UnknownRazorDocument_Retur var resolver = CreateResolverWith(documentManager: documentManager); // Act - var result = await resolver.TryResolveProximityExpressionsAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var result = await resolver.TryResolveProximityExpressionsAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(result); @@ -96,25 +96,25 @@ public async Task TryResolveProximityExpressionsAsync_UnsynchronizedCSharpDocume var resolver = CreateResolverWith(documentManager: documentManager); // Act - var expressions = await resolver.TryResolveProximityExpressionsAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var expressions = await resolver.TryResolveProximityExpressionsAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(expressions); } - private RazorProximityExpressionResolver CreateResolverWith( + private IRazorProximityExpressionResolver CreateResolverWith( FileUriProvider uriProvider = null, LSPDocumentManager documentManager = null) { var documentUri = _documentUri; - uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextbuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextbuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); + uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextBuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextBuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); var csharpVirtualDocumentSnapshot = new CSharpVirtualDocumentSnapshot(projectKey: default, _csharpDocumentUri, _csharpTextBuffer.CurrentSnapshot, hostDocumentSyncVersion: 0); LSPDocumentSnapshot documentSnapshot = new TestLSPDocumentSnapshot(_documentUri, 0, csharpVirtualDocumentSnapshot); documentManager ??= Mock.Of( manager => manager.TryGetDocument(_documentUri, out documentSnapshot) == true, MockBehavior.Strict); - var razorProximityExpressionResolver = new DefaultRazorProximityExpressionResolver( + var razorProximityExpressionResolver = new RazorProximityExpressionResolver( uriProvider, documentManager, TestLSPProximityExpressionProvider.Instance); @@ -122,7 +122,7 @@ private RazorProximityExpressionResolver CreateResolverWith( return razorProximityExpressionResolver; } - private class TestLSPProximityExpressionProvider : LSPProximityExpressionsProvider + private class TestLSPProximityExpressionProvider : ILSPProximityExpressionsProvider { public static readonly TestLSPProximityExpressionProvider Instance = new(); @@ -130,7 +130,7 @@ private TestLSPProximityExpressionProvider() { } - public override Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { return SpecializedTasks.Null>(); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs index b594365bdd2..dc7e3527557 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs @@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -internal class TestLSPBreakpointSpanProvider : LSPBreakpointSpanProvider +internal class TestLSPBreakpointSpanProvider : ILSPBreakpointSpanProvider { private readonly Uri _documentUri; private readonly IReadOnlyDictionary _mappings; @@ -36,7 +36,7 @@ public TestLSPBreakpointSpanProvider(Uri documentUri, IReadOnlyDictionary GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { if (documentSnapshot.Uri != _documentUri) { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/TestLSPRequestInvoker.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/TestLSPRequestInvoker.cs index 3bbf1c56ee0..c4d01769a9f 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/TestLSPRequestInvoker.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/TestLSPRequestInvoker.cs @@ -111,7 +111,8 @@ public async override Task> ReinvokeRequestOnServerAs return new ReinvocationResponse(languageClientName: RazorLSPConstants.RazorCSharpLanguageServerName, result); } - if (_htmlResponses.TryGetValue(method, out var response)) + if (_htmlResponses is not null && + _htmlResponses.TryGetValue(method, out var response)) { return new ReinvocationResponse(languageClientName: "html", (TOut)response); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj index 266d9132319..7a7dbddfdb0 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj @@ -30,4 +30,8 @@ + + + + diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs similarity index 96% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs index 60c229fa704..62b66ef903e 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs @@ -22,7 +22,7 @@ namespace Microsoft.VisualStudio.Razor.ProjectSystem; -public class DefaultProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase +public class ProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase { private static readonly HostDocument[] s_documents = [ @@ -52,7 +52,7 @@ public class DefaultProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase private readonly TestProjectSnapshotManager _projectManager; private readonly SourceText _sourceText; - public DefaultProjectSnapshotManagerTest(ITestOutputHelper testOutput) + public ProjectSnapshotManagerTest(ITestOutputHelper testOutput) : base(testOutput) { var someTagHelpers = ImmutableArray.Create( @@ -191,6 +191,8 @@ await _projectManager.UpdateAsync(updater => filePath => filePath == s_documents[0].FilePath); listener.AssertNoNotifications(); + + Assert.Equal(1, project.GetDocument(s_documents[0].FilePath)!.Version); } [UIFact] @@ -469,6 +471,8 @@ await _projectManager.UpdateAsync(updater => Assert.Same(_sourceText, text); Assert.True(_projectManager.IsDocumentOpen(s_documents[0].FilePath)); + + Assert.Equal(2, document.Version); } [UIFact] @@ -505,6 +509,7 @@ await _projectManager.UpdateAsync(updater => var text = await document.GetTextAsync(); Assert.Same(expected, text); Assert.False(_projectManager.IsDocumentOpen(s_documents[0].FilePath)); + Assert.Equal(3, document.Version); } [UIFact] @@ -569,6 +574,7 @@ await _projectManager.UpdateAsync(updater => Assert.NotNull(document); var text = await document.GetTextAsync(); Assert.Same(expected, text); + Assert.Equal(3, document.Version); } [UIFact] @@ -602,6 +608,7 @@ await _projectManager.UpdateAsync(updater => Assert.NotNull(document); var text = await document.GetTextAsync(); Assert.Same(expected, text); + Assert.Equal(3, document.Version); } [UIFact] @@ -749,6 +756,29 @@ await _projectManager.UpdateAsync(updater => listener.AssertNoNotifications(); } + [UIFact] + public async Task ProjectWorkspaceStateChanged_UpdateDocuments() + { + // Arrange + await _projectManager.UpdateAsync(updater => + { + updater.ProjectAdded(s_hostProject); + updater.DocumentAdded(s_hostProject.Key, s_documents[0], null!); + }); + + // Act + await _projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(s_hostProject.Key, _projectWorkspaceStateWithTagHelpers); + }); + + // Assert + var document = _projectManager.GetLoadedProject(s_hostProject.Key).GetDocument(s_documents[0].FilePath); + + Assert.NotNull(document); + Assert.Equal(2, document.Version); + } + [UIFact] public async Task ProjectWorkspaceStateChanged_WithHostProject_FirstTime_NotifiesListeners() { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs index 4dd8aa8e590..b4509b4df5f 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs @@ -70,7 +70,7 @@ public void ValidateBreakpointLocation_ValidBreakpointRange_ReturnsSOK() { // Arrange var breakpointRange = VsLspFactory.CreateRange(2, 4, 3, 5); - var breakpointResolver = Mock.Of(resolver => resolver.TryResolveBreakpointRangeAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(breakpointRange), MockBehavior.Strict); + var breakpointResolver = Mock.Of(resolver => resolver.TryResolveBreakpointRangeAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(breakpointRange), MockBehavior.Strict); var languageService = CreateLanguageServiceWith(breakpointResolver); // Act @@ -146,7 +146,7 @@ public void GetProximityExpressions_ValidRange_ReturnsSOK() { // Arrange IReadOnlyList expressions = new[] { "something" }; - var resolver = Mock.Of(resolver => resolver.TryResolveProximityExpressionsAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(expressions), MockBehavior.Strict); + var resolver = Mock.Of(resolver => resolver.TryResolveProximityExpressionsAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(expressions), MockBehavior.Strict); var languageService = CreateLanguageServiceWith(proximityExpressionResolver: resolver); // Act @@ -174,14 +174,14 @@ public void GetProximityExpressions_CanNotCreateDialog_ReturnsEFail() } private RazorLanguageService CreateLanguageServiceWith( - RazorBreakpointResolver breakpointResolver = null, - RazorProximityExpressionResolver proximityExpressionResolver = null, + IRazorBreakpointResolver breakpointResolver = null, + IRazorProximityExpressionResolver proximityExpressionResolver = null, IUIThreadOperationExecutor uiThreadOperationExecutor = null, IVsEditorAdaptersFactoryService editorAdaptersFactory = null) { if (breakpointResolver is null) { - breakpointResolver = new Mock(MockBehavior.Strict).Object; + breakpointResolver = new Mock(MockBehavior.Strict).Object; Mock.Get(breakpointResolver) .Setup(r => r.TryResolveBreakpointRangeAsync( It.IsAny(), @@ -193,7 +193,7 @@ private RazorLanguageService CreateLanguageServiceWith( if (proximityExpressionResolver is null) { - proximityExpressionResolver = new Mock(MockBehavior.Strict).Object; + proximityExpressionResolver = new Mock(MockBehavior.Strict).Object; Mock.Get(proximityExpressionResolver) .Setup(r => r.TryResolveProximityExpressionsAsync( It.IsAny(), diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Telemetry/TelemetryReporterTests.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Telemetry/TelemetryReporterTests.cs index 50fa4623eba..0f269a51b9a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Telemetry/TelemetryReporterTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Telemetry/TelemetryReporterTests.cs @@ -2,7 +2,9 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Telemetry; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.VisualStudio.Editor.Razor.Test.Shared; @@ -392,4 +394,33 @@ public void ReportFault_InnerMostExceptionIsOperationCanceledException_SkipsFaul // Assert Assert.Empty(reporter.Events); } + + [Theory, MemberData(nameof(s_throwFunctions))] + public void GetModifiedFaultParameters_FiltersCorrectly(Func throwAction) + { + try + { + throwAction(); + } + catch (Exception ex) + { + var (param1, param2) = TestTelemetryReporter.GetModifiedFaultParameters(ex); + + Assert.Equal("Microsoft.VisualStudio.LanguageServices.Razor.Test", param1); + Assert.NotNull(param2); + + // Depending on debug/release the stack can contain a constructor or + // a call to this method. We expect one or the other and both + // are valid +#if DEBUG + Assert.StartsWith("<.cctor>", param2); +#else + Assert.Equal("GetModifiedFaultParameters_FiltersCorrectly", param2); +#endif + } + } + + public static readonly IEnumerable s_throwFunctions = [ + [() => ((object?)null).AssumeNotNull()] + ]; } diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs index 0c7b2caf527..2cc9e500372 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs @@ -378,7 +378,7 @@ private void RunPartialParseTest(TestEdit edit, PartialParseResultInternal addit Assert.Equal(PartialParseResultInternal.Accepted | additionalFlags, result); var newSource = TestRazorSourceDocument.Create(edit.NewSnapshot.GetText()); - var newSyntaxTree = RazorSyntaxTree.Create(parser.ModifiedSyntaxTreeRoot, newSource, parser.OriginalSyntaxTree.Diagnostics, parser.OriginalSyntaxTree.Options); + var newSyntaxTree = new RazorSyntaxTree(parser.ModifiedSyntaxTreeRoot, newSource, parser.OriginalSyntaxTree.Diagnostics, parser.OriginalSyntaxTree.Options); BaselineTest(newSyntaxTree); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs index 8ba0b8b426f..0f5427a7a3b 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs @@ -551,7 +551,7 @@ private void VerifyPartialParseTree(TestParserManager manager, string content, s } var sourceDocument = TestRazorSourceDocument.Create(content); - var syntaxTree = RazorSyntaxTree.Create(manager.PartialParsingSyntaxTreeRoot, sourceDocument, manager.CurrentSyntaxTree!.Diagnostics, manager.CurrentSyntaxTree.Options); + var syntaxTree = new RazorSyntaxTree(manager.PartialParsingSyntaxTreeRoot, sourceDocument, manager.CurrentSyntaxTree!.Diagnostics, manager.CurrentSyntaxTree.Options); BaselineTest(syntaxTree); } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs index 54c9c11d2c6..a2017ae8d96 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs @@ -44,6 +44,9 @@ public override async Task InitializeAsync() VisualStudioLogging.AddCustomLoggers(); + // Our expected test results have spaces not tabs + await TestServices.Shell.SetInsertSpacesAsync(ControlledHangMitigatingCancellationToken); + _projectFilePath = await CreateAndOpenBlazorProjectAsync(ControlledHangMitigatingCancellationToken); await TestServices.SolutionExplorer.RestoreNuGetPackagesAsync(ControlledHangMitigatingCancellationToken); diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs index 81eb2aa6601..7cacf5c1d96 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs @@ -17,13 +17,15 @@ public async Task SetBreakpoint_FirstCharacter_SpanAdjusts() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync("

@{ var abc = 123; }

", ControlledHangMitigatingCancellationToken); - // Act - await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync("

@{ var abc = 123; }

", ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); - // Assert - await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 7, ControlledHangMitigatingCancellationToken); + Assert.True(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken)); + + Assert.True(await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 7, ControlledHangMitigatingCancellationToken)); } [IdeFact] @@ -34,15 +36,17 @@ public async Task SetBreakpoint_FirstCharacter_InvalidLine() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync(@"

@{ - var abc = 123; -}

", ControlledHangMitigatingCancellationToken); - // Act - var result = await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync(""" +

@{ + var abc = 123; + }

+ """, ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); - // Assert - Assert.False(result); + Assert.False(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken)); } [IdeFact] @@ -53,14 +57,18 @@ public async Task SetBreakpoint_FirstCharacter_ValidLine() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync(@"

@{ - var abc = 123; -}

", ControlledHangMitigatingCancellationToken); - // Act - await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync(""" +

@{ + var abc = 123; + }

+ """, ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); + + Assert.True(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 1, ControlledHangMitigatingCancellationToken)); - // Assert - await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 4, ControlledHangMitigatingCancellationToken); + Assert.True(await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 5, ControlledHangMitigatingCancellationToken)); } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs index 8c8c8a12945..baf48dd0985 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs @@ -2,8 +2,10 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; +using Microsoft.VisualStudio.Extensibility.Testing; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; @@ -17,55 +19,270 @@ public class CompletionIntegrationTests(ITestOutputHelper testOutputHelper) : Ab [IdeFact] public async Task SnippetCompletion_Html() { - await TestServices.SolutionExplorer.AddFileAsync( - RazorProjectConstants.BlazorProjectName, - "Test.razor", - """ -@page "Test" + await VerifyTypeAndCommitCompletionAsync( + input: """ + @page "Test" -Test + Test + +

Test

+ + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + output: """ + @page "Test" -

Test

+ Test -@code { - private int currentCount = 0; +

Test

+
+
+
+
- private void IncrementCount() + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + search: "

Test

", + stringsToType: ["{ENTER}", "d", "d"]); + } + + [IdeFact, WorkItem("https://github.com/dotnet/razor/issues/10787")] + public async Task CompletionCommit_HtmlAttributeWithoutValue() { - currentCount++; + await VerifyTypeAndCommitCompletionAsync( + input: """ + @page "Test" + + Test + + + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + output: """ + @page "Test" + + Test + + + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + search: "Test", charsOffset: 1, ControlledHangMitigatingCancellationToken); - TestServices.Input.Send("{ENTER}"); - TestServices.Input.Send("d"); - TestServices.Input.Send("d"); + Test - await CommitCompletionAndVerifyAsync(""" -@page "Test" + + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + output: """ + @page "Test" -Test + Test -

Test

-
-
-
-
+ -@code { - private int currentCount = 0; + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + search: "Test + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + output: """ + @page "Test" + + Test + + ", + stringsToType: ["{ENTER}", "{ENTER}", "<", "s", "p", "a"], + commitChar: null, + expectedSelectedItemLabel: "span"); } -} -"""); + + [IdeFact] + public async Task CompletionCommit_WithAngleBracket_HtmlTag() + { + await VerifyTypeAndCommitCompletionAsync( + input: """ + @page "Test" + + Test + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + output: """ + @page "Test" + + Test + + + + @code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } + } + """, + search: "", + stringsToType: ["{ENTER}", "{ENTER}", "<", "s", "p", "a"], + commitChar: '>', + "span"); + } + + [IdeFact] + public async Task CompletionCommit_CSharp() + { + await VerifyTypeAndCommitCompletionAsync( + input: """ + @page "Test" + + Test + + @code { + private int myCurrentCount = 0; + + private void IncrementCount() + { + myCurrentCount++; + } + } + """, + output: """ + @page "Test" + + Test + + @code { + private int myCurrentCount = 0; + + private void IncrementCount() + { + myCurrentCount++; + + myCurrentCount + } + } + """, + search: "myCurrentCount++;", + stringsToType: ["{ENTER}", "{ENTER}", "m", "y", "C", "u", "r"]); + } + + private async Task VerifyTypeAndCommitCompletionAsync(string input, string output, string search, string[] stringsToType, char? commitChar = null, string? expectedSelectedItemLabel = null) + { + await TestServices.SolutionExplorer.AddFileAsync( + RazorProjectConstants.BlazorProjectName, + "Test.razor", + input, + open: true, + ControlledHangMitigatingCancellationToken); + + await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); + + await TestServices.Editor.PlaceCaretAsync(search, charsOffset: 1, ControlledHangMitigatingCancellationToken); + foreach (var stringToType in stringsToType) + { + TestServices.Input.Send(stringToType); + } + + if (expectedSelectedItemLabel is not null) + { + await CommitCompletionAndVerifyAsync(output, expectedSelectedItemLabel, commitChar); + } + else + { + await CommitCompletionAndVerifyAsync(output, commitChar); + } } [IdeFact] @@ -225,12 +442,25 @@ public enum MyEnum """); } - private async Task CommitCompletionAndVerifyAsync(string expected) + private async Task CommitCompletionAndVerifyAsync(string expected, char? commitChar = null) { var session = await TestServices.Editor.WaitForCompletionSessionAsync(HangMitigatingCancellationToken); Assert.NotNull(session); - Assert.True(session.CommitIfUnique(HangMitigatingCancellationToken)); + if (commitChar.HasValue) + { + // Commit using the specified commit character + session.Commit(commitChar.Value, HangMitigatingCancellationToken); + + // session.Commit call above commits as if the commit character was typed, + // but doesn't actually insert the character into the buffer. + // So we still need to insert the character into the buffer ourselves. + TestServices.Input.Send(commitChar.Value.ToString()); + } + else + { + Assert.True(session.CommitIfUnique(HangMitigatingCancellationToken)); + } var textView = await TestServices.Editor.GetActiveTextViewAsync(HangMitigatingCancellationToken); var text = textView.TextBuffer.CurrentSnapshot.GetText(); @@ -239,4 +469,41 @@ private async Task CommitCompletionAndVerifyAsync(string expected) // tests allow for it as long as the content is correct AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, text); } + + private async Task CommitCompletionAndVerifyAsync(string expected, string expectedSelectedItemLabel, char? commitChar = null) + { + // Actually open completion UI and wait for it have selected item we are interested in + var session = await TestServices.Editor.OpenCompletionSessionAndWaitForItemAsync(TimeSpan.FromSeconds(10), expectedSelectedItemLabel, HangMitigatingCancellationToken); + + Assert.NotNull(session); + if (commitChar is char commitCharValue) + { + // Commit using the specified commit character + session.Commit(commitCharValue, HangMitigatingCancellationToken); + + // session.Commit call above commits as if the commit character was typed, + // but doesn't actually insert the character into the buffer. + // So we still need to insert the character into the buffer ourselves. + TestServices.Input.Send(commitCharValue.ToString()); + } + else + { + Assert.True(session.CommitIfUnique(HangMitigatingCancellationToken)); + } + + var textView = await TestServices.Editor.GetActiveTextViewAsync(HangMitigatingCancellationToken); + + var stopwatch = new Stopwatch(); + string text; + while ((text = textView.TextBuffer.CurrentSnapshot.GetText()) != expected && stopwatch.ElapsedMilliseconds < EditorInProcess.DefaultCompletionWaitTimeMilliseconds) + { + // Text might get updated *after* completion by something like auto-insert, so wait for the desired text + await Task.Delay(100, HangMitigatingCancellationToken); + } + + // Snippets may have slight whitespace differences due to line endings. These + // tests allow for it as long as the content is correct + Assert.Equal(expected, text); + } + } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs index 4ffa1015ba4..7d7b23d949a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs @@ -24,27 +24,11 @@ public class FormatDocumentTests(ITestOutputHelper testOutputHelper) : AbstractR // If you want to generate the "after" state simple run the test without // creating the expected file, and it will be generated for you. // - // Things that aren't (yet?) supported: - // * Formatting must change the input state or the test will hang - // ie. these tests cannot be used for pure validation - // * Test input is always placed in a .razor file, so .cshtml specific - // quirks can't be validated - // - // You'll just have to write tests for those ones :P + // NOTE: Formatting must change the input state or the test will hang + // ie. these tests cannot be used for pure validation [IdeTheory] - [InlineData("BadlyFormattedCounter.razor")] - [InlineData("FormatCommentWithKeyword.cshtml")] - [InlineData("FormatDocument.cshtml")] - [InlineData("FormatDocumentAfterEdit.cshtml")] - [InlineData("FormatDocumentWithTextAreaAttributes.cshtml")] - [InlineData("FormatIfBlockInsideForBlock.cshtml")] - [InlineData("FormatOnPaste.cshtml")] - [InlineData("FormatOnPasteContainedLanguageCode.cshtml")] - [InlineData("FormatSelection.cshtml")] - [InlineData("FormatSelectionStartingWithContainedLanguageCode.cshtml")] - [InlineData("FormatSwitchCaseBlock.cshtml")] - [InlineData("RazorInCssClassAttribute.cshtml")] + [MemberData(nameof(GetFormattingTestResourceNames))] public async Task FormattingDocument(string testFileName) { var inputResourceName = GetResourceName(testFileName, "Input"); @@ -92,8 +76,11 @@ public async Task FormattingDocument(string testFileName) AssertEx.EqualOrDiff(expected, actual); } + private static string GetResourceBaseName() + => $"{typeof(FormatDocumentTests).Namespace}.Formatting.TestFiles"; + private static string GetResourceName(string name, string suffix) - => $"{typeof(FormatDocumentTests).Namespace}.Formatting.TestFiles.{suffix}.{name}"; + => $"{GetResourceBaseName()}.{suffix}.{name}"; private static bool TryGetResource(string name, [NotNullWhen(true)] out string? value) { @@ -112,4 +99,21 @@ private static bool TryGetResource(string name, [NotNullWhen(true)] out string? return true; } + + public static TheoryData GetFormattingTestResourceNames() + { + var baseName = $"{GetResourceBaseName()}.Input."; + var data = new TheoryData(); + var names = typeof(FormatDocumentTests).Assembly.GetManifestResourceNames(); + + foreach (var name in names) + { + if (name.StartsWith(baseName)) + { + data.Add(Path.GetFileName(name)[baseName.Length..]); + } + } + + return data; + } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatCommentWithKeyword.cshtml b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatCommentWithKeyword.cshtml index 22a432e6b73..9e56c758b58 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatCommentWithKeyword.cshtml +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatCommentWithKeyword.cshtml @@ -1,7 +1,7 @@ 

@* - {{{{{{{ - *@ +{{{{{{{ +*@ @while (true) { } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatDocument.cshtml b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatDocument.cshtml index 5e30f6590e2..29a95b3bf6d 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatDocument.cshtml +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Expected/FormatDocument.cshtml @@ -1,7 +1,7 @@ 

@* - test - *@ +test +*@ @while (true) { } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs index d8c08224a56..4d8c7f45290 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs @@ -39,7 +39,7 @@ public async Task VerifyBreakpointAsync(string fileName, int line, int cha foreach (EnvDTE.Breakpoint breakpoint in debugger.Breakpoints) { - if (breakpoint.File == fileName && + if (breakpoint.File.EndsWith(fileName) && breakpoint.FileLine == line && breakpoint.FileColumn == character) { diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Completion.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Completion.cs index 838e2eb79e8..caf687e31ee 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Completion.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/EditorInProcess_Completion.cs @@ -12,6 +12,8 @@ namespace Microsoft.VisualStudio.Extensibility.Testing; internal partial class EditorInProcess { + public const int DefaultCompletionWaitTimeMilliseconds = 10000; + public async Task DismissCompletionSessionsAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); @@ -55,4 +57,43 @@ public async Task DismissCompletionSessionsAsync(CancellationToken cancellationT return session; } + + ///

+ /// Open completion pop-up window UI and wait for the specified item to be present selected + /// + /// + /// + /// + /// Completion session that has matching selected item, or null otherwise + public async Task OpenCompletionSessionAndWaitForItemAsync(TimeSpan timeOut, string selectedItemLabel, CancellationToken cancellationToken) + { + await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + // Returns completion session that might or might not be visible in the IDE + var session = await WaitForCompletionSessionAsync(timeOut, cancellationToken); + + if (session is null) + { + return null; + } + + var textView = await GetActiveTextViewAsync(cancellationToken); + var stopWatch = Stopwatch.StartNew(); + + // Actually open the completion pop-up window and force visible items to be computed or re-computed + session.OpenOrUpdate(new CompletionTrigger(CompletionTriggerReason.Insertion, textView.TextSnapshot), textView.Caret.Position.BufferPosition, cancellationToken); + while (session.GetComputedItems(cancellationToken).SelectedItem?.DisplayText != selectedItemLabel) + { + if (stopWatch.ElapsedMilliseconds >= timeOut.TotalMilliseconds) + { + return null; + } + + await Task.Delay(100, cancellationToken); + + session.OpenOrUpdate(new CompletionTrigger(CompletionTriggerReason.Insertion, textView.TextSnapshot), textView.Caret.Position.BufferPosition, cancellationToken); + } + + return session; + } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs index 04f8659b0f8..98b4f5c7534 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs @@ -127,4 +127,43 @@ await Helper.RetryAsync(ct => }, TimeSpan.FromMilliseconds(100), cancellationToken); } + + public async Task WaitForCSharpVirtualDocumentUpdateAsync(string projectName, string relativeFilePath, Func updater, CancellationToken cancellationToken) + { + var filePath = await TestServices.SolutionExplorer.GetAbsolutePathForProjectRelativeFilePathAsync(projectName, relativeFilePath, cancellationToken); + + var documentManager = await TestServices.Shell.GetComponentModelServiceAsync(cancellationToken); + + var uri = new Uri(filePath, UriKind.Absolute); + + long? desiredVersion = null; + + await Helper.RetryAsync(async ct => + { + if (documentManager.TryGetDocument(uri, out var snapshot)) + { + if (snapshot.TryGetVirtualDocument(out var virtualDocument)) + { + if (!virtualDocument.ProjectKey.IsUnknown && + virtualDocument.Snapshot.Length > 0) + { + if (desiredVersion is null) + { + desiredVersion = virtualDocument.HostDocumentSyncVersion + 1; + await updater(); + } + else if (virtualDocument.HostDocumentSyncVersion == desiredVersion) + { + return true; + } + } + + return false; + } + } + + return false; + + }, TimeSpan.FromMilliseconds(100), cancellationToken); + } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs index efdf2a1b200..c7867c4a50f 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs @@ -4,7 +4,10 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.VisualStudio.Razor; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.TextManager.Interop; +using Xunit; namespace Microsoft.VisualStudio.Extensibility.Testing; @@ -22,4 +25,16 @@ public async Task GetActiveDocumentFileNameAsync(CancellationToken cance var documentPath = (string)documentPathObj; return Path.GetFileName(documentPath); } + + public async Task SetInsertSpacesAsync(CancellationToken cancellationToken) + { + var textManager = await GetRequiredGlobalServiceAsync(cancellationToken); + + var langPrefs3 = new LANGPREFERENCES3[] { new LANGPREFERENCES3() { guidLang = RazorConstants.RazorLanguageServiceGuid } }; + Assert.Equal(VSConstants.S_OK, textManager.GetUserPreferences4(null, langPrefs3, null)); + + langPrefs3[0].fInsertTabs = 0; + + Assert.Equal(VSConstants.S_OK, textManager.SetUserPreferences4(null, langPrefs3, null)); + } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs index 37e533b0cca..697a10f79a8 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs @@ -60,7 +60,7 @@ public async Task Rename_ComponentAttribute_FromCSharpInRazor() await TestServices.Editor.VerifyTextContainsAsync("@ZooperDooper", ControlledHangMitigatingCancellationToken); } - [IdeFact] + [IdeFact(Skip = "https://github.com/dotnet/razor/issues/10820")] public async Task Rename_ComponentAttribute_FromCSharpInCSharp() { // Create the file diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs index 6172ec66877..d9cea544a10 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs @@ -89,7 +89,14 @@ private static void FeedbackLoggerInternal(string filePath, params string[] expe var files = new List(); foreach (var feedbackFileProvider in feedbackFileProviders) { - files.AddRange(feedbackFileProvider.GetFiles()); + try + { + files.AddRange(feedbackFileProvider.GetFiles()); + } + catch + { + // If one of the providers has issues, we don't want it causing us to not be able to report our stuff properly + } } _ = CollectFeedbackItemsAsync(files, filePath, expectedFileParts); diff --git a/src/Shared/Directory.Build.props b/src/Shared/Directory.Build.props index 22e7f16332f..e269e4a7fe1 100644 --- a/src/Shared/Directory.Build.props +++ b/src/Shared/Directory.Build.props @@ -14,7 +14,7 @@ LatestMajor - + diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs index e1726562363..91ae5629e82 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectReaders.cs @@ -42,6 +42,8 @@ public static RazorConfiguration ReadConfigurationFromProperties(JsonDataReader { var configurationName = reader.ReadNonNullString(nameof(RazorConfiguration.ConfigurationName)); var languageVersionText = reader.ReadNonNullString(nameof(RazorConfiguration.LanguageVersion)); + var suppressAddComponentParameter = reader.ReadBooleanOrFalse(nameof(RazorConfiguration.SuppressAddComponentParameter)); + var useConsolidatedMvcViews = reader.ReadBooleanOrTrue(nameof(RazorConfiguration.UseConsolidatedMvcViews)); var extensions = reader.ReadImmutableArrayOrEmpty(nameof(RazorConfiguration.Extensions), static r => { @@ -53,7 +55,7 @@ public static RazorConfiguration ReadConfigurationFromProperties(JsonDataReader ? version : RazorLanguageVersion.Version_2_1; - return new(languageVersion, configurationName, extensions); + return new(languageVersion, configurationName, extensions, SuppressAddComponentParameter: suppressAddComponentParameter); } public static RazorDiagnostic ReadDiagnostic(JsonDataReader reader) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs index c8998ca6fc9..aad91449d2b 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/ObjectWriters.cs @@ -35,6 +35,9 @@ public static void WriteProperties(JsonDataWriter writer, RazorConfiguration val writer.Write(nameof(value.LanguageVersion), languageVersionText); + writer.WriteIfNotFalse(nameof(value.SuppressAddComponentParameter), value.SuppressAddComponentParameter); + writer.WriteIfNotTrue(nameof(value.UseConsolidatedMvcViews), value.UseConsolidatedMvcViews); + writer.WriteArrayIfNotNullOrEmpty(nameof(value.Extensions), value.Extensions, static (w, v) => w.Write(v.ExtensionName)); } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/SerializationFormat.cs b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/SerializationFormat.cs index 1be32b7f927..c6a8db23f4a 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/SerializationFormat.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Serialization.Json/SerializationFormat.cs @@ -9,5 +9,5 @@ internal static class SerializationFormat // or any of the types that compose it changes. This includes: RazorConfiguration, // ProjectWorkspaceState, TagHelperDescriptor, and DocumentSnapshotHandle. // NOTE: If this version is changed, a coordinated insertion is required between Roslyn and Razor for the C# extension. - public const int Version = 5; + public const int Version = 6; } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ErrorCode.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ErrorCode.cs index 642478e173c..feb1b0102b5 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ErrorCode.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ErrorCode.cs @@ -36,4 +36,5 @@ public enum ErrorCode WRN_NullReferenceReceiver = 8602, WRN_UninitializedNonNullableField = 8618, WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode = 8669, + ERR_IllegalAtSequence = 9008, } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index e4f695cc133..b884acf51ef 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -15,32 +15,14 @@ public static CodeRenderingContext CreateDesignTime( RazorSourceDocument source = null, IntermediateNodeWriter nodeWriter = null) { + nodeWriter ??= new RuntimeNodeWriter(); + source ??= TestRazorSourceDocument.Create(); var documentNode = new DocumentIntermediateNode(); - var options = RazorCodeGenerationOptions.CreateDesignTimeDefault(); - if (source == null) - { - source = TestRazorSourceDocument.Create(); - } - - var codeDocument = RazorCodeDocument.Create(source); - if (newLineString != null) - { - codeDocument.Items[CodeRenderingContext.NewLineString] = newLineString; - } - - if (suppressUniqueIds != null) - { - codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = suppressUniqueIds; - } - - if (nodeWriter == null) - { - nodeWriter = new DesignTimeNodeWriter(); - } + var options = ConfigureOptions(RazorCodeGenerationOptions.DesignTimeDefault, newLineString, suppressUniqueIds); - var context = new DefaultCodeRenderingContext(nodeWriter, codeDocument, documentNode, options); - context.Visitor = new RenderChildrenVisitor(context); + var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); + context.SetVisitor(new RenderChildrenVisitor(context.CodeWriter)); return context; } @@ -51,47 +33,45 @@ public static CodeRenderingContext CreateRuntime( RazorSourceDocument source = null, IntermediateNodeWriter nodeWriter = null) { + nodeWriter ??= new RuntimeNodeWriter(); + source ??= TestRazorSourceDocument.Create(); var documentNode = new DocumentIntermediateNode(); - var options = RazorCodeGenerationOptions.CreateDefault(); - if (source == null) - { - source = TestRazorSourceDocument.Create(); - } + var options = ConfigureOptions(RazorCodeGenerationOptions.Default, newLineString, suppressUniqueIds); + + var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); + context.SetVisitor(new RenderChildrenVisitor(context.CodeWriter)); + + return context; + } - var codeDocument = RazorCodeDocument.Create(source); - if (newLineString != null) + private static RazorCodeGenerationOptions ConfigureOptions(RazorCodeGenerationOptions options, string newLine, string suppressUniqueIds) + { + if (newLine is null && suppressUniqueIds is null) { - codeDocument.Items[CodeRenderingContext.NewLineString] = newLineString; + return options; } - if (suppressUniqueIds != null) + var builder = options.ToBuilder(); + + if (newLine is not null) { - codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = suppressUniqueIds; + builder.NewLine = newLine; } - if (nodeWriter == null) + if (suppressUniqueIds is not null) { - nodeWriter = new RuntimeNodeWriter(); + builder.SuppressUniqueIds = suppressUniqueIds; } - var context = new DefaultCodeRenderingContext(nodeWriter, codeDocument, documentNode, options); - context.Visitor = new RenderChildrenVisitor(context); - - return context; + return builder.Build(); } - private class RenderChildrenVisitor : IntermediateNodeVisitor + private class RenderChildrenVisitor(CodeWriter writer) : IntermediateNodeVisitor { - private readonly CodeRenderingContext _context; - public RenderChildrenVisitor(CodeRenderingContext context) - { - _context = context; - } - public override void VisitDefault(IntermediateNode node) { - _context.CodeWriter.WriteLine("Render Children"); + writer.WriteLine("Render Children"); } } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs index ae9ba577a3b..79c3db4ff59 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs @@ -10,7 +10,6 @@ using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Intermediate; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; @@ -299,7 +298,7 @@ private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, { return RazorProjectEngine.Create(configuration, FileSystem, b => { - b.Phases.Insert(0, new ConfigureCodeRenderingPhase(LineEnding)); + b.Features.Add(new ConfigureCodeGenerationOptionsFeature(LineEnding)); b.RegisterExtensions(); @@ -782,19 +781,14 @@ private static string NormalizeNewLines(string content, string lineEnding) return Regex.Replace(content, "(? directives, bool designTime = false, RazorParserFeatureFlags featureFlags = null, string fileKind = null) { - directives = directives ?? Array.Empty(); + directives = directives ?? []; var source = TestRazorSourceDocument.Create(document, filePath: null, relativePath: null, normalizeNewLines: true); var options = CreateParserOptions(version, directives, designTime, _validateSpanEditHandlers, featureFlags, fileKind); - var context = new ParserContext(source, options); + using var context = new ParserContext(source, options); var codeParser = new CSharpCodeParser(directives, context); var markupParser = new HtmlMarkupParser(context); @@ -207,11 +207,11 @@ internal virtual RazorSyntaxTree ParseDocument(RazorLanguageVersion version, str var root = markupParser.ParseDocument().CreateRed(); - var diagnostics = context.ErrorSink.Errors; + var diagnostics = context.ErrorSink.GetErrorsAndClear(); var codeDocument = RazorCodeDocument.Create(source); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, options); + var syntaxTree = new RazorSyntaxTree(root, source, diagnostics, options); codeDocument.SetSyntaxTree(syntaxTree); var defaultDirectivePass = new DefaultDirectiveSyntaxTreePass(); diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ReferenceUtil.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ReferenceUtil.cs index c1329b54189..4e7429e9dbf 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ReferenceUtil.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/ReferenceUtil.cs @@ -12,5 +12,7 @@ internal static class ReferenceUtil { public static ImmutableArray AspNetLatestAll { get; } = AspNetLatest.References.All; public static PortableExecutableReference AspNetLatestComponents { get; } = AspNetLatest.References.MicrosoftAspNetCoreComponents; + public static PortableExecutableReference AspNetLatestRazor { get; } = AspNetLatest.References.MicrosoftAspNetCoreRazor; public static ImmutableArray NetLatestAll { get; } = NetLatest.References.All; + public static PortableExecutableReference NetLatestSystemRuntime { get; } = NetLatest.References.SystemRuntime; } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs index 137ad28eb93..76dee4cb168 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/TestCompilation.cs @@ -9,6 +9,7 @@ using System.IO; using System.Linq; using System.Reflection; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.CSharp; using Microsoft.Extensions.DependencyModel; using Xunit; @@ -58,6 +59,8 @@ private static IEnumerable ResolvePaths(CompilationLibrary library) public static string AssemblyName => "TestAssembly"; + // When we use Basic.Reference.Assemblies everywhere, this overload should be removed. + // See also https://github.com/dotnet/razor/issues/10343. public static CSharpCompilation Create(Assembly assembly, SyntaxTree syntaxTree = null) { IEnumerable syntaxTrees = null; @@ -80,6 +83,21 @@ public static CSharpCompilation Create(Assembly assembly, SyntaxTree syntaxTree return compilation; } + public static CSharpCompilation Create() => Create(syntaxTrees: [], references: []); + + public static CSharpCompilation Create(IEnumerable syntaxTrees, IEnumerable references) + { + var compilation = CSharpCompilation.Create( + AssemblyName, + syntaxTrees, + [..references, ..ReferenceUtil.AspNetLatestAll], + new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); + + EnsureValidCompilation(compilation); + + return compilation; + } + private static void EnsureValidCompilation(CSharpCompilation compilation) { using (var stream = new MemoryStream()) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs new file mode 100644 index 00000000000..6cd347ae095 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs @@ -0,0 +1,525 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class EnumExtensionsTests +{ + private enum ByteEnum : byte + { + Flag1 = 1 << 0, + Flag2 = 1 << 1, + Flag3 = 1 << 2, + Flag4 = 1 << 3, + Flag5 = 1 << 4, + Flag6 = 1 << 5, + Flag7 = 1 << 6, + Flag8 = 1 << 7 + } + + [Fact] + public void TestByteSizedEnum() + { + ByteEnum actual = 0; + ByteEnum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag1); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag2); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag3); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag4); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag5); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag6); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag7); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag8); + + Assert.Equal(byte.MaxValue, (byte)actual); + Assert.Equal(byte.MaxValue, (byte)expected); + + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag8); + + Assert.Equal(0, (byte)actual); + Assert.Equal(0, (byte)expected); + + static void SetFlagAndAssert(ref ByteEnum actual, ref ByteEnum expected, ByteEnum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref ByteEnum actual, ref ByteEnum expected, ByteEnum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt16Enum : ushort + { + Flag1 = 1 << 0, + Flag2 = 1 << 1, + Flag3 = 1 << 2, + Flag4 = 1 << 3, + Flag5 = 1 << 4, + Flag6 = 1 << 5, + Flag7 = 1 << 6, + Flag8 = 1 << 7, + Flag9 = 1 << 8, + Flag10 = 1 << 9, + Flag11 = 1 << 10, + Flag12 = 1 << 11, + Flag13 = 1 << 12, + Flag14 = 1 << 13, + Flag15 = 1 << 14, + Flag16 = 1 << 15 + } + + [Fact] + public void TestUInt16SizedEnum() + { + UInt16Enum actual = 0; + UInt16Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag16); + + Assert.Equal(ushort.MaxValue, (ushort)actual); + Assert.Equal(ushort.MaxValue, (ushort)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag16); + + Assert.Equal(0, (ushort)actual); + Assert.Equal(0, (ushort)expected); + + static void SetFlagAndAssert(ref UInt16Enum actual, ref UInt16Enum expected, UInt16Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt16Enum actual, ref UInt16Enum expected, UInt16Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt32Enum : uint + { + Flag1 = 1u << 0, + Flag2 = 1u << 1, + Flag3 = 1u << 2, + Flag4 = 1u << 3, + Flag5 = 1u << 4, + Flag6 = 1u << 5, + Flag7 = 1u << 6, + Flag8 = 1u << 7, + Flag9 = 1u << 8, + Flag10 = 1u << 9, + Flag11 = 1u << 10, + Flag12 = 1u << 11, + Flag13 = 1u << 12, + Flag14 = 1u << 13, + Flag15 = 1u << 14, + Flag16 = 1u << 15, + Flag17 = 1u << 16, + Flag18 = 1u << 17, + Flag19 = 1u << 18, + Flag20 = 1u << 19, + Flag21 = 1u << 20, + Flag22 = 1u << 21, + Flag23 = 1u << 22, + Flag24 = 1u << 23, + Flag25 = 1u << 24, + Flag26 = 1u << 25, + Flag27 = 1u << 26, + Flag28 = 1u << 27, + Flag29 = 1u << 28, + Flag30 = 1u << 29, + Flag31 = 1u << 30, + Flag32 = 1u << 31 + } + + [Fact] + public void TestUInt32SizedEnum() + { + UInt32Enum actual = 0; + UInt32Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag16); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag17); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag18); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag19); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag20); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag21); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag22); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag23); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag24); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag25); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag26); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag27); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag28); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag29); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag30); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag31); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag32); + + Assert.Equal(uint.MaxValue, (uint)actual); + Assert.Equal(uint.MaxValue, (uint)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag16); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag17); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag18); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag19); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag20); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag21); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag22); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag23); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag24); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag25); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag26); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag27); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag28); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag29); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag30); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag31); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag32); + + Assert.Equal(0u, (uint)actual); + Assert.Equal(0u, (uint)expected); + + static void SetFlagAndAssert(ref UInt32Enum actual, ref UInt32Enum expected, UInt32Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt32Enum actual, ref UInt32Enum expected, UInt32Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt64Enum : ulong + { + Flag1 = 1ul << 0, + Flag2 = 1ul << 1, + Flag3 = 1ul << 2, + Flag4 = 1ul << 3, + Flag5 = 1ul << 4, + Flag6 = 1ul << 5, + Flag7 = 1ul << 6, + Flag8 = 1ul << 7, + Flag9 = 1ul << 8, + Flag10 = 1ul << 9, + Flag11 = 1ul << 10, + Flag12 = 1ul << 11, + Flag13 = 1ul << 12, + Flag14 = 1ul << 13, + Flag15 = 1ul << 14, + Flag16 = 1ul << 15, + Flag17 = 1ul << 16, + Flag18 = 1ul << 17, + Flag19 = 1ul << 18, + Flag20 = 1ul << 19, + Flag21 = 1ul << 20, + Flag22 = 1ul << 21, + Flag23 = 1ul << 22, + Flag24 = 1ul << 23, + Flag25 = 1ul << 24, + Flag26 = 1ul << 25, + Flag27 = 1ul << 26, + Flag28 = 1ul << 27, + Flag29 = 1ul << 28, + Flag30 = 1ul << 29, + Flag31 = 1ul << 30, + Flag32 = 1ul << 31, + Flag33 = 1ul << 32, + Flag34 = 1ul << 33, + Flag35 = 1ul << 34, + Flag36 = 1ul << 35, + Flag37 = 1ul << 36, + Flag38 = 1ul << 37, + Flag39 = 1ul << 38, + Flag40 = 1ul << 39, + Flag41 = 1ul << 40, + Flag42 = 1ul << 41, + Flag43 = 1ul << 42, + Flag44 = 1ul << 43, + Flag45 = 1ul << 44, + Flag46 = 1ul << 45, + Flag47 = 1ul << 46, + Flag48 = 1ul << 47, + Flag49 = 1ul << 48, + Flag50 = 1ul << 49, + Flag51 = 1ul << 50, + Flag52 = 1ul << 51, + Flag53 = 1ul << 52, + Flag54 = 1ul << 53, + Flag55 = 1ul << 54, + Flag56 = 1ul << 55, + Flag57 = 1ul << 56, + Flag58 = 1ul << 57, + Flag59 = 1ul << 58, + Flag60 = 1ul << 59, + Flag61 = 1ul << 60, + Flag62 = 1ul << 61, + Flag63 = 1ul << 62, + Flag64 = 1ul << 63 + } + + [Fact] + public void TestUInt64SizedEnum() + { + UInt64Enum actual = 0; + UInt64Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag16); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag17); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag18); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag19); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag20); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag21); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag22); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag23); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag24); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag25); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag26); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag27); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag28); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag29); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag30); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag31); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag32); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag33); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag34); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag35); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag36); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag37); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag38); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag39); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag40); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag41); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag42); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag43); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag44); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag45); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag46); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag47); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag48); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag49); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag50); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag51); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag52); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag53); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag54); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag55); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag56); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag57); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag58); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag59); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag60); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag61); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag62); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag63); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag64); + + Assert.Equal(ulong.MaxValue, (ulong)actual); + Assert.Equal(ulong.MaxValue, (ulong)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag16); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag17); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag18); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag19); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag20); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag21); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag22); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag23); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag24); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag25); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag26); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag27); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag28); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag29); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag30); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag31); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag32); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag33); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag34); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag35); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag36); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag37); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag38); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag39); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag40); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag41); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag42); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag43); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag44); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag45); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag46); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag47); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag48); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag49); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag50); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag51); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag52); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag53); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag54); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag55); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag56); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag57); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag58); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag59); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag60); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag61); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag62); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag63); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag64); + + Assert.Equal(0ul, (ulong)actual); + Assert.Equal(0ul, (ulong)expected); + + static void SetFlagAndAssert(ref UInt64Enum actual, ref UInt64Enum expected, UInt64Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt64Enum actual, ref UInt64Enum expected, UInt64Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableExtensionsTests.cs new file mode 100644 index 00000000000..a549039b2b9 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableExtensionsTests.cs @@ -0,0 +1,143 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Runtime.CompilerServices; +using Xunit; +using SR = Microsoft.AspNetCore.Razor.Utilities.Shared.Resources.SR; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class EnumerableExtensionsTests +{ + [Fact] + public void CopyTo_ImmutableArray() + { + Span source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var immutableArray = ImmutableArray.Create(source); + + AssertCopyToCore(immutableArray, immutableArray.Length); + } + + [Fact] + public void CopyTo_ImmutableArrayBuilder() + { + Span source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var builder = ImmutableArray.CreateBuilder(); + builder.AddRange(source); + + AssertCopyToCore(builder, builder.Count); + } + + [Fact] + public void CopyTo_List() + { + IEnumerable source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var list = new List(source); + + AssertCopyToCore(list, list.Count); + } + + [Fact] + public void CopyTo_HashSet() + { + IEnumerable source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var set = new HashSet(source); + + AssertCopyToCore(set, set.Count); + } + + [Fact] + public void CopyTo_Array() + { + int[] array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + AssertCopyToCore(array, array.Length); + } + + [Fact] + public void CopyTo_CustomEnumerable() + { + CustomEnumerable custom = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + AssertCopyToCore(custom, 10); + } + + [Fact] + public void CopyTo_CustomReadOnlyCollection() + { + CustomReadOnlyCollection custom = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + AssertCopyToCore(custom, 10); + } + + private static void AssertCopyToCore(IEnumerable sequence, int count) + { + var destination1 = new int[count - 1]; + var exception = Assert.Throws(() => sequence.CopyTo(destination1.AsSpan())); + Assert.StartsWith(SR.Destination_is_too_short, exception.Message); + + Span destination2 = stackalloc int[count]; + sequence.CopyTo(destination2); + AssertElementsEqual(sequence, destination2); + + Span destination3 = stackalloc int[count + 1]; + sequence.CopyTo(destination3); + AssertElementsEqual(sequence, destination3); + + static void AssertElementsEqual(IEnumerable sequence, ReadOnlySpan span) + { + var index = 0; + + foreach (var item in sequence) + { + Assert.Equal(item, span[index++]); + } + } + } + + [CollectionBuilder(typeof(CustomEnumerable), "Create")] + private sealed class CustomEnumerable(params ReadOnlySpan values) : IEnumerable + { + private readonly int[] _values = values.ToArray(); + + public IEnumerator GetEnumerator() + { + foreach (var value in _values) + { + yield return value; + } + } + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + + public static CustomEnumerable Create(ReadOnlySpan span) + => new(span); + } + + [CollectionBuilder(typeof(CustomReadOnlyCollection), "Create")] + private sealed class CustomReadOnlyCollection(params ReadOnlySpan values) : IReadOnlyCollection + { + private readonly int[] _values = values.ToArray(); + + public int Count => _values.Length; + + public IEnumerator GetEnumerator() + { + foreach (var value in _values) + { + yield return value; + } + } + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + + public static CustomReadOnlyCollection Create(ReadOnlySpan span) + => new(span); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableOrderingTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableOrderingTests.cs new file mode 100644 index 00000000000..ad5a60cb182 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumerableOrderingTests.cs @@ -0,0 +1,176 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class EnumerableOrderingTests : EnumerableOrderingTestBase +{ + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray(IEnumerable data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_OddBeforeEven(IEnumerable data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray(IEnumerable data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_OddBeforeEven(IEnumerable data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray(IEnumerable> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_OddBeforeEven(IEnumerable> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray(IEnumerable> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_OddBeforeEven(IEnumerable> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + +#if NET // Enumerable.Order(...) and Enumerable.OrderDescending(...) were introduced in .NET 7 + + [Fact] + public void OrderAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(), + testFunction: data => data.OrderAsArray()); + } + + [Fact] + public void OrderAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(), + testFunction: data => data.OrderDescendingAsArray()); + } + + [Fact] + public void OrderDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + +#endif + + [Fact] + public void OrderByAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text), + testFunction: data => data.OrderByAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderByDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + private static void OrderAndAssertStableSort( + Func, IEnumerable> linqFunction, + Func, ImmutableArray> testFunction) + { + IEnumerable data = [ + "All", "Your", "Base", "Are", "belong", null, "To", "Us", + "all", "your", null, "Base", "are", "belong", "to", "us"]; + + var expected = linqFunction(data); + var actual = testFunction(data); + + Assert.Equal(expected, actual, ReferenceEquals); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/HashSetExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/HashSetExtensionsTests.cs new file mode 100644 index 00000000000..3e7e050a6a6 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/HashSetExtensionsTests.cs @@ -0,0 +1,41 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System; +using Xunit; +using SR = Microsoft.AspNetCore.Razor.Utilities.Shared.Resources.SR; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class HashSetExtensionsTests +{ + [Fact] + public void CopyTo() + { + IEnumerable source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var set = new HashSet(source); + + var destination1 = new int[set.Count - 1]; + var exception = Assert.Throws(() => set.CopyTo(destination1.AsSpan())); + Assert.StartsWith(SR.Destination_is_too_short, exception.Message); + + Span destination2 = stackalloc int[set.Count]; + set.CopyTo(destination2); + AssertElementsEqual(set, destination2); + + Span destination3 = stackalloc int[set.Count + 1]; + set.CopyTo(destination3); + AssertElementsEqual(set, destination3); + + static void AssertElementsEqual(HashSet set, ReadOnlySpan span) + { + var index = 0; + + foreach (var item in set) + { + Assert.Equal(item, span[index++]); + } + } + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayExtensionsTests.cs index 7a04d9083b4..c8a436095c4 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayExtensionsTests.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayExtensionsTests.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Immutable; -using System.Runtime.InteropServices; using Xunit; namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; @@ -37,282 +36,4 @@ public void GetMostRecentUniqueItems() }, s => Assert.Equal("WoRlD", s)); } - - private static Comparison OddBeforeEven - => (x, y) => (x % 2 != 0, y % 2 != 0) switch - { - (true, false) => -1, - (false, true) => 1, - _ => x.CompareTo(y) - }; - - public static TheoryData, ImmutableArray> OrderAsArrayData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - }; - - [Theory] - [MemberData(nameof(OrderAsArrayData))] - public void OrderAsArray(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderAsArray(); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderAsArray_OddBeforeEvenData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - }; - - [Theory] - [MemberData(nameof(OrderAsArray_OddBeforeEvenData))] - public void OrderAsArray_OddBeforeEven(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderAsArray(OddBeforeEven); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderDescendingAsArrayData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - }; - - [Theory] - [MemberData(nameof(OrderAsArrayData))] - public void OrderDescendingAsArray(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderAsArray(); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderDescendingAsArray_OddBeforeEvenData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - }; - - [Theory] - [MemberData(nameof(OrderDescendingAsArray_OddBeforeEvenData))] - public void OrderDescendingAsArray_OddBeforeEven(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderDescendingAsArray(OddBeforeEven); - Assert.Equal(expected, sorted); - } - - public readonly record struct ValueHolder(int Value) - { - public static implicit operator ValueHolder(int value) - => new(value); - } - - public static TheoryData, ImmutableArray> OrderByAsArrayData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, - }; - - [Theory] - [MemberData(nameof(OrderByAsArrayData))] - public void OrderByAsArray(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderByAsArray(static x => x.Value); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderByAsArray_OddBeforeEvenData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, - }; - - [Theory] - [MemberData(nameof(OrderByAsArray_OddBeforeEvenData))] - public void OrderByAsArray_OddBeforeEvent(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderByAsArray(static x => x.Value, OddBeforeEven); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderByDescendingAsArrayData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, - }; - - [Theory] - [MemberData(nameof(OrderByDescendingAsArrayData))] - public void OrderByDescendingAsArray(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderByDescendingAsArray(static x => x.Value); - Assert.Equal(expected, sorted); - } - - public static TheoryData, ImmutableArray> OrderByDescendingAsArray_OddBeforeEvenData - => new() - { - { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, - }; - - [Theory] - [MemberData(nameof(OrderByDescendingAsArray_OddBeforeEvenData))] - public void OrderByDescendingAsArray_OddBeforeEven(ImmutableArray data, ImmutableArray expected) - { - var sorted = data.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); - Assert.Equal(expected, sorted); - } - - [Fact] - public void OrderAsArray_EmptyArrayReturnsSameArray() - { - var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); - var immutableArray = ImmutableArray.Empty; - - immutableArray = immutableArray.OrderAsArray(); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderAsArray_SingleElementArrayReturnsSameArray() - { - var array = new int[] { 42 }; - var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); - - immutableArray = immutableArray.OrderAsArray(); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderAsArray_SortedArrayReturnsSameArray() - { - var values = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(values); - - immutableArray = immutableArray.OrderAsArray(); - Assert.Same(values, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderDescendingAsArray_EmptyArrayReturnsSameArray() - { - var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); - var immutableArray = ImmutableArray.Empty; - - immutableArray = immutableArray.OrderDescendingAsArray(); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderDescendingAsArray_SingleElementArrayReturnsSameArray() - { - var array = new int[] { 42 }; - var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); - - immutableArray = immutableArray.OrderDescendingAsArray(); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderDescendingAsArray_SortedArrayReturnsSameArray() - { - var values = new int[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; - var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); - - presortedArray = presortedArray.OrderDescendingAsArray(); - Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); - } - - [Fact] - public void OrderByAsArray_EmptyArrayReturnsSameArray() - { - var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); - var immutableArray = ImmutableArray.Empty; - - immutableArray = immutableArray.OrderByAsArray(static x => x.Value); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderByAsArray_SingleElementArrayReturnsSameArray() - { - var array = new ValueHolder[] { 42 }; - var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); - - immutableArray = immutableArray.OrderByAsArray(static x => x.Value); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderByAsArray_SortedArrayReturnsSameArray() - { - var values = new ValueHolder[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); - - presortedArray = presortedArray.OrderByAsArray(static x => x.Value); - Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); - } - - [Fact] - public void OrderByDescendingAsArray_EmptyArrayReturnsSameArray() - { - var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); - var immutableArray = ImmutableArray.Empty; - - immutableArray = immutableArray.OrderByDescendingAsArray(static x => x.Value); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderByDescendingAsArray_SingleElementArrayReturnsSameArray() - { - var array = new ValueHolder[] { 42 }; - var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); - - immutableArray = immutableArray.OrderByDescendingAsArray(static x => x.Value); - Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); - } - - [Fact] - public void OrderByDescendingAsArray_SortedArrayReturnsSameArray() - { - var values = new ValueHolder[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; - var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); - - presortedArray = presortedArray.OrderByDescendingAsArray(static x => x.Value); - Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); - } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayOrderingTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayOrderingTests.cs new file mode 100644 index 00000000000..64229f4d61a --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ImmutableArrayOrderingTests.cs @@ -0,0 +1,665 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Runtime.InteropServices; +using Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class ImmutableArrayOrderingTests : ImmutableArrayOrderingTestBase +{ + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray(ImmutableArray data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray(ImmutableArray data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray(ImmutableArray> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray(ImmutableArray> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray_ReadOnlyList(ImmutableArray data, ImmutableArray expected) + { + var readOnlyList = (IReadOnlyList)data; + var sorted = readOnlyList.OrderAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_ReadOnlyList_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var readOnlyList = (IReadOnlyList)data; + var sorted = readOnlyList.OrderAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray_ReadOnlyList(ImmutableArray data, ImmutableArray expected) + { + var readOnlyList = (IReadOnlyList)data; + var sorted = readOnlyList.OrderDescendingAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_ReadOnlyList_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var readOnlyList = (IReadOnlyList)data; + var sorted = readOnlyList.OrderDescendingAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray_ReadOnlyList(ImmutableArray> data, ImmutableArray> expected) + { + var readOnlyList = (IReadOnlyList>)data; + var sorted = readOnlyList.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_ReadOnlyList_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var readOnlyList = (IReadOnlyList>)data; + var sorted = readOnlyList.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray_ReadOnlyList(ImmutableArray> data, ImmutableArray> expected) + { + var readOnlyList = (IReadOnlyList>)data; + var sorted = readOnlyList.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_ReadOnlyList_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var readOnlyList = (IReadOnlyList>)data; + var sorted = readOnlyList.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray_Enumerable(ImmutableArray data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_Enumerable_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray_Enumerable(ImmutableArray data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderDescendingAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_Enumerable_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderDescendingAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray_Enumerable(ImmutableArray> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_Enumerable_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray_Enumerable(ImmutableArray> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_Enumerable_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void ToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrdered(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void ToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrdered(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void ToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedDescending(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedDescending(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void ToImmutableOrderedBy(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedBy(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void ToImmutableOrderedBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void ToImmutableOrderedByDescending(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void DrainToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrdered(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void DrainToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrdered(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void DrainToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedDescending(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedDescending(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void DrainToImmutableOrderedBy(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void DrainToImmutableOrderedBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void DrainToImmutableOrderedByDescending(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builder = data.ToBuilder(); + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Fact] + public void OrderAsArray_EmptyArrayReturnsSameArray() + { + var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); + var immutableArray = ImmutableArray.Empty; + + immutableArray = immutableArray.OrderAsArray(); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderAsArray_SingleElementArrayReturnsSameArray() + { + var array = new int[] { 42 }; + var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); + + immutableArray = immutableArray.OrderAsArray(); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderAsArray_SortedArrayReturnsSameArray() + { + var values = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(values); + + immutableArray = immutableArray.OrderAsArray(); + Assert.Same(values, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderDescendingAsArray_EmptyArrayReturnsSameArray() + { + var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray.Empty); + var immutableArray = ImmutableArray.Empty; + + immutableArray = immutableArray.OrderDescendingAsArray(); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderDescendingAsArray_SingleElementArrayReturnsSameArray() + { + var array = new int[] { 42 }; + var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); + + immutableArray = immutableArray.OrderDescendingAsArray(); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderDescendingAsArray_SortedArrayReturnsSameArray() + { + var values = new int[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); + + presortedArray = presortedArray.OrderDescendingAsArray(); + Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); + } + + [Fact] + public void OrderByAsArray_EmptyArrayReturnsSameArray() + { + var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray>.Empty); + var immutableArray = ImmutableArray>.Empty; + + immutableArray = immutableArray.OrderByAsArray(static x => x.Value); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderByAsArray_SingleElementArrayReturnsSameArray() + { + var array = new ValueHolder[] { 42 }; + var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); + + immutableArray = immutableArray.OrderByAsArray(static x => x.Value); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderByAsArray_SortedArrayReturnsSameArray() + { + var values = new ValueHolder[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); + + presortedArray = presortedArray.OrderByAsArray(static x => x.Value); + Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); + } + + [Fact] + public void OrderByDescendingAsArray_EmptyArrayReturnsSameArray() + { + var array = ImmutableCollectionsMarshal.AsArray(ImmutableArray>.Empty); + var immutableArray = ImmutableArray>.Empty; + + immutableArray = immutableArray.OrderByDescendingAsArray(static x => x.Value); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderByDescendingAsArray_SingleElementArrayReturnsSameArray() + { + var array = new ValueHolder[] { 42 }; + var immutableArray = ImmutableCollectionsMarshal.AsImmutableArray(array); + + immutableArray = immutableArray.OrderByDescendingAsArray(static x => x.Value); + Assert.Same(array, ImmutableCollectionsMarshal.AsArray(immutableArray)); + } + + [Fact] + public void OrderByDescendingAsArray_SortedArrayReturnsSameArray() + { + var values = new ValueHolder[] { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + var presortedArray = ImmutableCollectionsMarshal.AsImmutableArray(values); + + presortedArray = presortedArray.OrderByDescendingAsArray(static x => x.Value); + Assert.Same(values, ImmutableCollectionsMarshal.AsArray(presortedArray)); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void UnsafeOrder(ImmutableArray data, ImmutableArray expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().Order(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void UnsafeOrder_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().Order(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void UnsafeOrderDescending(ImmutableArray data, ImmutableArray expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderDescending(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void UnsafeOrderDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderDescending(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void UnsafeOrderBy(ImmutableArray> data, ImmutableArray> expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderBy(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void UnsafeOrderBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderBy(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void UnsafeOrderByDescending(ImmutableArray> data, ImmutableArray> expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderByDescending(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void UnsafeOrderByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + // Clone array, since we're modifying it in-place. + var sorted = ImmutableArray.Create(data.AsSpan()); + sorted.Unsafe().OrderByDescending(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + +#if NET // Enumerable.Order(...) and Enumerable.OrderDescending(...) were introduced in .NET 7 + + [Fact] + public void OrderAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(), + testFunction: data => data.OrderAsArray()); + } + + [Fact] + public void OrderAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(), + testFunction: data => data.OrderDescendingAsArray()); + } + + [Fact] + public void OrderDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + +#endif + + [Fact] + public void OrderByAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text), + testFunction: data => data.OrderByAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderByDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + private static void OrderAndAssertStableSort( + Func, IEnumerable> linqFunction, + Func, ImmutableArray> testFunction) + { + ImmutableArray data = [ + "All", "Your", "Base", "Are", "belong", null, "To", "Us", + "all", "your", null, "Base", "are", "belong", "to", "us"]; + + var expected = linqFunction(data); + var actual = testFunction(data); + + Assert.Equal(expected, actual, ReferenceEquals); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ListExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ListExtensionsTests.cs new file mode 100644 index 00000000000..58eced7fbce --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ListExtensionsTests.cs @@ -0,0 +1,40 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using Xunit; +using SR = Microsoft.AspNetCore.Razor.Utilities.Shared.Resources.SR; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class ListExtensionsTests +{ + [Fact] + public void CopyTo() + { + IEnumerable source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var list = new List(source); + + var destination1 = new int[list.Count - 1]; + var exception = Assert.Throws(() => list.CopyTo(destination1.AsSpan())); + Assert.StartsWith(SR.Destination_is_too_short, exception.Message); + + Span destination2 = stackalloc int[list.Count]; + list.CopyTo(destination2); + AssertElementsEqual(list, destination2); + + Span destination3 = stackalloc int[list.Count + 1]; + list.CopyTo(destination3); + AssertElementsEqual(list, destination3); + + static void AssertElementsEqual(List list, ReadOnlySpan span) + { + var count = list.Count; + for (var i = 0; i < count; i++) + { + Assert.Equal(list[i], span[i]); + } + } + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj index 470d326cc87..b10885404af 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj @@ -4,6 +4,7 @@ $(DefaultNetCoreTargetFrameworks) $(TargetFrameworks);$(DefaultNetFxTargetFramework) True + false diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs new file mode 100644 index 00000000000..53de1ae5329 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNetCore.Razor.PooledObjects; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.PooledObjects; + +internal static class Extensions +{ + public static void Validate(this ref readonly PooledArrayBuilder builder, Action.TestAccessor> validator) + { + validator(builder.GetTestAccessor()); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs new file mode 100644 index 00000000000..515ee999523 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs @@ -0,0 +1,216 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.PooledObjects; + +public class PooledArrayBuilderOrderingTests : ImmutableArrayOrderingTestBase +{ + [Theory] + [MemberData(nameof(OrderTestData))] + public void ToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrdered(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void ToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrdered(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void ToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedDescending(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedDescending(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void ToImmutableOrderedBy(ImmutableArray> data, ImmutableArray> expected) + { + using var builder = new PooledArrayBuilder>(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedBy(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void ToImmutableOrderedBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + using var builder = new PooledArrayBuilder>(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void ToImmutableOrderedByDescending(ImmutableArray> data, ImmutableArray> expected) + { + using var builder = new PooledArrayBuilder>(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + using var builder = new PooledArrayBuilder>(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void DrainToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrdered(); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void DrainToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrdered(OddBeforeEven); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void DrainToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedDescending(); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedDescending(OddBeforeEven); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void DrainToImmutableOrderedBy(ImmutableArray> data, ImmutableArray> expected) + { + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void DrainToImmutableOrderedBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void DrainToImmutableOrderedByDescending(ImmutableArray> data, ImmutableArray> expected) + { + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) + { + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + private static void AssertIsDrained(ref readonly PooledArrayBuilder builder) + { + builder.Validate(static t => + { + Assert.NotNull(t.InnerArrayBuilder); + Assert.Empty(t.InnerArrayBuilder); + + // After draining, the capacity of the inner array builder should be 0. + Assert.Equal(0, t.InnerArrayBuilder.Capacity); + }); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs index 03129b86b02..c029b9d7aca 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs @@ -86,6 +86,61 @@ public void RemoveAtIndex(int count, int removeIndex) } } + [Fact] + public void UseDrainAndReuse() + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: 10, builderPool); + + for (var i = 0; i < 10; i++) + { + builder.Add(i); + } + + // Verify that the builder contains 10 items within its inner array builder. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Equal(10, t.InnerArrayBuilder.Count); + Assert.Equal(10, t.InnerArrayBuilder.Capacity); + }); + + var result = builder.DrainToImmutable(); + + // After draining, the builder should contain 0 items in its inner array builder + // and the capacity should have been set to 0. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Empty(t.InnerArrayBuilder); + Assert.Equal(0, t.InnerArrayBuilder.Capacity); + }); + + // Add another 10 items to the builder. At the end, the inner array builder + // should hold 10 items with a capacity of 10. + for (var i = 0; i < 10; i++) + { + builder.Add(i); + } + + // Verify that the builder contains 10 items within its inner array builder. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Equal(10, t.InnerArrayBuilder.Count); + Assert.Equal(10, t.InnerArrayBuilder.Capacity); + }); + } + private static Func IsEven => x => x % 2 == 0; private static Func IsOdd => x => x % 2 != 0; diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs new file mode 100644 index 00000000000..8380389a86d --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.Extensions.ObjectPool; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.PooledObjects; + +internal static class TestArrayBuilderPool +{ + public static ObjectPool.Builder> Create( + IPooledObjectPolicy.Builder>? policy = null, int size = 1) + => DefaultPool.Create(policy ?? NoReturnPolicy.Instance, size); + + public sealed class NoReturnPolicy : IPooledObjectPolicy.Builder> + { + public static readonly NoReturnPolicy Instance = new(); + + private NoReturnPolicy() + { + } + + public ImmutableArray.Builder Create() + => ImmutableArray.CreateBuilder(); + + public bool Return(ImmutableArray.Builder obj) + => false; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensionsTests.cs similarity index 69% rename from src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensions.cs rename to src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensionsTests.cs index 29aabbf892f..bcf37734efd 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListExtensionsTests.cs @@ -2,7 +2,11 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Runtime.CompilerServices; using Xunit; using SR = Microsoft.AspNetCore.Razor.Utilities.Shared.Resources.SR; @@ -183,4 +187,95 @@ public void SingleWithPredicate() Assert.Equal(42, readOnlyList.Single(IsEven)); Assert.Equal(42, readOnlyList.SingleOrDefault(IsEven)); } + + [Fact] + public void CopyTo_ImmutableArray() + { + Span source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var immutableArray = ImmutableArray.Create(source); + + AssertCopyToCore(immutableArray); + } + + [Fact] + public void CopyTo_ImmutableArrayBuilder() + { + Span source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var builder = ImmutableArray.CreateBuilder(); + builder.AddRange(source); + + AssertCopyToCore(builder); + } + + [Fact] + public void CopyTo_List() + { + IEnumerable source = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + var list = new List(source); + + AssertCopyToCore(list); + } + + [Fact] + public void CopyTo_Array() + { + int[] array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + AssertCopyToCore(array); + } + + [Fact] + public void CopyTo_CustomReadOnlyList() + { + CustomReadOnlyList custom = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + AssertCopyToCore(custom); + } + + private static void AssertCopyToCore(IReadOnlyList list) + { + var destination1 = new int[list.Count - 1]; + var exception = Assert.Throws(() => list.CopyTo(destination1.AsSpan())); + Assert.StartsWith(SR.Destination_is_too_short, exception.Message); + + Span destination2 = stackalloc int[list.Count]; + list.CopyTo(destination2); + AssertElementsEqual(list, destination2); + + Span destination3 = stackalloc int[list.Count + 1]; + list.CopyTo(destination3); + AssertElementsEqual(list, destination3); + + static void AssertElementsEqual(IReadOnlyList list, ReadOnlySpan span) + { + var count = list.Count; + for (var i = 0; i < count; i++) + { + Assert.Equal(list[i], span[i]); + } + } + } + + [CollectionBuilder(typeof(CustomReadOnlyList), "Create")] + private sealed class CustomReadOnlyList(params ReadOnlySpan values) : IReadOnlyList + { + private readonly int[] _values = values.ToArray(); + + public int this[int index] => _values[index]; + public int Count => _values.Length; + + public IEnumerator GetEnumerator() + { + foreach (var value in _values) + { + yield return value; + } + } + + IEnumerator IEnumerable.GetEnumerator() + => GetEnumerator(); + + public static CustomReadOnlyList Create(ReadOnlySpan span) + => new(span); + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListOrderingTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListOrderingTests.cs new file mode 100644 index 00000000000..959c10ca298 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/ReadOnlyListOrderingTests.cs @@ -0,0 +1,248 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class ReadOnlyListOrderingTests : ReadOnlyListOrderingTestBase +{ + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray(IReadOnlyList data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_OddBeforeEven(IReadOnlyList data, ImmutableArray expected) + { + var sorted = data.OrderAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray(IReadOnlyList data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_OddBeforeEven(IReadOnlyList data, ImmutableArray expected) + { + var sorted = data.OrderDescendingAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray(IReadOnlyList> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_OddBeforeEven(IReadOnlyList> data, ImmutableArray> expected) + { + var sorted = data.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray(IReadOnlyList> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_OddBeforeEven(IReadOnlyList> data, ImmutableArray> expected) + { + var sorted = data.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void OrderAsArray_Enumerable(IReadOnlyList data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void OrderAsArray_Enumerable_OddBeforeEven(IReadOnlyList data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void OrderDescendingAsArray_Enumerable(IReadOnlyList data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderDescendingAsArray(); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void OrderDescendingAsArray_Enumerable_OddBeforeEven(IReadOnlyList data, ImmutableArray expected) + { + var enumerable = (IEnumerable)data; + var sorted = enumerable.OrderDescendingAsArray(OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void OrderByAsArray_Enumerable(IReadOnlyList> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void OrderByAsArray_Enumerable_OddBeforeEven(IReadOnlyList> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void OrderByDescendingAsArray_Enumerable(IReadOnlyList> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByDescendingAsArray(static x => x.Value); + AssertEqual(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void OrderByDescendingAsArray_Enumerable_OddBeforeEven(IReadOnlyList> data, ImmutableArray> expected) + { + var enumerable = (IEnumerable>)data; + var sorted = enumerable.OrderByDescendingAsArray(static x => x.Value, OddBeforeEven); + AssertEqual(expected, sorted); + } + +#if NET // Enumerable.Order(...) and Enumerable.OrderDescending(...) were introduced in .NET 7 + + [Fact] + public void OrderAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(), + testFunction: data => data.OrderAsArray()); + } + + [Fact] + public void OrderAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.Order(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(), + testFunction: data => data.OrderDescendingAsArray()); + } + + [Fact] + public void OrderDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.Ordinal), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.Ordinal)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderDescending(StringHolder.Comparer.OrdinalIgnoreCase), + testFunction: data => data.OrderDescendingAsArray(StringHolder.Comparer.OrdinalIgnoreCase)); + } + +#endif + + [Fact] + public void OrderByAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text), + testFunction: data => data.OrderByAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderBy(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + [Fact] + public void OrderByDescendingAsArray_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text)); + } + + [Fact] + public void OrderByDescendingAsArray_Comparer_IsStable() + { + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + + OrderAndAssertStableSort( + linqFunction: data => data.OrderByDescending(static x => x?.Text, StringComparer.OrdinalIgnoreCase), + testFunction: data => data.OrderByDescendingAsArray(static x => x?.Text, StringComparer.OrdinalIgnoreCase)); + } + + private static void OrderAndAssertStableSort( + Func, IEnumerable> linqFunction, + Func, ImmutableArray> testFunction) + { + IReadOnlyList data = [ + "All", "Your", "Base", "Are", "belong", null, "To", "Us", + "all", "your", null, "Base", "are", "belong", "to", "us"]; + + var expected = linqFunction(data); + var actual = testFunction(data); + + Assert.Equal(expected, actual, ReferenceEquals); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/EnumerableOrderingTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/EnumerableOrderingTestBase.cs new file mode 100644 index 00000000000..3e77f83b99f --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/EnumerableOrderingTestBase.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public abstract class EnumerableOrderingTestBase : OrderingTestBase, IEnumerable>, OrderingCaseConverters.Enumerable> +{ +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ImmutableArrayOrderingTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ImmutableArrayOrderingTestBase.cs new file mode 100644 index 00000000000..db7164fdd71 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ImmutableArrayOrderingTestBase.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public abstract class ImmutableArrayOrderingTestBase : OrderingTestBase, ImmutableArray>, OrderingCaseConverters.ImmutableArray> +{ +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingCaseConverters.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingCaseConverters.cs new file mode 100644 index 00000000000..d09dc1c8d12 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingCaseConverters.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public interface IOrderingCaseConverter + where TOrderCollection : IEnumerable + where TOrderByCollection : IEnumerable> +{ + TOrderCollection ConvertOrderCase(ImmutableArray data); + TOrderByCollection ConvertOrderByCase(ImmutableArray> data); +} + +public static class OrderingCaseConverters +{ + public sealed class Enumerable : IOrderingCaseConverter, IEnumerable>> + { + public IEnumerable ConvertOrderCase(ImmutableArray data) => data; + public IEnumerable> ConvertOrderByCase(ImmutableArray> data) => data; + } + + public sealed class ImmutableArray : IOrderingCaseConverter, ImmutableArray>> + { + public ImmutableArray ConvertOrderCase(ImmutableArray data) => data; + public ImmutableArray> ConvertOrderByCase(ImmutableArray> data) => data; + } + + public sealed class ReadOnlyList : IOrderingCaseConverter, IReadOnlyList>> + { + public IReadOnlyList ConvertOrderCase(ImmutableArray data) => data; + public IReadOnlyList> ConvertOrderByCase(ImmutableArray> data) => data; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingTestBase.cs new file mode 100644 index 00000000000..584bf59fbf8 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/OrderingTestBase.cs @@ -0,0 +1,84 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public abstract class OrderingTestBase + where TOrderCollection : IEnumerable + where TOrderByCollection : IEnumerable> + where TCaseConverter : IOrderingCaseConverter, new() +{ + private static readonly TheoryData> s_orderTestData = []; + private static readonly TheoryData> s_orderTestData_OddBeforeEven = []; + private static readonly TheoryData> s_orderDescendingTestData = []; + private static readonly TheoryData> s_orderDescendingTestData_OddBeforeEven = []; + private static readonly TheoryData>> s_orderByTestData = []; + private static readonly TheoryData>> s_orderByTestData_OddBeforeEven = []; + private static readonly TheoryData>> s_orderByDescendingTestData = []; + private static readonly TheoryData>> s_orderByDescendingTestData_OddBeforeEven = []; + + protected static void AddCase(TOrderCollection collection) + { + s_orderTestData.Add(collection, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + s_orderTestData_OddBeforeEven.Add(collection, [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]); + s_orderDescendingTestData.Add(collection, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); + s_orderDescendingTestData_OddBeforeEven.Add(collection, [10, 8, 6, 4, 2, 9, 7, 5, 3, 1]); + } + + protected static void AddCase(TOrderByCollection collection) + { + s_orderByTestData.Add(collection, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); + s_orderByTestData_OddBeforeEven.Add(collection, [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]); + s_orderByDescendingTestData.Add(collection, [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); + s_orderByDescendingTestData_OddBeforeEven.Add(collection, [10, 8, 6, 4, 2, 9, 7, 5, 3, 1]); + } + + static OrderingTestBase() + { + var converter = new TCaseConverter(); + + AddCase(converter.ConvertOrderCase([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])); + AddCase(converter.ConvertOrderCase([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])); + AddCase(converter.ConvertOrderCase([1, 3, 5, 7, 9, 2, 4, 6, 8, 10])); + AddCase(converter.ConvertOrderCase([2, 5, 8, 1, 3, 9, 7, 4, 10, 6])); + AddCase(converter.ConvertOrderCase([6, 10, 4, 7, 9, 3, 1, 8, 5, 2])); + + AddCase(converter.ConvertOrderByCase([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])); + AddCase(converter.ConvertOrderByCase([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])); + AddCase(converter.ConvertOrderByCase([1, 3, 5, 7, 9, 2, 4, 6, 8, 10])); + AddCase(converter.ConvertOrderByCase([2, 5, 8, 1, 3, 9, 7, 4, 10, 6])); + AddCase(converter.ConvertOrderByCase([6, 10, 4, 7, 9, 3, 1, 8, 5, 2])); + } + + protected static Comparison OddBeforeEven + => (x, y) => (x % 2 != 0, y % 2 != 0) switch + { + (true, false) => -1, + (false, true) => 1, + _ => x.CompareTo(y) + }; + + public static TheoryData> OrderTestData => s_orderTestData; + public static TheoryData> OrderTestData_OddBeforeEven => s_orderTestData_OddBeforeEven; + public static TheoryData> OrderDescendingTestData => s_orderDescendingTestData; + public static TheoryData> OrderDescendingTestData_OddBeforeEven => s_orderDescendingTestData_OddBeforeEven; + public static TheoryData>> OrderByTestData => s_orderByTestData; + public static TheoryData>> OrderByTestData_OddBeforeEven => s_orderByTestData_OddBeforeEven; + public static TheoryData>> OrderByDescendingTestData => s_orderByDescendingTestData; + public static TheoryData>> OrderByDescendingTestData_OddBeforeEven => s_orderByDescendingTestData_OddBeforeEven; + + protected void AssertEqual(ImmutableArray result, ImmutableArray expected) + { + Assert.Equal(result, expected); + } + + protected void AssertEqual(ImmutableArray result, ImmutableArray expected, IEqualityComparer comparer) + { + Assert.Equal(result, expected, comparer); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ReadOnlyListOrderingTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ReadOnlyListOrderingTestBase.cs new file mode 100644 index 00000000000..a7af9cc8d2b --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ReadOnlyListOrderingTestBase.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public abstract class ReadOnlyListOrderingTestBase : OrderingTestBase, IReadOnlyList>, OrderingCaseConverters.ReadOnlyList> +{ +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/StringHolder.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/StringHolder.cs new file mode 100644 index 00000000000..300a77f80f5 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/StringHolder.cs @@ -0,0 +1,61 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public sealed class StringHolder(string? text) : IComparable +{ + public string? Text => text; + + public int CompareTo(StringHolder? other) + { + if (other is null) + { + return 1; + } + + return string.CompareOrdinal(Text, other.Text); + } + + public override string ToString() => Text ?? string.Empty; + + public static implicit operator StringHolder(string? text) + => new(text); + + public sealed class Comparer : IComparer + { + public static readonly IComparer Ordinal = new Comparer(StringComparer.Ordinal); + public static readonly IComparer OrdinalIgnoreCase = new Comparer(StringComparer.OrdinalIgnoreCase); + + private readonly StringComparer _comparer; + + private Comparer(StringComparer comparer) + { + _comparer = comparer; + } + + public int Compare(StringHolder? x, StringHolder? y) + { + if (x is null) + { + if (y is not null) + { + return 1; + } + else + { + return 0; + } + } + else if (y is null) + { + return -1; + } + + return _comparer.Compare(x.Text, y.Text); + } + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ValueHolder`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ValueHolder`1.cs new file mode 100644 index 00000000000..3a4a2d15353 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/TestData/ValueHolder`1.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.TestData; + +public readonly record struct ValueHolder(T Value) +{ + public static implicit operator ValueHolder(T value) + => new(value); +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ArgHelper.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ArgHelper.cs index 3e7b9982f1d..ea2e73adcc9 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ArgHelper.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ArgHelper.cs @@ -176,4 +176,13 @@ public static void ThrowIfLessThanOrEqual(T value, T other, [CallerArgumentEx } #endif } + + public static void ThrowIfDestinationTooShort( + Span destination, int expectedLength, [CallerArgumentExpression(nameof(destination))] string? paramName = null) + { + if (destination.Length < expectedLength) + { + ThrowHelper.ThrowArgumentException(paramName, SR.Destination_is_too_short); + } + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/BufferExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/BufferExtensions.cs index b3b1f58d087..0916d756f0e 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/BufferExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/BufferExtensions.cs @@ -7,6 +7,41 @@ namespace System.Buffers; internal static class BufferExtensions { + /// + /// Rents an array of the given minimum length from the specified . + /// + /// + /// The to use. + /// + /// + /// The minimum length of the array. + /// + /// + /// The array is guaranteed to be at least in length. However, + /// it will likely be larger. + /// + public static PooledArray GetPooledArray(this ArrayPool pool, int minimumLength) + => pool.GetPooledArray(minimumLength, clearOnReturn: false); + + /// + /// Rents an array of the given minimum length from the specified . + /// + /// + /// The to use. + /// + /// + /// The minimum length of the array. + /// + /// + /// Indicates whether the contents of the array should be cleared before it is returned to the pool. + /// + /// + /// The array is guaranteed to be at least in length. However, + /// it will likely be larger. + /// + public static PooledArray GetPooledArray(this ArrayPool pool, int minimumLength, bool clearOnReturn) + => new(pool, minimumLength, clearOnReturn); + /// /// Rents an array of the given minimum length from the specified . /// @@ -47,7 +82,7 @@ public static PooledArray GetPooledArray(this ArrayPool pool, int minim /// public static PooledArray GetPooledArray(this ArrayPool pool, int minimumLength, bool clearOnReturn, out T[] array) { - var result = new PooledArray(pool, minimumLength, clearOnReturn); + var result = pool.GetPooledArray(minimumLength, clearOnReturn); array = result.Array; return result; } @@ -88,7 +123,7 @@ public static PooledArray GetPooledArraySpan(this ArrayPool pool, int m /// public static PooledArray GetPooledArraySpan(this ArrayPool pool, int minimumLength, bool clearOnReturn, out Span span) { - var result = new PooledArray(pool, minimumLength, clearOnReturn); + var result = pool.GetPooledArray(minimumLength, clearOnReturn); span = result.Span; return result; } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs new file mode 100644 index 00000000000..67df57e028c --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs @@ -0,0 +1,148 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace Microsoft.AspNetCore.Razor; + +internal static class EnumExtensions +{ + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void SetFlag(ref this T value, T flag) + where T : unmanaged, Enum + { + var v = (T*)Unsafe.AsPointer(ref value); + + if (sizeof(T) == sizeof(byte)) + { + *(byte*)v |= *(byte*)&flag; + return; + } + else if (sizeof(T) == sizeof(ushort)) + { + *(ushort*)v |= *(ushort*)&flag; + return; + } + else if (sizeof(T) == sizeof(uint)) + { + *(uint*)v |= *(uint*)&flag; + return; + } + else if (sizeof(T) == sizeof(ulong)) + { + *(ulong*)v |= *(ulong*)&flag; + return; + } + + Debug.Fail("Unexpected enum underlying type."); + } + + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void ClearFlag(ref this T value, T flag) + where T : unmanaged, Enum + { + var v = (T*)Unsafe.AsPointer(ref value); + + if (sizeof(T) == sizeof(byte)) + { + *(byte*)v &= (byte)~*(byte*)&flag; + return; + } + else if (sizeof(T) == sizeof(ushort)) + { + *(ushort*)v &= (ushort)~*(ushort*)&flag; + return; + } + else if (sizeof(T) == sizeof(uint)) + { + *(uint*)v &= ~*(uint*)&flag; + return; + } + else if (sizeof(T) == sizeof(ulong)) + { + *(ulong*)v &= ~*(ulong*)&flag; + return; + } + + Debug.Fail("Unexpected enum underlying type."); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void UpdateFlag(ref this T value, T flag, bool set) + where T : unmanaged, Enum + { + if (set) + { + value.SetFlag(flag); + } + else + { + value.ClearFlag(flag); + } + } + + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. + // This is somewhat faster than Enum.HasFlag(...) when running on .NET Framework. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool IsFlagSet(this T value, T flags) + where T : unmanaged, Enum + { + if (sizeof(T) == sizeof(byte)) + { + var f = *(byte*)&flags; + return (*(byte*)&value & f) == f; + } + else if (sizeof(T) == sizeof(ushort)) + { + var f = *(ushort*)&flags; + return (*(ushort*)&value & f) == f; + } + else if (sizeof(T) == sizeof(uint)) + { + var f = *(uint*)&flags; + return (*(uint*)&value & f) == f; + } + else if (sizeof(T) == sizeof(ulong)) + { + var f = *(ulong*)&flags; + return (*(ulong*)&value & f) == f; + } + + Debug.Fail("Unexpected enum underlying type."); + return false; + } + + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool IsFlagClear(this T value, T flags) + where T : unmanaged, Enum + { + if (sizeof(T) == sizeof(byte)) + { + var f = *(byte*)&flags; + return (*(byte*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(ushort)) + { + var f = *(ushort*)&flags; + return (*(ushort*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(uint)) + { + var f = *(uint*)&flags; + return (*(uint*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(ulong)) + { + var f = *(ulong*)&flags; + return (*(ulong*)&value & f) == 0; + } + + Debug.Fail("Unexpected enum underlying type."); + return false; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumerableExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumerableExtensions.cs index 2fe19c1ddf1..0017b1e40a0 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumerableExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumerableExtensions.cs @@ -2,7 +2,10 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; +using System.Runtime.InteropServices; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Utilities; namespace System.Collections.Generic; @@ -10,6 +13,11 @@ internal static class EnumerableExtensions { public static ImmutableArray SelectAsArray(this IEnumerable source, Func selector) { + if (source is ImmutableArray array) + { + return ImmutableArrayExtensions.SelectAsArray(array, selector); + } + if (source is IReadOnlyList list) { return list.SelectAsArray(selector); @@ -59,4 +67,433 @@ public static bool TryGetCount(this IEnumerable sequence, out int count) count = 0; return false; } + + /// + /// Copies the contents of the sequence to a destination . + /// + /// The type of elements in the sequence. + /// The sequence to copy items from. + /// The span to copy items into. + /// + /// The destination span is shorter than the source sequence. + /// + public static void CopyTo(this IEnumerable sequence, Span destination) + { + // First, check a few common cases. + switch (sequence) + { + case ImmutableArray array: + ArgHelper.ThrowIfDestinationTooShort(destination, array.Length); + array.CopyTo(destination); + break; + + // HashSet has special enumerator and doesn't implement IReadOnlyList + case HashSet set: + set.CopyTo(destination); + break; + + case IReadOnlyList list: + list.CopyTo(destination); + break; + + default: + CopySequence(sequence, destination); + break; + } + + static void CopySequence(IEnumerable sequence, Span destination) + { + if (sequence.TryGetCount(out var count)) + { + ArgHelper.ThrowIfDestinationTooShort(destination, count); + + var index = 0; + + foreach (var item in sequence) + { + destination[index++] = item; + } + } + else + { + var index = 0; + + foreach (var item in sequence) + { + ArgHelper.ThrowIfDestinationTooShort(destination, index + 1); + + destination[index++] = item; + } + } + } + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IEnumerable sequence) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderAsArray(list); + } + + var sortHelper = new SortHelper(comparer: null, descending: false); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IEnumerable sequence, IComparer comparer) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array, comparer); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderAsArray(list, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: false); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IEnumerable sequence, Comparison comparison) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array, comparison); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderAsArray(list, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: false); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IEnumerable sequence) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderDescendingAsArray(list); + } + + var sortHelper = new SortHelper(comparer: null, descending: true); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IEnumerable sequence, IComparer comparer) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array, comparer); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderDescendingAsArray(list, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: true); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IEnumerable sequence, Comparison comparison) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array, comparison); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderDescendingAsArray(list, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: true); + return sequence.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IEnumerable sequence, Func keySelector) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByAsArray(list, keySelector); + } + + var sortHelper = new SortHelper(comparer: null, descending: false); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IEnumerable sequence, Func keySelector, IComparer comparer) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector, comparer); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByAsArray(list, keySelector, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: false); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IEnumerable sequence, Func keySelector, Comparison comparison) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector, comparison); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByAsArray(list, keySelector, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: false); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IEnumerable sequence, Func keySelector) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByDescendingAsArray(list, keySelector); + } + + var sortHelper = new SortHelper(comparer: null, descending: true); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IEnumerable sequence, Func keySelector, IComparer comparer) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector, comparer); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByDescendingAsArray(list, keySelector, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: true); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IEnumerable sequence, Func keySelector, Comparison comparison) + { + if (sequence is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector, comparison); + } + + if (sequence is IReadOnlyList list) + { + return ReadOnlyListExtensions.OrderByDescendingAsArray(list, keySelector, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: true); + return sequence.OrderByAsArrayCore(keySelector, in sortHelper); + } + + private static ImmutableArray OrderAsArrayCore(this IEnumerable sequence, ref readonly SortHelper sortHelper) + => sequence.OrderByAsArrayCore(SortHelper.IdentityFunc, in sortHelper); + + private static ImmutableArray OrderByAsArrayCore( + this IEnumerable sequence, Func keySelector, ref readonly SortHelper sortHelper) + { + var newArray = BuildArray(sequence); + + if (newArray.Length <= 1) + { + return ImmutableCollectionsMarshal.AsImmutableArray(newArray); + } + + var length = newArray.Length; + using var keys = SortKey.GetPooledArray(minimumLength: length); + + if (!sortHelper.ComputeKeys(newArray.AsSpan(), keySelector, keys.Span)) + { + // The keys are not ordered, so we need to sort the array. + Array.Sort(keys.Array, newArray, 0, length, sortHelper.GetOrCreateComparer()); + } + + return ImmutableCollectionsMarshal.AsImmutableArray(newArray); + } + + private static T[] BuildArray(IEnumerable sequence) + { + if (!sequence.TryGetCount(out var count)) + { + return BuildSlow(sequence); + } + + if (count == 0) + { + return []; + } + + var result = new T[count]; + sequence.CopyTo(result); + + return result; + + static T[] BuildSlow(IEnumerable sequence) + { + using var builder = new PooledArrayBuilder(); + + foreach (var item in sequence) + { + builder.Add(item); + } + + return builder.ToArray(); + } + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/HashSetExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/HashSetExtensions.cs index 7d1d85bfc56..fe3f75da3a6 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/HashSetExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/HashSetExtensions.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using Microsoft.AspNetCore.Razor; namespace System.Collections.Generic; @@ -23,4 +24,29 @@ public static void AddRange(this HashSet set, ImmutableArray array) set.Add(item); } } + + /// + /// Copies the contents of the set to a destination . + /// + /// The type of elements in the set. + /// The set to copy items from. + /// The span to copy items into. + /// + /// The is . + /// + /// + /// The destination span is shorter than the source set. + /// + public static void CopyTo(this HashSet set, Span destination) + { + ArgHelper.ThrowIfNull(set); + ArgHelper.ThrowIfDestinationTooShort(destination, set.Count); + + var index = 0; + + foreach (var item in set) + { + destination[index++] = item; + } + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions.cs index 3107a833101..808f00451e8 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions.cs @@ -1,17 +1,17 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Buffers; using System.Collections.Generic; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Utilities; namespace System.Collections.Immutable; /// /// extension methods /// -internal static class ImmutableArrayExtensions +internal static partial class ImmutableArrayExtensions { /// /// Returns an empty array if the input array is null (default) @@ -175,286 +175,759 @@ public static int BinarySearchBy(this ImmutableArray array, TArg arg return ~min; } + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// + /// Returns a new whose elements are sorted in ascending order. + /// public static ImmutableArray OrderAsArray(this ImmutableArray array) { - var compareHelper = new CompareHelper(comparer: null, descending: false); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparer: null, descending: false); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// public static ImmutableArray OrderAsArray(this ImmutableArray array, IComparer comparer) { - var compareHelper = new CompareHelper(comparer, descending: false); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparer, descending: false); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// A to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// public static ImmutableArray OrderAsArray(this ImmutableArray array, Comparison comparison) { - var compareHelper = new CompareHelper(comparison, descending: false); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparison, descending: false); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// + /// Returns a new whose elements are sorted in descending order. + /// public static ImmutableArray OrderDescendingAsArray(this ImmutableArray array) { - var compareHelper = new CompareHelper(comparer: null, descending: true); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparer: null, descending: true); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// public static ImmutableArray OrderDescendingAsArray(this ImmutableArray array, IComparer comparer) { - var compareHelper = new CompareHelper(comparer, descending: true); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparer, descending: true); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An array to ordered. + /// A to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// public static ImmutableArray OrderDescendingAsArray(this ImmutableArray array, Comparison comparison) { - var compareHelper = new CompareHelper(comparison, descending: true); - return array.OrderAsArrayCore(in compareHelper); + var sortHelper = new SortHelper(comparison, descending: true); + return array.OrderAsArrayCore(in sortHelper); } + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// public static ImmutableArray OrderByAsArray( this ImmutableArray array, Func keySelector) { - var compareHelper = new CompareHelper(comparer: null, descending: false); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparer: null, descending: false); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// public static ImmutableArray OrderByAsArray( this ImmutableArray array, Func keySelector, IComparer comparer) { - var compareHelper = new CompareHelper(comparer, descending: false); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparer, descending: false); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// A to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// public static ImmutableArray OrderByAsArray( this ImmutableArray array, Func keySelector, Comparison comparison) { - var compareHelper = new CompareHelper(comparison, descending: false); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparison, descending: false); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// public static ImmutableArray OrderByDescendingAsArray( this ImmutableArray array, Func keySelector) { - var compareHelper = new CompareHelper(comparer: null, descending: true); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparer: null, descending: true); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// public static ImmutableArray OrderByDescendingAsArray( this ImmutableArray array, Func keySelector, IComparer comparer) { - var compareHelper = new CompareHelper(comparer, descending: true); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparer, descending: true); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An array to ordered. + /// A function to extract a key from an element. + /// A to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// public static ImmutableArray OrderByDescendingAsArray( this ImmutableArray array, Func keySelector, Comparison comparison) { - var compareHelper = new CompareHelper(comparison, descending: true); - return array.OrderByAsArrayCore(keySelector, in compareHelper); + var sortHelper = new SortHelper(comparison, descending: true); + return array.OrderByAsArrayCore(keySelector, in sortHelper); } - private static ImmutableArray OrderAsArrayCore(this ImmutableArray array, ref readonly CompareHelper compareHelper) + private static ImmutableArray OrderAsArrayCore(this ImmutableArray array, ref readonly SortHelper sortHelper) + => array.OrderByAsArrayCore(SortHelper.IdentityFunc, in sortHelper); + + private static ImmutableArray OrderByAsArrayCore( + this ImmutableArray array, Func keySelector, ref readonly SortHelper sortHelper) { - if (array.Length > 1) + if (array.Length <= 1) { - var items = array.AsSpan(); + return array; + } - if (AreOrdered(items, in compareHelper)) - { - // No need to sort - items are already ordered. - return array; - } + var items = array.AsSpan(); + var length = items.Length; + + using var keys = SortKey.GetPooledArray(minimumLength: length); - var length = items.Length; - var newArray = new T[length]; - items.CopyTo(newArray); + if (sortHelper.ComputeKeys(items, keySelector, keys.Span)) + { + // The keys are already ordered, so we don't need to create a new array and sort it. + return array; + } - var comparer = compareHelper.GetOrCreateComparer(); + var newArray = new TElement[length]; + items.CopyTo(newArray); - Array.Sort(newArray, comparer); + Array.Sort(keys.Array, newArray, 0, length, sortHelper.GetOrCreateComparer()); - return ImmutableCollectionsMarshal.AsImmutableArray(newArray); - } + return ImmutableCollectionsMarshal.AsImmutableArray(newArray); + } + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order. + /// + public static ImmutableArray ToImmutableOrdered(this ImmutableArray.Builder builder) + { + var array = builder.ToImmutable(); + array.Unsafe().Order(); return array; } - private static ImmutableArray OrderByAsArrayCore( - this ImmutableArray array, Func keySelector, ref readonly CompareHelper compareHelper) + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order. + /// + public static ImmutableArray ToImmutableOrdered(this ImmutableArray.Builder builder, IComparer comparer) { - if (array.Length > 1) - { - var items = array.AsSpan(); - var length = items.Length; + var array = builder.ToImmutable(); + array.Unsafe().Order(comparer); + return array; + } - using var _ = ArrayPool.Shared.GetPooledArray(minimumLength: length, out var keys); + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order. + /// + public static ImmutableArray ToImmutableOrdered(this ImmutableArray.Builder builder, Comparison comparison) + { + var array = builder.ToImmutable(); + array.Unsafe().Order(comparison); + return array; + } - if (SelectKeys(items, keySelector, compareHelper, keys.AsSpan(0, length))) - { - // No need to sort - keys are already ordered. - return array; - } + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + public static ImmutableArray ToImmutableOrderedDescending(this ImmutableArray.Builder builder) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderDescending(); + return array; + } - var newArray = new TElement[length]; - items.CopyTo(newArray); + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + public static ImmutableArray ToImmutableOrderedDescending(this ImmutableArray.Builder builder, IComparer comparer) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderDescending(comparer); + return array; + } - var comparer = compareHelper.GetOrCreateComparer(); + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + public static ImmutableArray ToImmutableOrderedDescending(this ImmutableArray.Builder builder, Comparison comparison) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderDescending(comparison); + return array; + } - Array.Sort(keys, newArray, 0, length, comparer); + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray ToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderBy(keySelector); + return array; + } - return ImmutableCollectionsMarshal.AsImmutableArray(newArray); - } + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray ToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector, IComparer comparer) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderBy(keySelector, comparer); + return array; + } + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray ToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector, Comparison comparison) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderBy(keySelector, comparison); return array; } /// - /// Walk through and determine whether they are already ordered using - /// the provided . + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order according to a key. /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. /// - /// if the items are in order; otherwise . + /// Returns a new whose elements are sorted in descending order according to a key. /// - /// - /// When the items are already ordered, there's no need to perform a sort. - /// - private static bool AreOrdered(ReadOnlySpan items, ref readonly CompareHelper compareHelper) + public static ImmutableArray ToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector) { - var isOutOfOrder = false; + var array = builder.ToImmutable(); + array.Unsafe().OrderByDescending(keySelector); + return array; + } - for (var i = 1; i < items.Length; i++) - { - if (!compareHelper.InSortedOrder(items[i], items[i - 1])) - { - isOutOfOrder = true; - break; - } - } + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray ToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector, IComparer comparer) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderByDescending(keySelector, comparer); + return array; + } - return !isOutOfOrder; + /// + /// Returns an immutable array that contains the current contents of this + /// sorted in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray ToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector, Comparison comparison) + { + var array = builder.ToImmutable(); + array.Unsafe().OrderByDescending(keySelector, comparison); + return array; } /// - /// Walk through and convert each element to a key using . - /// While walking, each computed key is compared with the previous one using the provided - /// to determine whether they are already ordered. + /// Returns the current contents of this + /// as an immutable array sorted in ascending order and sets the collection to a zero length array. /// + /// The type of the elements in . + /// The whose contents will be sorted. /// - /// if the keys are in order; otherwise . + /// An immutable array that contains the current contents of this + /// sorted in ascending order. /// /// - /// When the keys are already ordered, there's no need to perform a sort. + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. /// - private static bool SelectKeys( - ReadOnlySpan items, Func keySelector, CompareHelper compareHelper, Span keys) + public static ImmutableArray DrainToImmutableOrdered(this ImmutableArray.Builder builder) { - var isOutOfOrder = false; - - keys[0] = keySelector(items[0]); - - for (var i = 1; i < items.Length; i++) - { - keys[i] = keySelector(items[i]); - - if (!isOutOfOrder && !compareHelper.InSortedOrder(keys[i], keys[i - 1])) - { - isOutOfOrder = true; - - // Continue processing to finish converting elements to keys. However, we can stop comparing keys. - } - } - - return !isOutOfOrder; + var array = builder.DrainToImmutable(); + array.Unsafe().Order(); + return array; } /// - /// Helper that avoids creating an until its needed. + /// Returns the current contents of this + /// as an immutable array sorted in ascending order and sets the collection to a zero length array. /// - private readonly ref struct CompareHelper + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrdered(this ImmutableArray.Builder builder, IComparer comparer) { - private readonly IComparer _comparer; - private readonly Comparison _comparison; - private readonly bool _comparerSpecified; - private readonly bool _useComparer; - private readonly bool _descending; - - public CompareHelper(IComparer? comparer, bool descending) - { - _comparerSpecified = comparer is not null; - _comparer = comparer ?? Comparer.Default; - _useComparer = true; - _descending = descending; - _comparison = null!; - } - - public CompareHelper(Comparison comparison, bool descending) - { - _comparison = comparison; - _useComparer = false; - _descending = descending; - _comparer = null!; - } - - public bool InSortedOrder(T? x, T? y) - { - // We assume that x and y are in sorted order if x is > y. - // We don't consider x == y to be sorted because the actual sor - // might not be stable, depending on T. - - return _useComparer - ? !_descending ? _comparer.Compare(x!, y!) > 0 : _comparer.Compare(y!, x!) > 0 - : !_descending ? _comparison(x!, y!) > 0 : _comparison(y!, x!) > 0; - } - - public IComparer GetOrCreateComparer() - // There are six cases to consider. - => (_useComparer, _comparerSpecified, _descending) switch - { - // Provided a comparer and the results are in ascending order. - (true, true, false) => _comparer, - - // Provided a comparer and the results are in descending order. - (true, true, true) => DescendingComparer.Create(_comparer), - - // Not provided a comparer and the results are in ascending order. - // In this case, _comparer was already set to Comparer.Default. - (true, false, false) => _comparer, + var array = builder.DrainToImmutable(); + array.Unsafe().Order(comparer); + return array; + } - // Not provided a comparer and the results are in descending order. - (true, false, true) => DescendingComparer.Default, + /// + /// Returns the current contents of this + /// as an immutable array sorted in ascending order and sets the collection to a zero length array. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrdered(this ImmutableArray.Builder builder, Comparison comparison) + { + var array = builder.DrainToImmutable(); + array.Unsafe().Order(comparison); + return array; + } - // Provided a comparison delegate and the results are in ascending order. - (false, _, false) => Comparer.Create(_comparison), + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order and sets the collection to a zero length array. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedDescending(this ImmutableArray.Builder builder) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderDescending(); + return array; + } - // Provided a comparison delegate and the results are in descending order. - (false, _, true) => DescendingComparer.Create(_comparison) - }; + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order and sets the collection to a zero length array. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedDescending(this ImmutableArray.Builder builder, IComparer comparer) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderDescending(comparer); + return array; } - private abstract class DescendingComparer : IComparer + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order and sets the collection to a zero length array. + /// + /// The type of the elements in . + /// The whose contents will be sorted. + /// An to compare elements. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedDescending(this ImmutableArray.Builder builder, Comparison comparison) { - private static IComparer? s_default; + var array = builder.DrainToImmutable(); + array.Unsafe().OrderDescending(comparison); + return array; + } - public static IComparer Default => s_default ??= new ReversedComparer(Comparer.Default); + /// + /// Returns the current contents of this + /// as an immutable array sorted in ascending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderBy(keySelector); + return array; + } - public static IComparer Create(IComparer comparer) - => new ReversedComparer(comparer); + /// + /// Returns the current contents of this + /// as an immutable array sorted in ascending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector, IComparer comparer) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderBy(keySelector, comparer); + return array; + } - public static IComparer Create(Comparison comparison) - => new ReversedComparison(comparison); + /// + /// Returns the current contents of this + /// as an immutable array sorted in ascending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// An immutable array that contains the current contents of this + /// sorted in ascending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedBy( + this ImmutableArray.Builder builder, Func keySelector, Comparison comparison) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderBy(keySelector, comparison); + return array; + } - public abstract int Compare(T? x, T? y); + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderByDescending(keySelector); + return array; + } - private sealed class ReversedComparer(IComparer comparer) : DescendingComparer - { - public override int Compare(T? x, T? y) - => comparer.Compare(y!, x!); - } + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector, IComparer comparer) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderByDescending(keySelector, comparer); + return array; + } - private sealed class ReversedComparison(Comparison comparison) : DescendingComparer - { - public override int Compare(T? x, T? y) - => comparison(y!, x!); - } + /// + /// Returns the current contents of this + /// as an immutable array sorted in descending order according to a key and sets + /// the collection to a zero length array. + /// + /// The type of the elements in . + /// The type of key returned by . + /// The whose contents will be sorted. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// An immutable array that contains the current contents of this + /// sorted in descending order according to a key. + /// + /// + /// If Capacity equals + /// Count, the internal array will be extracted as an + /// without copying the contents. Otherwise, the contents will be copied + /// into a new array. The collection will then be set to a zero length array. + /// + public static ImmutableArray DrainToImmutableOrderedByDescending( + this ImmutableArray.Builder builder, Func keySelector, Comparison comparison) + { + var array = builder.DrainToImmutable(); + array.Unsafe().OrderByDescending(keySelector, comparison); + return array; } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions_Unsafe.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions_Unsafe.cs new file mode 100644 index 00000000000..a7195275c71 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ImmutableArrayExtensions_Unsafe.cs @@ -0,0 +1,184 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Microsoft.AspNetCore.Razor.Utilities; + +namespace System.Collections.Immutable; + +internal static partial class ImmutableArrayExtensions +{ + /// + /// Provides a set of unsafe operations that can be performed on an . + /// + /// The type of the elements in . + /// The array that unsafe operations will target. + /// + /// Returns a struct that provides access to unsafe operations to perform on the + /// . These operations mutate the internal array + /// of the and should be only be used in + /// performance-critical code. + /// + public static UnsafeOperations Unsafe(this ImmutableArray array) + => new(array); + + public readonly ref struct UnsafeOperations(ImmutableArray array) + { + /// + /// Sorts the elements of this in ascending order. + /// + public void Order() + { + var sortHelper = new SortHelper(comparer: null, descending: false); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in ascending order. + /// + /// An to compare elements. + public void Order(IComparer comparer) + { + var sortHelper = new SortHelper(comparer, descending: false); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in ascending order. + /// + /// A to compare elements. + public void Order(Comparison comparison) + { + var sortHelper = new SortHelper(comparison, descending: false); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in descending order. + /// + public void OrderDescending() + { + var sortHelper = new SortHelper(comparer: null, descending: true); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in descending order. + /// + /// An to compare elements. + public void OrderDescending(IComparer comparer) + { + var sortHelper = new SortHelper(comparer, descending: true); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in descending order. + /// + /// A to compare elements. + public void OrderDescending(Comparison comparison) + { + var sortHelper = new SortHelper(comparison, descending: true); + array.UnsafeOrderCore(in sortHelper); + } + + /// + /// Sorts the elements of this in ascending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + public void OrderBy(Func keySelector) + { + var sortHelper = new SortHelper(comparer: null, descending: false); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of this in ascending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + /// An to compare elements. + public void OrderBy(Func keySelector, IComparer comparer) + { + var sortHelper = new SortHelper(comparer, descending: false); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of this in ascending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + /// An to compare elements. + public void OrderBy(Func keySelector, Comparison comparison) + { + var sortHelper = new SortHelper(comparison, descending: false); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of this in descending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + public void OrderByDescending(Func keySelector) + { + var sortHelper = new SortHelper(comparer: null, descending: true); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of this in descending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + /// An to compare elements. + public void OrderByDescending(Func keySelector, IComparer comparer) + { + var sortHelper = new SortHelper(comparer, descending: true); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of this in descending order according to a key. + /// + /// The type of key returned by . + /// A function to extract a key from an element. + /// An to compare elements. + public void OrderByDescending(Func keySelector, Comparison comparison) + { + var sortHelper = new SortHelper(comparison, descending: true); + array.UnsafeOrderByCore(keySelector, in sortHelper); + } + } + + private static ImmutableArray UnsafeOrderCore(this ImmutableArray array, ref readonly SortHelper sortHelper) + => array.UnsafeOrderByCore(SortHelper.IdentityFunc, in sortHelper); + + private static ImmutableArray UnsafeOrderByCore( + this ImmutableArray array, Func keySelector, ref readonly SortHelper sortHelper) + { + // Note: Checking the length will throw if array.IsDefault returns true. + // So, we can assume that the inner array below is non-null. + if (array.Length <= 1) + { + return array; + } + + var innerArray = ImmutableCollectionsMarshal.AsArray(array)!; + var items = innerArray.AsSpan(); + var length = items.Length; + + using var keys = SortKey.GetPooledArray(minimumLength: length); + + if (!sortHelper.ComputeKeys(items, keySelector, keys.Span)) + { + // The keys are not ordered, so we need to sort the array. + Array.Sort(keys.Array, innerArray, 0, length, sortHelper.GetOrCreateComparer()); + } + + return array; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ListExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ListExtensions.cs index d1a07f223c0..98cd48863fa 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ListExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ListExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Generic; namespace Microsoft.AspNetCore.Razor; @@ -33,4 +34,33 @@ public static T[] ToArrayOrEmpty(this List? list) public static bool Any(this List list) => list.Count > 0; + + /// + /// Copies the contents of the list to a destination . + /// + /// The type of elements in the list. + /// The list to copy items from. + /// The span to copy items into. + /// + /// The is . + /// + /// + /// The destination span is shorter than the source list. + /// + public static void CopyTo(this List list, Span destination) + { +#if NET8_0_OR_GREATER + CollectionExtensions.CopyTo(list, destination); +#else + ArgHelper.ThrowIfNull(list); + ArgHelper.ThrowIfDestinationTooShort(destination, list.Count); + + var index = 0; + + foreach (var item in list) + { + destination[index++] = item; + } +#endif + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.csproj b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.csproj index 18d42c533aa..15d4b337497 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.csproj +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.csproj @@ -5,7 +5,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the language server library assets. false false - false + false Microsoft.AspNetCore.Razor false true diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs index 457b72c0988..11f9ae42214 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Utilities; +using Microsoft.Extensions.ObjectPool; namespace Microsoft.AspNetCore.Razor.PooledObjects; @@ -33,6 +34,8 @@ internal partial struct PooledArrayBuilder : IDisposable /// private const int InlineCapacity = 4; + private ObjectPool.Builder>? _builderPool; + /// /// A builder to be used as storage after the first time that the number /// of items exceeds . Once the builder is used, @@ -56,9 +59,10 @@ internal partial struct PooledArrayBuilder : IDisposable /// private int _inlineCount; - public PooledArrayBuilder(int? capacity = null) + public PooledArrayBuilder(int? capacity = null, ObjectPool.Builder>? builderPool = null) { _capacity = capacity is > InlineCapacity ? capacity : null; + _builderPool = builderPool; _element0 = default!; _element1 = default!; _element2 = default!; @@ -79,13 +83,50 @@ public void Dispose() // Return _builder to the pool if necessary. Note that we don't need to clear the inline elements here // because this type is intended to be allocated on the stack and the GC can reclaim objects from the // stack after the last use of a reference to them. - if (_builder is { } builder) + if (_builder is { } innerBuilder) { - ArrayBuilderPool.Default.Return(builder); + _builderPool?.Return(innerBuilder); _builder = null; } } + /// + /// Retrieves the inner . + /// + /// + /// Returns if is available; otherwise + /// + /// + /// This should only be used by methods that will not add to the inner . + /// + private readonly bool TryGetBuilder([NotNullWhen(true)] out ImmutableArray.Builder? builder) + { + builder = _builder; + return builder is not null; + } + + /// + /// Retrieves the inner and resets its capacity if necessary. + /// + /// + /// Returns if is available; otherwise + /// + /// + /// This should only be used by methods that will add to the inner . + /// + private readonly bool TryGetBuilderAndEnsureCapacity([NotNullWhen(true)] out ImmutableArray.Builder? builder) + { + if (TryGetBuilder(out builder)) + { + if (builder.Capacity == 0 && _capacity is int capacity) + { + builder.Capacity = capacity; + } + } + + return builder is not null; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void ClearInlineElement(int index) { @@ -108,7 +149,7 @@ public T this[int index] [MethodImpl(MethodImplOptions.AggressiveInlining)] readonly get { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder[index]; } @@ -124,7 +165,7 @@ readonly get [MethodImpl(MethodImplOptions.AggressiveInlining)] set { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { builder[index] = value; return; @@ -194,7 +235,7 @@ public readonly int Count public void Add(T item) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.Add(item); } @@ -229,7 +270,7 @@ public void AddRange(ReadOnlySpan items) return; } - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.AddRange(items); } @@ -250,7 +291,7 @@ public void AddRange(ReadOnlySpan items) public void AddRange(IEnumerable items) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.AddRange(items); return; @@ -292,7 +333,7 @@ public void AddRange(IEnumerable items) public void Clear() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { // Keep using a real builder to avoid churn in the object pool. builder.Clear(); @@ -310,7 +351,7 @@ public readonly Enumerator GetEnumerator() public void RemoveAt(int index) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.RemoveAt(index); return; @@ -380,7 +421,7 @@ public void RemoveAt(Index index) /// An immutable array. public ImmutableArray DrainToImmutable() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.DrainToImmutable(); } @@ -396,7 +437,7 @@ public ImmutableArray DrainToImmutable() public readonly ImmutableArray ToImmutable() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.ToImmutable(); } @@ -420,7 +461,7 @@ private readonly ImmutableArray InlineItemsToImmutableArray() public readonly T[] ToArray() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.ToArray(); } @@ -1314,7 +1355,8 @@ private void MoveInlineItemsToBuilder() { Debug.Assert(_builder is null); - var builder = ArrayBuilderPool.Default.Get(); + _builderPool ??= ArrayBuilderPool.Default; + var builder = _builderPool.Get(); if (_capacity is int capacity) { @@ -1333,4 +1375,205 @@ private void MoveInlineItemsToBuilder() // Since _inlineCount tracks the number of inline items used, we zero it out here. _inlineCount = 0; } + + public readonly ImmutableArray ToImmutableOrdered() + { + var result = ToImmutable(); + result.Unsafe().Order(); + + return result; + } + + public readonly ImmutableArray ToImmutableOrdered(IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().Order(comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrdered(Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().Order(comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending() + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending(IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending(Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector, IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector, comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector, Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector, comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector, IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector, Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered() + { + var result = DrainToImmutable(); + result.Unsafe().Order(); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered(IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().Order(comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered(Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().Order(comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending() + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending(IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending(Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector, IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector, comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector, Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector, comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector, IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector, Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparison); + + return result; + } + + internal readonly TestAccessor GetTestAccessor() => new(in this); + + internal readonly struct TestAccessor(ref readonly PooledArrayBuilder builder) + { + public ImmutableArray.Builder? InnerArrayBuilder { get; } = builder._builder; + public int? Capacity { get; } = builder._capacity; + public int InlineItemCount { get; } = builder._inlineCount; + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs index c5ac61e1248..f976a5b58f0 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs @@ -16,7 +16,9 @@ namespace Microsoft.AspNetCore.Razor.PooledObjects; internal ref struct PooledHashSet { private readonly ObjectPool> _pool; +#pragma warning disable IDE0052 // Used in NET only code below. Called API doesn't exist on framework. private readonly int? _capacity; +#pragma warning restore IDE0052 private HashSet? _set; public PooledHashSet() @@ -67,10 +69,13 @@ public readonly bool Contains(T item) => _set?.Contains(item) ?? false; public readonly T[] ToArray() - => _set?.ToArray() ?? Array.Empty(); + => _set?.ToArray() ?? []; public readonly ImmutableArray ToImmutableArray() - => _set?.ToImmutableArray() ?? ImmutableArray.Empty; + => _set?.ToImmutableArray() ?? []; + + public readonly ImmutableArray OrderByAsArray(Func keySelector) + => _set?.OrderByAsArray(keySelector) ?? []; public void UnionWith(IList? other) { diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ReadOnlyListExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ReadOnlyListExtensions.cs index a62950ce924..01c96def822 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ReadOnlyListExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/ReadOnlyListExtensions.cs @@ -2,8 +2,10 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; +using System.Runtime.InteropServices; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Utilities; namespace System.Collections.Generic; @@ -34,6 +36,47 @@ static ImmutableArray BuildResult(IReadOnlyList items, Func(this IReadOnlyList list) + { + return list switch + { + [] => [], + [var item] => [item], + [var item1, var item2] => [item1, item2], + [var item1, var item2, var item3] => [item1, item2, item3], + [var item1, var item2, var item3, var item4] => [item1, item2, item3, item4], + var items => BuildResult(items) + }; + + static T[] BuildResult(IReadOnlyList items) + { + var result = new T[items.Count]; + items.CopyTo(result); + + return result; + } + } + + public static ImmutableArray ToImmutableArray(this IReadOnlyList list) + { + return list switch + { + [] => [], + [var item] => [item], + [var item1, var item2] => [item1, item2], + [var item1, var item2, var item3] => [item1, item2, item3], + [var item1, var item2, var item3, var item4] => [item1, item2, item3, item4], + var items => BuildResult(items) + }; + + static ImmutableArray BuildResult(IReadOnlyList items) + { + var result = items.ToArray(); + + return ImmutableCollectionsMarshal.AsImmutableArray(result); + } + } + /// /// Determines whether a list contains any elements. /// @@ -952,4 +995,333 @@ public void Reset() _current = default!; } } + + /// + /// Copies the contents of the list to a destination . + /// + /// The type of elements in the list. + /// The list to copy items from. + /// The span to copy items into. + /// + /// The destination span is shorter than the source list. + /// + public static void CopyTo(this IReadOnlyList list, Span destination) + { + ArgHelper.ThrowIfDestinationTooShort(destination, list.Count); + + switch (list) + { + case ImmutableArray array: + array.CopyTo(destination); + break; + + case ImmutableArray.Builder builder: + builder.CopyTo(destination); + break; + + case List listOfT: + ListExtensions.CopyTo(listOfT, destination); + break; + + case T[] array: + MemoryExtensions.CopyTo(array, destination); + break; + + default: + var count = list.Count; + + for (var i = 0; i < count; i++) + { + destination[i] = list[i]; + } + + break; + } + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IReadOnlyList list) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array); + } + + var sortHelper = new SortHelper(comparer: null, descending: false); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IReadOnlyList list, IComparer comparer) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: false); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in ascending order. + /// + public static ImmutableArray OrderAsArray(this IReadOnlyList list, Comparison comparison) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderAsArray(array, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: false); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IReadOnlyList list) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array); + } + + var sortHelper = new SortHelper(comparer: null, descending: true); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IReadOnlyList list, IComparer comparer) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: true); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in descending order. + /// + /// The type of the elements in . + /// An to ordered. + /// An to compare elements. + /// + /// Returns a new whose elements are sorted in descending order. + /// + public static ImmutableArray OrderDescendingAsArray(this IReadOnlyList list, Comparison comparison) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderDescendingAsArray(array, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: true); + return list.OrderAsArrayCore(in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IReadOnlyList list, Func keySelector) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector); + } + + var sortHelper = new SortHelper(comparer: null, descending: false); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IReadOnlyList list, Func keySelector, IComparer comparer) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: false); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in ascending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in ascending order according to a key. + /// + public static ImmutableArray OrderByAsArray( + this IReadOnlyList list, Func keySelector, Comparison comparison) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByAsArray(array, keySelector, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: false); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IReadOnlyList list, Func keySelector) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector); + } + + var sortHelper = new SortHelper(comparer: null, descending: true); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IReadOnlyList list, Func keySelector, IComparer comparer) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector, comparer); + } + + var sortHelper = new SortHelper(comparer, descending: true); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + /// + /// Sorts the elements of an in descending order according to a key. + /// + /// The type of the elements in . + /// The type of key returned by . + /// An to ordered. + /// A function to extract a key from an element. + /// An to compare keys. + /// + /// Returns a new whose elements are sorted in descending order according to a key. + /// + public static ImmutableArray OrderByDescendingAsArray( + this IReadOnlyList list, Func keySelector, Comparison comparison) + { + if (list is ImmutableArray array) + { + return ImmutableArrayExtensions.OrderByDescendingAsArray(array, keySelector, comparison); + } + + var sortHelper = new SortHelper(comparison, descending: true); + return list.OrderByAsArrayCore(keySelector, in sortHelper); + } + + private static ImmutableArray OrderAsArrayCore( + this IReadOnlyList list, ref readonly SortHelper sortHelper) + => list.OrderByAsArrayCore(SortHelper.IdentityFunc, in sortHelper); + + private static ImmutableArray OrderByAsArrayCore( + this IReadOnlyList list, Func keySelector, ref readonly SortHelper sortHelper) + { + switch (list.Count) + { + case 0: + return []; + case 1: + return [list[0]]; + } + + var length = list.Count; + + using var keys = SortKey.GetPooledArray(minimumLength: length); + + if (sortHelper.ComputeKeys(list, keySelector, keys.Span)) + { + // The keys are already ordered, so we don't need to create a new array and sort it. + return ImmutableCollectionsMarshal.AsImmutableArray(list.ToArray()); + } + + var newArray = list.ToArray(); + + Array.Sort(keys.Array, newArray, 0, length, sortHelper.GetOrCreateComparer()); + + return ImmutableCollectionsMarshal.AsImmutableArray(newArray); + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortComparer`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortComparer`1.cs new file mode 100644 index 00000000000..e2bb49fbe11 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortComparer`1.cs @@ -0,0 +1,77 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Utilities; + +internal abstract class SortComparer : IComparer> +{ + public static IComparer> GetOrCreate(IComparer comparer, bool descending) + { + if (ReferenceEquals(comparer, Comparer.Default)) + { + return descending + ? DescendingComparer.Default + : AscendingComparer.Default; + } + + return descending + ? new DescendingComparer(comparer) + : new AscendingComparer(comparer); + } + + public static IComparer> Create(Comparison comparison, bool descending) + => descending + ? new DescendingComparison(comparison) + : new AscendingComparison(comparison); + + private SortComparer() + { + } + + protected abstract int CompareValues(T x, T y); + + public int Compare(SortKey x, SortKey y) + => CompareValues(x.Value, y.Value) switch + { + // If the values are equal, use their indices to ensure stability. + 0 => x.Index - y.Index, + var result => result + }; + + private sealed class AscendingComparer(IComparer comparer) : SortComparer + { + private static SortComparer? s_default; + + public static SortComparer Default + => s_default ?? InterlockedOperations.Initialize(ref s_default, new AscendingComparer(Comparer.Default)); + + protected override int CompareValues(T x, T y) + => comparer.Compare(x, y); + } + + private sealed class DescendingComparer(IComparer comparer) : SortComparer + { + private static SortComparer? s_default; + + public static SortComparer Default + => s_default ?? InterlockedOperations.Initialize(ref s_default, new DescendingComparer(Comparer.Default)); + + protected override int CompareValues(T x, T y) + => comparer.Compare(y, x); + } + + private sealed class AscendingComparison(Comparison comparison) : SortComparer + { + protected override int CompareValues(T x, T y) + => comparison(x, y); + } + + private sealed class DescendingComparison(Comparison comparison) : SortComparer + { + protected override int CompareValues(T x, T y) + => comparison(y, x); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortHelper`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortHelper`1.cs new file mode 100644 index 00000000000..5f2fe57a3cc --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortHelper`1.cs @@ -0,0 +1,207 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace Microsoft.AspNetCore.Razor.Utilities; + +/// +/// Helper that avoids creating an until its needed. +/// +internal readonly ref struct SortHelper +{ + public static readonly Func IdentityFunc = x => x; + + private readonly IComparer _comparer; + private readonly Comparison? _comparison; + private readonly bool _descending; + + public SortHelper(IComparer? comparer, bool descending) + { + _comparer = comparer ?? Comparer.Default; + _comparison = null; + _descending = descending; + } + + public SortHelper(Comparison comparison, bool descending) + { + _comparer = null!; // This value will never be used when _comparison is non-null. + _comparison = comparison; + _descending = descending; + } + + public IComparer> GetOrCreateComparer() + => _comparison is null + ? SortComparer.GetOrCreate(_comparer, _descending) + : SortComparer.Create(_comparison, _descending); + + /// + /// Determines whether is greater than + /// using the provided or . + /// + /// + /// We assume that value and previousValue are in sorted order if value is > previousValue. + /// We don't consider value == previousValue to be sorted because the actual sort might + /// not be stable, depending on T. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool AreInSortedOrder(T? value, T? previousValue) + => (_comparison, _descending) switch + { + (null, true) => _comparer.Compare(previousValue!, value!) > 0, + (null, false) => _comparer.Compare(value!, previousValue!) > 0, + (not null, true) => _comparison(previousValue!, value!) > 0, + (not null, false) => _comparison(value!, previousValue!) > 0, + }; + + /// + /// Walk through and convert each element to a key using . + /// While walking, each computed key is compared with the previous one using the provided + /// to determine whether they are already ordered. + /// + /// + /// if the keys are in order; otherwise . + /// + /// + /// When the keys are already ordered, there's no need to perform a sort. + /// + public bool ComputeKeys(ReadOnlySpan items, Func keySelector, Span> keys) + { + // Is this our identity func? If so, we can call a faster path that casts T -> TKey. + if (ReferenceEquals(IdentityFunc, keySelector)) + { + return ComputeIdentityKeys(items, keys); + } + + var isOutOfOrder = false; + + var previousKey = keySelector(items[0]); + keys[0] = new(Index: 0, previousKey); + + for (var i = 1; i < items.Length; i++) + { + var currentKey = keySelector(items[i]); + keys[i] = new(Index: i, currentKey); + + if (!isOutOfOrder) + { + if (!AreInSortedOrder(currentKey, previousKey)) + { + // Continue processing to finish converting elements to keys. However, we can stop comparing keys. + isOutOfOrder = true; + } + + previousKey = currentKey; + } + } + + return !isOutOfOrder; + } + + private bool ComputeIdentityKeys(ReadOnlySpan items, Span> keys) + { + Debug.Assert(typeof(TElement) == typeof(T)); + + var isOutOfOrder = false; + + var previousKey = (T)(object)items[0]!; + keys[0] = new(Index: 0, previousKey); + + for (var i = 1; i < items.Length; i++) + { + var currentKey = (T)(object)items[i]!; + keys[i] = new(Index: i, currentKey); + + if (!isOutOfOrder) + { + if (!AreInSortedOrder(currentKey, previousKey)) + { + // Continue processing to finish converting elements to keys. However, we can stop comparing keys. + isOutOfOrder = true; + } + + previousKey = currentKey; + } + } + + return !isOutOfOrder; + } + + /// + /// Walk through and convert each element to a key using . + /// While walking, each computed key is compared with the previous one using the provided + /// to determine whether they are already ordered. + /// + /// + /// if the keys are in order; otherwise . + /// + /// + /// When the keys are already ordered, there's no need to perform a sort. + /// + public bool ComputeKeys(IReadOnlyList items, Func keySelector, Span> keys) + { + // Is this our identity func? If so, we can call a faster path that casts T -> TKey. + if (ReferenceEquals(IdentityFunc, keySelector)) + { + return ComputeIdentityKeys(items, keys); + } + + var isOutOfOrder = false; + var count = items.Count; + + var previousKey = keySelector(items[0]); + keys[0] = new(Index: 0, previousKey); + + for (var i = 1; i < count; i++) + { + var currentKey = keySelector(items[i]); + keys[i] = new(Index: i, currentKey); + + if (!isOutOfOrder) + { + if (!AreInSortedOrder(currentKey, previousKey)) + { + // Continue processing to finish converting elements to keys. However, we can stop comparing keys. + isOutOfOrder = true; + } + + previousKey = currentKey; + } + } + + return !isOutOfOrder; + } + + private bool ComputeIdentityKeys(IReadOnlyList items, Span> keys) + { + Debug.Assert(typeof(TElement) == typeof(T)); + + var isOutOfOrder = false; + var count = items.Count; + + var previousKey = (T)(object)items[0]!; + keys[0] = new(Index: 0, previousKey); + + for (var i = 1; i < count; i++) + { + var currentKey = (T)(object)items[i]!; + keys[i] = new(Index: i, currentKey); + + if (!isOutOfOrder) + { + if (!AreInSortedOrder(currentKey, previousKey)) + { + // Continue processing to finish converting elements to keys. However, we can stop comparing keys. + isOutOfOrder = true; + } + + previousKey = currentKey; + } + } + + return !isOutOfOrder; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortKey`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortKey`1.cs new file mode 100644 index 00000000000..38231426f20 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/Utilities/SortKey`1.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Buffers; +using Microsoft.AspNetCore.Razor.PooledObjects; + +namespace Microsoft.AspNetCore.Razor.Utilities; + +internal readonly record struct SortKey(int Index, T Value) +{ + public static PooledArray> GetPooledArray(int minimumLength) + => ArrayPool>.Shared.GetPooledArray(minimumLength); +}