Skip to content
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

Dependency conflict with third-party plugins #269

Open
Nice3point opened this issue Aug 9, 2024 · 32 comments
Open

Dependency conflict with third-party plugins #269

Nice3point opened this issue Aug 9, 2024 · 32 comments
Assignees
Labels
open discussion ☎️ An issue open for active community discussion

Comments

@Nice3point
Copy link
Collaborator

Nice3point commented Aug 9, 2024

RevitLookup uses third-party dependencies produced by other developers. User plugins may also use these dependencies, but of different versions, which will cause a conflict and an exception on startup. We have no control over this process, and we cannot prevent other developers from using third-party libraries.

Why are you getting this error in RevitLookup and not in another plugin? Because plugins are loaded in alphabetical order, and the 'R' is near the end, so that's where you get the exception and RevitLookup not working. Unfortunately, the plugin that is loaded first forces Revit to use it dependencies for all plugins. And if it's outdated, RevitLookup, which uses the newest one, will simply be incompatible, if everything was in reverse order this could have been avoided.

At the moment there are some ways, disable conflicting plugins:

  • Use Revit 2025, in this version RevitLookup dependencies are isolated from other plugins.
  • Update user plugins to the newest version.
  • You can try to rename the RevitLookup loading manifest, give it a name like _RevitLookup.addin. Add-ins are loaded in alphabetic order.
  • Downgrade the RevitLookup version.
  • Download the DependenciesReport tool and analyse conflicts.
  • Download the AssembliesReport tool and share you report here.

Remember though, you can fix RevitLookup in this way, but there is a chance that conflicting plugins may not work.

RevitLookup dependencies list:
https://github.com/jeremytammik/RevitLookup/blob/dev/source/RevitLookup/RevitLookup.csproj#L45-L71

@Nice3point Nice3point added the open discussion ☎️ An issue open for active community discussion label Aug 9, 2024
@Nice3point Nice3point pinned this issue Aug 9, 2024
@Nice3point Nice3point moved this to 📋 Backlog in RevitLookup roadmap Sep 1, 2024
@Nice3point Nice3point moved this from 📋 Backlog to 🏗 In progress in RevitLookup roadmap Sep 1, 2024
@Nice3point Nice3point self-assigned this Sep 1, 2024
@Nice3point
Copy link
Collaborator Author

Nice3point commented Sep 1, 2024

DependenciesReport

This tool designed for static analysis of dependency conflicts between plugins. Displays a conflict summary and optionally updates dependencies to the latest version. It works without starting Revit.

Download:

Source code: https://github.com/jeremytammik/RevitLookup/tree/dev/tools/source/DependenciesReport

If you have problems with running RevitLookup, please send reports:
изображение

Be careful when running the upgrade, dependencies that are not backwards compatible may break older plugins:
изображение

AssembliesReport

This tool designed for Revit, creates a report on the dependencies used. Aimed at helping to trace the loading of dependencies.

Download:

Source code: https://github.com/jeremytammik/RevitLookup/tree/dev/tools/source/AssembliesReport

  • Download and run the .msi installer.
  • Open the Revit.
  • Run AssembliesReport command.

изображение

Report sample:
изображение

@acco-jpitts
Copy link

The current RevitLookup 2025.08 uses Nice3point.Revit.Toolkit 2025.0.1
My addin was built using your project templates and is using the latest Nice3point.Revit.Toolkit 2025.0.2

image
image

I built RevitLookup using the current Toolkit 2025.0.2 and had no issues loading both.
image

Why am I still running into this issue in 2025?

I'm unable to run the DependenciesReport because company hyper-aggressive anti-virus doesn't like it.

@Nice3point
Copy link
Collaborator Author

@acco-jpitts at the moment Revit Toolkit is the only one bottleneck that can cause failures in Revit 2025, as it is this library that provides isolation. I will look into how to get around this, thanks for the clarification

@Nice3point Nice3point moved this from 🏗 In progress to Pre-release in RevitLookup roadmap Sep 18, 2024
@trgiangv
Copy link

trgiangv commented Oct 7, 2024

@Nice3point Please have a look, there have conflict between Python node in Dynamo and RevitLookup

  • Tested on
    • Revit 2025.0.2
    • Dynamo 3.2
    • RevitLookup 2025.0.10.0

image

2024-10-07_16h37_26

@Nice3point
Copy link
Collaborator Author

Nice3point commented Oct 7, 2024

@trgiangv we already have an issue #272. Dynamo team hasn't made any comments on this topic, and I have no idea why initial loading of Python node can affect RevitLookup functioning. I'll try to investigate this problem in the future

@Nice3point
Copy link
Collaborator Author

Nice3point commented Nov 14, 2024

Native add-in isolation planned for feature Revit updates

Feature Summary - Add-in Dependency Isolation.pdf

