Implemented assembly redirect for non-default AppDomain#4728
Implemented assembly redirect for non-default AppDomain#4728iskiselev wants to merge 4 commits intoopen-telemetry:mainfrom
Conversation
Introduce OTEL_APP_DOMAIN_STRATEGY to control AppDomain config update strategies for .NET Framework, supporting LoaderOptimization, assembly redirects, or no action. Add dynamic app.config modification for assembly binding redirects via AppConfigUpdater and new AssemblyCatalog. Expand IIS tests to cover all strategies.
|
SOLVED: We do not use any special processing for MongoDB anymore and do not include it in distro |
There was a problem hiding this comment.
Should we try to parse app.config when we check it? Which app.config should be used - creator domain or target domain?
How should be file-based config be integrated here?
For now, I plan to add it to the list of settings supported only by environment variables.
…AIN_STRATEGY` Added documentation and changlog information.
Handled creation of config when not provided by AppDomain
| existingNewVersion = new Version(0, 0); | ||
| } | ||
|
|
||
| if (existingNewVersion >= assemblyInfo.Version) |
There was a problem hiding this comment.
It would be bad if app uses newer version of the same assembly that we need, but does not have binding redirect.
To solve it better, we may need implement scan of assembly folders and GAC to check if newer version exisists. I do not plan to do it in that PR, but can be done later if any requests will come.
Why
Exisitng solution #4187 force LoaderOptimization.SingleDomain for every additional app domains. It is not standard behaviour and may result in increased memory consumption and slower warm-up for process hosting multiple web-applications - and other processes that use additional AppDomains.
Implement second stage of fix for #4186.
What
Added environment variable
OTEL_APP_DOMAIN_STRATEGYthat controls strategy of fixing assembly conflicts in non-default app domains.Possible values:
None- do not apply anything. Works with test app and OTEL 1.14, crash with Loading this assembly would produce a different grant set from other instances #4186 on OTEL 1.13. May be useful for custom host that creates AppDomains.LoaderOptimizationSingleDomain- exisiting solution implemented in Automatic LoaderOptimization.SingleDomain #4187 - all additional AppDomains useLoaderOptimization.SingleDomain- used by defaultAssemblyRedirect- new stategy - patch assemblyBindings/dependentAssembly/bindingRedirect in memory-loaded app.config. On test app docker requires app pool to loading user profile if assemblies loaded from folder (and has no issues when assemblies are registered in GAC). On my local computer works even without loading user profile for app pool.Tests
AspNetTests.SubmitsTraces now test additional modes.
Checklist
CHANGELOG.mdis updated.