In my C# aws lambda function I use Assembly.Load() with a binary array. I do the following:
//
// "item" is an object that has the property "DotNetAssembly" with
// the binary array that has the assembly that I need to load
//
// this works perfectly!
var assembly = AppDomain.CurrentDomain.Load(item.DotNetAssembly)
Now I create an instance from the "assembly" variable:
//
// "item" is an object that has a property "DotNetType"
// with the name of the class that I need to instance
//
// this works perfectly!
var obj = assembly.CreateInstance(item.DotNetType);
But now, when I try to call the method "ABC" from the "obj" variable
//
// this doesn't work!
obj.ABC();
I receive the following error: System.MissingMethodException: Method not found "AmazonDynamoDBClient"
The method "obj.ABC()" is using an instance of "AmazonDynamoDBClient", so it's clear that dotnet cannot resolve this dependency.
I found this Microsoft's article: https://docs.microsoft.com/en-us/dotnet/framework/deployment/best-practices-for-assembly-loading but it's not clear for me how to resolve dependencies when I use Assembly.Load(binary_array)
How can I resolve the dependencies that the variable "obj" or its class need?
Aucun commentaire:
Enregistrer un commentaire