Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm running into a similar issue same as this post.
Solved: Disable or enable updater - Autodesk Community - Revit Products
I keep getting the object reference isn't set to an instance when it clearly is unless I'm missing something that's going on internally. Below is the command that I'm using:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
try
{
//UpdaterRegistry.DisableUpdater(new assemblyLockUpdater.GetUpdaterId());
//UpdaterRegistry.UnregisterUpdater(new AssemblyLockUpdaterId(application.ActiveAddInId).GetUpdaterId());
//UpdaterRegistry.RemoveAllTriggers(assemblyLockUpdater.GetUpdaterId());
//UpdaterRegistry.EnableUpdater(assemblyLockUpdater.GetUpdaterId());
UpdaterRegistry.DisableUpdater(assemblyLockUpdater.GetUpdaterId());
return Result.Succeeded;
}
catch(Exception e)
{
MessageBox.Show(e.Message);
return Result.Failed;
}
}
This is how I have it registered in the application:
{
UtilsAssemblyLock.AssemblyLockUpdaterId assemblyLockUpdater =
new UtilsAssemblyLock.AssemblyLockUpdaterId(application
.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(assemblyLockUpdater, true);
UpdaterRegistry.AddTrigger(
assemblyLockUpdater.GetUpdaterId(),
new ElementClassFilter(typeof(FabricationPart)),
Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.FABRICATION_PART_WEIGHT)));
UtilsAssemblyLock.assemblyLockedFailureId =
new FailureDefinitionId(Guid.NewGuid());
FailureDefinition.CreateFailureDefinition(
UtilsAssemblyLock.assemblyLockedFailureId,
FailureSeverity.Error,
"S.A.I.: \n" + "Cannot edit assembly without permission.";
}
Solved! Go to Solution.