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.

Erro: "Unable to load one or more of the requested types."

See original GitHub issue

Describe the bug

After adding the Datadog.Monitoring.Distribution in my API project, any request I make returns the error below:

{
  "errors": [
    "Unable to load one or more of the requested types.\nCould not load type 'Microsoft_AspNetCore_Routing__ADB9793829DDAE60.Microsoft_AspNetCore_Routing_Patterns_RoutePatternParameterPart.Datadog_Trace_DiagnosticListeners_AspNetCoreDiagnosticObserver__RoutePatternContentPartStruct_30' from assembly 'DuckTypeNotVisibleAssembly.RoutePatternParameterPart_30, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'."
  ]
}

The curious thing is that this only happens when the API is running in the container on AWS, locally on IIS or docker, I couldn’t replicate the behavior.

To Reproduce To reproduce the behavior you can create an API using .NET 6, install Datadog.Monitoring.Distribution 2.3.0-beta01 and upload it to an ECS on AWS. Following this documentation, the commands below were included in the docker container image:

# Enable Datadog automatic instrumentation -> App is being copied to /app, so Datadog assets are at /app/datadog
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/app/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/app/datadog

# Run the createLogPath script on Linux to ensure the automatic instrumentation logs are generated without permission isues
RUN /app/datadog/createLogPath.sh

Screenshots

image

Runtime environment (please complete the following information):

  • Instrumentation mode: NuGet Package Datadog.Monitoring.Distribution 2.3.0-beta01
  • Tracer version: 2.3.0
  • OS: Ubuntu 20.04.3 LTS
  • CLR: .NET 6

Additional context

API Endpoint:

curl -X 'GET' \
  'https://myapi.com/api/v1/portfolios/5c0178237a6c1e000f6a72b8/returns/global/current/profit-and-loss-statement?referenceDate=2021-01-01&liquidity=10' \
  -H 'accept: text/plain'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
caiovmscommented, May 5, 2022

Hi @pierotibou , of course, I just tested it here and it worked perfectly for me.

1reaction
andrewlockcommented, May 3, 2022

Thanks all, we’ve just merged #2716 which should fix this issue. The next release should include this change. Once it’s released if you could test it out and let us know if you have any issues that would be great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Error message 'Unable to load one or more of the ...
Most likely a dynamically loaded assembly is missing a referenced assembly. That assembly needs to be in the bin directory of your application....
Read more >
[Solved] Unable to load one or more of the requested types ...
If it works on your local machine, the issue is that you have not copied the dlls to the server. ... The error...
Read more >
.NET 6 Plugin Development - "Unable to load one or more ...
Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Method 'Init' in type 'CreateNewBusinessPlugin.
Read more >
Server Error: Unable to load one or more of the requested ...
Im running Creatio studio with postgresql on Windows Server 2019 using wsl + ubuntu for the redis server. Exception Details: System.
Read more >
Unable to load one or more of the requested types
An error is thrown when trying to setup a new Sitefinity project.
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