Skip to content

Latest commit

 

History

History
46 lines (29 loc) · 2.62 KB

File metadata and controls

46 lines (29 loc) · 2.62 KB

Part 07: Debugging with Copilot

In this section, you'll learn how to use Copilot to debug an exception in your application.

  1. [] Debug the AppHost project if it isn't yet, and open the store from the .NET Aspire dashboard.

  2. [] Click on the Go to About button in the navigation menu.

  3. [] Observe that an exception occurs, and the application crashes.

  4. [] Press the Analyze with Copilot option in the pop up.

    Pop up for exception with Analyze with Copilot option

  5. [] Review how Copilot brings in debugger information, including stack traces and variable states.

  6. [] Note how Copilot recommends a fix for the issue or provides code suggestions to resolve it.

Key Takeaway: Copilot can assist in diagnosing and fixing exceptions by analyzing debugger information and providing actionable recommendations.

Using Watch Windows and Visualizers

In this subsection, you'll learn how to use Copilot to analyze variables using watch windows and visualizers.

  1. [] Open the Products.razor file again from the Products project.

  2. [] Add a breakpoint at the end of the OnInitializedAsync method.

  3. [] Debug the TinyShop.AppHost and open the store from the .NET Aspire dashboard, and navigate to the Products page.

  4. [] When the breakpoint is hit, hover over the imagePrefix variable.

  5. [] Press the Copilot button to analyze the imagePrefix variable.

    Copilot button on variable

    Note: you can also see these in the Locals or watch windows

  6. [] Observe how Copilot provides detailed information about the variable, including its value and potential issues.

  7. [] Hover over the products collection and click the View button with the magnifier icon.

    View button on products

  8. [] Use the visualizer to inspect the contents of the products collection.

  9. [] Click the Generate expression button and, in natural language, type: Products that have the name outdoor in them and are under 40 dollars

  10. [] Observe how Copilot generates the appropriate expression automatically.

    Generate expression for visualizer

Key Takeaway: Copilot can enhance debugging by providing detailed insights into variables through watch windows and visualizers. Copilot can simplify complex debugging tasks by generating expressions and LINQ queries based on natural language input.


Back: Part 06 - Using Copilot Vision | Next: Part 08 - Commit Summary Descriptions