- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an application that needs to pull the list of types from within a family. It does this with this simple method:
public void PopulateTypes(FamilyData family)
{
var doc = _revitApp.OpenDocumentFile(family.FilePath);
if (!doc.IsFamilyDocument)
throw new InvalidOperationException("Only families can be processed");
foreach (var type in doc.FamilyManager.Types.Cast<FamilyType>())
{
family.Types.Add(new TypeData(type.Name));
}
doc.Close(false);
}
Basically it just opens the family, reads the types into my data objects, and then closes it. This happens from a view model of a dialog I'm running. The dialog is in 'ShowDialog()' mode in the middle of my command so it isn't returning anything to Revit and should still be in a valid API context. This dialog has 'pages' that it goes through and after this happens it should go to the next page.
The problem is that when I tell it to go to the next page it acts like it is but never updates the UI. It's even more strange because I can click on the dialog close button and it actually closes but everything else is frozen.
I've tried with nothing in this method (which obviously doesn't populate the types then) and it works and turns the page properly. I also tried it with just opening and closing the family (not pulling any types) with just one family and it still freezes.
This seems to be only when debugging, when I run it normally it seems to work. I guess that's ok, but it makes it hard to debug those routines...
Anyone have any idea why this would freeze up the UI thread (at least that's what I'm guessing is happening) but only with debugger attached?
Solved! Go to Solution.