question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DNN Tracking DLL Dependencies fails when multiple Versions are in Use

See original GitHub issue

Description of bug

Two modules using the same DLL in different versions can easily do so by placing them in a subfolder in the bin and setting the Web.Config rules for version redirects. This works at runtime, but fails on module installs and updates. Here’s a real example where 2sxc and DnnSharp run into a problem (see also the issue on 2sxc:

  1. 2sxc uses EF 1.1 and the MS Dependency Injection 1.1 and places all this in bin/2sxc
  2. PlantAnApp (DnnSharp) uses EF 2.1 and places all this in bin/PlantAnApp

Because the web.config redirects manage all this, it’s not a problem. But on Module-Install and Upgrade it fails. The reason is that DNN tries to help by tracking installed DLLs, but doesn’t keep track of the folder. So even though the files don’t conflict, DNN checks the DB and assumes a newer version has already been installed (Table: Assemblies):

image

Note: for historic reasons the EF in 2sxc has the wrong version (it believes it’s EF v11 or 12 because that’s the 2sxc version). This may lead to more confusion, because actually installing 2sxc after PlantAnApp works, but updating PlantAnApp will fail then. But the core problem is that the version ignores the folder it’s in.

Current behavior

This leads to the following problems:

  1. If PlantAnApp is installed first, 2sxc with EF v1.1 wouldn’t install, because DNN believes it already has a newer version.
  2. If 2sxc with EF 1.1 is installed first, the entry would say v1.1 and Would allow PlantAnApp to install it as well. That would bump the version to 2.1. After that updating 2sxc with a newer EF (say 1.2) would fail, because DNN believes it already has a newer version.

Expected behavior

DLL Versions in Assemblies should include the folder they are in, as the same DLL can be installed in different versions.

Affected version

  • All DNN versions as of now up and till v09.09.01

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bdukescommented, Jun 4, 2021

I just looked at the .dnn file in your latest install package and wanted to respond to the comments 🙂

The File component will report file extensions that are not on the allowed list. However, the ResourceFile component will not. https://github.com/2sic/2sxc/blob/9ba57100fa532aef41ec96a9bb0f347ac89aeb73/Src/Dnn/ToSic.Sxc.Dnn.Main/DnnPackageBuilder/2sic_2SexyContent.dnn#L266-L275

It looks like this is what you’re doing now for pdb files, you could do the same for your bin/2sxc/*.dll files. https://github.com/2sic/2sxc/blob/9ba57100fa532aef41ec96a9bb0f347ac89aeb73/Src/Dnn/ToSic.Sxc.Dnn.Main/DnnPackageBuilder/2sic_2SexyContent.dnn#L286-L293

Regarding PDB files, it looks like you implemented support for pdb files in the Assembly component in DNN 9.1.1. https://github.com/2sic/2sxc/blob/9ba57100fa532aef41ec96a9bb0f347ac89aeb73/Src/Dnn/ToSic.Sxc.Dnn.Main/DnnPackageBuilder/2sic_2SexyContent.dnn#L145-L148

1reaction
bdukescommented, Jun 4, 2021

Using an Assembly component (as opposed to a File component) provides the following features:

  • Registers the assembly in the Assemblies table (records what version of an assembly each package installed)
  • Creates a binding redirect for strong-named assemblies
  • Checks the version of installed assemblies to avoid overwriting newer assemblies with older assemblies

It doesn’t seem to me that any of those features are of use to these assemblies that are installed to an alternate folder. Certainly a well-behaved module should declare their shared assemblies that are going into the bin folder using the Assembly component, but assemblies that you’re managing and that are not shared probably don’t benefit by using the Assembly component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio - DLL dependencies and allowing one to fail
I am not sure how Visual Studio (or dependency walker?) figures out which DLL's are dependencies for a given DLL. However I don't...
Read more >
Unable to find TensorFlow dll · Issue #2423
Core 2.1 Visual Studio version 15.9.4 Unable to find TensorFlow DLL What did ... Unable to load DLL 'tensorflow' or one of its...
Read more >
How best to handle multiple versions of the same ...
I have two dependencies that my program is using that themselves rely on different versions of the same dependency (Newtonsoft.Json.dll).
Read more >
Dependency Walker Frequently Asked Questions (FAQ)
EXE fail to register my DLL, but Dependency Walker does not show any error with my DLL? Many modules need to be "registered"...
Read more >
DLL load failed while importing cv2: The specified module ...
I'm hoping someone can guide me resolve this error on my setup. ... did not encounter this error on my first try of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found