Skip to content

Commit db38e4d

Browse files
update custom code docs for .net8 changes/new debugger
1 parent 84d1017 commit db38e4d

File tree

3 files changed

+10
-44
lines changed

3 files changed

+10
-44
lines changed

articles/logic-apps/create-run-custom-code-functions.md

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ For more information about limitations in Azure Logic Apps, see [Limits and conf
5454

5555
- Custom functions authoring currently isn't available in the Azure portal. However, after you deploy your functions from Visual Studio Code to Azure, follow the steps in [Call your code from a workflow](#call-code-from-workflow) for the Azure portal. You can use the built-in action named **Call a local function in this logic app** to select from your deployed custom functions and run your code. Subsequent actions in your workflow can reference the outputs from these functions, as in any other workflow. You can view the built-in action's run history, inputs, and outputs.
5656

57-
- Custom functions use an isolated worker to invoke the code in your logic app workflow. To avoid package references conflicts between your own function code and the worker, use the same package versions referenced by the worker. For the full package list and versions referenced by the worker, see [Worker and package dependencies](https://github.com/Azure/logicapps/blob/master/articles/worker-packages-dependencies-custom-code.pdf).
58-
5957
## Create a code project
6058

6159
The latest Azure Logic Apps (Standard) extension for Visual Studio Code includes a code project template that provides a streamlined experience for writing, debugging, and deploying your own code with your workflows. This project template creates a workspace file and two sample projects: one project to write your code, the other project to create your workflows.
@@ -102,8 +100,8 @@ The latest Azure Logic Apps (Standard) extension for Visual Studio Code includes
102100
| Node | Description |
103101
|------|-------------|
104102
| **<*workspace-name*>** | Contains both your .NET functions project and logic app workflow project. |
105-
| **Functions** | Contains the artifacts for your .NET functions project. For example, the **<*function-name*>.cs** file is the code file where you can author your code. |
106-
| **LogicApp** | Contains the artifacts for your logic app project, including a blank workflow. |
103+
| **<*function-name*>** | Contains the artifacts for your .NET functions project. For example, the **<*function-name*>.cs** file is the code file where you can author your code. |
104+
| **<*logic-app-name*>** | Contains the artifacts for your logic app project, including a blank workflow. |
107105

108106
## Write your code
109107

@@ -230,31 +228,19 @@ The latest Azure Logic Apps (Standard) extension for Visual Studio Code includes
230228
}
231229
```
232230

233-
1. Replace the sample function code with your own, and edit the default `Run` method for your own scenarios. Or, you can copy the function, including the `[FunctionName("<*function-name*>")]` declaration, and then rename the function with a unique name. You can then edit the renamed function to meet your needs.
231+
1. Replace the sample function code with your own, and edit the default `Run` method for your own scenarios. Or, you can copy the function, including the `[FunctionName("<function-name>")]` declaration, and then rename the function with a unique name. You can then edit the renamed function to meet your needs.
234232

235233
This example continues with the sample code without any changes.
236234

237235
## Compile and build your code
238236

239237
After you finish writing your code, compile to make sure that no build errors exist. Your .NET functions project automatically includes build tasks, which compile and then add your code to the **lib\custom** folder in your logic app project where workflows look for custom functions to run. These tasks put the assemblies in the **lib\custom\net472** or **lib\custom\net8** folder, based on your .NET version.
240238

241-
1. In Visual Studio Code, from the **Terminal** menu, select **New Terminal**.
242-
243-
1. From the working directory list that appears, select **Functions** as your current working directory for the new terminal.
244-
245-
:::image type="content" source="media/create-run-custom-code-functions/compile-function-project.png" alt-text="Screenshot shows Visual Studio Code, prompt for current working directory, and selected Functions directory.":::
246-
247-
Visual Studio Code opens a terminal window with a command prompt.
248-
249-
1. In the **Terminal** window, at the command prompt, enter **dotnet restore**.
239+
1. In the Visual Studio Code file explorer, right-click the functions project folder and select "Build functions project...".
250240

251-
Visual Studio Code analyzes your projects and determines whether they're up-to-date.
241+
:::image type="content" source="media/create-run-custom-code-functions/build-functions-project.png" alt-text="Screenshot shows Visual Studio Code, Logic App workspace file explorer, and the Build functions project context menu option.":::
252242

253-
:::image type="content" source="media/create-run-custom-code-functions/dotnet-restore-complete.png" alt-text="Screenshot shows Visual Studio Code, Terminal window, and completed dotnet restore command.":::
254-
255-
1. After the command prompt reappears, enter **dotnet build**. Or, from the **Terminal** menu, select **Run Task**. From the task list, select **build (Functions)**.
256-
257-
If your build succeeds, the **Terminal** window reports that the **Build succeeded**.
243+
1. The build task will execute for the functions project. If your build succeeds, the **Terminal** window reports that the **Build succeeded**.
258244

259245
1. Confirm that the following items exist in your logic app project:
260246

@@ -290,7 +276,7 @@ After you confirm that your code compiles and that your logic app project contai
290276

291277
## Debug your code and workflow
292278

293-
1. Repeat the following steps to start the Azurite storage emulator *three* times: one time each for the following Azure Storage services:
279+
1. Start the Azurite storage emulator for each of the Azure Storage services:
294280

295281
- Azure Blob Service
296282
- Azure Queue Service
@@ -308,38 +294,18 @@ After you confirm that your code compiles and that your logic app project contai
308294

309295
:::image type="content" source="media/create-run-custom-code-functions/storage-services-running.png" alt-text="Screenshot shows Visual Studio Code taskbar with Azure Blob Service, Azure Queue Service, and Azure Table Service running.":::
310296

311-
1. Attach the debugger to your logic app project by following these steps:
297+
1. Attach the debugger to your logic app project and .NET functions project by following these steps:
312298

313299
1. On the Visual Studio Code Activity Bar, select **Run and Debug**. (Keyboard: Ctrl+Shift+D)
314300

315301
:::image type="content" source="media/create-run-custom-code-functions/run-debug.png" alt-text="Screenshot shows Visual Studio Code Activity Bar with Run and Debug selected.":::
316302

317-
1. From the **Run and Debug** list, select **Attach to logic app (LogicApp)**, if not already selected, and then select **Play** (green arrow).
303+
1. From the **Run and Debug** list, select **Run/debug logic app with local function (LogicApp)**, if not already selected, and then select **Play** (green arrow).
318304

319-
:::image type="content" source="media/create-run-custom-code-functions/attach-debugger-logic-app.png" alt-text="Screenshot shows Run and Debug list with Attach to logic app selected and Play button selected.":::
305+
:::image type="content" source="media/create-run-custom-code-functions/attach-debugger-logic-app-with-local-function.png" alt-text="Screenshot shows Run and Debug list with Run/debug logic app with local function selected.":::
320306

321307
The **Terminal** window opens and shows the started debugging process. The **Debug Console** window then appears and shows the debugging statuses. At the bottom of Visual Studio Code, the task bar turns orange, indicating that the .NET debugger is loaded.
322308

323-
1. Attach the debugger to your .NET functions project by following these steps, based on your code:
324-
325-
**.NET 8 projects**
326-
327-
1. From the Visual Studio Code **View** menu, select **Command Palette**.
328-
329-
1. From the command palette, find and select **Debug: Attach to a .NET 5+ or .NET Core process**.
330-
331-
:::image type="content" source="media/create-run-custom-code-functions/attach-debugger-net-core.png" alt-text="Screenshot shows Run and Debug list with Attach to NET Functions selected and Play button selected.":::
332-
333-
1. From the list, find and select the **dotnet.exe** process. If multiple **dotnet.exe** processes exist, select the process that has the following path:
334-
335-
**\<drive-name\>:\Users\<user-name>\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle.Workflows\<extension-bundle-version>\CustomCodeNetFxWorker\net8\Microsoft.Azure.Workflows.Functions.CustomCodeNetFxWorker.dll**
336-
337-
**.NET Framework projects**
338-
339-
From the **Run and Debug** list, select **Attach to .NET Functions (Functions)**, if not already selected, and then select **Play** (green arrow).
340-
341-
:::image type="content" source="media/create-run-custom-code-functions/attach-debugger-net-functions.png" alt-text="Screenshot shows Run and Debug list with Attach to NET Functions (Functions) selected and Play button selected.":::
342-
343309
1. To set any breakpoints, in your function definition (**<*function-name*>.cs**) or workflow definition (**workflow.json**), find the line number where you want the breakpoint, and select the column to the left, for example:
344310

345311
:::image type="content" source="media/create-run-custom-code-functions/set-breakpoint.png" alt-text="Screenshot shows Visual Studio Code and the open function code file with a breakpoint set for a line in code.":::
21.4 KB
Loading
327 KB
Loading

0 commit comments

Comments
 (0)