You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix edge case with loading instrumentations (#6815)
## Summary of changes
This PR ignores additional modules for consideration when injecting our
startup hook (which initializes the rest of the library's
instrumentations). This avoids a rare issue with the injection of the
startup hook.
## Reason for change
This fixes an occasional issue I've encountered where small .NET 8 apps
fail to load instrumentations, which I've tracked down to the startup
hook being injected too early in `System.Security.*` modules. This
results in a failure to call our startup hook, as shown here:
```
04/02/25 03:23:16.488 PM [428784|422832] [error] An error occured in the managed loader: System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter #1': Cannot marshal managed types when the runtime marshalling system is disabled.
at __DDVoidMethodType__.GetAssemblyAndSymbolsBytes(IntPtr&, Int32&, IntPtr&, Int32&)
at __DDVoidMethodType__.__DDInvokeLoader__()
at __DDVoidMethodType__.__DDVoidMethodCall__()
```
## Implementation details
Adds the following module names to ignore when deciding whether to
inject the startup hook:
- `System.Security.AccessControl`
- `System.Security.Claims`
- `System.Security.Principal.Windows`
After making this change I observed in my test console application that
the startup hook was correctly inserted into `Program.Main()`
## Test coverage
Relies on existing tests.
## Other details
0 commit comments