Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit crashes (wpf)

3 REPLIES 3
Reply
Message 1 of 4
vano96711
1999 Views, 3 Replies

Revit crashes (wpf)

Hello everyone. I have a problem when using WPF in revit api.
I use MVVM pattern. Revit crashes, when an unexpected exception occurs in ICommand. Try/catch in IExternalCommand doesn't help. Tried use AppDomain.CurrentDomain.UnhandledException and AppDomain.CurrentDomain.FirstChanceException. 


I also tried using WPF template without MVVM (https://thebuildingcoder.typepad.com/blog/2020/01/revit-wpf-add-ins-and-template.html). I put a "throw new Exception()" in the button click handler. Revit also shuts down.
How can I avoid this problem?


The user can work with large projects. I would hate to lose progress because of an unexpected error.

Tags (3)
3 REPLIES 3
Message 2 of 4
Sean_Page
in reply to: vano96711

Can you provide any portion of the code related to the error, the error message details, and a little more description of when / how the error occurs? I don't believe your current description "it isn't working" is really enough for anyone to be able to help you very well.

Message 3 of 4
3dimdev
in reply to: vano96711

Do you have instances of Revit elements in your ViewModels which have properties bound to your UI?  Revit can (will always?) CTD when a binding attempts to access a Revit element that is no longer valid.

3rd Dimension Developer
YouTube.com/@3DimDev
Message 4 of 4
Moustafa_K
in reply to: vano96711

I recall I have given an example of how these works see this post.

let us know what was the error you experienced so we can be able to assist

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community