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 "$(TargetPath)" /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.
Hi Carsten,
as far as I understand, PDBs are side-loaded using the codebase of the assembly in question. If you do an EsriRegasm, the assembly, even if you put it into the GAC as well, is registered with the codebase that points to the directory where the assembly was located at that time. Have a look in to the registry HKCR\CLSID\{D8F25094-0F43-4aea-83C6-8DE4187101C9}
to find out where.
Please make sure as well that the correct 32bit EsriRegasm from %ProgramFiles(x86)%\ArcGIS\bin is used. %ProgramFiles%\ArcGIS\bin contains a EsriRegasm.exe for 64bit (in case ArcGIS Server has been installed)
Last option is to use a DEVPATH: How to: Locate Assemblies by Using DEVPATH | Microsoft Docs - That makes sense on a developer machine, where you need full control about how assemblies get loaded without the need to put assemblies into the GAC
HTH + Greetings
Karl
Hi Karl,
on your last paragraph did you intended to set the assemblies locxation within the ArcMap.exe.config?
Checked esriregasm´s version also, it´s 32bit one located at "C:\Program Files (x86)\Common Files\ArcGIS\bin"
The registry-key you´ve mentioned contains entry codebase showing to the exact same path as my target-path I´m compiling into. What makes me wonder is that I have five different InProcServer32-folders under that key. They obviously serve different versions of my assembly - Version 24, 25, 30, 32, 35 and 36. I recently checked out our latest build for version 35 and compiled it. Anyway all the values for codebase show to the exact same path as my target-path in Visual Studio.
What is your ArcMap/ArcObjects version?
I´m working on ArcGIS 10.2.2.3552