I cannot debug an addin for Inventor 2012 from Visual Studio 2010 professional on Win7 64.
I started with a new “Autodesk Inventor Addin” project
Set debug “Start external program” to inventor
Added a form and called it from StandardAddInServer.Activate sub
IF I debug from here inventor starts but form does not open. Addin not loaded.
Move *.addin file to Inventor addins
Now when running debug, form opens but breakpoints do not work. VS reports no errors on build.
So... Is there a tutorial or good instructions for this anywhere? I could not find anything specific to 2012 addins.
I can go back to registering the com...
Thanks
Stan
Hi Stan,
Would you try with below steps:
Configuration: Debug
Build output path: C:\Program Files\Autodesk\Inventor [version]\Bin
(this will avoid manually copying the binary to that folder).
6. Compile the addin(if you don't set the Build output path above, just manually copy the binary to the Inventor Bin folder).
7. Launch Inventor.
8. In VS, Tools->Attach to Process…->choose Inventor.exe->Attach.
Now you can add breakpoint in your addin project, and debug it. Hope it helps.
Please let me know if any questions.
I want to update the steps as below which maybe more convenient:
6. In VS, open the project Properties(Project->[project name] Properties), on Debug tab, set the Start external program: to the Inventor.exe path.
7. Set breakpoint in addin code and debug your project(Debug->Start debugging F5).
This will start the external program and attach to it so need not to attach the process manually after launching it.
First I reset all settings in VS2010
Added code consists of a message box at end of StandardAddInServer.Activate.
Code runs fine outside VS2010
When debugging from VS breakpoints in StandardAddInServer.Activate work on load.
After Inventor starts and I move the mouse I get “DisconnectedContext was detected”
“Context 0x302278' is disconnected. Releasing the interfaces from the current context (context 0x301f00).This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the applicationis completely done with the RuntimeCallableWrappers that represent COM components that liveinside them.”
Immediate window has lots of errors and warnings while loading like...
“System.Windows.Data Error: 39 : BindingExpression path error: 'Id' property not found on 'object' ''InvFlowRibbonPanel' (HashCode=24807479)'. BindingExpression:Path=Id; DataItem='InvFlowRibbonPanel' (HashCode=24807479); target element is 'KeyboardActivatableToggleButton' (Name='PART_CollapsedPanelButton'); target property is 'AutomationId' (type 'String')”
I was getting this problem before in IV2012 while trying to debug com registered dll. Any ideas?
Thanks
Stan
Same issues here. This wasn't a problem with Inventor 2011. Looks like this is something Autodesk overlooked. I can attach to the process manually but it's a bit of a pain. I'm getting a similar disconnected context error when having VS2010 start an external program (Inventor 2012).
Can you add a simple addin project that I can debug to see the problem you encountered. I guess you have added some content that I did not. And please add detailed steps if you think it is necessary for me to follow.
I made this simple addin with a ribbonbar and a button, when I debug and click on the ribbonbar/button I get the error: “DisconnectedContext was detected”
Please try the attached one. Modify the .addin file to update the Assembly path to the full file name of the .\Addin\BWEdocxInventor2012Vault\bin\Debug\BWEdocxInventor2012Vault.dll.
Sorry for the late reply, I've been on vacation.
I've tried the attached addin, and modified the addin file - I still get the error: “DisconnectedContext was detected”
Please provide a solution - this is very important to me.
Can you share more info that which step you encounterred this error. Did you debug into the breakpoint?
If i debug your code it goes into the breakpoint, but when i step to linie 66 i get the error below (I'm running a 64-bit windows XP and VS2010 SP1).
No Source Avaiable
Call stack location:
msvcm90.dll!<CrtImplementationDetails>DoDllLanguageSupportValidation() Line505
Source file information:
Locating source for 'f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h'. Checksum: MD5 {35 fe 78 dc 38 4e b df 99 82 ab 9 9a ba 9d 2f}
The file 'f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h' does not exist.
Looking in script documents for 'f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h'...
Looking in the projects for 'f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Source was found at 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\minternal.h'.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
Determining whether the checksum matches for the following locations:
1: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\minternal.h Checksum: MD5 {c9 db 5a 4a a1 c7 49 7b 27 a6 a7 b4 4b e7 a d} Checksum doesn't match.
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h.
The debugger could not locate the source file 'f:\dd\vctools\crt_bld\self_64_amd64\crt\src\minternal.h'.
When i insert addtional code eg. a simpel MsgBox and try to debug i still get the error: “DisconnectedContext was detected”
Public Sub m_featureCountButtonDef_OnExecute(ByVal Context As Inventor.NameValueMap) Handles m_featureCountButtonDef.OnExecute MsgBox("Hello", MsgBoxStyle.Information) End Sub
Been busy so just getting back to this...
64-bit win7 and VS2010
Tried out the posted addin sample. Can step through Activate and Inventor finishes loading. When I move the mouse over Inventor I get -
DisconnectedContext was detected
Message: Context 0x3ac0f8' is disconnected. Releasing the interfaces from the current context (context 0x3abd80).This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the applicationis completely done with the RuntimeCallableWrappers that represent COM components that liveinside them.
Stan
I have found a solution to the problem.
In VS2010 under Debug, Exceptions ...
remove checkmark from ContextSwitchDeadlock and DisconnectedContext.
This worked on the sample addin but...
When I tried debugging a very complex project "Visual Studio Remote Debugging Monitor" runs one CPU at 100% as soon I open a drawing. This project runs fine when not debugging.
Stan
HEllo Rocky
I Got everythig correct, but I can't find .addin file in my project folder...
can you please point out me in corrct way.. please
When you use InventorWizards to create your addin project, you can find the .addin file in the project folder. Can you share more info about your situation? Like which Inventor you use, and in which language you create your addin, and the VS version.
Hello Rocky,
Thanks Mate for replies.
I found a way tofix the above issue with your post and updated in this thread.
i Got 2 Main questions in my head
1. But I see there are two types of templates to use for VS2010. one is Autodesk Inventor AddIn (old Template) and Autodesk Inventor 2013 AddIn (updated).
I am Using Autodesk FDS 2013 Premium and VS2010 Express with SP1 and with Windows SDK for .Net 4.
There are .maifest errors when I use updated templates and no errors with old templates.
Why is That?????????
2. when I am debugging a simple module, VS2010 is opening Inventor and after i opening an assembly it is doing nothing. Is there something that I am missing??? (fixed debug procedire foro express versions)
3. How to get addin Button on to Auodesk Invedntor User interface??? so to use directly from Inventor
Thanks in Advace ffor your unlimited patience.
will wait on repply.
cheers.
My answer are as below:
1. From Inventor 2013 we merged the InventorWizards installer to DeveloperTool.msi, and make sure we can install the DeveloperTools side by side with previous ones, so you can see the different versions of Inventor wizards templates, and the updated wizards template will have the latest Autodesk.Inventor.Interop.dll referenced if the VS supports(like VS2010 supports Inventor 2003).
As for the error, can you copy the error info here?
2. If I understand right, you mean you used the VS2010 to launch Inventor during debuged it, and then it did run into the code when you open an assembly document? Can you double check that you have the .addin file copied to proper folder, and set the Dll path in the .addin correctly? You can get help from the Readme.txt file in the addin project to know where to copy the .addin.
3. You can create your own controls on Ribbon in the addin project, you can find sample in SDK (like SimpleAddin : C:\Users\Public\Documents\Autodesk\Inventor 2013\SDK\DeveloperTools\Samples\VB.NET\AddIns\SimpleAddIn) with the source code.
Can't find what you're looking for? Ask the community or share your knowledge.