Skip to content

Several assemblies are missing #25

Description

@oleks9o6

I'm developing a solution that uses Azure Functions in isolated mode, the project targets .NET7. I'm also using System.Text.Json for serialization inside it.

I set up an HTTP function with [Authorize] attribute as per the instruction but when I'm calling it, it fails:

[2023-05-02T14:45:13.972Z] Exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
[2023-05-02T14:45:13.972Z] Could not load file or assembly 'Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
[2023-05-02T14:45:13.972Z] 
[2023-05-02T14:45:13.972Z] Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
[2023-05-02T14:45:13.972Z] 
[2023-05-02T14:45:13.972Z] Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.
[2023-05-02T14:45:13.972Z] 
[2023-05-02T14:45:13.972Z] Could not load file or assembly 'Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
[2023-05-02T14:45:13.972Z] 
[2023-05-02T14:45:13.972Z]    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
[2023-05-02T14:45:13.972Z]    at System.Reflection.Assembly.GetTypes()
[2023-05-02T14:45:13.972Z]    at AzureFunctions.Extensions.OpenIDConnect.RouteGuardian.<>c.<.cctor>b__5_2(Assembly x)
[2023-05-02T14:45:13.972Z]    at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
[2023-05-02T14:45:13.972Z]    at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
[2023-05-02T14:45:13.972Z]    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
[2023-05-02T14:45:13.972Z]    at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
[2023-05-02T14:45:13.972Z]    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
[2023-05-02T14:45:13.972Z]    at AzureFunctions.Extensions.OpenIDConnect.RouteGuardian..ctor(FunctionTypeCrawler typeCrawler, IFunctionsAnalyzer functionsAnalyzer)
[2023-05-02T14:45:13.972Z]    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
[2023-05-02T14:45:13.972Z]    at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
[2023-05-02T14:45:13.972Z]    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType)
[2023-05-02T14:45:13.972Z]    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
[2023-05-02T14:45:13.972Z]    at Microsoft.Extensions.Hosting.MiddlewareWorkerApplicationBuilderExtensions.<>c__DisplayClass3_0`1.<UseMiddleware>b__1(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Hosting\WorkerMiddlewareWorkerApplicationBuilderExtensions.cs:line 105
[2023-05-02T14:45:13.973Z]    at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.DurableTaskFunctionsMiddleware.Invoke(FunctionContext functionContext, FunctionExecutionDelegate next) in /_/src/Worker.Extensions.DurableTask/DurableTaskFunctionsMiddleware.cs:line 22
[2023-05-02T14:45:13.973Z]    at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77
[2023-05-02T14:45:13.973Z] System.IO.FileNotFoundException: Could not load file or assembly 'Azure.Core, Version=1.20.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

Adding both missing packages fixes the issue but are there other options since I did not plan to include them in the project?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions