Azure functions V4 issue
w1ckedmellow opened this issue · 5 comments
While I was migrating to Azure Functions V4 I stambled upon an issue with a dependency.
I cannot find a way to solve this, and I'm reaching out for help.
To Reproduce
I prepared a simple repo that recreates the issue, by running RenderRazorLight
function.
https://github.com/w1ckedmellow/Azure-functions-v4-razor-light-issues.git
Expected behavior
Compilation a template from a path or Assembly embeded resource
razorLightEngine.CompileRenderAsync( templatePath, templateModel )
- OS: Windows & Linux
- Platform: .NET 6
- RazorLight version: 2.3
- Are you using the OFFICIAL RazorLight package? yes
- Visual Studio version: Visual Studio Community 17.8.1
Additional context
Error
System. Private. CoreLib: Exception while executing function. RazorLight: Could not load file or assembly 'Microsoft. Extensions. DependencyModelJ Version=6.O.O.O
Thanks, the repro is helpful. I may take a look this weekend.
I was having the same issue. I was updating my Azure Functions app from v3 runtime to v4 runtime running .NET 6.0 in-process model. While the app compiled and ran fine, I got the same exception when calling razorLightEngine.CompileRenderAsync(templatePath, model)
.
I was able to work around it by migrating my app to the isolated worker process model running .NET 8.0. This approach might make more sense for some people, given the isolated worker model is the recommended approach going forward.
I suspect RazorLight might also work in isolated mode with .NET 6.0, but in my case, going with .NET 8.0 was preferrable.
Hope that helps!
I've been telling people to use isolated worker mode forever.
The default Azure Functions stuff is terrible.
Thank you @rn1d for the tip and helpful links! :)
I migrated one of my functions to 'dotnet-isolated' and it worked smoothly.
Soon I will add a working branch of my test above. Hiope it will help otehrs.
@jzabroski maybe it would be beneficial to add some info about this Azure functions limitations on the project readme.