Message 1 of 5
Revit Crash when closing after using WPF application - my fix

Not applicable
02-12-2021
01:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear forum users,
I spent too much time finding a solution not to share it with you.
My problem:
Revit crash after closing the active document. This happened only after I opened and closed my WPF application.
Otherwise, the application works perfectly.
Cause:
I used WPF commands binded to buttons, with the CanExecute checking if the Revit selection was empty or not.
Don't do that in your commands:
public bool CanExecute(object parameter)
{
//if (_vm.Uidoc.Selection.GetElementIds().Count == 0)
//{
// return false;
//}
return true;
}
I thought it was pretty cool.And it worked, but made Revit crash when the document was closed.
Anyone have a solution to get the same result without crashing Revit?
Anyway, I hope I can help someone find that solution faster than I could.
Best Regards,
François Robberts