Extensions.json not generated when using Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator 1.1.4
See original GitHub issueTaking @jeffhollan’s words into action, this is the main issue I’ve seen not only on my personal projects, but elsewhere too.
Error while running the functions via Visual Studio:
Microsoft.Extensions.DependencyInjection.Abstractions: Unable to resolve service for type
Error while deployed on a brand new Function v3 app in Azure:
System.InvalidOperationException: Unable to resolve service for type 'Project.Hidden.Domain.Interfaces.Service.IAzureStorageService' while attempting to activate 'Project.Hidden.Serverless.Importacion.VerificarFunction'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method(Closure , IServiceProvider , Object[] )
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IServiceProvider serviceProvider) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs:line 37
at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IFunctionInstanceEx functionInstance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs:line 32
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.<>c__DisplayClass1_1.<.ctor>b__0(IFunctionInstanceEx i) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs:line 20
at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory`1.Create(IFunctionInstanceEx functionInstance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs:line 26
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 44
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 846
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 116
Only working when…
If I run the project from the cli with func start --build
, all the functions work, but it logs the following errors on the console for each function:
[2020-02-18 12:30:49 AM] Error indexing method 'ImportarcionVerificarFunction'
[2020-02-18 12:30:49 AM] Microsoft.Azure.WebJobs.Host: Error indexing method 'ImportarcionVerificarFunction'. System.Private.CoreLib: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.
[2020-02-18 12:30:49 AM] Function 'ImportarcionVerificarFunction' failed indexing and will be disabled.
..
..
[2020-02-18 12:30:49 AM] The 'ImportarcionFinalizarFunction' function is in error: Unable to load one or more of the requested types.
[2020-02-18 12:30:49 AM] Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
My system setup and configurations
Everything worked fine until I migrated to .NET Core 3
- Visual Studio 16.5.0 Preview 2
- azure-functions-core-tools@3.0.2106
- npm@v13.2.0
global.json
{
"sdk": {
"version": "3.1.101"
}
}
.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Project.Hidden.Data\Project.Hidden.Data.csproj" />
<ProjectReference Include="..\Project.Hidden.Domain\Project.Hidden.Domain.csproj" />
<ProjectReference Include="..\Project.Hidden.Services\Project.Hidden.Services.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Startup.cs
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Project.Hidden.Data;
using Project.Hidden.Domain.Interfaces.Repository;
[assembly: FunctionsStartup(typeof(Project.Hidden.Functions.Startup))]
namespace Project.Hidden.Functions
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddSingleton<IAzureStorageService, AzureStorageService>();
}
}
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"FUNCTIONS_EXTENSION_VERSION": "~3"
}
}
host.json
{
"version": "2.0",
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
},
"functionTimeout": "00:10:00"
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (8 by maintainers)
Top Results From Across the Web
Azure Functions Not Generating extensions.json
json is getting generated locally but is not on the build machine, along with empty localization folders that don't exist on the build...
Read more >How to update a particular extension of an Azure Function?
I've tried npm through Kudu, through Visual Studio Code... I'm missing something very simple. Extension: Microsoft.Azure.WebJobs.Extensions.
Read more >Migrating to Dotnet-Isolated Azure Functions worker.config. ...
I am currently upgrading an azure functions project to dotnet 5. ... to Dotnet-Isolated Azure Functions worker.config.json was not found.
Read more >Register Azure Functions binding extensions
Learn to register an Azure Functions binding extension based on your environment.
Read more >NuGet Gallery | Microsoft.Azure.WebJobs.Script. ...
Azure Functions extensions metadata generator.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve just pushed new versions of Microsoft.Net.Sdk.Functions to nuget. Versions
1.0.34
(for v1 and v2) and3.0.5
(for v3) should be indexed and available shortly.Please give those a try and let us know if you run into issues with generated extensions.json (or DI or bindings) with this package.
@brettsam thanks for the quick responses and effort put on resolve this quickly!
I can confirm that all the issues related with the dependency injection have been resolved, locally and deployed using the version
3.0.5
of theMicrosoft.NET.Sdk.Functions
package.Thanks again and @jeffhollan too for jumping on this also.