Vivek Nuna
Vivek Nuna

Reputation: 1

How can I debug Azure function using Visual Studio?

I'm trying to debug the Azure function, but it exists with the error "Unknown argument debug".

Please find below the screenshot of the project debug configuration.

Visual Studio Screenshot

I have referred to this link.

When I run without --debug vs, the application runs perfectly fine but I'm not able to hit the breakpoint.

I have tried host start --debug vs also, but it's also not working.

It gives the following exception.

Exception

Upvotes: 0

Views: 1911

Answers (2)

Vivek Nuna
Vivek Nuna

Reputation: 1

I have solved the issue with the help of this link. In my case, it was the cases when the Windows username contained spaces.

Change the launchSettings.json file to something like this:

"newProfile1": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
      "commandLineArgs": "\"C:\\Users\\myname\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\Azure.Functions.Cli.dll\" host start",
      "workingDirectory": "$(TargetDir)"
    }

Upvotes: 1

evilSnobu
evilSnobu

Reputation: 26414

$ func --debug vs host start

                  %%%%%%
                 %%%%%%
            @   %%%%%%    @
          @@   %%%%%%      @@
       @@@    %%%%%%%%%%%    @@@
     @@      %%%%%%%%%%        @@
       @@         %%%%       @@
         @@      %%%       @@
           @@    %%      @@
                %%
                %

Error: unknown argument --debug

Just place your options after the action (verb), you know à la BSD.

For example:

$ func host start --debug vs

This is mentioned in usage:

$ func

...
Usage: func [context] [context] <action> [-/--options]

Upvotes: 0

Related Questions