Check that you don't have fiddler running!
Azure Functions (.net5) Not able to debug
Hi,
I'm not able to debug locally my azure functions. I was following many articles on microsoft, github etc, but still facing issues.
Environment:
- Visual Studio 2019
- .net 5 with newest functions
- steps for setup were following https://github.com/Azure/azure-functions-core-tools
- running functions with dotnet-isolated runtime
- using dependency injection
What is happening:
- Developer powershell running command: func start --dotnet-isolated-debug or func host start --dotnet-isolated-debug
- HttpRequest function is found
- Url is shown: http://localhost:7071/api/HttpFunction2
- .Net Worker (PID: 53424) is shown
- I attach debugger for given process, then I'm able to debug my Main method on Program, where host builder is setup
- It goes through the code, but once it touches await host.RunAsync(); it is throwing error "Can't write the message because the call is complete."
- Debugger is stopped
- I'm trying to ping my functions, which write that function was triggered via api, but then it ends without any log (even one inside of function)
4 answers
Sort by: Most helpful
-
-
Ondrej Durica 1 Reputation point
2021-04-22T06:54:02.947+00:00 Still same issues. Is there anything I could check (debug) inside the code?
Azure Functions .NET Worker (PID: 28040) initialized in debug mode. Waiting for debugger to attach...
[2021-04-22T06:52:31.915Z] System.InvalidOperationException: Can't write the message because the call is complete.
[2021-04-22T06:52:31.917Z] at Microsoft.Azure.Functions.Worker.GrpcWorker.SendStartStreamMessageAsync(IClientStreamWriter`1 requestStream) in C:\srdev\Projects\Functions\azure-functions-dotnet-worker-main\src\DotNetWorker.Grpc\GrpcWorker.cs:line 83
[2021-04-22T06:52:31.920Z] at Microsoft.Azure.Functions.Worker.WorkerHostedService.StartAsync(CancellationToken cancellationToken) in C:\srdev\Projects\Functions\azure-functions-dotnet-worker-main\src\DotNetWorker.Core\WorkerHostedService.cs:line 25
[2021-04-22T06:52:31.922Z] at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
[2021-04-22T06:52:31.923Z] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
[2021-04-22T06:52:31.925Z] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
[2021-04-22T06:52:31.926Z] at FunctionApp.Program.Main(String[] args) in C:\srdev\Projects\Functions\azure-functions-dotnet-worker-main\samples\FunctionApp\Program.cs:line 35 -
Jason Wisener 26 Reputation points
2021-05-25T20:24:41.713+00:00 In visual studio 2019, we have lost the ability to debug azure 5 functions. What has happened to break this? It's critical we be able to debug our azure functions (5) locally.
-
Jimmy Karlsson 1 Reputation point
2021-05-25T22:35:19.923+00:00 Hi. Initially I had some issues, which was mostly related to proxy settings for an Azure Servicebus trigger function. I got it working by following the official .net 5 instructions at
https://learn.microsoft.com/en-gb/azure/azure-functions/dotnet-isolated-process-guideCurrently there is no debug available through vs2019 when running .net 5 functions, so you need to attach the debugger to the dotnet process after you start it in a command or powershell prompt with: func start or func host start (http trigger)