AnsweredAssumed Answered

Can´t attach VS2010 to ArcMap

Question asked by HimBromBeere on Nov 28, 2017
Latest reply on Dec 5, 2017 by HimBromBeere

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

namespace MyNamespace.Toolbars
{
     using System;
     using System.Runtime.InteropServices;
     using System.Collections.Generic;

     using ESRI.ArcGIS.SystemUI;
     using ESRI.ArcGIS.ADF.CATIDs;

     [System.Runtime.InteropServices.ComVisibleAttribute(true)]

     #region "COM GUIDs"
     [ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
     [Guid("D8F25094-0F43-4aea-83C6-8DE4187101C9")]
     #endregion

     public sealed class MyToolbar : IToolBarDef
     {
          #region Component Category Registration
          [ComRegisterFunction()]
          static void Reg(String regKey)
          {
               MxCommandBars.Register(regKey);
          }

          [ComUnregisterFunction()]
          static void Unreg(String regKey)
          {
               MxCommandBars.Unregister(regKey);
          }
          #endregion
     }

     // ...
     // implementation for IToolbar
     // ...
}

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

To re-register I have some post-processing within my VS-project that calls esriregasm again

 

<Target Name="AfterBuild">
<Exec WorkingDirectory="$(CommonProgramFiles)\ArcGIS\bin" Command="esriRegasm.exe &quot;$(TargetPath)&quot; /p:Desktop /s" />
</Target>

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.

Outcomes