Getting MissingMethodException when using standard libraries
See original GitHub issueI have a “factory” class tat sets up some dependency injection inside of my Aws Lambda:
var serviceProvider = new ServiceCollection()
.AddHttpClient()
..... Other services
and when I run the test tool it throws back:
System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.HttpClientFactoryServiceCollectionExtensions.AddHttpClient(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.
at Factories.ProcessorFactory.CreateProcessor()
// Handle event method
at Amazon.Lambda.TestTool.Runtime.LambdaExecutor.ProcessReturnAsync(ExecutionRequest request, Object lambdaReturnObject) in C:\codebuild\tmp\output\src142363207\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\Runtime\LambdaExecutor.cs:line 141
at Amazon.Lambda.TestTool.Runtime.LambdaExecutor.ExecuteAsync(ExecutionRequest request) in C:\codebuild\tmp\output\src142363207\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\Runtime\LambdaExecutor.cs:line 62
Heres a dump of the aws-lambda-tools-defaults.json
:
{
"Information": [
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
"dotnet lambda help",
"All the command line options for the Lambda command can be specified in this file."
],
"profile": "default",
"region": "eu-west-1",
"configuration": "Release",
"framework": "netcoreapp3.1",
"function-runtime": "dotnetcore3.1",
"function-memory-size": 256,
"function-timeout": 30,
"function-handler": "HandleStreamEvent"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Why am I getting System.MissingMethodException when ...
In the solution for the library project, there is an executable console project called Test . Within Test I can call MyLib.Extensions.Extension1 ...
Read more >MissingMethodException Class (System)
MissingMethodException is thrown when code in a dependent assembly attempts to access a missing method in an assembly that was modified. MissingMethodException ......
Read more >Method contains unsupported native code
Same problem, trying to use c++ crl library, getting error: MissingMethodException: Method contains unsupported native code <Module>.
Read more >Missing Method Exception in Rebex.Sftp Package for .NET ...
a) Use multi-targeting in the .NET Standard library. Remove line from its project file and add something like netstandard2.0;net461 instead. See ...
Read more >Missing Method Exception in Plugin's Project-Referenced ...
Decompiled the dll to see if the missing method is missing, and the method in the decompiled code is there. Decompiled using JetBrains'...
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 would have to take the time to dig deeper into it.
But at first glance it might me that the tool has its own set of dependencies that somehow might be conflicting with the app. I would have to check how the assembly resolution is done when the application is attached to the tool to see if my guess is correct (since I believe the tool is what provisions the “runtime” while testing).
But then again this is just a wild guess, so take it with a grain of salt.
I am having this same problem with using libraries that have a Microsoft.AspNetCore dependency. I put together a test project. It builds but throws the MissingMethodException when run via the lambda test tool.
[Removed pending employer approval to upload source code]
Would appreciate some insight as we were forced to downgrade our lambda to .NET Core 2.1 in order to continue development. Thank you!