Did you change the ArcMap.exe.config to allow you to debug against .NET 4? The default behavior prior to 10.4 is for it to only allow debugging against 3.5. The url below explains how to do this. It says 10.2 in the title, but it should be true for 10.0 to 10.3.1.
.NET 4.0 and 4.5 support for ArcGIS 10.2 Desktop and Engine developers
Hi freddie,
Thanks for the reply.
I am using Nunit version 2.6.4 to debug the code.
Its working fine with .net framework 3.5 but as i upgrade the version to 4.0 after that breakpoint not get hit due to that debugging is no more possible.
Did you update your arcmap.exe.config file? Or could you upload it here?
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
The GUI only runs under .NET 2.0 or higher. The
useLegacyV2RuntimeActivationPolicy setting only
applies under .NET 4.0 and permits use of mixed
mode assemblies, which would otherwise not load
correctly.
-->
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- Comment out the next line to force use of .NET 4.0 -->
</startup>
<runtime>
<!-- Ensure that test exceptions don't crash NUnit -->
<legacyUnhandledExceptionPolicy enabled="1"/>
<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
<loadFromRemoteSources enabled="true"/>
<!-- Look for addins in the addins directory for now -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;addins"/>
</assemblyBinding>
</runtime>
</configuration>
What version of ArcGIS Desktop are you using? What application are you needing to debug in? (e.g. ArcMap, ArcCatalog, ArcScene, ArcGlobe) What version of VS are you using?
The exe.config file should start like on of the following:
Version 10.0 - 10.3 should start as follows
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0.30319"/>
<!--<supportedRuntime version="v2.0.50727"/>-->
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ESRI.ArcGIS.ADF.Local" culture="" publicKeyToken="8fc3cc631e44ad86"/>
<bindingRedirect oldVersion="9.3.0.0-10.2.0.0" newVersion="10.3.0.0"/>
</dependentAssembly>
</assemblyBinding>
Version 10.4 and higher (Note 10.4 uses .NET 4 as the Minimum Version) should start as follows
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ESRI.ArcGIS.ADF.Local" culture="" publicKeyToken="8fc3cc631e44ad86"/>
<bindingRedirect oldVersion="9.3.0.0-10.3.0.0" newVersion="10.4.0.0"/>
</dependentAssembly>
</assemblyBinding>
Thanks for the reply.
I added this code of line in nunit.exe.config file and now the breakpoint started hitting.
<supportedRuntime version="v4.0"/>
so the issue get resolved.