Skip to content

[Regression][Windows]Fix Exception thrown on .NET 10 Windows when calling Permissions.CheckStatusAsync<Permissions.Microphone>()#33179

Merged
kubaflo merged 10 commits intodotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-32989
Mar 21, 2026
Merged

[Regression][Windows]Fix Exception thrown on .NET 10 Windows when calling Permissions.CheckStatusAsync<Permissions.Microphone>()#33179
kubaflo merged 10 commits intodotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-32989

Conversation

@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor

Issue Details

On .NET 10 Windows, calling
Permissions.CheckStatusAsync<Permissions.Microphone>() throws an exception when the app is running as an unpackaged app.

This is a regression introduced after Windows apps were changed to run as unpackaged by default. In unpackaged apps, AppxManifest.xml is not used, so microphone capabilities declared in the manifest are ignored. However, the current implementation always validates microphone capability declarations against AppxManifest.xml, which causes an exception for unpackaged apps.

Description of Change

Updated the Windows microphone permission logic to skip manifest capability checks for unpackaged apps. The microphone declaration is now required only for packaged apps, preventing exceptions and aligning the behavior with other Essentials APIs.

Issues Fixed

Fixes #32989

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Windows
Windows

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 16, 2025
@sheiksyedm sheiksyedm added platform/windows area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info labels Dec 16, 2025
@sheiksyedm sheiksyedm marked this pull request as ready for review December 16, 2025 14:06
Copilot AI review requested due to automatic review settings December 16, 2025 14:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Windows-specific exception that occurs when calling Permissions.CheckStatusAsync<Permissions.Microphone>() on .NET 10 unpackaged apps. The issue was caused by the permission logic always validating against AppxManifest.xml, which doesn't exist in unpackaged apps (now the default for Windows). The fix adds conditional checks using AppInfoUtils.IsPackagedApp to skip manifest validation for unpackaged apps.

Key Changes:

  • Modified microphone permission logic to skip EnsureDeclared() for unpackaged apps
  • Refactored RequestAsync method to extract permission request logic into TryRequestPermissionAsync
  • Added UI test for Windows to verify the fix
  • Added new "Essentials" category to UI test infrastructure

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Essentials/src/Permissions/Permissions.windows.cs Adds conditional IsPackagedApp checks before calling EnsureDeclared() in both CheckStatusAsync and RequestAsync methods, and extracts try-catch logic into a new TryRequestPermissionAsync method
src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs Adds new "Essentials" category constant for UI test categorization
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32989.cs NUnit test implementation that taps a button and verifies no crash occurs
src/Controls/tests/TestCases.HostApp/Issues/Issue32989.cs Test page with button to trigger microphone permission check
eng/pipelines/common/ui-tests.yml Adds "Essentials" to the test category groups in the pipeline configuration

Copy link
Copy Markdown
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this with a device tests rather than with a UI test? I think all of the Essentials are device tests?

@jfversluis jfversluis added this to the .NET 10.0 SR3 milestone Dec 19, 2025
@devanathan-vaithiyanathan
Copy link
Copy Markdown
Contributor Author

Can we do this with a device tests rather than with a UI test? I think all of the Essentials are device tests?

@jfversluis , This issue reproduces only in unpackaged apps, not in packaged apps. Since only the HostApp is an unpackaged app and the DeviceTest is packaged, I wrote a UI test.

@github-project-automation github-project-automation bot moved this from Todo to Changes Requested in MAUI SDK Ongoing Dec 30, 2025
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [Windows]Fix Exception thrown on .NET 10 Windows when calling Permissions.CheckStatusAsync<Permissions.Microphone>() [Regression][Windows]Fix Exception thrown on .NET 10 Windows when calling Permissions.CheckStatusAsync<Permissions.Microphone>() Jan 7, 2026
@karthikraja-arumugam karthikraja-arumugam added the community ✨ Community Contribution label Jan 9, 2026
@PureWeen PureWeen modified the milestones: .NET 10.0 SR3, .NET 10.0 SR4 Jan 21, 2026
@sheiksyedm sheiksyedm modified the milestones: .NET 10.0 SR4, .NET 10 SR5 Feb 12, 2026
@PureWeen PureWeen modified the milestones: .NET 10 SR5, .NET 10 SR6 Mar 3, 2026
## Description

Remove the "Are you waiting for the changes in this PR to be merged?"
note from all Copilot instruction files.

This note was previously required at the top of every PR description so
users could find instructions on how to test PR artifacts. We now have a
**dogfooding comment bot** that automatically posts testing instructions
under each PR, making this manual note redundant.

Copilot agents were still prepending this note to every PR description
because it was hardcoded in:
- `.github/copilot-instructions.md` (main instructions)
- `.github/skills/pr-finalize/SKILL.md` (PR finalization skill)
- `.github/skills/pr-finalize/references/complete-example.md` (example
PR)

### Issues Fixed

N/A — instruction cleanup only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Problem

The `maui-pr-uitests` pipeline has 98+ test jobs that all publish
artifacts using `PublishBuildArtifacts@1` with **no artifact name**,
defaulting to `drop`. When multiple jobs upload the same file to the
same container simultaneously, AzDO blob storage encounters write
conflicts:

```
Blob is incomplete (missing block). Blob: 29adda685a1ff1119a49000d3a9183a5, Expected Offset: 0, Actual Offset: 8388608
##[error]File upload failed even after retry.
```

