Hi,
I've used to coding in Python in Dynamo, but for various reasons am now trying out C# and coding in Visual Studio.
I can compile DLLs OK, which run in Revit, but when I hit debug Revit pops up and immediatly exits with the following message in VS:
The program '[22680] Revit.exe' has exited with code 0 (0x0).
So I cant debug or watch the code execute at all.
Is there some setting I'm missing?
I'm using Visual Studio and the Add-In wizard for Revit 2015.
Thanks.
Solved! Go to Solution.
Hi,
I've used to coding in Python in Dynamo, but for various reasons am now trying out C# and coding in Visual Studio.
I can compile DLLs OK, which run in Revit, but when I hit debug Revit pops up and immediatly exits with the following message in VS:
The program '[22680] Revit.exe' has exited with code 0 (0x0).
So I cant debug or watch the code execute at all.
Is there some setting I'm missing?
I'm using Visual Studio and the Add-In wizard for Revit 2015.
Thanks.
Solved! Go to Solution.
Solved by Mustafa.Salaheldin. Go to Solution.
I assume you can run your code from VS, and you have it set up to start revit, and all that works.
I don't think debug works, probably because revit has to start before the code can run. I think you have to set a breakpoint, then run the code, and use the step commands after the breakpoint is reached.
it also seems like there was some compatibility setting that was added to VS around 2015 that has to be set right,, but I can't remember if that made the debug menu work or not.
I assume you can run your code from VS, and you have it set up to start revit, and all that works.
I don't think debug works, probably because revit has to start before the code can run. I think you have to set a breakpoint, then run the code, and use the step commands after the breakpoint is reached.
it also seems like there was some compatibility setting that was added to VS around 2015 that has to be set right,, but I can't remember if that made the debug menu work or not.
My best advice is to learn the differences between getting a program to run with VS, and the sharp develop.
do all your troubleshooting in sharp develop ( no starting and constantly restarting revit), and then paste your code to VS.
oddly enough, the debug menu doesn't work in sharp either. Again, you have to set break points, and run the code from the revit macros dialog box.
My best advice is to learn the differences between getting a program to run with VS, and the sharp develop.
do all your troubleshooting in sharp develop ( no starting and constantly restarting revit), and then paste your code to VS.
oddly enough, the debug menu doesn't work in sharp either. Again, you have to set break points, and run the code from the revit macros dialog box.
In Visual Studio enable the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging
Please don't forget to mark this reply as an answer if it satisfies your needs.
In Visual Studio enable the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging
Please don't forget to mark this reply as an answer if it satisfies your needs.
OK, I found the answer to this, I have to build my solution then start Revit, once Revit is running I click Debug > Attach to process.
This then allows me to set break points and debug my code.
I'm unsure why I have to use Attached to process though, I thought it would be automatic...
OK, I found the answer to this, I have to build my solution then start Revit, once Revit is running I click Debug > Attach to process.
This then allows me to set break points and debug my code.
I'm unsure why I have to use Attached to process though, I thought it would be automatic...
No If you follow my solution you don't have to attach process.
From the project properties just browse to the Revit.exe path and it will start Revit, run the addin and allow you to debug.
No If you follow my solution you don't have to attach process.
From the project properties just browse to the Revit.exe path and it will start Revit, run the addin and allow you to debug.
Mustafa - Thanks that worked!
Mustafa - Thanks that worked!
Mustafa,
Your post worked for me as well. Thanks so much. I upgraded to Visual Studio 2017, and everything I did failed until I read your post. The Revit process started, but it kept killing right away. "Use Managed..." fixed it.
Mustafa,
Your post worked for me as well. Thanks so much. I upgraded to Visual Studio 2017, and everything I did failed until I read your post. The Revit process started, but it kept killing right away. "Use Managed..." fixed it.
This solved it for me, thanks!
This solved it for me, thanks!
i had same problem and it works now... thanks you
so much!!!!!!!!!!!!!!!
i had same problem and it works now... thanks you
so much!!!!!!!!!!!!!!!
Hi Mustafa,
I followed your instructions enabling the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging. But the yellow debugging arrow still not popping up. It gives the warning at the breakpoint that "The breakpoint will not currently be hit. No symbols have been loaded for this document". I was following step by step in this course https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/simplecontent/content/lesso.... When I am trying to debug and setting up the breakpoint and then began debugging, the yellow debugging arrow is not showing up. Can you please suggest? Much appreciated.
Liang
Hi Mustafa,
I followed your instructions enabling the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging. But the yellow debugging arrow still not popping up. It gives the warning at the breakpoint that "The breakpoint will not currently be hit. No symbols have been loaded for this document". I was following step by step in this course https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/simplecontent/content/lesso.... When I am trying to debug and setting up the breakpoint and then began debugging, the yellow debugging arrow is not showing up. Can you please suggest? Much appreciated.
Liang
This is easy, just make sure in the manifest file (.addin file) that you have done 2 things:
1 - you are using the correct full class name (which is the namespace.classname)
2 - you are putting the file path of your complied assembly (something like "path/to/my/visual studio project/bin/debug/myaddin.dll)
I hope that solve the problem and is so please don't forget to mark this reply as an answer.
This is easy, just make sure in the manifest file (.addin file) that you have done 2 things:
1 - you are using the correct full class name (which is the namespace.classname)
2 - you are putting the file path of your complied assembly (something like "path/to/my/visual studio project/bin/debug/myaddin.dll)
I hope that solve the problem and is so please don't forget to mark this reply as an answer.
Hi Mustafa,
Thanks for the reply. I checked the .addin file and did not find problems. Please see the screenshot below. The yellow debugging arrow is still not showing up. I think it is more about how to set up configurations to attach visual studio debugging session to the Revit session. We can have a goto meeting if you like. Can you please suggest? Appreciate it.
Hi Mustafa,
Thanks for the reply. I checked the .addin file and did not find problems. Please see the screenshot below. The yellow debugging arrow is still not showing up. I think it is more about how to set up configurations to attach visual studio debugging session to the Revit session. We can have a goto meeting if you like. Can you please suggest? Appreciate it.
Ok, so one last thing, have you selected debug Managed Code from the debugging settings?
The picture is shown a little bit in the bottom of this topic.(maybe in the second page now)
In Visual Studio enable the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging
Ok, so one last thing, have you selected debug Managed Code from the debugging settings?
The picture is shown a little bit in the bottom of this topic.(maybe in the second page now)
In Visual Studio enable the "Used Managed Compatibility Mode" option from Tools menu -> Options -> Debugging
Hi Mustafa,
Yes I did as shown in the screenshot below. Let me know when we can have a quick goto to look at this. And then I will post what we find here afterwards.
Hi Mustafa,
Yes I did as shown in the screenshot below. Let me know when we can have a quick goto to look at this. And then I will post what we find here afterwards.
Mustafa is so helpful during the goto meeting and found the issue in the manifest file. On Line 19 below, we changed 34 to any random 2 digits (0-9, a-f). The original AddInId was conflicting with an existing .addin file. After changing 34 to 66, the debugging yellow arrow pops up.
Mustafa is a magician! Cheers!
Mustafa is so helpful during the goto meeting and found the issue in the manifest file. On Line 19 below, we changed 34 to any random 2 digits (0-9, a-f). The original AddInId was conflicting with an existing .addin file. After changing 34 to 66, the debugging yellow arrow pops up.
Mustafa is a magician! Cheers!
Hi Mustaffa, I set all of these settings. But the external Addin would not appear to show my addon button after Revit lunched. any thought?
Hi Mustaffa, I set all of these settings. But the external Addin would not appear to show my addon button after Revit lunched. any thought?
the .addin file is generated at my project folder such as (D:\VR\Revit_Addon_Sample\mySample\RevitAddin_Unity1\RevitAddin_Unity1\RevitAddin_Unity1.addin)
the .addin file is generated at my project folder such as (D:\VR\Revit_Addon_Sample\mySample\RevitAddin_Unity1\RevitAddin_Unity1\RevitAddin_Unity1.addin)
That is why. Your .addin file must exist in one of the following paths:
And don't forget to adjust the path inside the .addin file to properly point to the .dll file from those locations.
That is why. Your .addin file must exist in one of the following paths:
And don't forget to adjust the path inside the .addin file to properly point to the .dll file from those locations.
Can't find what you're looking for? Ask the community or share your knowledge.