question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test Tool: Internal Server Error: FileNotFoundException: Could not load file or assembly

See original GitHub issue

It seems like I’m having an issue that I can’t see others coming across. I’ve checked everything I can think of but no matter what I do, when the lambda test tool opens in the browser, it fails to load the functions list.

In the network tab I can see:

500 Error: http://localhost:5050/webtester-api/Tester/aws-lambda-tools-defaults.json
FileNotFoundException: Could not load file or assembly 'Amazon.Lambda.Serialization.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'. The system cannot find the file specified.

Full Stack Trace:

System.IO.FileNotFoundException: Could not load file or assembly 'Amazon.Lambda.Serialization.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'. The system cannot find the file specified.

File name: 'Amazon.Lambda.Serialization.Json, Version=1.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'
   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
   at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
   at Amazon.Lambda.TestTool.Runtime.LocalLambdaRuntime.LoadLambdaFunction(LambdaFunctionInfo functionInfo) in C:\codebuild\tmp\output\src248644039\src\Tools\LambdaTestTool\Amazon.Lambda.TestTool\Runtime\LocalLambdaRuntime.cs:line 125
   at Amazon.Lambda.TestTool.Runtime.LocalLambdaRuntime.LoadLambdaFunctions(IList`1 configInfos) in C:\codebuild\tmp\output\src248644039\src\Tools\LambdaTestTool\Amazon.Lambda.TestTool\Runtime\LocalLambdaRuntime.cs:line 69
   at Amazon.Lambda.TestTool.WebTester.Controllers.TesterController.GetFunctions(String configFile) in C:\codebuild\tmp\output\src248644039\src\Tools\LambdaTestTool\Amazon.Lambda.TestTool\WebTester\Controllers\TesterController.cs:line 34
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Amazon.Lambda.TestTool.WebTester.Startup.<Configure>b__6_0(HttpContext context, Func`1 next) in C:\codebuild\tmp\output\src248644039\src\Tools\LambdaTestTool\Amazon.Lambda.TestTool\WebTester\Startup.cs:line 97
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Has anyone come across this before or can point me in the right direction? There are no errors in the console from me running it and I’m not totally sure where it’s going wrong.

Might be worth mentioning that I’m running this on Ubuntu.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

16reactions
normjcommented, Apr 23, 2020

@ericmilaneze Could you try and experiment for me and in your csproj file add the property CopyLocalLockFileAssemblies with a value of true and see if that changes your behavior?

Here is a full csproj file example.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
    <AWSProjectType>Lambda</AWSProjectType>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
    <PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="1.0.0" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
  </ItemGroup>
</Project>
4reactions
judedarylcommented, May 22, 2020
 <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Adding this worked for me. Can we add this to the README temporarily?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not load file or assembly or one of its dependencies
The general solution is thorough analysis of all referenced assemblies to understand what's going wrong. To make this task easier I made a...
Read more >
System.IO.FileNotFoundException: 'Could not load file or ...
I have an application in .net core. the application was running fine, but the error started coming after I installed.
Read more >
UnitTest fails for a DLL which uses assemblies (Could not ...
=> Test fails with error: System.IO.FileNotFoundException : Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture= ...
Read more >
How to resolve “Could not load file or assembly … or one of its ...
Thus, another solution is to update NuGet package in all root project and then in subsequent referred project (if required) where same package...
Read more >
Vault Basic 2023 Test for System Readiness Failed
The remote server returned an error: (500) Internal Server Error." ... FileNotFoundException: Could not load file or assembly 'Microsoft.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found