Repository navigation
Exception thrown in LambdaEntryPoint #114
Description
Previously deployed this code many times. After upgrading to VS2017 I'm getting the following error in my CloudWatch logs launch: (project name redacted)
An exception was thrown when the constructor for type 'redacted.LambdaEntryPoint' was invoked. Check inner exception for more details.: LambdaException
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
Exception has been thrown by the target of an invocation.: TargetInvocationException
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction..ctor()
The given key was not present in the dictionary.: KeyNotFoundException
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency) at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency) at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency) at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency) at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.<GetCandidates>d__4.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__1592.MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
at wv3.fieldFlowAPI.Startup.ConfigureServices(IServiceCollection services)
Activity
normj commentedon May 3, 2017
Take a look at this github issue, #101, I answered earlier on the subject. What I think you are missing is in the PropertyGroup section of your csproj file the following.
lthompson-cartasite commentedon May 3, 2017
Thanks Norm. I was able to get it compiling by creating a new serverless project in vs2017 and cribbing the references from there using 1.5.0 of the tools. It required a few more code tweaks to deal with annotations but it is deploying and running correctly now.
The packages are a bit out of date, can we use dotnet core 1.1 yet? These are the versions it picked for me:
normj commentedon May 4, 2017
Lambda's policy is to support LTS (long term support) versions or runtimes which .NET Core 1.1 is not.
normj commentedon May 4, 2017
Closing because I believe this answered. Feel free to reopen or open a new issue if there are more questions.