microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.27k stars 674 forks source link

Can't debug Windows app built in MAUI blazor when the application is ran as an admin #8978

Open vsfeedback opened 11 months ago

vsfeedback commented 11 months ago

This issue has been moved from a ticket on Developer Community.


[severity:It’s more difficult to complete my work]
Create a new MAUI Blazor hello world app. (I haven’t investigated whether this behavior occurs with regular MAUI apps as well.)

Set the application to run as administrator. To do this, update Platforms\Windows\app.manifest as follows:

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
        <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>

Then, update Package.appxmanifest as follows:

<Capabilities>
    <rescap:Capability Name="runFullTrust" />
    <rescap:Capability Name="allowElevation" />
</Capabilities>

Place a debug breakpoint anywhere, such as in MauiProgram.cs, run the application, and it won’t be hit.

In case any of my instructions are unclear, this process is demonstrated in the following youtube video: https://www.youtube.com/watch?v=XZuKJbUtXR8

This issue was also reported on the project’s GitHub issues page:
https://github.com/dotnet/maui/issues/11730


Original Comments

Feedback Bot on 10/2/2023, 07:22 PM:

(private comment, text removed)

Kevin Xu [MSFT] on 10/9/2023, 10:21 PM:

(private comment, text removed)

Joel Devey on 10/11/2023, 07:45 AM:

(private comment, text removed)

Feedback Bot on 10/11/2023, 07:09 PM:

(private comment, text removed)

Feedback Bot on 10/12/2023, 06:58 AM:

(private comment, text removed)


Original Solutions

(no solutions)

MSLukeWest commented 11 months ago

This issue is not specific to MAUI or MAUI Blazor. These same repro steps with a new WinUI 1.4 project reproduces this issue.

gm-prodigy commented 10 months ago

While this doesn't solve the issue, you can run the built app first and then attach the debugger after.

image