### Recent failures
- [Build
1334980](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1334980):
3 jobs failed (Controls CollectionView, Controls (vlatest), Controls
(vlatest) CollectionView)
- [Build
1334245](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1334245):
1 job failed (Controls (vlatest))

The specific collision: both "Controls (vlatest)" and "Controls
(vlatest) CollectionView" upload
`drop/logs/appium_ios_Controls.TestCases.iOS.Tests-Release-ios-CollectionView.log`
— same blob ID, concurrent writes.

## Fix

Add a unique artifact name per job using
`$(System.StageName)-$(System.JobName)-$(System.JobAttempt)` in
`eng/pipelines/common/ui-tests-steps.yml`. This matches the pattern
already used by snapshot diff artifacts in
`ui-tests-collect-snapshot-diffs.yml`.

Fixes dotnet#34477
Ref: dotnet/dnceng#1916

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 21, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 33179

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 33179"

@kubaflo
Copy link
Copy Markdown
Contributor

kubaflo commented Mar 21, 2026

/azp run maui-pr-devicetests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@kubaflo kubaflo changed the base branch from main to inflight/current March 21, 2026 18:12
@kubaflo kubaflo merged commit ef3ba62 into dotnet:inflight/current Mar 21, 2026
37 of 40 checks passed
@github-project-automation github-project-automation bot moved this from Changes Requested to Done in MAUI SDK Ongoing Mar 21, 2026
PureWeen pushed a commit that referenced this pull request Mar 24, 2026
…ling Permissions.CheckStatusAsync<Permissions.Microphone>() (#33179)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### Issue Details
On .NET 10 Windows, calling
Permissions.CheckStatusAsync<Permissions.Microphone>() throws an
exception when the app is running as an unpackaged app.

This is a regression introduced after Windows apps were changed to run
as unpackaged by default. In unpackaged apps, AppxManifest.xml is not
used, so microphone capabilities declared in the manifest are ignored.
However, the current implementation always validates microphone
capability declarations against AppxManifest.xml, which causes an
exception for unpackaged apps.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated the Windows microphone permission logic to skip manifest
capability checks for unpackaged apps. The microphone declaration is now
required only for packaged apps, preventing exceptions and aligning the
behavior with other Essentials APIs.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #32989 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [ ] Android
- [x] Windows
- [ ] iOS
- [ ] Mac


| Before  | After  |
|---------|--------|
| **Windows**<br> <img
src="https://github.com/user-attachments/assets/7870d1a7-eeab-4e85-be4d-b951f0bd3d19"
width="600" height="300"> | **Windows**<br> <img
src="https://github.com/user-attachments/assets/bd43f5b8-85b7-4e3c-8404-d01c165fefa4"
width="600" height="300"> |

---------
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Mar 30, 2026
…ling Permissions.CheckStatusAsync<Permissions.Microphone>() (dotnet#33179)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### Issue Details
On .NET 10 Windows, calling
Permissions.CheckStatusAsync<Permissions.Microphone>() throws an
exception when the app is running as an unpackaged app.

This is a regression introduced after Windows apps were changed to run
as unpackaged by default. In unpackaged apps, AppxManifest.xml is not
used, so microphone capabilities declared in the manifest are ignored.
However, the current implementation always validates microphone
capability declarations against AppxManifest.xml, which causes an
exception for unpackaged apps.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated the Windows microphone permission logic to skip manifest
capability checks for unpackaged apps. The microphone declaration is now
required only for packaged apps, preventing exceptions and aligning the
behavior with other Essentials APIs.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes dotnet#32989 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [ ] Android
- [x] Windows
- [ ] iOS
- [ ] Mac


| Before  | After  |
|---------|--------|
| **Windows**<br> <img
src="https://github.com/user-attachments/assets/7870d1a7-eeab-4e85-be4d-b951f0bd3d19"
width="600" height="300"> | **Windows**<br> <img
src="https://github.com/user-attachments/assets/bd43f5b8-85b7-4e3c-8404-d01c165fefa4"
width="600" height="300"> |

---------
sheiksyedm pushed a commit that referenced this pull request Apr 4, 2026
…ling Permissions.CheckStatusAsync<Permissions.Microphone>() (#33179)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### Issue Details
On .NET 10 Windows, calling
Permissions.CheckStatusAsync<Permissions.Microphone>() throws an
exception when the app is running as an unpackaged app.

This is a regression introduced after Windows apps were changed to run
as unpackaged by default. In unpackaged apps, AppxManifest.xml is not
used, so microphone capabilities declared in the manifest are ignored.
However, the current implementation always validates microphone
capability declarations against AppxManifest.xml, which causes an
exception for unpackaged apps.

### Description of Change

<!-- Enter description of the fix in this section -->
Updated the Windows microphone permission logic to skip manifest
capability checks for unpackaged apps. The microphone declaration is now
required only for packaged apps, preventing exceptions and aligning the
behavior with other Essentials APIs.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #32989 

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

**Tested the behavior in the following platforms.**
- [ ] Android
- [x] Windows
- [ ] iOS
- [ ] Mac


| Before  | After  |
|---------|--------|
| **Windows**<br> <img
src="https://github.com/user-attachments/assets/7870d1a7-eeab-4e85-be4d-b951f0bd3d19"
width="600" height="300"> | **Windows**<br> <img
src="https://github.com/user-attachments/assets/bd43f5b8-85b7-4e3c-8404-d01c165fefa4"
width="600" height="300"> |

---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Exception thrown on .NET 10 Windows when calling Permissions.CheckStatusAsync<Permissions.Microphone>()

10 participants