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
2072 Views, 3 Replies

Revit crashes (wpf)

vano96711
Explorer
Explorer

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.

0 Likes

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

Sean_Page
Collaborator
Collaborator

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.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes

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.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 3 of 4
3dimdev
in reply to: vano96711

3dimdev
Enthusiast
Enthusiast

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
0 Likes

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

Moustafa_K
Collaborator
Collaborator

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

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  

Autodesk Design & Make Report