Skip to content

Commit a42e9d1

Browse files
ElanHassonclaude
andauthored
Upgrade to .NET 10 and update all packages (#41)
* Upgrade to .NET 10 and update all packages - Upgrade target framework from net9.0 to net10.0 - Update CI/CD workflows to use .NET 10.0.x SDK - Upgrade packages: - Microsoft.CodeAnalysis.CSharp.Scripting: 4.14.0 → 5.0.0 - Microsoft.Extensions.Hosting: 10.0.0-rc.2 → 10.0.1 - Microsoft.NET.Test.Sdk: 18.0.0 → 18.0.1 - NuGet.Protocol: 6.14.0 → 7.0.1 - NuGet.Resolver: 6.14.0 → 7.0.1 - NUnit.Analyzers: 4.10.0 → 4.11.2 - NUnit3TestAdapter: 5.2.0 → 6.0.0 - Remove unnecessary System.Formats.Asn1 package (now built into .NET 10) - Update tests to work with NUnit 6.0 console output behavior - Update console output capture to use synchronized TextWriter This commit supersedes PRs #36, #37, #39, and #40. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix tests for AssemblyLoadContext isolation in .NET 10 - Add AssemblyLoadContext workaround for CSharpScript compatibility - Update tests to verify execution success and return values instead of console output (Console.SetOut doesn't propagate across ALCs) - Change timeout test to use Task.Delay which respects cancellation - Minor cleanup in CSharpEvalTools (use CancelAsync) See: dotnet/roslyn#45197 (comment) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5a7a8fd commit a42e9d1

File tree

8 files changed

+159
-165
lines changed

8 files changed

+159
-165
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch:
1010

1111
env:
12-
DOTNET_VERSION: '9.0.x'
12+
DOTNET_VERSION: '10.0.x'
1313
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
1414
DOTNET_NOLOGO: true
1515
NUGET_XMLDOC_MODE: skip

.github/workflows/validate-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup .NET
1717
uses: actions/setup-dotnet@v5
1818
with:
19-
dotnet-version: '9.0.x'
19+
dotnet-version: '10.0.x'
2020

2121
- name: Restore dependencies
2222
run: dotnet restore

Directory.Packages.props

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
<PrivateAssets>all</PrivateAssets>
1010
</PackageVersion>
1111
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview.4" />
12-
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.0-rc.2.25502.107" />
12+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
1313
<!-- Roslyn Scripting -->
14-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.14.0" />
14+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0" />
1515
<!-- NuGet Client Libraries -->
16-
<PackageVersion Include="NuGet.Protocol" Version="6.14.0" />
17-
<PackageVersion Include="NuGet.Resolver" Version="6.14.0" />
16+
<PackageVersion Include="NuGet.Protocol" Version="7.0.1" />
17+
<PackageVersion Include="NuGet.Resolver" Version="7.0.1" />
1818
<!-- Testing -->
1919
<PackageVersion Include="NUnit" Version="4.4.0" />
20-
<PackageVersion Include="NUnit.Analyzers" Version="4.10.0" />
21-
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
20+
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2" />
21+
<PackageVersion Include="NUnit3TestAdapter" Version="6.0.0" />
2222
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
2323
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
24-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
25-
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" />
24+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2625
</ItemGroup>
2726
</Project>

src/InfinityFlow.CSharp.Eval/InfinityFlow.CSharp.Eval.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net9.0</TargetFramework>
3+
<TargetFramework>net10.0</TargetFramework>
44
<RollForward>Major</RollForward>
55
<OutputType>Exe</OutputType>
66
<Nullable>enable</Nullable>
@@ -42,7 +42,6 @@
4242
</ItemGroup>
4343

4444
<ItemGroup>
45-
<PackageReference Include="System.Formats.Asn1" />
4645
<InternalsVisibleTo Include="InfinityFlow.CSharp.Eval.Tests" />
4746
</ItemGroup>
4847
</Project>

src/InfinityFlow.CSharp.Eval/Tools/CSharpEvalTools.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,16 @@ public async Task<string> EvalCSharp(
143143
// Execute the script with timeout
144144
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutSeconds));
145145

146-
// Run script in a task so we can properly handle timeout
147-
var scriptTask = Task.Run(async () =>
148-
await CSharpScript.EvaluateAsync(cleanedScript, scriptOptions, cancellationToken: cts.Token),
149-
cts.Token);
146+
// Run script directly (not in Task.Run) to preserve Console.Out context
147+
// CSharpScript.EvaluateAsync already returns a Task, so we can use WhenAny for timeout
148+
var scriptTask = CSharpScript.EvaluateAsync(cleanedScript, scriptOptions, cancellationToken: cts.Token);
149+
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(timeoutSeconds), cts.Token);
150150

151-
var timeoutTask = Task.Delay(TimeSpan.FromSeconds(timeoutSeconds));
152151
var completedTask = await Task.WhenAny(scriptTask, timeoutTask);
153152

154153
if (completedTask == timeoutTask)
155154
{
156-
cts.Cancel();
155+
await cts.CancelAsync();
157156
throw new OperationCanceledException();
158157
}
159158

0 commit comments

Comments
 (0)