@ricaun
Copy link
Contributor

ricaun commented Nov 18, 2024

Native add-in isolation planned for feature Revit updates

Interesting! Where did you get this file?
If is the Revit Preview probably is better to share the link to the Feature inside the Revit Preview Forum, and not the Feature Summary file.

Edited:

@ricaun
Copy link
Contributor

ricaun commented Jan 16, 2025

I was experimenting with ILRepack and decided to try in RevitLookUp to repack all dependencies inside the main RevitLookup.dll

In the end only RevitLookup.dll and RevitLookup.UI.dll is available inside the plugin, and looks every thing is working like should be.

Looks better and easier than the Isolation approach all the dependencies are inside the main RevitLookup.dll, so is impossible to have some conflict with other dependencies already loaded inside Revit.

Here is a image inside Revit 2025, with only RevitLookup.dll and RevitLookup.UI.dll loaded inside Revit, any Nice3Point dependencies is not loaded because is already inside the main dll.

Image

I was messing with bundle so here is the version with ILRepack I'm using.

RevitLookup.bundle.zip

And the repo: https://github.com/ricaun/RevitLookup/tree/refs/heads/dev-bundle-ilrepack

I'm using my custom ricaun.ILRepack tool to repack the dlls using Target in the end of build process.

Using this code inside the csproj to repack all dlls except the RevitLookup.UI.dll.

<ItemGroup>
    <PackageReference Include="ricaun.ILRepack" Version="1.0.0-rc" />
    <ILRepackIgnoreReferences Include="RevitLookup.UI.dll" />
</ItemGroup>

<PropertyGroup>
    <ILRepackImportance>High</ILRepackImportance>
    <ILRepackCommandImportance>High</ILRepackCommandImportance>
    <ILRepackCommandExtra>/union /allowduplicateresources</ILRepackCommandExtra>
</PropertyGroup>

This would fix once for all the RevitLookup dependency conflict with third-party plugins, and works with all Revit version.

@Nice3point
Copy link
Collaborator Author

I don't really feel like this would make sense in Revit 2026 with a native isolation. What do you think?

@ricaun
Copy link
Contributor

ricaun commented Jan 17, 2025

I don't really feel like this would make sense in Revit 2026 with a native isolation. What do you think?

I guess you could not use ILRepack in Revit 2026, but I feel Autodesk gonna mess-up the feature native isolation.

@Nice3point
Copy link
Collaborator Author

Nice3point commented Jan 17, 2025

Probably they will release it with insufficient quality, given the strict release policy they will not finish the fixes with .addin, and we will need to look for workarounds. Just in case we can use the repack, for now let's wait for April and new news

@Nice3point
Copy link
Collaborator Author

So, Il-Repack is not compatible with the current code base.

Blocked by: gluck/il-repack#387

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

So, Il-Repack is not compatible with the current code base.

Blocked by: gluck/il-repack#387

You don't need to repack the UI, because you already copy the whole project and rebuild with a different assembly name.

I don't know exactly how the new code base is working but only the references that is not start with RevitLookup should be repacked.

@Nice3point
Copy link
Collaborator Author

This will not work, now RevitLookup consists of more than one file. Also RevitLookup.Ui.Framework contains WPF markup, which will not allow to merge dlls so easily because of the issue above @ricaun

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

Interesting a lot of projects, maybe the way would be to have another project just to repack the references, like RevitLookup.Extensions with Microsoft.Extensions.* and Serilog.* and use that project as reference in the others that requires Microsoft.Extensions.* or Serilog.*.

Gonna try that when I have some free time.

@Nice3point
Copy link
Collaborator Author

Nice3point commented Feb 11, 2025

A separate project is a bad way to go, the current implementation should not depend on whether Repack is used or not. Still it is an additional option, and besides we will not use it for Revit 2026+ in favor of Revit built-in AssemblyLoadContext. So, if you dynamically link to the project after the repack, maybe it will be fine, but it's a very complex approach, you can try.

I think it's best to wait for the Il-Repack patch, as it will solve the current problem completely. The whole problem is that the Package URL doesn't updated in the Ui.Framework, but we cannot exclude it from the repack, because it refers to CommunityToolkit and Microsoft.Logging.

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

A separate project is a bad way to go, the current implementation should not depend on whether Repack is used or not. Still it is an additional option, and besides we will not use it for Revit 2026+ in favor of Revit built-in AssemblyLoadContext. So, if you dynamically link to the project after the repack, maybe it will be fine, but it's a very complex approach, you can try.

I think it's best to wait for the Il-Repack patch, as it will solve the current problem completely. The whole problem is that the Package URL doesn't updated in the Ui.Framework, but we cannot exclude it from the repack, because it refers to CommunityToolkit and Microsoft.Logging.

