Skip to content

[net11.0] Some updates to net11 branch#33575

Merged
rmarinho merged 6 commits intonet11.0from
update-branch-validation
Jan 16, 2026
Merged

[net11.0] Some updates to net11 branch#33575
rmarinho merged 6 commits intonet11.0from
update-branch-validation

Conversation

@rmarinho
Copy link
Member

Description of Change

This pull request introduces minor updates to configuration and issue template files to support the upcoming .NET 11.0 release.

.NET 11.0 support:

  • Added net11.0 to the list of branch classifications in .azuredevops/policies/branchClassification.yml to enable policy enforcement for .NET 11.0-related branches.
  • Added 11.0.0-preview.1 to the version options in the bug report issue template (.github/ISSUE_TEMPLATE/bug-report.yml) to allow users to report issues against the .NET 11.0 preview.

PureWeen and others added 6 commits January 14, 2026 14:37
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

Adds a `FileLoggingProvider` to capture ILogger output during
MacCatalyst UI tests. This solves the problem where Console.WriteLine
and ILogger messages were not being captured when running UI tests via
Appium.

### Problem

When running MacCatalyst UI tests with `BuildAndRunHostApp.ps1`, log
output was not being captured because:
1. Appium's Mac2 driver relaunches the app with `macos: launchApp`
2. This kills any existing app instance that had stderr capture
configured
3. The new app instance launched by Appium has no logging connection to
the test script

### Solution

Instead of trying to capture stderr from outside the app, the app now
writes its own logs to a file:
1. Test script sets `MAUI_LOG_FILE` environment variable to the desired
log path
2. `UITest.cs` passes this env var to the app via Appium's environment
args
3. `MauiProgram.cs` checks for the env var and adds
`FileLoggingProvider` if set
4. App writes all ILogger output directly to the specified file
5. This works regardless of how the app is launched (directly or via
Appium relaunch)

### Changes

- **`FileLoggingProvider.cs`** (new): Simple `ILoggerProvider`
implementation that writes formatted log messages to a file with
timestamps and log levels
- **`MauiProgram.cs`**: Adds `FileLoggingProvider` to logging pipeline
when `MAUI_LOG_FILE` env var is set
- **`UITest.cs`**: Reads `MAUI_LOG_FILE` from environment and passes it
to app via `SetTestConfigurationArg`
- **`BuildAndRunHostApp.ps1`**: Simplified - now just sets
`MAUI_LOG_FILE` directly to output path instead of copying from temp
file

### Usage

```powershell
# Run MacCatalyst UI test with logging
pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform catalyst -TestFilter "FullyQualifiedName~MyTest"

# Logs are written directly to:
# CustomAgentLogsTmp/UITests/catalyst-device.log
```

### Example Log Output

```
=== MAUI HostApp File Logger Started at 1/13/2026 2:29:21 PM ===
Log file: /path/to/catalyst-device.log
Minimum log level: Debug

[14:29:36.015] [ERROR] Microsoft.Maui.IApplication: Error Domain=UISceneErrorDomain Code=0 "The application does not support multiple scenes."
  Exception: Foundation.NSErrorException: Error Domain=UISceneErrorDomain Code=0 ...
```
Update the badge to point to maui-pr-public

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
### Description of Change

Now the correct links
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Description

This PR improves the `verify-tests-fail-without-fix` skill by fixing
fork repository detection, improving error handling, and making full
verification the recommended/default behavior.

## Changes

### 1. **Added `git fetch origin` for Accurate Diffs**
- Fetches the base branch from origin before computing git diff
- Ensures accurate fix file detection even in fork repositories
- Prevents false negatives when base branch is stale locally

### 2. **Improved Verification Mode Behavior**
- **Made full verification the primary/default mode** - tests must FAIL
without fix and PASS with fix
- **Added `-RequireFullVerification` parameter** - prevents silent
fallback to verify-only mode
- **Improved error handling** - script now warns/errors if no fix files
detected (instead of silently switching modes)
- **Verify-only mode still available** - runs when no fix files detected
AND `-RequireFullVerification` not set
- **Clearer expectations** - user explicitly controls whether
verify-only fallback is allowed

### 3. **Improved Documentation**
- Updated SKILL.md to reflect improved mode behavior
- Clarified requirements (fix files + test files for full verification)
- Updated mode selection table to show both modes clearly
- Added troubleshooting guidance for "no fix files detected" scenario

### 4. **Better Error Handling**
- Script exits early with actionable error if no fix files found AND
`-RequireFullVerification` set
- Provides explicit solutions (use `-FixFiles` or `-BaseBranch`
explicitly)
- Reduced ambiguity - user knows exactly what mode is running

## Why These Changes?

### Problem 1: Fork Repository Detection
When working in a fork, the base branch might not be up-to-date locally,
causing `git diff` to produce inaccurate results. This led to:
- Missing fix files in the diff
- False "only test files" mode activation
- Incorrect verification results

**Solution**: Always fetch the base branch from origin before computing
diff.

### Problem 2: Confusing Auto-Detection
The previous auto-detection system was unclear:
- Silent fallback to "verify failure only" when no fix files detected
- Users didn't know which mode was running
- Made debugging harder

