Exception Handling in Revit Api.

Exception Handling in Revit Api.

sowmiyhan
Contributor Contributor
146 Views
1 Reply
Message 1 of 2

Exception Handling in Revit Api.

sowmiyhan
Contributor
Contributor

I am trying to handle an exception in a Revit 2025 add-in, but none of the standard managed exception classes are catching it, causing Revit to crash during an AddCoedge() attempted read/write operation. In Revit 2024, I was able to successfully handle this using the base Exception or InternalException classes. However, due to Revit 2025's migration to .NET Core (.NET 8), these exceptions are bypassed. Are there any recommendations or workarounds for catching or preventing this exception?
2025

sowmiyhan_0-1788160362656.png

2024

sowmiyhan_1-1788160817304.png

147 Views
1 Reply
Reply (1)
Message 2 of 2

AEC_Revit_Lab
Explorer
Explorer

That message indicates a native access violation, not a Revit API exception, so .NET 8 try/catch cannot safely recover. Before AddCoEdge(), validate IDs, loop order, opposite reversal flags, and the two-co-edge-per-edge limit. If valid input still reproduces it, submit minimal code and journal to Autodesk. Hope this helps. If it solves the issue, you’re welcome to mark it as a solution so others can find it more easily.

0 Likes