Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When using a Filtered Element Collector to get elements from a linked model, everything works perfectly when the same code is executed through the Add-In Manager.
However, when I run it in debug mode (from Visual Studio) or after installing the add-in normally, Revit throws this error and crashes:
System.AccessViolationException: Attempted to read or write protected memory.
Here’s the core part of the code:
FilteredElementCollector fec = new FilteredElementCollector(
doc,
choosenView.Id,
revitLinkInstance.Id
);
List<Element> elmns = new List<Element>(
fec.WhereElementIsNotElementType().ToElement()
);
Solved! Go to Solution.