From f5b9c84cc96052da94645d77ffb0da35eb5cfd9f Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Thu, 1 Dec 2022 12:08:07 -0800 Subject: [PATCH 01/10] Drop netcoreapp3.1, add net7.0 support Resolves #32596. With netcoreapp3.1 falling out of support soon, we're upgrading to net7.0, net6.0, and, on Windows, net461. --- .vsconfig | 18 +++++++++++ CONTRIBUTING.md | 28 ++++++++--------- common/SmokeTests/SmokeTest/SmokeTest.csproj | 4 +-- doc/ApiDocGeneration/assets/docgen.csproj | 2 +- doc/dev/Using-Mock-Test-Generation.md | 4 +-- eng/Directory.Build.Common.props | 2 +- eng/mgmt/AzSdk.test.reference.props | 8 ++--- eng/pipelines/templates/jobs/smoke.tests.yml | 8 ++--- .../templates/stages/platform-matrix.json | 30 +++++++++---------- .../templates/steps/install-dotnet.yml | 6 ++-- .../dependencies/azure-sdk.deps.csproj | 8 ++--- global.json | 2 +- .../AppSecretsConfig/AppSecretsConfig.csproj | 2 +- .../CloudClipboard/CloudClipboard.csproj | 2 +- samples/linecounter/LineCounter.csproj | 2 +- sdk/appconfiguration/CONTRIBUTING.md | 6 ++-- .../phone-numbers-livetest-matrix.json | 14 ++++----- sdk/devcenter/CONTRIBUTING.md | 2 +- .../Azure.DigitalTwins.Core/perf/README.md | 6 ++-- .../DigitalTwinsClientSample.csproj | 4 +-- .../Microsoft.Extensions.Azure.Samples.csproj | 4 +-- sdk/identity/platform-matrix.json | 2 +- .../IotHubClientSamples.csproj | 4 +-- sdk/keyvault/CONTRIBUTING.md | 2 +- sdk/keyvault/samples/getcert/getcert.csproj | 2 +- ...mples.Security.KeyVault.Proxy.Tests.csproj | 2 +- .../samples/sharelink/ShareLink.csproj | 2 +- ...elemetry.Exporter.Integration.Tests.csproj | 4 +-- .../Azure.ResourceManager/docs/TestGuide.md | 6 ++-- sdk/search/CONTRIBUTING.md | 2 +- sdk/storage/CONTRIBUTING.md | 2 +- sdk/storage/platform-matrix-all-versions.json | 4 +-- .../Azure.AI.TextAnalytics.Perf/README.md | 6 ++-- .../TimeSeriesInsightsClientSample.csproj | 2 +- .../AzureDotNetSDK-TestProject.csproj | 2 +- 35 files changed, 111 insertions(+), 93 deletions(-) create mode 100644 .vsconfig diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 000000000000..1485a71378fe --- /dev/null +++ b/.vsconfig @@ -0,0 +1,18 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedDesktop", + "Microsoft.Net.ComponentGroup.4.6.2-4.7.1.DeveloperTools", + "Microsoft.Net.Component.4.7.2.TargetingPack", + "Microsoft.Net.Component.4.6.1.TargetingPack", + "Microsoft.Net.Component.4.8.SDK", + "Microsoft.Component.MSBuild", + "Microsoft.NetCore.Component.DevelopmentTools", + "Microsoft.NetCore.Component.Runtime.7.0", + "Microsoft.NetCore.Component.Runtime.6.0", + "Microsoft.NetCore.Component.Runtime.5.0", + "Microsoft.NetCore.Component.Runtime.3.1", + "Microsoft.NetCore.Component.SDK", + "Microsoft.VisualStudio.Component.Git" + ] +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a3655874077..2c65117b5e75 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,8 +8,8 @@ - Install Visual Studio 2022 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/). - Need at least .NET Framework 4.6.1 and 4.7 development tools -- Install the **.NET Core cross-platform development** workloads in VisualStudio -- Install **.NET Core 6.0.100 SDK** for your specific platform. (or a higher version within the 6.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/6.0) +- Install the **.NET cross-platform development** workloads in VisualStudio +- Install **.NET 7.0.100 SDK** for your specific platform. (or a higher version within the 6.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/7.0) - Install the latest version of git (https://git-scm.com/downloads) - Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 6 or higher, if you plan to make public API changes or are working with generated code snippets. - Install [NodeJS](https://nodejs.org/) (16.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp). @@ -182,7 +182,7 @@ In some cases, you might want to test against the latest versions of the client If you make public API changes or additions, the `eng\scripts\Export-API.ps1` script has to be run to update public API listings. This generates a file in the library's directory similar to the example found in `sdk\template\Azure.Template\api\Azure.Template.netstandard2.0.cs`. -Running the script for a project in `sdk\tables` would look like this: +Running the script for a project in `sdk\tables` would look like this: ``` eng\scripts\Export-API.ps1 tables ``` @@ -191,7 +191,7 @@ eng\scripts\Export-API.ps1 tables If the specific client library has sample snippets in markdown format, they were most likely created with help of the `eng\scripts\Update-Snippets.ps1` script. Any changes made to the snippet markdown should be done via updating the corresponding C# snippet code and subsequently running the script. -Running the script for a project, for example in `sdk\keyvault`, would look like this: +Running the script for a project, for example in `sdk\keyvault`, would look like this: ``` eng\scripts\Update-Snippets.ps1 keyvault ``` @@ -211,13 +211,13 @@ string ignored = "this code will not appear in the snippet markdown"; #endregion ``` - will be mapped to any markdown file with a corresponding code region in the format below where the snippet names match: + will be mapped to any markdown file with a corresponding code region in the format below where the snippet names match: **\`\`\`C# Snippet:\** **\`\`\`** -See the following example of a [snippet C# file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/tests/Samples/Sample01_HelloWorld.cs) and a [snippet markdown file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/samples/Sample01a_HelloWorld.md). +See the following example of a [snippet C# file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/tests/Samples/Sample01_HelloWorld.cs) and a [snippet markdown file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/samples/Sample01a_HelloWorld.md). Note that snippet names need to be globally unique under a given service directory. Snippets also can be integrated into XML doc comments. For example: @@ -238,7 +238,7 @@ For general information about samples, see the [Samples Guidelines](https://azur ## Updating Source on Build You can run `eng\scripts\Export-API.ps1` and `eng\scripts\Update-Snippets.ps1` simultaneously as part of the build by setting as true either: -1. The property `UpdateSourceOnBuild` +1. The property `UpdateSourceOnBuild` 2. The Environment variable `AZURE_DEV_UPDATESOURCESONBUILD=true` e.g. @@ -329,7 +329,7 @@ As you can see in the example below, we want to use the `Azure.Data.Tables` vers ## Preparing a new library release -To prepare a package for release you should make use of `.\eng\common\scripts\Prepare-Release.ps1` script passing it appropriate arguments for the package intended for release. This script will correctly update the package version and changelog in the repo as well as update the DevOps release work items for that release. +To prepare a package for release you should make use of `.\eng\common\scripts\Prepare-Release.ps1` script passing it appropriate arguments for the package intended for release. This script will correctly update the package version and changelog in the repo as well as update the DevOps release work items for that release. ``` .\eng\common\scripts\Prepare-Release.ps1 [] [] [-ReleaseTrackingOnly] @@ -419,7 +419,7 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net { private const ServiceVersion Latest = ServiceVersion.V2019_06_01; internal static StorageManagementClientOptions Default { get; } = new StorageManagementClientOptions(); - + public StorageManagementClientOptions(ServiceVersion serviceVersion = Latest) { VersionString = serviceVersion switch @@ -428,9 +428,9 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net _ => throw new ArgumentOutOfRangeException(nameof(serviceVersion)) }; } - + internal string VersionString { get; } - + public enum ServiceVersion { #pragma warning disable CA1707 // Identifiers should not contain underscores @@ -449,7 +449,7 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net public FileSharesClient(string subscriptionId, TokenCredential tokenCredential): this(subscriptionId, tokenCredential, StorageManagementClientOptions.Default) { } - + public FileSharesClient(string subscriptionId, TokenCredential tokenCredential, StorageManagementClientOptions options): this(new ClientDiagnostics(options), ManagementClientPipeline.Build(options, tokenCredential), subscriptionId, apiVersion: options.VersionString) { @@ -520,8 +520,8 @@ Once all of the above steps are met, the following process will be followed: | | Linux (Ubuntu 20.04) | MacOS 10.15 | Windows Server 2019 | | ------------------------ | :------------------: | :---------: | :-----------------: | -| **.NET 6** | x | x | x | -| **.NET Core 3.1** | x | x | x | +| **.NET 7.0** | x | x | x | +| **.NET 6.0** | x | x | x | | **.NET Framework 4.6.1** | | | x | ### Issues with Generated Code diff --git a/common/SmokeTests/SmokeTest/SmokeTest.csproj b/common/SmokeTests/SmokeTest/SmokeTest.csproj index d804456f679f..cc35789eb32e 100644 --- a/common/SmokeTests/SmokeTest/SmokeTest.csproj +++ b/common/SmokeTests/SmokeTest/SmokeTest.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp3.1;net461;net6.0 + net7.0;net6.0;net461 latest $(NoWarn);NU1605 @@ -38,7 +38,7 @@ - + diff --git a/doc/ApiDocGeneration/assets/docgen.csproj b/doc/ApiDocGeneration/assets/docgen.csproj index 290bef188f1c..6a68c148378d 100644 --- a/doc/ApiDocGeneration/assets/docgen.csproj +++ b/doc/ApiDocGeneration/assets/docgen.csproj @@ -1,6 +1,6 @@ - netcoreapp3.1 + net6.0 This is a dummy project used to restore nuget packages used for doc generation Doc generation Packages diff --git a/doc/dev/Using-Mock-Test-Generation.md b/doc/dev/Using-Mock-Test-Generation.md index 75c7986d088d..f0722f037ca8 100644 --- a/doc/dev/Using-Mock-Test-Generation.md +++ b/doc/dev/Using-Mock-Test-Generation.md @@ -21,7 +21,7 @@ Below is a sample for mock testcase:
-# Generate Mock Test +# Generate Mock Test The Mgmt mock tests can be generated by below steps: 1. Go to folder Azure.ResourceManager.xxx\tests @@ -56,7 +56,7 @@ The Mgmt mock tests can be generated by below steps: [USE autorest] ~~~ // clone autorest.csharp and build - > autorest --use=PATH_TO_AUTOREST.CSHARP\artifacts\bin\AutoRest.CSharp\Debug\netcoreapp3.1 autorest.tests.md --testmodeler={} --debug + > autorest --use=PATH_TO_AUTOREST.CSHARP\artifacts\bin\AutoRest.CSharp\Debug\net6.0 autorest.tests.md --testmodeler={} --debug ~~~ [or USE dotnet target] diff --git a/eng/Directory.Build.Common.props b/eng/Directory.Build.Common.props index 9a0680118064..81e1bf8e0798 100644 --- a/eng/Directory.Build.Common.props +++ b/eng/Directory.Build.Common.props @@ -123,7 +123,7 @@ false - net6.0;netcoreapp3.1 + net7.0;net6.0 $(RequiredTargetFrameworks);net461 diff --git a/eng/mgmt/AzSdk.test.reference.props b/eng/mgmt/AzSdk.test.reference.props index 00e520844f9b..fae55443ffa7 100644 --- a/eng/mgmt/AzSdk.test.reference.props +++ b/eng/mgmt/AzSdk.test.reference.props @@ -1,6 +1,6 @@ - + - netcoreapp3.1 + net6.0 @@ -14,7 +14,7 @@ - - + + diff --git a/eng/pipelines/templates/jobs/smoke.tests.yml b/eng/pipelines/templates/jobs/smoke.tests.yml index 25996a66b081..fc237b42acd9 100644 --- a/eng/pipelines/templates/jobs/smoke.tests.yml +++ b/eng/pipelines/templates/jobs/smoke.tests.yml @@ -51,14 +51,14 @@ jobs: Pool: "azsdk-pool-mms-win-2022-general" OSVmImage: "MMS2022" TestTargetFramework: net461 - Windows_NetCore: - Pool: "azsdk-pool-mms-ubuntu-2004-general" - OSVmImage: "MMSUbuntu20.04" - TestTargetFramework: netcoreapp3.1 Windows_Net60: Pool: "azsdk-pool-mms-win-2022-general" OSVmImage: "MMS2022" TestTargetFramework: net6.0 + Windows_Net70: + Pool: "azsdk-pool-mms-ubuntu-2004-general" + OSVmImage: "MMSUbuntu20.04" + TestTargetFramework: net7.0 pool: name: $(Pool) vmImage: $(OSVmImage) diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index b98d3c330e89..ca7b84c7c072 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -5,35 +5,35 @@ }, "matrix": { "Agent": { - "Ubuntu-20.04_NETCore3.1": { + "Ubuntu-20.04_NET6.0": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "TestTargetFramework": "netcoreapp3.1" + "TestTargetFramework": "net6.0" }, - "Ubuntu-20.04_NET6.0": { + "Ubuntu-20.04_NET7.0": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "TestTargetFramework": "net6.0" + "TestTargetFramework": "net7.0" }, - "windows2022_NET6.0": { + "Windows2022_NET461": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general", - "TestTargetFramework": "net6.0" + "TestTargetFramework": "net461" }, - "windows2022_NET461": { + "Windows2022_NET7.0": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general", - "TestTargetFramework": "net461" + "TestTargetFramework": "net7.0" }, - "macos-11_NETCore3.1": { + "MacOS-11_NET6.0": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines", - "TestTargetFramework": "netcoreapp3.1" + "TestTargetFramework": "net6.0" }, - "macos-11_NET6.0": { + "MacOS-11_NET7.0": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines", - "TestTargetFramework": "net6.0" + "TestTargetFramework": "net7.0" } }, "AdditionalTestArguments": [ @@ -48,14 +48,14 @@ "include": [ { "Agent": { - "windows2022": { + "Windows2022": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general", - "TestTargetFramework": "net6.0" + "TestTargetFramework": "net7.0" } }, "TestMode": { - "NET6.0_Coverage_Record": { + "NET7.0_Coverage_Record": { "SupportsRecording": true, "CollectCoverage": true } diff --git a/eng/pipelines/templates/steps/install-dotnet.yml b/eng/pipelines/templates/steps/install-dotnet.yml index e896df58b65c..e276cb0fa834 100644 --- a/eng/pipelines/templates/steps/install-dotnet.yml +++ b/eng/pipelines/templates/steps/install-dotnet.yml @@ -12,20 +12,20 @@ steps: msbuildArguments: /p:WorkFolder="$(Agent.WorkFolder)" /p:BuildDirectory="$(Agent.BuildDirectory)" # Installation steps need to be uncommented when switching to a newer SDK that's not available on DevOps agents - task: UseDotNet@2 - displayName: 'Use .NET Core SDK' + displayName: 'Use .NET SDK' retryCountOnTaskFailure: 3 inputs: useGlobalJson: true performMultiLevelLookup: true - task: UseDotNet@2 condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) # Windows supports MultiLevelLookup and doesn't need explicit framework installation - displayName: 'Use .NET Core 3.1 SDK' + displayName: 'Use .NET 6.0 SDK' retryCountOnTaskFailure: 3 inputs: # AspNetCore runtime pack can't be installed outside of SDK and we need it for intergation tests packageType: sdk performMultiLevelLookup: true - version: "3.1.x" + version: "6.0.x" - task: Cache@2 inputs: key: 'nuget | "$(Agent.OS)" | $(Build.SourcesDirectory)/eng/Packages.Data.props | ${{parameters.NuGetCacheKey}}' diff --git a/eng/scripts/dependencies/azure-sdk.deps.csproj b/eng/scripts/dependencies/azure-sdk.deps.csproj index 435a3d469f5c..3bf9eef88c79 100644 --- a/eng/scripts/dependencies/azure-sdk.deps.csproj +++ b/eng/scripts/dependencies/azure-sdk.deps.csproj @@ -1,11 +1,11 @@  - netcoreapp3.1 + net6.0 Exe false - $(NoWarn);NU1605 diff --git a/global.json b/global.json index 13dca532eef2..e44352dc3313 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "Microsoft.Build.Traversal": "3.0.23" }, "sdk": { - "version": "6.0.403", + "version": "7.0.100", "rollForward": "feature" } } \ No newline at end of file diff --git a/samples/AppSecretsConfig/AppSecretsConfig.csproj b/samples/AppSecretsConfig/AppSecretsConfig.csproj index b18da313f3f1..1184a128a51a 100644 --- a/samples/AppSecretsConfig/AppSecretsConfig.csproj +++ b/samples/AppSecretsConfig/AppSecretsConfig.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 AppSecretsConfig diff --git a/samples/CloudClipboard/CloudClipboard/CloudClipboard.csproj b/samples/CloudClipboard/CloudClipboard/CloudClipboard.csproj index 2daaf16b069d..c446f5397969 100644 --- a/samples/CloudClipboard/CloudClipboard/CloudClipboard.csproj +++ b/samples/CloudClipboard/CloudClipboard/CloudClipboard.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 preview diff --git a/samples/linecounter/LineCounter.csproj b/samples/linecounter/LineCounter.csproj index 4f0bb55823c4..7e6ad8abcfa6 100644 --- a/samples/linecounter/LineCounter.csproj +++ b/samples/linecounter/LineCounter.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net6.0 67ca5d37-051b-4ab1-b013-c74a2d4edb76 diff --git a/sdk/appconfiguration/CONTRIBUTING.md b/sdk/appconfiguration/CONTRIBUTING.md index 025af1b05ee5..7bf2ac9e5676 100644 --- a/sdk/appconfiguration/CONTRIBUTING.md +++ b/sdk/appconfiguration/CONTRIBUTING.md @@ -22,9 +22,9 @@ Before working on a contribution, it would be beneficial to familiarize yourself These libraries follow the [Azure SDK Design Guidelines for .NET][sdk_design_guidelines_dotnet] and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features in the [Azure.Core README][sdk_dotnet_code_readme]. -## Public API changes +## Public API changes -To update [`Azure.Data.AppConfiguration.netstandard2.0.cs`][azconfig_api] after making changes to the public API, execute [`./eng/scripts/Export-API.ps1`][azconfig_export_api]. +To update [`Azure.Data.AppConfiguration.netstandard2.0.cs`][azconfig_api] after making changes to the public API, execute [`./eng/scripts/Export-API.ps1`][azconfig_export_api]. ## Testing @@ -48,7 +48,7 @@ Properly supporting recorded tests does require a few extra considerations. All The easiest way to run the tests is via Visual Studio's unit test runner. -You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` or `dotnet test -f net461`. +You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. The recorded tests are run automatically on every pull request. Live tests are run nightly. Contributors with write access can ask Azure DevOps to run the live tests against a pull request by commenting `/azp run net - appconfiguration - tests` in the PR. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json b/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json index af84acf4c7d1..6191a81ae1be 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json +++ b/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json @@ -5,10 +5,10 @@ }, "matrix": { "Agent": { - "Ubuntu-20.04_NETCore3.1": { + "Ubuntu-20.04_NET7.0": { "OSVmImage": "MMSUbuntu20.04", "Pool": "azsdk-pool-mms-ubuntu-2004-general", - "TestTargetFramework": "netcoreapp3.1", + "TestTargetFramework": "net7.0", "SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE" }, "Ubuntu-20.04_NET6.0": { @@ -32,10 +32,10 @@ "SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE" }, - "macos-11_NETCore3.1": { + "macos-11_NET7.0": { "OSVmImage": "macos-11", "Pool": "Azure Pipelines", - "TestTargetFramework": "netcoreapp3.1", + "TestTargetFramework": "net7.0", "SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE" }, "macos-11_NET6.0": { @@ -55,14 +55,14 @@ "include": [ { "Agent": { - "windows2022": { + "Windows2022": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general", - "TestTargetFramework": "net6.0" + "TestTargetFramework": "net7.0" } }, "TestMode": { - "net6.0_Coverage_Record": { + "NET7.0_Coverage_Record": { "SupportsRecording": true, "CollectCoverage": true } diff --git a/sdk/devcenter/CONTRIBUTING.md b/sdk/devcenter/CONTRIBUTING.md index 6451aee01524..3ab9cd4dfa25 100644 --- a/sdk/devcenter/CONTRIBUTING.md +++ b/sdk/devcenter/CONTRIBUTING.md @@ -44,7 +44,7 @@ Properly supporting recorded tests does require a few extra considerations. All The easiest way to run the tests is via Visual Studio's unit test runner. -You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` or `dotnet test -f net461`. +You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. The recorded tests are run automatically on every pull request. Contributors with write access can ask Azure DevOps to run the live tests against a pull request by commenting `/azp run net - devcenter - tests` in the PR. diff --git a/sdk/digitaltwins/Azure.DigitalTwins.Core/perf/README.md b/sdk/digitaltwins/Azure.DigitalTwins.Core/perf/README.md index 068ce65d1e3f..e1b8b166a302 100644 --- a/sdk/digitaltwins/Azure.DigitalTwins.Core/perf/README.md +++ b/sdk/digitaltwins/Azure.DigitalTwins.Core/perf/README.md @@ -15,7 +15,7 @@ The Digital Twins performance tests will be plugged into performance automation ### QueryDigitalTwins -This scenario tests API calls to the DigitalTwins service to query for Twins and Relationships. +This scenario tests API calls to the DigitalTwins service to query for Twins and Relationships. The `GlobalTestSetupAsync` method override will create a single model that is used for all instances of the parallel test runs. This method is only invoked once and will not be called during the parallel test run across all instances of the test. The `SetupAsync` method override will create multiple Twins that is configurable using the input options. Each test will create Twins using a unique test Id and will only query that subset during each run. @@ -31,11 +31,11 @@ Run the executable output of a project dotnet run -c Release -f --no-build -p -- [parameters needed for the test] ``` -\ can be one of netcoreapp3.1, netcoreapp3.1, net461 or net5.0. Note the -- before any custom parameters to pass. This prevents dotnet from trying to handle any ambiguous command line switches. +\ can be one of net7.0, net6.0, or net461. Note the -- before any custom parameters to pass. This prevents dotnet from trying to handle any ambiguous command line switches. You should use the scenario test class names as the first parameter that is needed for running the test. -## Contributing +## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. diff --git a/sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/DigitalTwinsClientSample.csproj b/sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/DigitalTwinsClientSample.csproj index 247ab19cefe2..6ffdb7e488db 100644 --- a/sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/DigitalTwinsClientSample.csproj +++ b/sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/DigitalTwinsClientSample.csproj @@ -2,13 +2,13 @@ Exe - netcoreapp3.1 + net6.0 Azure.DigitalTwins.Core.Samples false - + $(NoWarn);NU5104 diff --git a/sdk/extensions/Microsoft.Extensions.Azure/samples/Microsoft.Extensions.Azure.Samples.csproj b/sdk/extensions/Microsoft.Extensions.Azure/samples/Microsoft.Extensions.Azure.Samples.csproj index a24e71cf4e31..e0d93782ad07 100644 --- a/sdk/extensions/Microsoft.Extensions.Azure/samples/Microsoft.Extensions.Azure.Samples.csproj +++ b/sdk/extensions/Microsoft.Extensions.Azure/samples/Microsoft.Extensions.Azure.Samples.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net6.0 $(RequiredTargetFrameworks) false @@ -8,7 +8,7 @@ - diff --git a/sdk/identity/platform-matrix.json b/sdk/identity/platform-matrix.json index 8f8249e07b68..07745ecd2db8 100644 --- a/sdk/identity/platform-matrix.json +++ b/sdk/identity/platform-matrix.json @@ -8,7 +8,7 @@ "Container": "ubuntu_netcore_keyring" } }, - "TestTargetFramework": "netcoreapp3.1", + "TestTargetFramework": "net6.0", "SupportedClouds": "Public,Preview,Canary" } ] diff --git a/sdk/iot/Azure.IoT.Hub.Service/samples/IotHubClientSamples/IotHubClientSamples.csproj b/sdk/iot/Azure.IoT.Hub.Service/samples/IotHubClientSamples/IotHubClientSamples.csproj index 9b1f92f0cb77..7e5838a4fabc 100644 --- a/sdk/iot/Azure.IoT.Hub.Service/samples/IotHubClientSamples/IotHubClientSamples.csproj +++ b/sdk/iot/Azure.IoT.Hub.Service/samples/IotHubClientSamples/IotHubClientSamples.csproj @@ -2,13 +2,13 @@ Exe - netcoreapp3.1 + net6.0 Azure.IoT.Hub.Service.Samples false - + $(NoWarn);NU5104 diff --git a/sdk/keyvault/CONTRIBUTING.md b/sdk/keyvault/CONTRIBUTING.md index 007c21f2d0cf..e94c59de03d9 100644 --- a/sdk/keyvault/CONTRIBUTING.md +++ b/sdk/keyvault/CONTRIBUTING.md @@ -47,7 +47,7 @@ Properly supporting recorded tests does require a few extra considerations. All The easiest way to run and debug the tests is via Visual Studio's unit test runner. -You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` or `dotnet test -f net461`. +You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. The recorded tests are run automatically on every pull request. Live tests are run nightly. Contributors with write access can ask Azure DevOps to run the live tests against a pull request by commenting `/azp run net - keyvault - tests` in the PR. diff --git a/sdk/keyvault/samples/getcert/getcert.csproj b/sdk/keyvault/samples/getcert/getcert.csproj index 62f114e29c7d..52f878ad6762 100644 --- a/sdk/keyvault/samples/getcert/getcert.csproj +++ b/sdk/keyvault/samples/getcert/getcert.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 $(NoWarn); CA1810; diff --git a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj index 80ca2119f91a..81dd5be0fa87 100644 --- a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj +++ b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net6.0 + net6.0 $(TargetFrameworks);net461 false diff --git a/sdk/keyvault/samples/sharelink/ShareLink.csproj b/sdk/keyvault/samples/sharelink/ShareLink.csproj index 333787b0631b..043917322b89 100644 --- a/sdk/keyvault/samples/sharelink/ShareLink.csproj +++ b/sdk/keyvault/samples/sharelink/ShareLink.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 Azure.Security.KeyVault.Storage $(NoWarn); diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj index 09138d2021d3..aaf53fc14a43 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj @@ -30,7 +30,7 @@ - + @@ -43,5 +43,5 @@ - + diff --git a/sdk/resourcemanager/Azure.ResourceManager/docs/TestGuide.md b/sdk/resourcemanager/Azure.ResourceManager/docs/TestGuide.md index 8495b6b20900..ab6e1ab7f0a9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/docs/TestGuide.md +++ b/sdk/resourcemanager/Azure.ResourceManager/docs/TestGuide.md @@ -75,13 +75,13 @@ In order to run the tests, the following environment variables need to be set: 1. Our testing framework supports three different test modes: `Live`, `Playback`, `Record`. In management plane, please set the `AZURE_TEST_MODE` to `Record` for your first test run, this will record HTTP requests and responses and store the record files in `SessionRecords` folder. Properly supporting recorded tests does require a few extra considerations. All random values should be obtained via `this.Recording.Random` since we use the same seed on test playback to ensure our client code generates the same "random" values each time. You can't share any state between tests or rely on ordering because you don't know the order they'll be recorded or replayed. Any sensitive values are redacted via the [`ConfigurationRecordedTestSanitizer`][test_sanitizer]. After you have successfully recorded all the tests for the first time, you can change its value to `Playback`. If the tests locally fail due to recording session file mismatches at this point, the attribute `RecordedTest` will help enable automatically re-record failed tests. -2. You need to change its value depending on the Azure Cloud type you are using in your tests. `https://login.microsoftonline.com` only applies to Azure Public Cloud. +2. You need to change its value depending on the Azure Cloud type you are using in your tests. `https://login.microsoftonline.com` only applies to Azure Public Cloud. 3. These values depend on the subscription and token credential you are using for testing. Please refer to this [document][authenticate] to get the values. The easiest way to run the tests is via Visual Studio's test runner. Please note that the Visual Studio 2022 is required as one of the test target frameworks is `.NET 6.0`. -You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` or `dotnet test -f net461`. +You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. If you are using system environment variables, make sure to restart Visual Studio or the terminal after setting or changing the environment variables. @@ -94,4 +94,4 @@ Our samples are structured as unit tests so we can easily verify they're up to d [core_tests]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/core/Azure.Core.TestFramework [mgmt_template]: https://github.com/Azure/azure-sdk-for-net/tree/main/eng/templates/Azure.ResourceManager.Template [test_sanitizer]: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/core/Azure.Core.TestFramework#sanitizing -[authenticate]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/AuthUsingEnvironmentVariables.md \ No newline at end of file +[authenticate]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/AuthUsingEnvironmentVariables.md diff --git a/sdk/search/CONTRIBUTING.md b/sdk/search/CONTRIBUTING.md index f2fd0dc93d3a..fd38acec2475 100644 --- a/sdk/search/CONTRIBUTING.md +++ b/sdk/search/CONTRIBUTING.md @@ -60,7 +60,7 @@ The easiest way to run the tests is via Visual Studio's unit test runner. You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their -output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` +output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. The recorded tests are run automatically on every pull request. Live tests are diff --git a/sdk/storage/CONTRIBUTING.md b/sdk/storage/CONTRIBUTING.md index d2d4527cae32..4b2e0500c03b 100644 --- a/sdk/storage/CONTRIBUTING.md +++ b/sdk/storage/CONTRIBUTING.md @@ -110,7 +110,7 @@ The easiest way to run the tests is via Visual Studio's unit test runner. You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their -output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` +output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`. The recorded tests are run automatically on every pull request. Live tests are diff --git a/sdk/storage/platform-matrix-all-versions.json b/sdk/storage/platform-matrix-all-versions.json index 4c7403e26013..47c052856e96 100644 --- a/sdk/storage/platform-matrix-all-versions.json +++ b/sdk/storage/platform-matrix-all-versions.json @@ -11,8 +11,8 @@ } }, "TestTargetFramework": [ - "netcoreapp3.1", - "net5.0" + "net6.0", + "net7.0" ], "AZURE_LIVE_TEST_SERVICE_VERSIONS": [ "V2019_02_02", diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/perf/Azure.AI.TextAnalytics.Perf/README.md b/sdk/textanalytics/Azure.AI.TextAnalytics/perf/Azure.AI.TextAnalytics.Perf/README.md index af3254f3b559..440495f02a7b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/perf/Azure.AI.TextAnalytics.Perf/README.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/perf/Azure.AI.TextAnalytics.Perf/README.md @@ -7,10 +7,10 @@ The assets in this area comprise a set of performance tests for the [Azure Text Run the Text Analytics client library performance tests by executing the command-line application using the `dotnet run` command or, in some environments, your operating system's executable support. The performance tests rely on the same set of environment variables used by the Text Analytics client library's test suite. An example test run would be like this: ```dotnetcli -dotnet run --framework netcoreapp3.1 DetectLanguagePerf +dotnet run --framework net6.0 DetectLanguagePerf ``` -## Contributing +## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. @@ -19,5 +19,5 @@ When you submit a pull request, a CLA-bot will automatically determine whether y This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. Please see our [contributing guide](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/eventhub/Azure.Messaging.EventHubs/CONTRIBUTING.md) for more information. - + ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftextanalytics%2FAzure.AI.TextAnalytics%2Fperf%2FAzure.AI.TextAnalytics.Perf%2FREADME.png) diff --git a/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/TimeSeriesInsightsClientSample.csproj b/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/TimeSeriesInsightsClientSample.csproj index abda0a26dcbb..f5b18ccc29ff 100644 --- a/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/TimeSeriesInsightsClientSample.csproj +++ b/sdk/timeseriesinsights/Azure.IoT.TimeSeriesInsights/samples/TimeSeriesInsightsClientSample/TimeSeriesInsightsClientSample.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 false diff --git a/tools/ProjectTemplates/AzureDotNetSDK-TestProject/AzureDotNetSDK-TestProject.csproj b/tools/ProjectTemplates/AzureDotNetSDK-TestProject/AzureDotNetSDK-TestProject.csproj index 107dd3d93379..c79a51f2181e 100644 --- a/tools/ProjectTemplates/AzureDotNetSDK-TestProject/AzureDotNetSDK-TestProject.csproj +++ b/tools/ProjectTemplates/AzureDotNetSDK-TestProject/AzureDotNetSDK-TestProject.csproj @@ -9,7 +9,7 @@ BatchAI.Tests; - netcoreapp3.1 + net6.0 From bfd6641d15679676b78aa968e14690716d3f4efe Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Thu, 1 Dec 2022 14:36:13 -0800 Subject: [PATCH 02/10] Resolve PR comments and fix build break --- CONTRIBUTING.md | 2 +- common/SmokeTests/SmokeTest/SmokeTest.csproj | 2 +- eng/pipelines/templates/steps/install-dotnet.yml | 9 +++++++++ ...nitor.OpenTelemetry.Exporter.Integration.Tests.csproj | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2c65117b5e75..73377078f1cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ - Install Visual Studio 2022 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/). - Need at least .NET Framework 4.6.1 and 4.7 development tools - Install the **.NET cross-platform development** workloads in VisualStudio -- Install **.NET 7.0.100 SDK** for your specific platform. (or a higher version within the 6.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/7.0) +- Install **.NET 7.0.100 SDK** for your specific platform. (or a higher version within the 7.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/7.0) - Install the latest version of git (https://git-scm.com/downloads) - Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 6 or higher, if you plan to make public API changes or are working with generated code snippets. - Install [NodeJS](https://nodejs.org/) (16.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp). diff --git a/common/SmokeTests/SmokeTest/SmokeTest.csproj b/common/SmokeTests/SmokeTest/SmokeTest.csproj index cc35789eb32e..aebc691aab18 100644 --- a/common/SmokeTests/SmokeTest/SmokeTest.csproj +++ b/common/SmokeTests/SmokeTest/SmokeTest.csproj @@ -38,7 +38,7 @@ - + diff --git a/eng/pipelines/templates/steps/install-dotnet.yml b/eng/pipelines/templates/steps/install-dotnet.yml index e276cb0fa834..f61a0a3595de 100644 --- a/eng/pipelines/templates/steps/install-dotnet.yml +++ b/eng/pipelines/templates/steps/install-dotnet.yml @@ -26,6 +26,15 @@ steps: packageType: sdk performMultiLevelLookup: true version: "6.0.x" + - task: UseDotNet@2 + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) # Windows supports MultiLevelLookup and doesn't need explicit framework installation + displayName: 'Use .NET Core 3.1 SDK' + retryCountOnTaskFailure: 3 + inputs: + # AspNetCore runtime pack can't be installed outside of SDK and we need it for intergation tests + packageType: sdk + performMultiLevelLookup: true + version: "3.1.x" - task: Cache@2 inputs: key: 'nuget | "$(Agent.OS)" | $(Build.SourcesDirectory)/eng/Packages.Data.props | ${{parameters.NuGetCacheKey}}' diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj index aaf53fc14a43..e50b2777bc0b 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/Azure.Monitor.OpenTelemetry.Exporter.Integration.Tests.csproj @@ -30,7 +30,7 @@ - + From 970b058a8b9306d21f0975fe9b14c6d9fb5b11c6 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Thu, 1 Dec 2022 15:43:19 -0800 Subject: [PATCH 03/10] Tweak platform monikers --- eng/pipelines/templates/jobs/smoke.tests.yml | 8 ++++++-- eng/pipelines/templates/stages/platform-matrix.json | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/jobs/smoke.tests.yml b/eng/pipelines/templates/jobs/smoke.tests.yml index fc237b42acd9..e8ef029164bd 100644 --- a/eng/pipelines/templates/jobs/smoke.tests.yml +++ b/eng/pipelines/templates/jobs/smoke.tests.yml @@ -47,6 +47,10 @@ jobs: condition: and(succeeded(), eq(dependencies.smoke_test_eligibility.outputs['output_eligibility.RunSmokeTests'], true)) strategy: matrix: + Ubuntu_Net60: + Pool: "azsdk-pool-mms-ubuntu-2004-general" + OSVmImage: "MMSUbuntu20.04" + TestTargetFramework: net6.0 Windows_NetFramework: Pool: "azsdk-pool-mms-win-2022-general" OSVmImage: "MMS2022" @@ -56,8 +60,8 @@ jobs: OSVmImage: "MMS2022" TestTargetFramework: net6.0 Windows_Net70: - Pool: "azsdk-pool-mms-ubuntu-2004-general" - OSVmImage: "MMSUbuntu20.04" + Pool: "azsdk-pool-mms-win-2022-general" + OSVmImage: "MMS2022" TestTargetFramework: net7.0 pool: name: $(Pool) diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index ca7b84c7c072..b11dcfa81257 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -48,14 +48,14 @@ "include": [ { "Agent": { - "Windows2022": { + "Windows2022_NET7.0": { "OSVmImage": "MMS2022", "Pool": "azsdk-pool-mms-win-2022-general", "TestTargetFramework": "net7.0" } }, "TestMode": { - "NET7.0_Coverage_Record": { + "Coverage_Record": { "SupportsRecording": true, "CollectCoverage": true } From cc5e0e20d496b63ae1c1f1d13c7b5d568218898f Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 14:54:06 -0800 Subject: [PATCH 04/10] Upgrade to .NET 7.0.101 SDK Required for microsoft/vstest#4014 fix --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index e44352dc3313..c948bb4d4671 100644 --- a/global.json +++ b/global.json @@ -3,7 +3,7 @@ "Microsoft.Build.Traversal": "3.0.23" }, "sdk": { - "version": "7.0.100", + "version": "7.0.101", "rollForward": "feature" } -} \ No newline at end of file +} From ef90ef9a684bff97ccab1266859efe8a9181618a Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 15:02:39 -0800 Subject: [PATCH 05/10] Drop unnecessary runtimes from .vsconfig --- .vsconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.vsconfig b/.vsconfig index 1485a71378fe..f7f146c464fe 100644 --- a/.vsconfig +++ b/.vsconfig @@ -10,9 +10,7 @@ "Microsoft.NetCore.Component.DevelopmentTools", "Microsoft.NetCore.Component.Runtime.7.0", "Microsoft.NetCore.Component.Runtime.6.0", - "Microsoft.NetCore.Component.Runtime.5.0", - "Microsoft.NetCore.Component.Runtime.3.1", "Microsoft.NetCore.Component.SDK", "Microsoft.VisualStudio.Component.Git" ] -} \ No newline at end of file +} From 40dddce921a4baf447bd6bd1f4de26393abdf2a8 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 16:07:46 -0800 Subject: [PATCH 06/10] Skip Monitor tests failing under net7.0 Relates to #33403 --- .../tests/Integration.Tests/BasicTests.cs | 2 +- .../tests/Integration.Tests/RequestTelemetryTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/BasicTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/BasicTests.cs index 787b0f4e0451..a98d0d73b6c0 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/BasicTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/BasicTests.cs @@ -25,7 +25,7 @@ public BasicTests(WebApplicationFactory factory) this.factory = factory; } - [Theory] + [Theory(Skip = "https://github.com/Azure/azure-sdk-for-net/issues/33403")] [InlineData(HttpStatusCode.OK)] [InlineData(HttpStatusCode.BadRequest)] public async Task VerifyRequest(HttpStatusCode httpStatusCode) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/RequestTelemetryTests.cs b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/RequestTelemetryTests.cs index e8aa319f552e..d9656bc6b6a9 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/RequestTelemetryTests.cs +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/Integration.Tests/RequestTelemetryTests.cs @@ -34,7 +34,7 @@ public RequestTelemetryTests(WebApplicationFactory factory, ITestOutput /// This test validates that when an app instrumented with the AzureMonitorExporter receives an HTTP request, /// A TelemetryItem is created matching that request. /// - [Fact] + [Fact(Skip = "https://github.com/Azure/azure-sdk-for-net/issues/33403")] public async Task VerifyRequestTelemetry() { string testValue = Guid.NewGuid().ToString(); From c5fdc7b294b3daa428ae17aa6018050e5abb2c19 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 16:26:18 -0800 Subject: [PATCH 07/10] Resolve track 1 management plane issues on net7.0 --- .../tests/ScenarioTests/BlueprintTests.cs | 8 ++++---- .../tests/ServerManagementTestBase.cs | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sdk/blueprint/Microsoft.Azure.Management.Blueprint/tests/ScenarioTests/BlueprintTests.cs b/sdk/blueprint/Microsoft.Azure.Management.Blueprint/tests/ScenarioTests/BlueprintTests.cs index e1ebfd1b0eb0..a0d341c77a0b 100644 --- a/sdk/blueprint/Microsoft.Azure.Management.Blueprint/tests/ScenarioTests/BlueprintTests.cs +++ b/sdk/blueprint/Microsoft.Azure.Management.Blueprint/tests/ScenarioTests/BlueprintTests.cs @@ -37,7 +37,7 @@ public async Task DynamicBlueprintCRUD() } /// - /// XUnit [Theory] with [InlineData] works, + /// XUnit [Theory] with [InlineData] works, /// but recording/playback doen't work, it generate single recording file, with recording from latest permutation. /// /// @@ -76,7 +76,7 @@ private async Task DynamicBlueprintCRUDInternal(BlueprintTestBase testFixture, s } /// - /// cover blueprint operations on MG + /// cover blueprint operations on MG /// /// [Fact] @@ -121,7 +121,7 @@ public async Task ManagementGroupBlueprintCRUD() } /// - /// cover blueprint operations on Subscription + /// cover blueprint operations on Subscription /// /// [Fact] @@ -470,7 +470,7 @@ await WaitForCondition( return result; } } - throw ex; + throw; } if (condition(result)) diff --git a/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs b/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs index aed05d92bf87..1ed801c0b521 100644 --- a/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs +++ b/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs @@ -80,7 +80,7 @@ protected static bool TestingInteractively } /// - /// the name of the SMT node to create + /// the name of the SMT node to create /// protected static string NodeName { @@ -122,7 +122,7 @@ protected static string Location } /// - /// the gateway name to use when creating the gateway + /// the gateway name to use when creating the gateway /// protected static string GatewayOne { @@ -144,14 +144,14 @@ protected static string GatewayTwo { get { - // if the SMT_GATEWAY_2 isn't set, we default to 'mygateway' ... + // if the SMT_GATEWAY_2 isn't set, we default to 'mygateway' ... // makes it easier to not regenerate the gateway profile every time return _gatewaytwo ?? (_gatewaytwo = HttpMockServer.GetVariable("SMT_GATEWAY_2", Environment.GetEnvironmentVariable("SMT_GATEWAY_2") ?? "mygateway").ToLower()); - } + } } /// @@ -194,6 +194,13 @@ protected static bool IsAdmin { get { + if (Environment.OSVersion.Platform != PlatformID.Win32NT) + { + // BUGBUG: https://github.com/Azure/azure-sdk-for-net/issues/33404 + // Returning false should be safe since recording on other platforms would've failed as written. + return false; + } + try { return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); From 7201addee2fbb5f5604c8b25e53da1e957733350 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 17:40:57 -0800 Subject: [PATCH 08/10] Resolve Key Vault issues after upgrade to net7.0 --- sdk/keyvault/samples/getcert/Program.cs | 4 ++-- .../tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/keyvault/samples/getcert/Program.cs b/sdk/keyvault/samples/getcert/Program.cs index 0d88d633112f..5589b3ed8158 100644 --- a/sdk/keyvault/samples/getcert/Program.cs +++ b/sdk/keyvault/samples/getcert/Program.cs @@ -62,13 +62,13 @@ private static async Task RunAsync( // Decode and encrypt the message. byte[] plaintext = Encoding.UTF8.GetBytes(message); - using RSA encryptor = (RSA)pfx.PublicKey.Key; + using RSA encryptor = pfx.GetRSAPublicKey(); byte[] ciphertext = encryptor.Encrypt(plaintext, RSAEncryptionPadding.OaepSHA256); console.Out.WriteLine($"Encrypted message: {Convert.ToBase64String(ciphertext)}"); // Decrypt and encode the message. - using RSA decryptor = (RSA)pfx.PrivateKey; + using RSA decryptor = pfx.GetRSAPrivateKey(); plaintext = decryptor.Decrypt(ciphertext, RSAEncryptionPadding.OaepSHA256); message = Encoding.UTF8.GetString(plaintext); diff --git a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj index 81dd5be0fa87..46361cc51ca2 100644 --- a/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj +++ b/sdk/keyvault/samples/keyvaultproxy/tests/AzureSamples.Security.KeyVault.Proxy.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0;net6.0 $(TargetFrameworks);net461 false From 864cf4222c0f745e5f02075bb3c38436ed42af2d Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Tue, 10 Jan 2023 18:05:42 -0800 Subject: [PATCH 09/10] Use different platform guard for management plane --- .../tests/ServerManagementTestBase.cs | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs b/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs index 1ed801c0b521..035048f2feaa 100644 --- a/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs +++ b/sdk/servermanagement/Microsoft.Azure.Management.ServerManagement/tests/ServerManagementTestBase.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Security.Principal; using System.ServiceProcess; using System.Threading.Tasks; @@ -194,20 +195,17 @@ protected static bool IsAdmin { get { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - // BUGBUG: https://github.com/Azure/azure-sdk-for-net/issues/33404 - // Returning false should be safe since recording on other platforms would've failed as written. - return false; + try + { + return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); + } + catch + { + } } - try - { - return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); - } - catch - { - } return false; } } @@ -374,4 +372,4 @@ protected async Task EnsurePrerequisites() } } } -} \ No newline at end of file +} From 4751b860dad96248ce0ef984167f7dea48f3acd1 Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Wed, 11 Jan 2023 13:33:19 -0800 Subject: [PATCH 10/10] Resolve PR feedback --- eng/pipelines/templates/steps/install-dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/install-dotnet.yml b/eng/pipelines/templates/steps/install-dotnet.yml index f61a0a3595de..0aeb5681ffa4 100644 --- a/eng/pipelines/templates/steps/install-dotnet.yml +++ b/eng/pipelines/templates/steps/install-dotnet.yml @@ -22,7 +22,7 @@ steps: displayName: 'Use .NET 6.0 SDK' retryCountOnTaskFailure: 3 inputs: - # AspNetCore runtime pack can't be installed outside of SDK and we need it for intergation tests + # AspNetCore runtime pack can't be installed outside of SDK and we need it for integration tests packageType: sdk performMultiLevelLookup: true version: "6.0.x"