-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
In version 5.6.1, I'm getting a build error when trying to use an async command with a CancellationToken. Version 5.5.0 builds just fine, so I'm suspecting it's a bug?
error CS0103: The name '__ExternalCancellationToken__' does not exist in the current context
/Users/jacob/dev/me/active/CafSample/obj/Debug/net9.0/ConsoleAppFramework/ConsoleAppFramework.ConsoleAppGenerator/ConsoleApp.Run.g.cs(30,77): error CS0103: The name '__ExternalCancellationToken__' does not exist in the current context
The build failed. Fix the build errors and run again.
using ConsoleAppFramework;
await ConsoleApp.RunAsync(args, Commands.Save);
static class Commands
{
/// <summary>
/// Some sort of save command.
/// </summary>
public static async Task<int> Save(CancellationToken ct)
{
await Task.Delay(1000);
return 0;
}
}Same result with:
using System.Threading;
using System.Threading.Tasks;
using ConsoleAppFramework;
await ConsoleApp.RunAsync(args, async (CancellationToken ct) => await Task.Delay(1000, ct));I tried running in a docker container (mcr.microsoft.com/dotnet/sdk:9.0) to avoid any weirdness with early releases of dotnet 10 I've installed.
root@78e35801fe2e:/src# rm -fr {bin,obj] ; dotnet run
/src/obj/Debug/net9.0/ConsoleAppFramework/ConsoleAppFramework.ConsoleAppGenerator/ConsoleApp.Run.g.cs(28,77): error CS0103: The name '__ExternalCancellationToken__' does not exist in the current context
The build failed. Fix the build errors and run again.
root@78e35801fe2e:/src# dotnet --info
.NET SDK:
Version: 9.0.306
Commit: cc9947ca66
Workload version: 9.0.300-manifests.87361a52
MSBuild version: 17.14.28+09c1be848
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-arm64
Base Path: /usr/share/dotnet/sdk/9.0.306/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.10
Architecture: arm64
Commit: e1f19886fe
.NET SDKs installed:
9.0.306 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
shivinsky, fallenwood and tgiachi
Metadata
Metadata
Assignees
Labels
No labels