I created an ITool (not an AddIn) which I embed within a toolbar (MyToolbar). The code for the entire toolbar is located within one single assembly, let´s call it MyAssembly. It´s written in C#, which compiles for .NET 3.5, x86 in debug-mode. All PDB-files are appropriately copied to my assemblies bin-folder.
Here is some short code for the toolbar:
Snippet
<SPAN class="keyword token">namespace</SPAN> MyNamespace<SPAN class="punctuation token">.</SPAN>Toolbars
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Runtime<SPAN class="punctuation token">.</SPAN>InteropServices<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> System<SPAN class="punctuation token">.</SPAN>Collections<SPAN class="punctuation token">.</SPAN>Generic<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> ESRI<SPAN class="punctuation token">.</SPAN>ArcGIS<SPAN class="punctuation token">.</SPAN>SystemUI<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">using</SPAN> ESRI<SPAN class="punctuation token">.</SPAN>ArcGIS<SPAN class="punctuation token">.</SPAN>ADF<SPAN class="punctuation token">.</SPAN>CATIDs<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">[</SPAN>System<SPAN class="punctuation token">.</SPAN>Runtime<SPAN class="punctuation token">.</SPAN>InteropServices<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ComVisibleAttribute</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="token preprocessor">#region </SPAN><SPAN class="string token">"COM GUIDs"</SPAN>
<SPAN class="punctuation token">[</SPAN><SPAN class="token function">ClassInterface</SPAN><SPAN class="punctuation token">(</SPAN>System<SPAN class="punctuation token">.</SPAN>Runtime<SPAN class="punctuation token">.</SPAN>InteropServices<SPAN class="punctuation token">.</SPAN>ClassInterfaceType<SPAN class="punctuation token">.</SPAN>None<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="punctuation token">[</SPAN><SPAN class="token function">Guid</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"D8F25094-0F43-4aea-83C6-8DE4187101C9"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="token preprocessor">#endregion</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">sealed</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">MyToolbar</SPAN> <SPAN class="punctuation token">:</SPAN> IToolBarDef
<SPAN class="punctuation token">{</SPAN>
<SPAN class="token preprocessor">#region Component Category Registration</SPAN>
<SPAN class="punctuation token">[</SPAN><SPAN class="token function">ComRegisterFunction</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">static</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">Reg</SPAN><SPAN class="punctuation token">(</SPAN>String regKey<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
MxCommandBars<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Register</SPAN><SPAN class="punctuation token">(</SPAN>regKey<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">[</SPAN><SPAN class="token function">ComUnregisterFunction</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">static</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">Unreg</SPAN><SPAN class="punctuation token">(</SPAN>String regKey<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
MxCommandBars<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Unregister</SPAN><SPAN class="punctuation token">(</SPAN>regKey<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="token preprocessor">#endregion</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="comment token">// ...</SPAN>
<SPAN class="comment token">// implementation for IToolbar</SPAN>
<SPAN class="comment token">// ...</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Now I start ArcMap and try to attch that code to it. When I set any breakpoint, it´ll not hit, because
"no symbols have been loaded for this document".
I allready uninstalled my assembly from GAC and used esriregasm to unregister any potential previous version of the file. To do so I used this:
esriregasm.exe /p:desktop /u /s MyAssembly.dll<SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
To re-register I have some post-processing within my VS-project that calls esriregasm again
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>Target</SPAN> <SPAN class="attr-name token">Name</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>AfterBuild<SPAN class="punctuation token">"</SPAN></SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>Exec</SPAN> <SPAN class="attr-name token">WorkingDirectory</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>$(CommonProgramFiles)\ArcGIS\bin<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="attr-name token">Command</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>esriRegasm.exe "$(TargetPath)" /p:Desktop /s<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="punctuation token">/></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>Target</SPAN><SPAN class="punctuation token">></SPAN></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I also re-started VS and my computer as well, cleaned my solution and rebuilt it (which is the standard procedure for this problem when attaching any .NET-code to a program), however I still can´t break into the code.
Another possibly related issue to this is, that I can´t put my toolbar into ArcMap. As soon as I add the toolbar via RightClick --> MyToolbar, ArcMap crashes without any error-message, not even in its log-file.