-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdg
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
the code bellow work if i dont enable EnableRequestDelegateGenerator
//Program.cs
using TestRepo.Routes;
using TestRepo.Setup;
var builder = WebApplication.CreateBuilder(args);
builder.RegisterService(); // typical register service builder.Service.Add{stuf} i put it in another file to keep thing clean
var app = builder.Build();
await app.StartupAction(); // this check DB and do seed data
app.MapGroup("/person").WithTags("Person").HandlePersonRoute(); // the main route define bellow
app.Run();
// PersonRoute.cs
public static class PersonRoute
{
/// <summary>
/// this consumes the <see cref="RouteGroupBuilder"/> and handle all logic and child route. <br />
/// This method must be and mean to be called last of <c>Map{Verb}</c> chain, as it return <see cref="Void"/>
/// </summary>
/// <param name="route"></param>
public static void HandlePersonRoute(this RouteGroupBuilder route)
{
route.MapPost("/add", CreatePerson);
// more route handler like above
}
private static async Task<Results<Ok<int>, BadRequest<string>>> CreatePerson(
ILogger logger,
IRepository repository,
Person person
)
{
// do validate
// -----snif--------
await using var transaction = await repository.BeginTransactionAsync();
try
{
await repository.AddAsync(person);
await repository.SaveChangesAsync();
await transaction.CommitAsync();
return TypedResults.Ok(person.Id);
}
catch (Exception ex)
{
var reason = ex.GetBaseException().Message;
await transaction.RollbackAsync();
logger.WriteToDatabaseFail(nameof(Person), reason);
return TypedResults.BadRequest(reason);
}
}
// --- snif-----
}
Expected Behavior
the app build and run perfectly fine if using default template, but fail to compile if enable either EnableRequestDelegateGenerator
or PublishTrimmed
or PublishAOT
, note that i put EFCore in another project and reference to it
below is compiler complain
and in source gen file
I dont know how false
can be generate as False
but i suspect something to do with TypedResults
Steps To Reproduce
you can find my repo here https://github.com/NotAsea/TestRepo.git
- create with Web API template in Visual Studio
- dont choose enable native AOT
- dont choose use Controller
Exceptions (if any)
No response
.NET Version
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.8d38d0cc
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100\
.NET workloads installed:
Workload version: 8.0.100-manifests.8d38d0cc
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71
.NET SDKs installed:
8.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdg
Type
Projects
Status
Done