Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This code crashes Revit (2015, 2016 and 2017 on Windows 10):
[Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] class TestCommand : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiApplication = commandData.Application; Document document = uiApplication.ActiveUIDocument.Document; using (var collector = new FilteredElementCollector(document)) { collector.OfClass(typeof(ViewSchedule)); foreach (Element element in collector) { var viewSchedule = (ViewSchedule) element; TableData tableData = viewSchedule.GetTableData(); for (int sectionIdx = 0; sectionIdx < tableData.NumberOfSections; sectionIdx++) { TableSectionData sectionData = tableData.GetSectionData(sectionIdx); for (int rowIdx = sectionData.FirstRowNumber; rowIdx <= sectionData.LastRowNumber; rowIdx++) { for (int colIdx = sectionData.FirstColumnNumber; colIdx < sectionData.LastColumnNumber; colIdx++) { TableCellStyle cellStyle = sectionData.GetTableCellStyle(rowIdx, colIdx); // <- Boom!!! } } } } } return Result.Succeeded; } }
Steps to reproduce:
- Open a file (rac_advanced_sample_project.rvt for example);
- Launch the command ;
- Revit crashes with a 'System.AccessViolationException' in RevitDBAPI.dll.
Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Manager
Add-ins development for Autodesk software products
http://wiip.fr
Solved! Go to Solution.