**Solution**: 
- Add `-RequireFullVerification` parameter to make expectations explicit
- Error immediately if user expects full verification but no fix files
found
- Maintain verify-only mode for legitimate test-first workflows

### Problem 3: Silent Failures
When no fix files were detected (due to stale base branch or wrong base
detection), the script would silently fall back to "verify failure only"
mode, which wasn't the intended behavior.

**Solution**: Fail fast with clear error message and troubleshooting
steps when `-RequireFullVerification` is set.

## Testing

Verified the changes work correctly with:
- ✅ Fork repositories (fetch ensures accurate base branch)
- ✅ PRs with fix files + test files (full verification runs)
- ✅ Clear error when no fix files detected with
`-RequireFullVerification`
- ✅ Verify-only mode still works when appropriate (without the flag)
- ✅ `-RequireFullVerification` parameter enforces strict mode

## Example Usage

```bash
# Recommended for PR validation - ensures full verification
pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -Platform android -RequireFullVerification

# With explicit test filter
pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -Platform ios -TestFilter "Issue33356" -RequireFullVerification

# Override fix files or base branch if auto-detection fails
pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -Platform android -FixFiles @("src/Core/File.cs") -BaseBranch "main"

# Test-first workflow (verify tests fail before writing fix)
pwsh .github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1 -Platform ios
```

## Breaking Changes

⚠️ **Behavior Change**: The skill now requires explicit intent when fix
files are not detected:
- **Without `-RequireFullVerification`**: Falls back to verify-only mode
(tests only need to FAIL)
- **With `-RequireFullVerification`**: Errors immediately if no fix
files found

**Recommended usage**: Always use `-RequireFullVerification` when
validating PRs to ensure full verification (tests FAIL without fix, PASS
with fix).

**Migration**: Update any automated scripts that call this skill to add
`-RequireFullVerification` for PR validation workflows.

## Related

- Part of improving PR verification workflows
- Complements the `pr` custom agent for better PR validation
- Ensures consistent behavior across fork and non-fork repositories
```

---

## Key Changes from Current Description

### Change 1: Section 2 Title and Content

**Current (inaccurate):**
```markdown
### 2. **Simplified Verification Mode**
- **Removed** "verify failure only" mode (when only test files exist)
```

**Corrected:**
```markdown
### 2. **Improved Verification Mode Behavior**
- **Made full verification the primary/default mode** - tests must FAIL
without fix and PASS with fix
- **Verify-only mode still available** - runs when no fix files detected
AND `-RequireFullVerification` not set
```

### Change 2: Breaking Changes Section

**Current (inaccurate):**
```markdown
⚠️ **Behavior Change**: The skill no longer supports "verify failure
only" mode.
```

**Corrected:**
```markdown
⚠️ **Behavior Change**: The skill now requires explicit intent when fix
files are not detected:
- **Without `-RequireFullVerification`**: Falls back to verify-only mode
(tests only need to FAIL)
- **With `-RequireFullVerification`**: Errors immediately if no fix
files found
```

### Change 3: Added Test-First Workflow Example

**Added:**
```bash
# Test-first workflow (verify tests fail before writing fix)
pwsh
.github/skills/verify-tests-fail-without-fix/scripts/verify-tests-fail.ps1
-Platform ios
```

This clarifies that verify-only mode is still useful for legitimate workflows.

---

## Why This Correction Matters

**Code Reality**: The implementation shows verify-only mode still exists at lines 173-193:
```powershell
if ($DetectedFixFiles.Count -eq 0) {
Write-Host "║ VERIFY FAILURE ONLY MODE ║"
    # ... mode implementation
}
```

**Impact of Inaccuracy**: 
- Future maintainers reading "removed" will be confused when they see the mode in code
- Users might think they can't use verify-only mode for test-first workflows
- Documentation doesn't match reality

**Correction Approach**:
- Acknowledge mode still exists
- Explain it's no longer the silent fallback (key improvement)
- Show it's still useful for test-first development
- Emphasize full verification is now recommended/default

---

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
@rmarinho rmarinho added this to the .NET 11.0-preview1 milestone Jan 16, 2026
Copilot AI review requested due to automatic review settings January 16, 2026 18:28
@rmarinho rmarinho added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Jan 16, 2026
@rmarinho rmarinho changed the base branch from main to net11.0 January 16, 2026 18:29
Copy link
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 adds support for the upcoming .NET 11.0 release by updating branch classification policies and issue templates to recognize the new version.

Changes:

  • Added net11.0 branch to Azure DevOps branch classification policies
  • Added 11.0.0-preview.1 version option to the bug report issue template

Reviewed changes

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

File Description
.github/ISSUE_TEMPLATE/bug-report.yml Adds 11.0.0-preview.1 to version dropdown for bug reports
.azuredevops/policies/branchClassification.yml Adds net11.0 to protected branch list for policy enforcement

@rmarinho rmarinho merged commit 9d9ce69 into net11.0 Jan 16, 2026
5 of 28 checks passed
@rmarinho rmarinho deleted the update-branch-validation branch January 16, 2026 18:57
@github-actions github-actions bot locked and limited conversation to collaborators Feb 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants