Skip to content

Commit bdd7164

Browse files
berndverstBernd Verst
andauthored
Upgrade test/sample projects to .NET 8.0 and bump dependencies (#1323)
* Upgrade test/sample projects to net8.0 and bump dependencies - Retarget all test projects from net6.0 to net8.0 (net48 multi-target preserved) - Retarget all sample projects from net6.0 to net8.0 - Update framework-conditional ItemGroups in Directory.Packages.props - Apply pending dependabot package updates: - Azure.Storage.Blobs 12.24.0 -> 12.27.0 - Azure.Monitor.OpenTelemetry.Exporter 1.0.0-beta.4 -> 1.6.0 - Azure.Identity 1.12.0 -> 1.18.0 - Microsoft.ApplicationInsights 2.21.0 -> 2.23.0 - System.Text.RegularExpressions 4.3.1 (security pin) - Bump transitive dependencies to resolve NU1605 downgrades: - Microsoft.Bcl.AsyncInterfaces 6.0.0 -> 8.0.0 - System.Text.Json 6.0.10 -> 10.0.3 - Microsoft.Extensions.Logging* 8.0.0 -> 10.0.3 (net8.0) - Fix compilation issues from API changes: - Add explicit parameters for Blob API calls (12.27.0 removed defaults) - Suppress SYSLIB0050/0051 for obsolete formatter serialization in tests - Suppress CS8633/CS8766 for ILogger.BeginScope nullability changes * Address PR review comments - Fix GetBlobsByHierarchyAsync delimiter from null to '/' to preserve hierarchy semantics - Add explanatory comment for SYSLIB0050 suppression in LegacyTableEntityConverter * Update CI pipelines to install .NET 8 SDK - Replace .NET 6 SDK install with .NET 8 in Azure DevOps build-steps.yml - Add .NET 8 SDK setup step in CodeQL GitHub Actions workflow * Address review comments: conditional compilation and tighter pragma scoping - Use #if NET8_0_OR_GREATER for BeginScope<TState> to match ILogger contract per TFM - Split pragma suppressions for serialization ctor and GetObjectData into separate blocks * Increase DTFxASValidate job timeout to 90 minutes Azure Storage tests exceed the default 60-minute job timeout due to the larger test suite and Azurite emulator startup overhead. * Increase DTFxASValidate timeout to 150min and update vsTestVersion - Increase DTFxASValidate job timeout from 90 to 150 minutes - Update VSTest version from 17.0 to latest for better .NET 8 test runtime support * Fix GetBlobsByHierarchyAsync delimiter to null (original behavior) The previous fix changed delimiter from null (the SDK default) to '/' per a review suggestion. However, with delimiter='/' and prefix without a trailing slash, blobs are returned as virtual directory prefixes (IsBlob=false) rather than blob items, causing the Where(x => x.IsBlob) filter to return no results. * Fix sync-over-async blocking patterns causing .NET 8 threadpool starvation Move service.CreateAsync() from TestOrchestrationHost constructor (where it blocked synchronously via .GetAwaiter().GetResult()) to StartAsync() (where it is properly awaited). This eliminates the primary source of threadpool starvation when many tests run in parallel under .NET 8. Also convert remaining .Result and .GetAwaiter().GetResult() calls to proper await patterns in AzureStorageScaleTests and TestTablePartitionManager. * Address review comments: condition RegularExpressions, pin vsTestVersion, add pragma comments - Condition System.Text.RegularExpressions PackageReference on net48 only - Revert vsTestVersion from 'latest' back to '17.0' for CI reproducibility - Add justification comments on SYSLIB0051 pragma suppressions in ExceptionHandlingIntegrationTests.cs * Reduce console log level to Warning, remove excessive timeout Reduce TestHelpers LoggerFactory console log level from Trace to Warning to reduce contention from verbose output under Microsoft.Extensions.Logging 10.x. Remove the 150-minute timeout override (revert to default) since the sync-over-async fix should prevent threadpool starvation hangs. * Fix Azurite API version compatibility with Azure.Storage.Blobs 12.27.0 Azure.Storage.Blobs 12.27.0 uses API version 2026-02-06 which is not supported by the Azurite version installed in CI via 'npm install -g azurite'. This causes tests to hang as the SDK's retry logic repeatedly fails. Add --skipApiVersionCheck to the Azurite startup command to allow the newer API version to work with the installed Azurite version. * Fix OpenTelemetry tests for SDK 1.14.0 compatibility The BaseProcessor<T> in OpenTelemetry SDK 1.14.0 (transitive from Azure.Monitor.OpenTelemetry.Exporter 1.6.0) changed method signatures - OnShutdown and OnForceFlush now take int timeoutMilliseconds parameters. This broke the hard-coded processor.Invocations[index] pattern which assumed fixed invocation ordering. Replace fragile index-based access with filtering for OnEnd method invocations, which gives us only the completed Activity objects regardless of SDK-internal invocation changes. --------- Co-authored-by: Bernd Verst <beverst@microsoft.com>
1 parent 52890a8 commit bdd7164

22 files changed

Lines changed: 187 additions & 201 deletions

.github/workflows/codeQL.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ jobs:
6666
with:
6767
dotnet-version: '3.1.x'
6868

69+
- name: Set up .NET 8
70+
uses: actions/setup-dotnet@v3
71+
with:
72+
dotnet-version: '8.0.x'
73+
6974
- name: Restore dependencies
7075
run: dotnet restore $solution
7176

Directory.Packages.props

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
<PackageVersion Include="Azure.Core" Version="1.44.1" />
1313
<PackageVersion Include="Azure.Data.Tables" Version="12.11.0" />
1414
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.20.1" />
15-
<PackageVersion Include="Azure.Storage.Blobs" Version="12.24.0" />
15+
<PackageVersion Include="Azure.Storage.Blobs" Version="12.27.0" />
1616
<PackageVersion Include="Azure.Storage.Queues" Version="12.22.0" />
1717
<PackageVersion Include="Castle.Core" Version="5.2.1" />
1818
<PackageVersion Include="ImpromptuInterface" Version="6.2.2" Condition="'$(TargetFramework)' == 'net48' OR '$(TargetFramework)' == 'net472'" />
1919
<PackageVersion Include="ImpromptuInterface" Version="7.0.1" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
20-
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.21.0" />
20+
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.23.0" />
2121
<PackageVersion Include="Microsoft.AspNet.WebApi.OwinSelfHost" Version="5.3.0" />
22-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
22+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
2323
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
2424
<PackageVersion Include="Microsoft.Data.Services.Client" Version="5.8.5" />
2525
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
@@ -47,8 +47,8 @@
4747

4848
<!-- Test dependencies -->
4949
<ItemGroup>
50-
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0-beta.4" />
51-
<PackageVersion Include="CommandLineParser" Version="2.9.1" Condition="'$(TargetFramework)' == 'net6.0'" />
50+
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.6.0" />
51+
<PackageVersion Include="CommandLineParser" Version="2.9.1" Condition="'$(TargetFramework)' == 'net8.0'" />
5252
<PackageVersion Include="CommandLineParser" Version="1.9.71" Condition="'$(TargetFramework)' == 'net48'" />
5353
<PackageVersion Include="EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer.NetCore" Version="2.0.1406.4" />
5454
<PackageVersion Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
@@ -60,13 +60,14 @@
6060
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
6161
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
6262
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
63-
<PackageVersion Include="System.Text.Json" Version="6.0.10" />
64-
<PackageVersion Include="WindowsAzure.Storage" Version="9.3.3" Condition="'$(TargetFramework)' == 'net6.0'" />
63+
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
64+
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
65+
<PackageVersion Include="WindowsAzure.Storage" Version="9.3.3" Condition="'$(TargetFramework)' == 'net8.0'" />
6566
<PackageVersion Include="WindowsAzure.Storage" Version="8.7.0" Condition="'$(TargetFramework)' == 'net48'" />
6667
</ItemGroup>
6768

68-
<!-- Test dependencies with net6.0-->
69-
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
69+
<!-- Test dependencies with net8.0-->
70+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
7071
<PackageVersion Include="EnterpriseLibrary.SemanticLogging.NetCore" Version="2.0.1406.4" />
7172
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
7273
</ItemGroup>
@@ -88,7 +89,7 @@
8889

8990
<!-- Samples dependencies -->
9091
<ItemGroup>
91-
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
92+
<PackageVersion Include="Azure.Identity" Version="1.18.0" />
9293
<PackageVersion Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" />
9394
<PackageVersion Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
9495
<PackageVersion Include="Microsoft.Azure.DurableTask.AzureStorage" Version="1.17.3" />
@@ -103,9 +104,9 @@
103104

104105
<!-- Dependencies specific to net8.0-->
105106
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
106-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
107-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
108-
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
107+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.3" />
108+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
109+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
109110
</ItemGroup>
110111
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
111112
<PackageVersion Include="Microsoft.Extensions.Logging" Version="6.0.0" />

eng/templates/build-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ steps:
2525
version: '3.1.x'
2626

2727
- task: UseDotNet@2
28-
displayName: 'Use the .NET 6 SDK'
28+
displayName: 'Use the .NET 8 SDK'
2929
inputs:
3030
packageType: 'sdk'
31-
version: '6.0.x'
31+
version: '8.0.x'
3232

3333
- task: DotNetCoreCLI@2
3434
displayName: 'Restore nuget dependencies'

eng/templates/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ steps:
2424
npm install -g azurite
2525
mkdir azurite1
2626
echo "azurite installed"
27-
azurite --silent --location azurite1 --debug azurite1\debug.txt --queuePort 10001 &
27+
azurite --silent --location azurite1 --debug azurite1\debug.txt --queuePort 10001 --skipApiVersionCheck &
2828
echo "azurite started"
2929
sleep 5
3030
displayName: 'Install and Run Azurite'
@@ -36,7 +36,7 @@ steps:
3636
testAssemblyVer2: |
3737
$(System.DefaultWorkingDirectory)/${{ parameters.testAssembly }}
3838
testFiltercriteria: 'TestCategory!=DisabledInCI'
39-
vsTestVersion: 17.0
39+
vsTestVersion: '17.0'
4040
distributionBatchType: basedOnExecutionTime
4141
platform: 'any cpu'
4242
configuration: 'Debug'

samples/Correlation.Samples/Correlation.Samples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

samples/DistributedTraceSample/ApplicationInsights/ApplicationInsightsSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UserSecretsId>d4d9b2e3-fb2a-4de6-9747-3d6d3b639d1a</UserSecretsId>
88
<ApplicationInsightsResourceId>dummy-value</ApplicationInsightsResourceId>

samples/DistributedTraceSample/OpenTelemetry/OpenTelemetrySample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

samples/ManagedIdentitySample/DTFx.AzureStorage v1.x/ManagedIdentity.AzStorageV1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<LangVersion>Latest</LangVersion>
55
<Nullable>enable</Nullable>
66
<OutputType>Exe</OutputType>
7-
<TargetFramework>net6.0</TargetFramework>
7+
<TargetFramework>net8.0</TargetFramework>
88
</PropertyGroup>
99

1010
<ItemGroup>

test/DurableTask.AzureStorage.Tests/AzureStorageScaleTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async Task<AzureStorageOrchestrationService> EnsureTaskHubAsync(
145145

146146
try
147147
{
148-
Assert.IsTrue(trackingStore.ExistsAsync().Result, $"Tracking Store was not created.");
148+
Assert.IsTrue(await trackingStore.ExistsAsync(), $"Tracking Store was not created.");
149149
}
150150
catch (NotSupportedException)
151151
{ }
@@ -182,7 +182,7 @@ async Task<AzureStorageOrchestrationService> EnsureTaskHubAsync(
182182

183183
try
184184
{
185-
Assert.IsFalse(trackingStore.ExistsAsync().Result, $"Tracking Store was not deleted.");
185+
Assert.IsFalse(await trackingStore.ExistsAsync(), $"Tracking Store was not deleted.");
186186
}
187187
catch (NotSupportedException)
188188
{ }
@@ -195,7 +195,7 @@ async Task<AzureStorageOrchestrationService> EnsureTaskHubAsync(
195195

196196
private async Task EnsureLeasesMatchControlQueue(string directoryReference, BlobContainerClient taskHubContainer, ControlQueue[] controlQueues)
197197
{
198-
BlobItem[] leaseBlobs = await taskHubContainer.GetBlobsAsync(prefix: directoryReference).ToArrayAsync();
198+
BlobItem[] leaseBlobs = await taskHubContainer.GetBlobsAsync(traits: BlobTraits.None, states: BlobStates.None, prefix: directoryReference, cancellationToken: default).ToArrayAsync();
199199
Assert.AreEqual(controlQueues.Length, leaseBlobs.Length, "Expected to see the same number of control queues and lease blobs.");
200200
foreach (BlobItem blobItem in leaseBlobs)
201201
{
@@ -322,9 +322,12 @@ public async Task MultiWorkerLeaseMovement(PartitionManagerType partitionManager
322322
Assert.IsTrue(
323323
service.OwnedControlQueues.All(q => ownedLeases.Any(l => l.Name.Contains(q.Name))),
324324
"Mismatch between queue assignment and lease ownership.");
325-
Assert.IsTrue(
326-
service.OwnedControlQueues.All(q => q.InnerQueue.ExistsAsync().GetAwaiter().GetResult()),
327-
$"One or more control queues owned by {service.WorkerId} do not exist");
325+
foreach (var q in service.OwnedControlQueues)
326+
{
327+
Assert.IsTrue(
328+
await q.InnerQueue.ExistsAsync(),
329+
$"Control queue {q.Name} owned by {service.WorkerId} does not exist");
330+
}
328331
}
329332

330333
Assert.AreEqual(totalLeaseCount, allQueueNames.Count, "Unexpected number of queues!");

0 commit comments

Comments
 (0)