Skip to content

2025.0.1

Compare
Choose a tag to compare
@github-actions github-actions released this 22 Jun 13:37

Add-in dependency isolation

This release introduces an isolated plugin dependency container using .NET AssemblyLoadContext.
This feature allows plugins to run in a separate, isolated context, ensuring independent execution and preventing conflicts from incompatible library versions.
This enhancement is available for Revit 2025 and higher, addressing the limitations of Revit's traditional plugin loading mechanism, which loads plugins by path without native support for isolation.

изображение

How It Works:

The core functionality centers on AssemblyLoadContext, which creates an isolated container for each plugin.
When a plugin is loaded, it is assigned a unique AssemblyLoadContext instance, encapsulating the plugin and its dependencies to prevent interference with other plugins or the main application.

To use this isolation feature, developers must inherit their classes from:

  • ExternalCommand
  • ExternalApplication
  • ExternalDbApplication
  • ExternalCommandAvailability

These classes contain the built-in isolation mechanism under the hood.
Plugins using interfaces such as IExternalCommand will not benefit from this isolation and will run in the default context.

Limitations:

  • The isolated plugin context feature is available starting with Revit 2025.
  • For older Revit versions, this library uses a ResolveHelper to help load dependencies from the plugin's folder, but does not protect against conflicts arising from incompatible packages.
  • Additionally, plugins that do not inherit from the specified classes will not be isolated and may experience compatibility issues if they rely on the default context.

Improvements

  • Added ExternalCommandAvailability class.

    Starting with Revit 2025, ExternalCommandAvailability uses AssemblyLoadContext to isolate dependencies.
    If your implementation does not include dependencies, use the IExternalCommandAvailability interface to reduce memory allocation

  • Added AvailableCommandController class.

    IExternalCommandAvailability implementation.
    Controller providing permanent accessibility for External Command invocation. This means that it will always be available for execution, even when no Document is open. Usage:

    panel.AddPushButton<StartupCommand>("Execute")
        .SetAvailabilityController<AvailableCommandController>()

Full changelog: 2025.0.0...2025.0.1