Skip to content

Commit 48c292b

Browse files
authored
[Fleet installer] Don't fail uninstall if the GAC lib has additional references (#6698)
## Summary of changes Don't fail uninstall if the GAC assembly has additional references ## Reason for change The GAC won't remove a file if it has additional install references. This happens if you try to register the same assembly name (name + version) with multiple paths. If you do this, then when you call uninstall with the path, the uninstall will return `IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES` because the file _isn't_ removed. But this isn't really a fail from our PoV - the file will be cleaned up later when _all_ the references are removed. ## Implementation details Handle the `IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES` case explicitly and treat it as a success ## Test coverage I will write tests soon, I promise
1 parent 91c36c6 commit 48c292b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tracer/src/Datadog.FleetInstaller/GacInstaller.cs

+4
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ private static unsafe bool TryGacUninstall(ILogger log, IEnumerable<(string Asse
171171
{
172172
log.WriteInfo($"Assembly '{gacAssemblyPath}' was already uninstalled from the GAC.");
173173
}
174+
else if (disposition is Fusion.UninstallDisposition.IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES)
175+
{
176+
log.WriteInfo($"Assembly '{gacAssemblyPath}' has additional install references. It was not removed from the GAC, but will be removed when all references are removed.");
177+
}
174178
else if (retValue == HResult.Code.S_OK)
175179
{
176180
log.WriteInfo($"Successfully uninstalled assembly '{gacAssemblyPath}' from the GAC.");

0 commit comments

Comments
 (0)