DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
448 stars 141 forks source link

The invoked member is not supported in a dynamic assembly #4511

Open lrwh opened 1 year ago

lrwh commented 1 year ago

Describe the bug Hi,I have a .NET application that uses versions 1.31.2,2.32, and 2.27 of dd-trace-donet. An error was reported in the application call flowchart. If the. NET probe is not used, this exception will not occur. It seems that ddtrace and the application used the same dll, but this is just my speculation.

Error info

CustomerHandlerErrorAttribute
System.Web.HttpParseException (0x80004005): The invoked member is not supported in a dynamic assembly. ---> System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
   At System.Reflection.Emit.InternalAssemblyBuilder.get_Location()
   At System.Web.UI.Util.GetAssemblyCodeBase(Assembly assembly)
   At System.Web.UI.Util.AddAssemblyToStringCollection(Assembly assembly, StringCollection toList)
   At System.Web.UI.Util.AddAssembliesToStringCollection(ICollection fromList, StringCollection toList)
   At System.Web.Compilation.AssemblyBuilder.AddCodeCompileUnit(BuildProvider buildProvider, CodeCompileUnit compileUnit)
   At System.Web.WebPages.Razor.RazorBuildProvider.GenerateCodeCore(IAssemblyBuilder assemblyBuilder)
   At System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)
   At System.Web.Compilation.AssemblyBuilder.AddBuildProvider(BuildProvider buildProvider)
   At System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   At System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   At System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   At System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   At System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   At System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   At System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)
   At System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   At System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   At System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   At System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   At System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   At System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult)

dd-trace-dotnet debug log

dotnet-tracer-native-w3wp-72892.log.txt

This is a very old application that cannot be upgraded to code. Can we filter from the .NET probe, but I don't know what the conflicting component is. I need your help. Thank you!

andrewlock commented 1 year ago

Hi @lrwh, sorry to see you're having issues. Please could you provide some more details?

Hi,I have a .NET application that uses versions 1.31.2, 2.32, and 2.27 of dd-trace-donet

How are you using multiple versions? Are you using custom instrumentation and automatic instrumentation? That would still only allow 2

uses versions 1.31.2

This is a very old version of the tracer, which has known bugs, especially related to enumerating dynamic assemblies. We strongly recommend updating to a newer version of the tracer.

If the. NET probe is not used

When you say ".NET probe", do you mean that it doesn't happen if you don't use the tracer? How are you running your application? Have you installed the MSI? Are you using custom instrumentation?

Thanks

lrwh commented 1 year ago

Hi,andrewlock ,Thank you very much for your reply.

How are you using multiple versions? Are you using custom instrumentation and automatic instrumentation? That would still only allow 2

Use one version at a time, not all.

This is a very old version of the tracer, which has known bugs, especially related to enumerating dynamic assemblies. We strongly recommend updating to a newer version of the tracer.

Unable to update program version, it was written by another team.

When you say ".NET probe", do you mean that it doesn't happen if you don't use the tracer? How are you running your application? Have you installed the MSI? Are you using custom instrumentation?

Using MSI without customization,We speculate that this engine Razor is not supported. If possible, we hope to find the configuration and eliminate it to avoid this error.

Thanks

andrewlock commented 1 year ago

Thanks for the reply @lrwh!

We speculate that this engine Razor is not supported

Razor is definitely supported, we have tests for it and haven't run into any issues.

I think we're going to need more information to get to the bottom of this problem (which version of the framework you're using, which libraries, all the debug logs etc). Could you please open a support ticket by visiting https://help.datadoghq.com/hc/en-us/requests/new and they'll handle securely collecting all the relevant information. You can link back to this github issue when you submit the request. Thanks!

lrwh commented 1 year ago

Sorry, @andrewlock , some information cannot be obtained due to the customer's environment.

The current knowledge is as follows:

This business is mainly a workflow business, which occasionally does not report errors, but in most cases, errors occur. After uninstalling the probe, the application is normal.

After the code is executed to return view, the front-end reports an error: System.Web.HttpParseException (0x80004005): The invoked member is not supported in a dynamic assembly

image

andrewlock commented 1 year ago

Hi @lrwh, could you please open a support ticket by visiting https://help.datadoghq.com/hc/en-us/requests/new and they'll handle securely collecting all the relevant information. You can link back to this github issue when you submit the request. Thanks!