1

I am receiving below error when function app is running on the run-time version "2.0.12701.0" (FUNCTIONS_EXTENSION_VERSION = ~2 in App Settings). As soon I change the FUNCTIONS_EXTENSION_VERSION to 2.0.12673.0 in App Settings. function starts working without any code change or deployment.

Error:

DryIoc.ContainerException : Scope disposed{no name, Parent=disposed{no name, Parent=disposed{no name}}} is disposed and scoped instances are disposed and no longer available. at DryIoc.Throw.It(Int32 error,Object arg0,Object arg1,Object arg2,Object arg3) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 8991 at DryIoc.Scope.TryGet(Object& item,Int32 id) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7881 at DryIoc.Container.InstanceFactory.GetAndUnwrapOrDefault(IScope scope,Int32 factoryId) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 1480 at DryIoc.Container.InstanceFactory.GetInstanceFromScopeChainOrSingletons(IResolverContext r) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 1466 at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 224 at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 195 at DryIoc.Resolver.Resolve[TService](IResolver resolver,IfUnresolved ifUnresolved) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 4742 at DryIoc.Microsoft.DependencyInjection.DryIocAdapter.<>c__DisplayClass3_0.b__0(IResolverContext r) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\DryIocAdapter.cs : 156 at DryIoc.Registrator.<>c__DisplayClass27_0.b__0(IResolverContext r) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 4541 at lambda_method(Closure ,IResolverContext ) at DryIoc.Factory.<>c__DisplayClass26_1.b__2() at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 6596 at DryIoc.Scope.TryGetOrAdd(ImMap1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7840 at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7825 at DryIoc.Factory.ApplyReuse(Expression serviceExpr,Request request) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 6595 at DryIoc.Factory.GetExpressionOrDefault(Request request) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 6555 at DryIoc.Factory.GetDelegateOrDefault(Request request) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 6625 at DryIoc.DelegateFactory.GetDelegateOrDefault(Request request) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7731 at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,Object serviceKey,IfUnresolved ifUnresolved,Type requiredServiceType,Request preResolveParent,Object[] args) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 290 at lambda_method(Closure ) at DryIoc.Scope.TryGetOrAdd(ImMap1 items,Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7840 at DryIoc.Scope.GetOrAdd(Int32 id,CreateScopedValue createValue,Int32 disposalOrder) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 7825 at lambda_method(Closure ,IResolverContext ) at DryIoc.Container.ResolveAndCacheDefaultFactoryDelegate(Type serviceType,IfUnresolved ifUnresolved) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 224 at DryIoc.Container.DryIoc.IResolver.Resolve(Type serviceType,IfUnresolved ifUnresolved) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs : 195 at Microsoft.Azure.WebJobs.Script.WebHost.DependencyInjection.ScopedServiceProvider.GetService(Type serviceType) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\ScopedServiceProvider.cs : 25 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) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 37 at Microsoft.Azure.WebJobs.Host.Executors.DefaultJobActivator.CreateInstance[T](IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\DefaultJobActivator.cs : 32 at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory1.<>c__DisplayClass1_1.<.ctor>b__0(IFunctionInstanceEx i) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 20 at Microsoft.Azure.WebJobs.Host.Executors.ActivatorInstanceFactory1.Create(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\ActivatorInstanceFactory.cs : 26 at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.CreateInstance(IFunctionInstanceEx functionInstance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs : 44 at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ParameterHelper.Initialize() at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 846 at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsyncCore(IFunctionInstanceEx functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 116

Changing the Function run-time version (FUNCTIONS_EXTENSION_VERSION =2.0.12673.0) in App Setting from default run-time version 2.0.12701.0 fixed the issue.

This is my Function App Startup class which register dependencies.

 public class FunctionAppStartup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            var config = new ConfigurationBuilder()
                                .SetBasePath(Environment.CurrentDirectory)
                                .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                                .AddJsonFile("secret.settings.json", optional: true, reloadOnChange: true)
                                .AddEnvironmentVariables()
                                .Build();

            builder.Services.Configure<ConfigurationManager>(x => config.Bind(x));
            builder.Services.AddSingleton<Contracts.IConfiguration>(resolver =>
                resolver.GetRequiredService<IOptions<ConfigurationManager>>().Value);

            builder.Services.AddScoped<IChannelAdapter, ChannelAdapter>();
            builder.Services.AddScoped<ITableStorageManager, TableStorageManager>();
            builder.Services.AddSingleton<IDatabaseContext, DatabaseContext>();
            builder.Services.AddScoped<IJobRepository, JobRepository>();
        }
    }

Expecting my function app to run on the latest run-time version instead of me targeting a minor run-time version.

SUNIL DHAPPADHULE
  • 2,755
  • 17
  • 32
SIDHU
  • 60
  • 2
  • 7
  • Thanks for the report @SIDHU. I've created https://github.com/Azure/azure-functions-host/issues/4989 so we can try to reproduce what you're seeing. Would you mind following up with me there? – brettsam Sep 27 '19 at 20:02
  • This issue is now fixed with the latest release of azure function run-time. https://github.com/Azure/azure-functions-host/issues/5060 – SIDHU Oct 11 '19 at 20:55

1 Answers1

1

Fro now, you couldn't use this runtime version.

Cause even this is a latest released version, however it's not updated to production site. Please check the release note.

Note: This release is not yet in production but will be deploying over the next few days. These release notes will be updated when it has been deployed to all production sites.

When it's updated, the official will update the note. So the latest available version is 2.0.12673.

George Chen
  • 13,703
  • 2
  • 11
  • 26
  • Thanks George. I am doing anything to target this version. my function app is automatically created using arm template and it's setting my run-time version to latest version when I am deploying my code using DevOps. – SIDHU Sep 27 '19 at 08:20
  • Hi George, How can I tell azure to not automatically promote latest version of run-time which is not production ready for my function app? – SIDHU Sep 27 '19 at 09:09
  • You mean if you set with ~2, it will be `2.0.12701.0`, if yes suppose you have to point the version manually. And if you have this problem suppose you could report this [issue](https://github.com/Azure/Azure-Functions/issues). – George Chen Sep 27 '19 at 09:36
  • 2
    Thanks George. I have reported the issue to Azure Functions team. I don't want to set my function app to minor version then I have to manually update it every time a new version is released. – SIDHU Sep 27 '19 at 10:35
  • Maybe you could tru with `latest` refer to this answer.https://stackoverflow.com/a/40332737/10383250 – George Chen Sep 27 '19 at 10:51
  • @SIDHU, if this could help you, please accept it as the answer. Thanks! – George Chen Sep 29 '19 at 12:09
  • @SIDHU I am also facing the same kind of issue, https://github.com/Azure/azure-functions-host/issues/9316. Can you please put some light on it – Prashant Agrawal Jun 05 '23 at 07:47