
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In my plugin, I am extracting floorplan tag text. This is working fine, however I'm running into a crash on a particular file that we have. This happens on Revit 2015 and 2016 and possibly more (that's all I've tested).
When I try to access the TagText property of IndependentTag, I get a System.AccessViolationException with the following callstack:
at getParamValueFormatted(Element* , ParamDef* , AString* , FormatOptions* , FormatIntent* )
at Autodesk.Revit.DB.IndependentTag.get_TagText()
This is happening for a few Door Tags in the file. Notably, all these tags show up as a question mark (?) on the floorplan. I suspect these tags were somehow corrupted when the Revit file upgraded.
I don't need to recover the data in these tags. All I'm asking is a way to avoid the System.AccessViolationException, as this Exception can't be caught, so it ends up crashing Revit. I'd just delete the corrupted tags, but the idea is for this plugin to be generic, and I suspect that if I have a file with this issue, others will likely run into this too. They won't know it's due to a corrupted tag, so they'll just blame my plugin, and I can't even bring up a message after it happens, because the exception is unrecoverable.
I suspect there's some way around this, because Revit does not crash when interacting with these tags outside of the API. Is there any way to determine that an IndependentTag is unsafe, and thus avoid accessing the TagText property for that case?
Thanks for any help.
Solved! Go to Solution.