Debugging ribbon code

Debugging ribbon code

james.levieux
Advocate Advocate
686 Views
6 Replies
Message 1 of 7

Debugging ribbon code

james.levieux
Advocate
Advocate

Hi All,

 

I've just updated my multi-targeted addin to version 2025 and it wasn't easy, but it's finally working now...except for the ribbon.  I can test all the commands using the Addin Manager but after all the troubleshooting, my ribbon still doesn't appear...with no errors so I have no idea what might be happening.  I want to run it through a debugger to find out if my ribbon code is even being hit.

 

My problem is, that it's been such a long time since I had problems with my ribbon that I can't even remember how I used to debug it!  I looked for instructions but the environment for a net8 program in VS2022 has changed so much that the instructions that I've found bear little resemblance to my current environment.

 

Any rudimentary outline of what needs to be done may jar my memory...

 

Regards,

James

0 Likes
687 Views
6 Replies
Replies (6)
Message 2 of 7

jeremy_tammik
Alumni
Alumni

Well, it all starts out in the external application OnStartup method... you should be able to step into the ribbon creation code from there...

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 7

nice3point
Advocate
Advocate

You can share the code so we can better understand your problem.

Take a look at the examples of basic add-ins here, maybe simple examples will make it clearer to you and you will find the error in your code faster

 

https://github.com/Nice3point/RevitTemplates/tree/main/samples

0 Likes
Message 4 of 7

james.levieux
Advocate
Advocate

I like your templates Nice3points!  Good stuff. 

 

No offence to you but I really want to be able to debug my code myself rather than rely on you guys for every typo!  I do a LOT of typoes.

0 Likes
Message 5 of 7

james.levieux
Advocate
Advocate

Hi Jeremy.

 

What I've seen in the past looks like this below: 

 

You can specify the path for the startup program that would be launched, then my addin's OnStartup code would be debugged as the program opened and initialized.  

 

jameslevieux_0-1725759773242.png

 

Now, when I convert to a .net8 project in VS 2022, I see this gobbledygook with no "start external program" available.

jameslevieux_1-1725760090344.png

 

 

 

0 Likes
Message 6 of 7

nice3point
Advocate
Advocate
0 Likes
Message 7 of 7

james.levieux
Advocate
Advocate

 

I found it!  This new(ish?) feature called "Launch Profiles" in VS is what is needed to do the job.  When you create a new profile you can choose between "Executable" and "Project".  You can give each profile a name, then these profiles become available using the drop-down on the green run button, so you can choose between a DLL launch or an EXE launch.  Yay!

 

So, the bad news is, when I try to debug my project, all the symbols load and Revit starts, and I can open a project file, but my ribbon is still not there and then worst thing...I'm not hitting any break points.  

 

Now, given all these new settings, I'd like some recommendations from Autodesk on all the appropriate debug settings in this new updated VS/.NET8  environment.  Does anything like that exist that is updated for 2025?

 

jameslevieux_0-1728087759069.png

 

jameslevieux_1-1728088084133.png

 

 

 

0 Likes