Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support both .NET 8 and .NET 9 #701

Merged
merged 11 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pipelines/dotnet-initialize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ steps:
- task: NuGetAuthenticate@1
displayName: NuGet Authenticate
- task: UseDotNet@2
displayName: Temporarily install .NET 7 SDK while dual targeting
displayName: Temporarily install .NET 8 SDK while dual targeting
inputs:
version: "7.0.405"
version: "8.0.404"
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
- task: UseDotNet@2
displayName: Use .NET SDK from global.json
inputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/pipelines/github-forward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extends:
Title: GitHub Forward Integration - $(GITHUBCOMMIT)
Description: GitHub forward integration Pull Request for commit '$(GITHUBCOMMIT)'
SkipIfNoChangesFound: false
WorkItemId: "8430180"
WorkItemId: "9421495"
AutoCompleteUserId: 75d3c7a0-2045-6bf0-b50e-3ab2cf9ae644
Pat: $(OfficeOcCodeAccessCorpNet)
MergeStrategy: noFastForward
2 changes: 1 addition & 1 deletion .github/pipelines/github-packageupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ extends:
TargetBranchName: main
Title: Automatic NuGet package update
Description: update of NuGet packages
WorkItemId: "9127473"
WorkItemId: "9421495"
Pat: $(omexgithubbotinternalpat)
MergeStrategy: "0"
4 changes: 4 additions & 0 deletions .github/pipelines/github-semmle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ extends:
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: Temporarily install .NET 8 SDK while dual targeting
inputs:
version: "8.0.404"
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
- task: UseDotNet@2
displayName: Use .NET SDK from global.json
inputs:
Expand Down
4 changes: 2 additions & 2 deletions .github/pipelines/sf-initialize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
parameters:
- name: SdkVersion
type: string
default: "10.1.2175.9590"
default: "10.1.2448.9590"
steps:
- task: PowerShell@2
displayName: Install SF ${{parameters.SdkVersion}}
inputs:
targetType: 'inline'
script: |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.${{parameters.SdkVersion}}.exe
.\setup.exe /accepteula /force /quiet
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ jobs:
IsReleaseBuild: ${{ matrix.configuration == 'Release' && github.event_name == 'release' && !github.event.release.prerelease && github.ref == 'refs/heads/master' }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- name: Checkout repository
uses: actions/checkout@v4
- name: Install .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
# Install SF SDK
- name: Install SF
- name: Install .NET 9 SDK
uses: actions/setup-dotnet@v4
with:
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
dotnet-version: '9.0.x'
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
- name: Install SF SDK
shell: powershell
run: |
run: |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.10.1.2448.9590.exe
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- name: Install .NET 8 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
artempushkin marked this conversation as resolved.
Show resolved Hide resolved
- name: Install .NET 9 SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
artempushkin marked this conversation as resolved.
Show resolved Hide resolved

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
17 changes: 8 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<PropertyGroup>
<RepoRoot Condition="'$(RepoRoot)' == ''">$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('global.json', '$(MSBuildProjectDirectory)'))))</RepoRoot>
</PropertyGroup>