Now I get it! You want to repack the whole plugin to a single dll. The Package URL make sense in this case, and is better solution if that works by default with no extra steps.

I did a quick test with the gluck/il-repack#390

And works really great, only need to change the hardcoded namespace to fix the theme change.

https://github.com/jeremytammik/RevitLookup/blob/6d6967b03d9268ab22505965387226e700b1c561/source/RevitLookup.UI/Appearance/ApplicationThemeManager.cs#L40C5-L41C1

//internal static string LibraryNamespace = "revitlookup.ui;";
internal static string LibraryNamespace { get; } = typeof(ApplicationThemeManager).Assembly.GetName().Name;

@Nice3point
Copy link
Collaborator Author

RevitLookup.UI can be left as a separate dll, like LookupEngine, they have no dependencies. I mean RevitLookup.UI.Framework, it contains Pack URIs like this: https://github.com/jeremytammik/RevitLookup/blob/dev/source/RevitLookup.UI.Framework/Markup/Menu/MenusDictionary.cs#L31

gluck/il-repack#390 2 days ago, so it will be included in the next patch 🙂

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

My idea was to not include the any UI dll in the repack. This new patch looks really promising. Let's wait for the release 🙂

@Nice3point
Copy link
Collaborator Author

If you notice any issues, let me know. The new version should work several times faster 🙂 Release in April

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

I noticed the Theme is not updating the current window, is similar like this issue: #194

Don't know if is because of the Repack version, but I Repack the RevitLookup.UI.Playground and in there works fine in playground version.

@Nice3point
Copy link
Collaborator Author

Is the problem only with repacking, or without it doesn't switch either?

@ricaun
Copy link
Contributor

ricaun commented Feb 11, 2025

Is the problem only with repacking, or without it doesn't switch either?

I rebuild without the repack loaded inside Revit and works, sorry about that.
Probably is something missing in the LibraryNamespace, kinda forgot the ; but that does not fix that.
Most probably the Theme is not been removed, everything now have the same namespace.

@Nice3point Nice3point moved this from 👀 In review to 📦 Pre-release in RevitLookup roadmap Feb 18, 2025
@TorsionTools
Copy link

Ran into this the other day where lookup appears to be using a little bit older version than the latest that was being used in a project. Only happened in R24, but seems to be similar to this issue. If I shifted the load order, then the error message was thrown by the other add-in and not Lookup.

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************

System.MissingMethodException: Method not found: 'Void Nice3point.Revit.Extensions.RibbonExtensions.SetImage(Autodesk.Revit.UI.RibbonButton, System.String)'.
   at RevitLookup.RibbonController.SetDefaultImage(RibbonButton button)
   at RevitLookup.RibbonController.CreatePanel(UIControlledApplication application, ISettingsService settingsService)
   at RevitLookup.Application.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

@Nice3point
Copy link
Collaborator Author

@ricaun
Copy link
Contributor

ricaun commented Feb 22, 2025

@Nice3point
Copy link
Collaborator Author

@ricaun yes, ILRepack enabled for RevitLookup 2025 and older https://github.com/jeremytammik/RevitLookup/blob/dev/Directory.Packages.props#L52

@ricaun
Copy link
Contributor

ricaun commented Feb 22, 2025

@ricaun yes, ILRepack enabled for RevitLookup 2025 and older https://github.com/jeremytammik/RevitLookup/blob/dev/Directory.Packages.props#L52

Nice.

This probably is irrelevant after the repack.

<!-- Revit 2025 fixed references -->
    <ItemGroup Condition="$(DefineConstants.Contains('NET8_0'))">
        <PackageVersion Update="Microsoft.Extensions.Hosting" Version="[8.0.1]"/>
        <PackageVersion Update="Serilog.Extensions.Hosting" Version="[8.0.0]"/>
        <PackageVersion Update="Microsoft.Extensions.Logging" Version="[8.0.1]"/>
    </ItemGroup>

Could be possible to release a .bundle.zip without any installation with the releases in the GitHub?

@Nice3point
Copy link
Collaborator Author

Nice3point commented Feb 22, 2025

Why do you need a bundle, what is the purpose? A new issue with the proposal is also welcome @ricaun

This probably is irrelevant after the repack.

Maybe) I'll check

@ricaun
Copy link
Contributor

ricaun commented Feb 22, 2025

To install all Revit versions at the same time, is more convenient to install/update a simple folder.
Yep, an issue/proposal makes sense.

@Nice3point
Copy link
Collaborator Author

I was thinking about WinGet, to install all versions from console

@russgreen
Copy link

2026.0.0-preview.2.250222 seems to be playing nicely with Revit 2025 and older versions of Revit when multiple plugins are installed (when previously I'd have some issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open discussion ☎️ An issue open for active community discussion
Projects
Status: 📦 Pre-release
Development

No branches or pull requests

6 participants