BUG

ArcGIS Pro SDK: When using an out-of-the-box ArcGIS Pro Managed Configuration project, the debugger does not launch, and a “System.IO.FileNotFoundException” is thrown

Last Published: April 25, 2020

Description

There are two problems generated by this bug. When trying to create a new project in Visual Studio using the ArcGIS Pro 2.0 SDK Managed Configuration project template:

  • the debugger does not launch, and
  • an exception is thrown when the configuration launches
Steps to reproduce the issue
  1. Add a new project in Visual Studio. Select the ArcGIS Pro 2.0 SDK Managed Configuration project template.
  2. Give the new configuration project a name that has a hyphen, for example: my-custom-configuration.proConfigX
  3. Click Start in Visual Studio to launch the debugger.
The new custom configuration does not launch, and ArcGIS Pro launches in default mode.
Once the launch issue has been fixed, the configuration launches, but the “System.IO.FileNotFoundException” from the bad pack Uri is thrown.

Cause

The Visual Studio debugger launches the configuration with the wrong command line. For example, if the new configuration was named “my-custom-configuration.proConfigX”, the command line generated for Visual Studio is “/config:my_custom_configuration”.  This is the wrong name. The hyphens have been changed to underscores by the template.
User-added image

The Icon property generated by the template likewise has underscores in the pack Uri for the assembly name. This is wrong, the underscores should be hyphens.

/// <summary>
/// Replaces the ArcGIS Pro Main window icon.
/// </summary>
protected override ImageSource Icon
{
   get
   {
       return new BitmapImage(new Uri(@"pack://application:,,,/my_custom_configuration;component/Images/favicon.ico"));
   }
 }

Workaround

To fix this, follow the steps listed below:

Modify the Command line argument used by Visual Studio’s debugger

  1. In Visual Studio’s solution explorer, right-click the Configurations project node to access the context menu.
  2. Click Properties to open the property settings dialog for the custom configuration.
  3. Click the Debug tab. 
  4. Change the underscores in the Command line arguments edit box to hyphens.
User-added image

Modify the configuration assembly name specified in the Icon override of the ConfigurationManager class

  1. In Visual Studio’s solution explorer, open the ConfigurationManager1.cs file. 
  2. Scroll to the Icon property override of the ConfigurationManager1 class. 
  3. In the pack Uri string for the icon to be used in the Configuration, change the assembly name to use the hyphens instead of underscores.
/// <summary>
/// Replaces the ArcGIS Pro Main window icon.
/// </summary>
protected override ImageSource Icon
   {
       get
       {
          return new BitmapImage(new Uri(@"pack://application:,,,/my-custom-configuration;component/Images/favicon.ico"));
       }
   }
  1. Rebuild the Configurations project in Visual Studio and click Start to launch the debugger.  ArcGIS Pro now launches using the custom configuration.

Article ID:000016289

Software:
  • ArcGIS Pro
  • ArcGIS Pro SDK for Microsoft NET

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic