U-SQL code behind breakpoints not hit

410 Views Asked by At

I am just learning Azure data lake analytics and U-SQL. I have a simple script that runs and produces the expected output. However when I set a breakpoint in the code behind helper method it is never hit because no symbols have been loaded. I have looked at all the available Microsoft tutorials and none suggest that I must do anything to enable debugging, it should just work when I run.

  • I am running on Local.
  • I am using F5 to run in debug mode.
  • Script completes successfully.
  • Output confirms that helper method is executed

U-SQL

@searchlog = 
EXTRACT UserId          int, 
        Start           DateTime, 
        Region          string, 
        Query           string, 
        Duration        int, 
        Urls            string, 
        ClickedUrls     string
FROM "/SearchLog.tsv"
USING Extractors.Tsv();

@searchlog = SELECT
            UserId,
            DataLake.Helper.Test() AS Test,
            Start, 
            Region, 
            Query, 
            Duration, 
            Urls, 
            ClickedUrls
    FROM @searchlog;


OUTPUT @searchlog 
TO "/SearchLog_output.tsv"
USING Outputters.Tsv();

Code Behind

namespace DataLake
{
public class Helper
{
    public static string Test()
    {
        Console.WriteLine("Stop");
        return "Test";
    }
}
}

Output Window

'DebugHost.exe' (CLR v4.0.30319: DefaultDomain): Loaded.
'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561
934e089\mscorlib.dll'. Symbols loaded.
'DebugHost.exe' (CLR v4.0.30319: DefaultDomain): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\DebugHost.exe'. 
Symbols loaded.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\Microsoft.Cosmos
.ScopeStudio.BusinessObjects.Debugger.dll'. Cannot find or open the PDB 
file.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\Microsoft.Cosmos
.ScopeStudio.BusinessObjects.Common.dll'. Cannot find or open the PDB file.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\Microsoft.Analytics
.LocalRun.dll'. Cannot find or open the PDB file.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c56
1934e089\System.dll'. Symbols loaded.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\Microsoft.Cosmos.
ClientTools.Shared.dll'. Cannot find or open the PDB file.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__
b77a5c561934e089\System.Core.dll'. Symbols loaded.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b
77a5c561934e089\System.Xml.dll'. Symbols loaded.
'DebugHost.exe' (CLR v4.0.30319: DebugHost.exe): Loaded 
'C:\Users\ksmith\Documents\Visual Studio 
2017\Projects\USQLApplication1\DataLake\bin\LocalDebug\ScopeRuntime.exe'. 
Cannot find or open the PDB file.
The program '[28036] DebugHost.exe' has exited with code 0 (0x0).

Can anyone shed some light on why the breakpoints are not hit?

Adding Debugger.Launch(); caused the Choose Just-In-Time Debugger window to appear. If I select one of the options I then get an instance of visual studio were the code behind break points are hit. The VS instance is called LocalVertexHost

JIT Debugger

Thanks

3

There are 3 best solutions below

1
On

Go to the Debug options in Visual Studio and ensure the following:

  • Uncheck "Enable Just My Code"
  • Check "Suppress JIT optimization on module load"
0
On

It is some issue that the extension of DataLake Analytics has for visual studio. I have had, and still having, this issue. Follow these steps and it can be ok for some runs, then repeat it again:

  1. Clean all the projects you have: ADLA and ADLA Class library;
  2. Make sure that the debug folders are empty on both projects;
  3. Rebuild and Register to your local ADLA the Class Library with the code behind;
  4. Rebuild the script you are trying to debug;
  5. Make the ADLA project your startup project;
  6. Submit the script to your local ADLA (makes sure that you have all the needed files in debug and that the script is assigned as the startup script);
  7. After the submit is successful, put the brak point into the code behind;
  8. Start debugging;

If the breakpoint is not hit yet, then try to delete everything from the local U-SQL temporary folder and repeat again all the steps.

0
On

This happenes in my environment me when I click the Submit button in Visual Studio instead of hitting F5 or clicking on start (with debugging). Thought I should share even though you mention already running with f5 because this was the only mention of this issue I could find. Maybe this will be helpful to others.

I think clicking submit runs the usql script in a separate process without the debugger attached.