<PropertyGroup Label="Target Platforms" >
<LatestSupportedDotNetVersion>net8.0</LatestSupportedDotNetVersion>
<PropertyGroup Label="Target Platforms">
<LatestSupportedDotNetVersion>net9.0</LatestSupportedDotNetVersion>
<OldestSupportedDotNetVersion>net8.0</OldestSupportedDotNetVersion>
<NetCoreVersions>$(LatestSupportedDotNetVersion)</NetCoreVersions>
<NetCoreVersions Condition="'$(LatestSupportedDotNetVersion)' != '$(OldestSupportedDotNetVersion)'">$(LatestSupportedDotNetVersion);$(OldestSupportedDotNetVersion)</NetCoreVersions>
Expand All @@ -14,7 +13,7 @@
<PropertyGroup Label="UnitTest Targets">
<UnitTestTargetFrameworks>$(NetCoreVersions)</UnitTestTargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="Project Settings" >
<PropertyGroup Label="Project Settings">
<Platforms>AnyCPU</Platforms>
<TargetPlatform>AnyCPU</TargetPlatform>
<ErrorReport>prompt</ErrorReport>
Expand All @@ -25,16 +24,16 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Label="Condition Variables" >
<PropertyGroup Label="Condition Variables">
<IsNetStandard>$(NetStandardVersions.Contains('$(TargetFramework)'))</IsNetStandard>
</PropertyGroup>
<PropertyGroup Label="Signing" >
<PropertyGroup Label="Signing">
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\OmexOpenSource.snk</AssemblyOriginatorKeyFile>
<StrongNameSuffix>, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d77aff3ec12650e8979fb873e4b409556a1a650482e6d4dfcf9fea3c87dc334dc2f08ab4820ad3555b949a172553484f5f8fecd302db2907a5d8e3c33d394276c05e18865c5776e0c1f04bba8c4d3e4b12bc44b70e70dc076cc69611b04368d7eff2e83f5b016db366f9d572dad24f09adc6ae732802958048b69727561d1bd</StrongNameSuffix>
</PropertyGroup>
<PropertyGroup Label="Build Output" >
<PropertyGroup Label="Build Output">
<BaseOutputPath>$(MSBuildThisFileDirectory)\bin\$(MSBuildProjectName)</BaseOutputPath>
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<PackageOutputPath>$(MSBuildThisFileDirectory)\nuget</PackageOutputPath>
Expand All @@ -58,7 +57,7 @@
<Description>$(MSBuildProjectName)</Description>
<Tags>Omex</Tags>
</PropertyGroup>
<PropertyGroup Label="Debug Information" >
<PropertyGroup Label="Debug Information">
<EnableSourceControlManagerQueries Condition="'$(CommitSha)' != ''">false</EnableSourceControlManagerQueries>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/microsoft/Omex</RepositoryUrl>
Expand All @@ -74,7 +73,7 @@
<!-- Optional: Include the PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<SourceRootLocation>$(MSBuildThisFileDirectory)</SourceRootLocation>
<!--
<!--
Maps paths injected by CallerFilePath attribute to be related and independent from repository location on hard drive to keep automatic log tags independent of the build location.
Doing this prevents debugger from finding symbols, so setting is disabled for debug builds.
-->
Expand Down
72 changes: 36 additions & 36 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
K-Cully marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
<ItemGroup Label="Latest DotNet Package Versions. AutoUpdate" Condition="'$(TargetFramework)' == '$(LatestSupportedDotNetVersion)' OR '$(IsNetStandard)'">
K-Cully marked this conversation as resolved.
Show resolved Hide resolved
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.11" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.11" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.0" />
<PackageVersion Include="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
<ItemGroup Label="Previous DotNet Package Versions. AutoUpdate" Condition="'$(TargetFramework)' == '$(OldestSupportedDotNetVersion)' And '$(OldestSupportedDotNetVersion)' != '$(LatestSupportedDotNetVersion)'">
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.20" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="7.0.20" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="7.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.1.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PreserveMajor="true" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" PreserveMajor="true" />
<PackageVersion Include="System.Text.Json" Version="7.0.4" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.11" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="8.0.11" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="8.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.SourceLink.AzureRepos.Git" Version="8.0.0" PreserveMajor="true" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PreserveMajor="true" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" PreserveMajor="true" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" PreserveMajor="true" />
</ItemGroup>
<ItemGroup Label="Package Versions. AutoUpdate">
<PackageVersion Include="MSTest.TestAdapter" Version="3.6.3" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.404",
"version": "9.0.100",
"rollForward": "latestMajor"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task ActivityListeners_ControlsActivityCreation()
// check that Activity from Diagnostic listener also captured
using (DiagnosticListener listener = new(nameof(ActivityListeners_ControlsActivityCreation)))
{
Activity activity = new("DiagnosticsListenerActivity");
using Activity activity = new("DiagnosticsListenerActivity");

listener.StartActivity(activity, null);
mockStartObserver.Verify(s => s.OnStart(activity, null), Times.Once);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,14 @@ public void SendActivityMetric_WithSendParentName_ProducesMetricPointWithParentN
Listener listener = new();

string? parentName = hasParentName ? nameof(parentName) : null;
if (hasParentActivity)
{
Activity parent = new(parentName!);
parent.Start();
}
using Activity? parent = hasParentActivity ? new(parentName!) : null;
parent?.Start();

Activity activity = new(nameof(activity));
using Activity activity = new(nameof(activity));
activity.Start().Stop();

parent?.Stop();

sender.SendActivityMetric(activity);

// 3. Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ActivityObserverTests
[TestMethod]
public void OnStop_CallsLogActivityStop()
{
Activity activity = new(nameof(OnStop_CallsLogActivityStop));
using Activity activity = new(nameof(OnStop_CallsLogActivityStop));
(ActivityObserver observer, _, Mock<IActivitiesEventSender> senderMock) = CreateObserver();

observer.OnStop(activity, null);
Expand Down Expand Up @@ -53,7 +53,7 @@ public void OnStart_LogsStart()
[DataRow(false, ActivityResult.ExpectedError)]
public void OnStop_LogsStop(bool isSuccesful, ActivityResult? result)
{
Activity activity = new Activity(nameof(OnStop_LogsStop))
using Activity activity = new Activity(nameof(OnStop_LogsStop))
.Start()
.SetBaggage("SomeValue", "BaggageValue")
.SetTag("SomeTag", "TagValue");
Expand Down
12 changes: 6 additions & 6 deletions tests/Activities.UnitTests/ServiceCollectionTests.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using System;
using Microsoft.Omex.Extensions.Abstractions.Activities.Processing;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Omex.Extensions.Abstractions.Activities.Processing;
using Microsoft.Omex.Extensions.Testing.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.Omex.Extensions.Activities.UnitTests
{
Expand Down Expand Up @@ -45,7 +45,7 @@ public void AddOmexActivitySource_ActivityCreationEnabled()
{
Task task = CreateHost().RunAsync();

Activity? activity = new ActivitySource("Source")
using Activity? activity = new ActivitySource("Source")
.StartActivity(nameof(AddOmexActivitySource_HostedServicesRegistered));

NullableAssert.IsNotNull(activity, "Activity creation enabled after host started");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(NetCoreVersions)</TargetFrameworks>
<TargetFrameworks>$(UnitTestTargetFrameworks)</TargetFrameworks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ public async Task CheckHealthAsync_ShouldReturnUnhealthy_WhenCertificateNotYetVa
[TestMethod]
public async Task CheckHealthAsync_ShouldReturnUnhealthy_WhenCertificateDoesNotHavePrivateKey()
{
#if NET9_0_OR_GREATER
X509Certificate2 certWithoutPrivateKey = X509CertificateLoader.LoadCertificate(CreateCert(m_certSubjectName).Export(X509ContentType.Cert));
#else
X509Certificate2 certWithoutPrivateKey = new(CreateCert(m_certSubjectName).Export(X509ContentType.Cert));
#endif

m_certificateReaderMock.Setup(m => m.GetCertificateByCommonName(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<StoreName>()))
.Returns(certWithoutPrivateKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ public void BuildStatelessWebService_UseUniqueServiceUrl_Failing()
[TestMethod]
public async Task BuildStatelessWebService_RegisterListeners()
{
(string name, int port) httpListener1 = ("httpListener", 20080);
(string name, int port) httpListener2 = ("httpsListener", 20443);
// Use random ports from private range.
Random random = new Random();
(string name, int port) httpListener1 = ("httpListener", random.Next(49152, 65535));
(string name, int port) httpListener2 = ("httpsListener", random.Next(49152, 65535));

SfConfigurationProviderHelper.SetPublishAddress();
SfConfigurationProviderHelper.SetPortVariable(httpListener1.name, httpListener1.port);
Expand Down
Loading
Loading