Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

env:
DOTNET_VERSION: '9.0.x'
DOTNET_VERSION: '10.0.x'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_XMLDOC_MODE: skip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
dotnet-version: '10.0.x'

- name: Restore dependencies
run: dotnet restore
Expand Down
15 changes: 7 additions & 8 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="ModelContextProtocol" Version="0.3.0-preview.4" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.0-rc.2.25502.107" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
<!-- Roslyn Scripting -->
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0" />
<!-- NuGet Client Libraries -->
<PackageVersion Include="NuGet.Protocol" Version="6.14.0" />
<PackageVersion Include="NuGet.Resolver" Version="6.14.0" />
<PackageVersion Include="NuGet.Protocol" Version="7.0.1" />
<PackageVersion Include="NuGet.Resolver" Version="7.0.1" />
<!-- Testing -->
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.10.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="6.0.0" />
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions src/InfinityFlow.CSharp.Eval/InfinityFlow.CSharp.Eval.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RollForward>Major</RollForward>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -42,7 +42,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Formats.Asn1" />
<InternalsVisibleTo Include="InfinityFlow.CSharp.Eval.Tests" />
</ItemGroup>
</Project>
11 changes: 5 additions & 6 deletions src/InfinityFlow.CSharp.Eval/Tools/CSharpEvalTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,16 @@ public async Task<string> EvalCSharp(
// Execute the script with timeout
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutSeconds));

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

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

if (completedTask == timeoutTask)
{
cts.Cancel();
await cts.CancelAsync();
throw new OperationCanceledException();
}

Expand Down
Loading
Loading