求助:使用Lambda Mock Test Tool调试.NET 8.0 Native AOT AWS Lambda遇阻
.NET 8 Native AOT Lambda项目本地调试异常:Lambda Mock Test Tool无法触发断点
我通过dotnet new serverless.NativeAOT创建了一个采用注解框架的Native AOT项目,部署至AWS Lambda后抛出空引用异常。为排查问题,我尝试在Visual Studio 2022中使用Lambda Mock Test Tool设置断点,但测试工具虽能正常启动,在Executable Assembly选项卡提交事件后却一直处于挂起状态,无法触发Startup.cs和Functions.cs中的断点。
launchSettings.json 配置内容
{ "profiles": { "Lambda Runtime API": { "commandName": "Executable", "commandLineArgs": "--port 5050", "executablePath": "/Users/xxx/.dotnet/tools/dotnet-lambda-test-tool-8.0.exe", "workingDirectory": "/Users/xxx/source/repos/SendTunesServerless/SendTunesServerless/src/SendTunesServerless/bin/Debug/net8.0", "environmentVariables": { "AWS_LAMBDA_RUNTIME_API": "localhost:5050", "AWS_PROFILE": "default", "AWS_REGION": "us-east-1" } } } }
Startup.cs 代码内容
[LambdaStartup] public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSingleton<ISpotifyAccessTokenService, SpotifyAccessTokenService>(); services.AddHttpClient<ISpotifyService, SpotifyService>(client => { client.BaseAddress = new Uri("https://api.spotify.com/v1/"); }); } }
我已查阅官方配置文档及工具内的可执行程序测试说明,但问题仍未解决。请问是否有人成功使用Lambda Mock Test Tool测试.NET 8.0 Native AOT项目?
内容的提问来源于stack exchange,提问作者Adam
相关产品推荐
相关产品推荐

