Erro: "Unable to load one or more of the requested types."
See original GitHub issueDescribe 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
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:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
Hi @pierotibou , of course, I just tested it here and it worked perfectly for me.
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!