-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install netfx dlls into GAC #1884
Conversation
@pjanotti Is there anything I am missing? Any recommendation on how to test it? |
Do we want to add strong names for all of the assemblies so that they can be added to GAC? |
This should cover it.
Test an Fx application referencing an older version of the |
🤔 I'm unsure at this point. In principle, this is mostly for DLLs shipped by the actual Fx applications themselves but which ones would we need besides |
OpenTelemetry.DotNet.Auto.psm1
Outdated
$publish = New-Object System.EnterpriseServices.Internal.Publish | ||
$dlls = Get-ChildItem -Path $installDir\netfx\ -Filter *.dll -File | ||
foreach ($dll in $dlls) { | ||
$publish.GacInstall($dll) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q.: what happens if the dll is not strong-named?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now only 3 DLLs (grpc_csharp_ext.x64.dll, grpc_csharp_ext.x86.dll, netstandard.dll) are not added to GAC and if it fails then we have a warning log in Event Viewer
The grpc_csharp_ext.x64.dll, grpc_csharp_ext.x86.dll are not .NET assemblies.
netstandard.dll was probably not added because it was already in GAC.
I think we do not have to do anything at this moment.
PS. Fix cf1c304
OpenTelemetry.DotNet.Auto.psm1
Outdated
$publish = New-Object System.EnterpriseServices.Internal.Publish | ||
$dlls = Get-ChildItem -Path $installDir\netfx\ -Filter *.dll -File | ||
foreach ($dll in $dlls) { | ||
$publish.GacRemove($dll) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a problem with the GAC because by itself it doesn't keep some kind of reference counting, so we may end up removing something added by other applications. I think MSIs interact with some low-level Windows APIs to do some kind of reference counting.
Short of using an MSI we may want to look into whatever API MSIs use for this purpose. That said we should treat as a separate issue and address it in a separate issue/PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a chance that $publish.GacRemove($dll)
has some logic to mitigate the problem as netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL
has not been removed by this line 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record: assemblies added to the GAC by MSIs aren't removed by $publish.GacRemove
. Assemblies added to the GAC via $publish.GacInstall
are not protected in the same way and multiple additions from different locations for the same assembly are clobbered by a single $publish.GacRemove
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more info related to the GAC usage at #1906 (comment)
Tested manually (described in PR description). Ready for review. |
Why
Fixes #1823
What
Install and uninstall netfx dlls into GAC via OpenTelemetry.DotNet.Auto.psm1
Tests
Manual
Run
nuke Workflow --test-name StrongNamedTests --test-project Integration
TEST FAILED
Execute in PowerShell (as admin):
Run
nuke RunManagedIntegrationTests --test-name StrongNamedTests
TEST PASSED 🎉
Run
Uninstall-OpenTelemetryCore
TEST FAILED 🎉
Checklist
CHANGELOG.md
is updated.