Revit crashes when I bind a list of sheets to a form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create a fairly simple batch printing tool and keep running into a really frustrating problem.
The tool displays a form with the list of sheets in the active model, the user selects the sheets they want to print and then click a button to run the batch process. What normally happens is the sheets are printed OK but then at the end of the process Revit will crash with a "An unrecoverable error has occurred..." message box.
If I don't show the form and simply just print all the sheets in the model non-interactively then it works fine.
Initially I tried a WPF form with a list of ViewSheet objects bound to a ListView, then I tried an ObservableCollection instead of a list and even tried populating the ListView without any binding. The result was the same.
I also tried a WinForms form as well and the crash still happens.