AnsweredAssumed Answered

How to debug  ArcGIS Pro (2.2.0) script tool using Visual Studio 2017?

Question asked by simo on Jun 28, 2018
Latest reply on Feb 25, 2019 by simo

It is a reality that developers can use Visual Studio 2017 to interactively debug the script tools in ArcGIS Pro V2.2.0.  This is clearly read and shown in the help document and the following video:


Debug Python code—ArcPy Get Started | ArcGIS Desktop 

ArcGIS Pro and Python - YouTube 


I spent many hours trying to make the Visual Studio 2017 debugger (Community Version) working with ArcGIS Pro without much success. 


After I attached the debugger to the ArcGIS Pro process, I run the tool, then I 'll see the following error:


Source Not Available and Frame not in module:



If I Enable address-level debugging--> Show disassembly if source is not available in the Debug-->Options

I'll the following error. To be honest, I don't think this setting make any sense for Python any way.


No disassembly available. (not surprised)




The way I set up the test:


1.Create a new python project in VS 2017.

2.Set the Python Environment to ArcGIS Pro env: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3

3.Put something testing code in the .py file in the project:

  1. aprx ="C:\RIASP II\RDA_Pro\RDA_Pro.aprx")
  2. m=aprx.listMaps("Current Work Space")[0]
  3. for lyr in m.listLayers():
  4.       if"Events":
  5.               print(

4. create a script tool in ArcGIS Pro and point the script to the py file mentioned in step 3.

5. In VS 2017, Debug --> Attach to Process --> Attach to : Python Code --> ArcGIS Pro

6. Run the tool created in step 4 in ArcGIS Pro


If I check the Solution Property in VS 2017,  I found my source code paths are automatically put into Do not look for these source files!!!



I tried to set the Directories containing source code in the above property window and empty the Do not look for these source files box before the debug, but, after the debug attempt my source code path will be put back in the Do not look for these source files. 


Have anyone else tried this and actually made it working? 

ESRI help document has not been very helpful to me so far..., Microsoft help document ? you know...

At least, we can see the light at the end of the tunnel: A rich debug experience in an IDE for script tools built for ArcGIS Pro is coming...

Any advice or suggestions will be highly appreciated.