SIGN IN SIGN UP

Fix `$mask` variable mutation in `GetDependencies` inner loop (#2247)

### ❔What, Why & How

`GetDependencies` mutates the outer `foreach($mask in $masks)` loop
variable inside the inner `foreach($dependency in $probingPathsJson)`
loop when prepending `buildMode`. This causes the mask to accumulate
prefixes across dependency iterations:

```
Iteration 1: App_xyz has buildMode "ONPREM" → $mask becomes "ONPREMApps"
Iteration 2: App_abc has no buildMode       → $mask becomes "ONPREMONPREMApps"
```

Introduced a local `$currentMask` variable initialized from `$mask` at
the top of the inner loop. All inner-loop references now use
`$currentMask`, leaving the outer loop variable untouched.

```powershell
foreach($mask in $masks) {
    foreach($dependency in $probingPathsJson) {
        $currentMask = $mask                      # local copy
        if($buildMode -ne "Default") {
            $currentMask = "$buildMode$currentMask" # mutate copy, not outer var
        }
    }
}
```

Related to issue: #2236

### ✅ Checklist

- [ ] Add tests (E2E, unit tests)
- [x] Update RELEASENOTES.md
- [ ] Update documentation (e.g. for new settings or scenarios)
- [ ] Add telemetry

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mazhelez <43066499+mazhelez@users.noreply.github.com>
Co-authored-by: Alexander Holstrup <117829001+aholstrup1@users.noreply.github.com>
C
Copilot committed
b7381d6f8119827ae136d10b26e4e7abfbbde694
Parent: 8be9109
Committed by GitHub <noreply@github.com> on 6/9/2026, 10:09:27 AM