AutoInstrumentation assembly not loaded as domain-neutral
Opened this issue · 3 comments
Bug Report
I'm trying to inject the opentelemetry-dotnet-instrumentation to Powershell.
The powershell assembly is loaded to domain-neutral but the AutoInstrumentation.Loader and AutoInstrumentation was loaded to the default domain.
ModuleLoadFinished: 140718829523560 Microsoft.PowerShell.ConsoleHost AppDomain 140720438070400 [EE Shared Assembly Repository] | IsNGEN = false | IsDynamic = false | IsResource = false
ModuleLoadFinished: opentelemetry.AutoInstrumentation.Loader loaded into AppDomain 2381253564688 [DefaultDomain]
Which casued the problem:
[warning] *** CallTarget_RewriterCallback() skipping method: Method replacement found but the managed profiler has not yet been loaded into AppDomain with id=140720438070400 token=100684843 caller_name=System.Management.Automation.Runspaces.RunspaceBase.Open()
The team have fixed before: #1134 (comment)
Is this expected?
After I have registered the AutoInstrumentation.Loader and AutoInstrumentation assembly to the AGC, the problem resolved, but it this the expected way to fix it?
@lipingma, do you have some time to prepare exact steps you are doing?
It is usually called Minimal, Reproducible Example. Executing code in a reproducible context - like docker image + scripts you are doing can be really helpful, and at least reduce time to figure out what your are trying to achieve.