# Windows

Below is a guide for profiling a Windows .NET MAUI application from:

{% embed url="<https://github.com/dotnet/maui/wiki/Profiling-.NET-MAUI-Apps>" %}

### Windows & PerfView

[PerfView](https://github.com/microsoft/perfview) is probably the simplest way to profile a .NET MAUI application running on Windows. We recommend using a `Release` build with [ReadyToRun](https://docs.microsoft.com/dotnet/core/deploying/ready-to-run) enabled. See our [Windows Publishing Documentation](https://docs.microsoft.com/dotnet/maui/windows/deployment/overview) for details about building a `Release` version of your app.

Begin by selecting the **Collect** > **Collect** menu. For a project named `hellomaui`, you can filter on `hellomaui.exe`:

![PerfView Collect Screen](https://github.com/dotnet/maui/wiki/images/PerfView-Collect.png)

Click **Start Collection** and manually launch your app.

Click **Stop Collection** when your app has launched and reached the point you are finished profiling.

Open `CPU Stacks` to view timing information of methods inside your app:

![PerfView CPU Stacks](https://github.com/dotnet/maui/wiki/images/PerfView-CPU-Stacks.png)

Use the **Flame Graph** tab for a graphical view:

![PerfView Flame Graph](https://github.com/dotnet/maui/wiki/images/PerfView-FlameGraph.png)

You can also do **File** > **Save View As** to save the file in SpeedScope format. This allows you to open the file in <https://speedscope.app/> as we recommend for iOS/Android projects.

### Windows & `dotnet-trace`

You can get a `.nettrace` or `.speedscope` file by publishing your app "unpackaged":

```
dotnet publish -f net6.0-windows10.0.19041.0 -c Release -p:PublishReadyToRun=true -p:WindowsPackageType=None
```

Then run `dotnet-trace` against the published `.exe`:

```
dotnet trace collect -- bin\Release\net6.0-windows10.0.19041.0\win10-x64\publish\YourApp.exe
```

This will place a `.nettrace` file in the current directory. You can also use `--format speedscope` to open the file in <https://speedscope.app/>.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/hybrid/application-profiling/windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
