Open anujb opened 2 years ago
Hi @anujb Thank you for the feedback. We will discuss this internally and let you know about the findings. Thanks.
I was able to solve this by adding this to my csproj...
<Target Name="RunFunctions" >
<Exec Command="func host start" />
</Target>
And then run
dotnet watch msbuild -t:RunFunctions
I was able to solve this by adding this to my csproj...
<Target Name="RunFunctions" > <Exec Command="func host start" /> </Target>
And then run
dotnet watch msbuild -t:RunFunctions
Hi, this is the workaround the OP referenced above. It basically stops/restarts the process automatically and does not inject changes in the running process, which hot reload is supposed to do.
@fabiocav Is the problem here that the dotnet worker is not compiling using dotnet watch
/ dotnet build
and instead accesses MSBuild directly?
$ func start
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
And it almost seems like it's going to work just by running the usually dotnet watch
$ dotnet watch
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
💡 Press "Ctrl + R" to restart.
dotnet watch 🔧 Building...
Determining projects to restore...
All projects are up-to-date for restore.
NutritionFlockDataApi -> C:\Users\xxx\devel\xxx\backend-functionapp\bin\Debug\net7.0\MyApp.dll
Determining projects to restore...
Restored C:\Users\zkohler\AppData\Local\Temp\bflo3fox.e01\WorkerExtensions.csproj (in 1.14 sec).
WorkerExtensions -> C:\Users\zkohler\AppData\Local\Temp\bflo3fox.e01\buildout\Microsoft.Azure.Functions.Worker.Extensions.dll
dotnet watch 🚀 Started
Unhandled exception. System.InvalidOperationException: The gRPC channel URI 'http://:0' could not be parsed.
at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.<>c.<AddGrpc>b__1_3(IServiceProvider p) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCo
Also the workarounds don't work when combined with the Static Web App toolkit https://azure.github.io/static-web-apps-cli/docs/cli/swa-start
Seems like the core tools are written in a way that expect the build to terminate, no real easy fix I guess?
I really hope this comes in with the updates planned for .NET 8. Hot reload is such a productivity boost. I haven't even been able to get the workaround to work with Functions v4 and .NET 8 preview 7 SDK.
Piling on as well. Hot reload is one of those things that would make the Dev Ex buttery smooth 🧈
It has been 2 years now. Either I didn't catch it, or there was no clear statement that this in the pipeline or not possible to realize with the current core tools.
I wonder, since the C# Devkit was just GA'd, can we expect hot reload from this in the near future? Or will VS remain to be the only thing that supports hot reload with Azure functions?
@justinmchase thanks for the workaround above, it worked nicely until we upgraded to .NET 8, and now it's broken with:
Unhandled exception. System.InvalidOperationException: The gRPC channel URI 'http://:' could not be parsed.
I've just started looking for a solution, and will report back if I find one. It seems like a problem loading config from somewhere.
Same issue for dotnet 8.0 @jpdillingham did you find a solution?
@eolamisan unfortunately no, I sunk a few hours into it and didn't reach any conclusions.
Azure Functions Tooling using the C# .NET 6 isolated process function does not support the hot reload capability by default. I tried using the hot reload capability by adding a custom build target recommended here:
https://github.com/Azure/azure-functions-core-tools/issues/1239#issuecomment-669018902
But the reload on average 5 seconds, which is a poor inner loop experience.