Select to view content in your preferred language

After change extension from .Net 3.5 to .Net 4.0 Debugging is no more possible

4747
15
01-18-2011 05:12 AM
LionelMartz
Emerging Contributor
Hello everyone,

I have a strange problem trying to debug an extension.

We are developping an ArcGIS-Extension. It used to be a .Net 3.5 Project for ArcView 9.3.
Now, we want to update this extension to the .Net Framework 4.0 on ArcGIS 10.
First, we made it work for ArcGIS 10 without any problems following the guide vom ESRI.
We also can change the version of the framework in Visual Studio 2010 from 3.5 to .Net 4.0.

After this change, wie can still compile the extension and start ArcMap in the VS debuggin mode properly. First we thougth that it worked. But then we tryed to debug this version. By setting a breakpoint in VS, is says:
"The break point currently will not be hit, no symbols have been loaded to this document".

Then we saw, our extension wasn't even registered to the Global Assembly Cash, however,
I don't know how this is possible, because it seemed to be startet properly with ArcMap.

Does anybody have an idea?
0 Kudos
15 Replies
FreddieGibson
Honored Contributor

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

0 Kudos
ManmeetKaur
Deactivated User

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.

0 Kudos
FreddieGibson
Honored Contributor

Did you update your arcmap.exe.config file? Or could you upload it here?

0 Kudos
ManmeetKaur
Deactivated User

<?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>

0 Kudos
FreddieGibson
Honored Contributor

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>‍‍‍‍‍‍‍‍‍‍‍‍
ManmeetKaur
Deactivated User

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.

0 Kudos