Repository navigation
External Events
Register the assemblies of your add-in
An external event created on a background thread or in a modeless window runs as the add-in that registered the assembly of the event.
Inside the handler, UIApplication.ActiveAddInId returns the add-in ID, and Extensible Storage grants access to the schemas of the add-in vendor.
ExternalApplication and ExternalCommand register their assembly and every project it references automatically.
The new RegisterAddInAssembly() method registers any other assembly: the assembly of an IExternalApplication without the Toolkit base class, a library from a NuGet package, or an assembly loaded at run time.
Call it in OnStartup:
public Result OnStartup(UIControlledApplication application)
{
application.RegisterAddInAssembly(typeof(Application).Assembly);
return Result.Succeeded;
}Fixes
- An external event created outside the Revit API context runs its handler as its add-in. Previously, Revit bound such an event to no add-in:
ActiveAddInIdreturned no add-in ID inside the handler, and Extensible Storage denied access to the schemas with the vendor access level.
Context
No more frozen Revit interface after loading older families
It's a long-standing Revit issue known from the forums: an add-in loads a family saved in an earlier Revit version, and the Revit interface stops updating.
The ribbon, the dockable panes, and the add-in windows still react to clicks, but nothing redraws until you resize a window.
The cause is the modal loop of the Model Upgrade progress dialog: it swallows the message WPF waits for before it draws the next frame.
The new RevitContext.BeginModalLoopCompatibilityScope() fixes it.
Wrap the calls that load or open older files, and the interface redraws as soon as the scope ends:
using (RevitContext.BeginModalLoopCompatibilityScope())
{
document.LoadFamily(fileName, out var family);
}The scope covers Document.LoadFamily, Application.NewFamilyDocument, and Application.OpenDocumentFile, and costs a single window message when it ends.
Full changelog: 2027.0.3...2027.0.4