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: 

Debugging Revit 2014 API with Visual Studio 2013

13 REPLIES 13
Reply
Message 1 of 14
trevor.taylor
3967 Views, 13 Replies

Debugging Revit 2014 API with Visual Studio 2013

Hello all,

 

I've just installed Visual Studio 2013, but can't get it to debug revit addins properly. I'm running VS as admin, .NET 4.0. Projects debug fine in VS 2012, but in VS 2013 the project will start and revit will load, but all of my modeling commands are disabled. I can switch views, open projects, etc., but I can't, for example, create a wall or run an addin.

 

My addins run fineApp runs fine outside the debugger, but when debugging the Revit ribbon looks like this with most modeling commands disabled:

 

Ribbon.png

 

Can anyone tell me how to fix this?

 

Thanks!

Tags (1)
13 REPLIES 13
Message 2 of 14
bburling
in reply to: trevor.taylor

Did you find a solution to this? I am having the same problem.

 

 

Regards,
Brett
Message 3 of 14
jeremytammik
in reply to: bburling

Hey guys,

 

Have you tried switching to managed compatibility mode?

 

http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/switching-to-managed-compatibility-mode-i...

 

I have not tried myself, because I am still happily using Visual Studio 2010  🙂

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 14

"...because I am still happily using Visual Studio 2010."

 

Jeremy, we know you want some of that edit-and-continue stuff... 😉

 

Compatibility mode causes 2013 debugger to do its duty, but alas, no edit-and-continue.

 

Thanks for the tip!

Message 5 of 14
bburling
in reply to: jeremytammik

Thanks Jeremy! This did the trick:

 

solution.JPG

Regards,
Brett
Message 6 of 14
jeremytammik
in reply to: bburling

Hey Brett,

 

Wow! Congratulations! Well done!

 

Can someone please confirm that this works?

 

Thank you for sharing!

 

Kudos from me!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 14

Update. I find that the disabled ribbon problem when debugging with Visual Studio 2013 does not manifest if I compile my code, run revit 2014 and then attach to process. Using this technique, I can have Managed Compatibility mode toggled off.

 

I should have tested this earlier.

 

1) Compile code

2) Configure your .addin file to load your debug DLL

3) Run Revit (confirm that your addin is loaded)

4) In VS 2013, choose DEBUG --> Attach to process

5) Choose Revit.exe

Message 8 of 14

Brilliant! Thank you for sharing this important discovery! May I promote this to a post on The Building Coder, please? Thank you! Cheers, Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 14

Thanks! Of course, please post!

Message 10 of 14

Great, thank you!

 

One more question, or a few...

 

Why in heaven's name are you doing this?

 

🙂

 

I mean, what is the advantage?

 

Does edit and continue work with Revit add-ins?

 

What are the exact steps for making use of that with a Revit add-in?

 

Are there any other significant advantages?

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 11 of 14

"Why in heaven's name are you doing this?"

 

Well, by the time it occured to me it occured to me that edit-and-continue couldn't work with a DLL I had already installed VS 2013 and didn't want the additional overhead of also installing VS 2012. Therefore, on I pressed. I discovered the 'attach-to-process' trick when trying to get the beta Revit to debug on a remote computer (since it would crash when I attempted to start it directly.) Attach to Process worked, so I tried it on my Visual Studio 2013 computer with locally installed Revit. Lo and behold, it worked and the ribbon behaved.

 

"I mean, what is the advantage? " None, since it doesn't work! However, if you could use edit and continue it would be like the VBA / LISP days when you could write a problem as you debugged it when we used often to write throw-away code to fix problem in AutoCAD drawings. Code could be written and executed so quickly that it wasn't worth keeping the program since by the time it was needed again it was quicker to re-write it than to find it again. But I'm describing a problem somewhat unique to corporate developers where we often have to address a very specific, often unique occurence.

 

"Does edit and continue work with Revit add-ins?"

 

I wish it did. Maybe in heaven... 🙂

 

 

Message 12 of 14

Hi Trevor,

 

It is live on the blog now:

 

http://thebuildingcoder.typepad.com/blog/2013/11/debugging-revit-2014-api-with-visual-studio-2013.ht...

 

Thank you!

Cheers,

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 13 of 14
jeremytammik
in reply to: jeremytammik

Hi again,

 

Here is an update on this; edit and continue of a Revit 2014 add-in with Visual Studio 2013 may work partially after all, at least in non-graphical views:

 

http://thebuildingcoder.typepad.com/blog/2013/12/visual-studio-2013-may-partially-support-edit-and-c...

 

Could you check it out, please, and let us know how it goes?

 

Mille grazie!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 14 of 14
jason.teagle
in reply to: jeremytammik

Jeremy, I can confirm that it fixes a lot more than just that. I'm now using Visual Studio Community Edition Update 4 as per your blog, and it also fixes the following issues: 

 

1) TaskDialog throwing an exception saying it had to be in the main thread. 

2) LoadFamily() not working - returning false (not throwing an exception). 

 

I am so glad I read this thread! 

 

A huge thanks to Brett for that setting. 

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community