When EF7 RC is referenced from a Function App, the app throws a runtime error on startup
Moved from https://github.com/dotnet/efcore/issues/29123 since we failed to get any input there.
A minimal reproduceable repo is here: https://github.com/elninoisback/ef7rc-fnapp-issue
The following error is thrown in the console when the function app startsup. It goes away when you remove the ef core dependancy,
The 'Function1' function is in error: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
The following is my .csproj file of the function app.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<RootNamespace>ef7rc_fnapp_issue</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-rc.1.22426.7" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
EF Core version: 7.0.0-rc.1.22426.7 Database provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer) Target framework: (e.g. .NET 6.0) Operating system: Windows 10 Pro IDE: Visual Studio Enterprise 2022
/cc @elninoisback
@ajcvickers Please use the below SO for the solution guide, https://stackoverflow.com/questions/58510301/could-not-load-file-or-assembly-microsoft-extensions-logging-abstractions If you still need help please provide us the function app name, timestamp and invocation id details so that we can check for the system logs and update you.
@ramya894 Note that I transferred this issue on behalf of a customer.
@elninoisback Please see the response from @ramya894 above.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
@ajcvickers Please use the below SO for the solution guide, https://stackoverflow.com/questions/58510301/could-not-load-file-or-assembly-microsoft-extensions-logging-abstractions If you still need help please provide us the function app name, timestamp and invocation id details so that we can check for the system logs and update you.
I don't think the mentioned SO addresses my issue. Infact, my issue is pretty basic, you create a new fnapp, refer the new ef core and it doesn't run (locally). I don't have any hosted ones to let you check the logs, this all happens locally.
For me it worked by switching to dotnet-isolated (https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/FunctionApp) fair amount of work but likely needed until functions upgrades some of its core dependencies
For me it worked by switching to dotnet-isolated (https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/FunctionApp) fair amount of work but likely needed until functions upgrades some of its core dependencies
Yeah, that's exactly what I've been doing till this point. It's too much work though. (I mentioned it here: https://github.com/dotnet/efcore/issues/29123#issuecomment-1250317693)
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
Having the same problem with trying to upgrade an existing .NET6 Functions V4 app also in process hosted and updated the EF Core packages to V7 today and cant even start them anymore in debugger.
opened an issue here as well as it might be related to that extension package not being maintained properly for Functions DI https://github.com/Azure/azure-functions-dotnet-extensions/issues/72
Is there any workaround for this apart from switching to isolated functions? Will this be going to be fixed in future versions of azure functions?
Not sure why they are not thinking about backwards compatibility on such level. We had to go back to using in process functions due to this.
I understand that the function teams want to us to go forward using isolated functions, but lots of things are still broken there and we cant just jump on there without certain thing being supported first...
One example being binding to actual Service Bus Message types.
is there any workaround for this other switching to isolated function?