[fix] Harden binding redirect validation to catch missing DLLs#15778
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens packaging validation for binding redirects so redirects to assemblies missing from the package layout are treated as validation errors instead of being silently skipped.
Changes:
- Detects binding redirects whose target DLL cannot be found in the extracted package layout.
- Records those cases as validation errors and emits explicit error output.
Change verify-binding-redirects.ps1 to fail when a binding redirect references a DLL that isn't in the package layout. Previously this was silently skipped, which allowed microsoft#15765 — a redirect for DiagnosticSource 8.0.0.1 shipped in the config but the DLL was excluded from the package. The whole-package-missing case (VMR) is still a skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0c9bdca to
cb7d691
Compare
|
/iterate |
1 similar comment
|
/iterate |
|
Warning The Fixed the CI failure. The new validation in
Removed both redirects. These were silently skipped before; now the hardened script surfaces them as errors, which is exactly what this PR is designed to do.
|
….console The hardened validation script caught two more orphaned binding redirects in vstest.console/app.config — both DLLs are explicitly excluded from the CLI package nuspec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
pr is from fork, don't touch this anymore PR iterator. My bad. |
- Missing-DLL errors now Write-Error instead of reporting success - CI message distinguishes version mismatches (auto-fixable) from missing-DLL errors (manual removal needed) - Addresses Copilot review comments on lines 133 and 138 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
eng/verify-binding-redirects.ps1:133
- Missing DLLs are reported through the same
$errorscollection as version mismatches, so the CI failure still tells contributors to run the local auto-fix even though this case cannot be auto-fixed and requires either shipping the DLL or removing the redirect. The missing-DLL error should carry actionable remediation instead of falling through to the generic version-mismatch instructions.
# failures (e.g. #15765). Fail so the redirect gets removed.
# This cannot be auto-fixed — the redirect must be manually removed or the DLL shipped.
$errors += "$($entry.ExeName): $assemblyName has a binding redirect but the DLL is not in the package layout"
Replace Unicode em-dash (U+2014) with ASCII hyphen in comments and strings. The em-dash gets corrupted to multi-byte garbage on CI's PowerShell, causing a parse error that breaks the entire validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
It ships in the package, so allowing it would mask a future packaging regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…soft#15778) * Error on binding redirects pointing to missing DLLs Change verify-binding-redirects.ps1 to fail when a binding redirect references a DLL that isn't in the package layout. Previously this was silently skipped, which allowed microsoft#15765 — a redirect for DiagnosticSource 8.0.0.1 shipped in the config but the DLL was excluded from the package. The whole-package-missing case (VMR) is still a skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove stale DiagnosticSource and Encodings.Web redirects from vstest.console The hardened validation script caught two more orphaned binding redirects in vstest.console/app.config — both DLLs are explicitly excluded from the CLI package nuspec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review feedback: fail locally on missing-DLL errors - Missing-DLL errors now Write-Error instead of reporting success - CI message distinguishes version mismatches (auto-fixable) from missing-DLL errors (manual removal needed) - Addresses Copilot review comments on lines 133 and 138 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix em-dash encoding in verify-binding-redirects.ps1 Replace Unicode em-dash (U+2014) with ASCII hyphen in comments and strings. The em-dash gets corrupted to multi-byte garbage on CI's PowerShell, causing a parse error that breaks the entire validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove FileSystemGlobbing from allow-list It ships in the package, so allowing it would mask a future packaging regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…soft#15778) * Error on binding redirects pointing to missing DLLs Change verify-binding-redirects.ps1 to fail when a binding redirect references a DLL that isn't in the package layout. Previously this was silently skipped, which allowed microsoft#15765 — a redirect for DiagnosticSource 8.0.0.1 shipped in the config but the DLL was excluded from the package. The whole-package-missing case (VMR) is still a skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove stale DiagnosticSource and Encodings.Web redirects from vstest.console The hardened validation script caught two more orphaned binding redirects in vstest.console/app.config — both DLLs are explicitly excluded from the CLI package nuspec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review feedback: fail locally on missing-DLL errors - Missing-DLL errors now Write-Error instead of reporting success - CI message distinguishes version mismatches (auto-fixable) from missing-DLL errors (manual removal needed) - Addresses Copilot review comments on lines 133 and 138 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix em-dash encoding in verify-binding-redirects.ps1 Replace Unicode em-dash (U+2014) with ASCII hyphen in comments and strings. The em-dash gets corrupted to multi-byte garbage on CI's PowerShell, causing a parse error that breaks the entire validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove FileSystemGlobbing from allow-list It ships in the package, so allowing it would mask a future packaging regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove DiagnosticSource binding redirect from app.configs The binding redirect for System.Diagnostics.DiagnosticSource (8.0.0.1) was added in #15567 but the DLL is excluded from the CLI package during packaging. The redirect points to a version that doesn't ship, causing MissingMethodException on net462 with DisableAppDomain=true when a test triggers assembly resolution for DiagnosticSource. Fixes #15765 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * [fix] Harden binding redirect validation to catch missing DLLs (#15778) * Error on binding redirects pointing to missing DLLs Change verify-binding-redirects.ps1 to fail when a binding redirect references a DLL that isn't in the package layout. Previously this was silently skipped, which allowed #15765 — a redirect for DiagnosticSource 8.0.0.1 shipped in the config but the DLL was excluded from the package. The whole-package-missing case (VMR) is still a skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove stale DiagnosticSource and Encodings.Web redirects from vstest.console The hardened validation script caught two more orphaned binding redirects in vstest.console/app.config — both DLLs are explicitly excluded from the CLI package nuspec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review feedback: fail locally on missing-DLL errors - Missing-DLL errors now Write-Error instead of reporting success - CI message distinguishes version mismatches (auto-fixable) from missing-DLL errors (manual removal needed) - Addresses Copilot review comments on lines 133 and 138 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix em-dash encoding in verify-binding-redirects.ps1 Replace Unicode em-dash (U+2014) with ASCII hyphen in comments and strings. The em-dash gets corrupted to multi-byte garbage on CI's PowerShell, causing a parse error that breaks the entire validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove FileSystemGlobbing from allow-list It ships in the package, so allowing it would mask a future packaging regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove DiagnosticSource binding redirect from app.configs The binding redirect for System.Diagnostics.DiagnosticSource (8.0.0.1) was added in #15567 but the DLL is excluded from the CLI package during packaging. The redirect points to a version that doesn't ship, causing MissingMethodException on net462 with DisableAppDomain=true when a test triggers assembly resolution for DiagnosticSource. Fixes #15765 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * [fix] Harden binding redirect validation to catch missing DLLs (#15778) * Error on binding redirects pointing to missing DLLs Change verify-binding-redirects.ps1 to fail when a binding redirect references a DLL that isn't in the package layout. Previously this was silently skipped, which allowed #15765 — a redirect for DiagnosticSource 8.0.0.1 shipped in the config but the DLL was excluded from the package. The whole-package-missing case (VMR) is still a skip. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove stale DiagnosticSource and Encodings.Web redirects from vstest.console The hardened validation script caught two more orphaned binding redirects in vstest.console/app.config — both DLLs are explicitly excluded from the CLI package nuspec. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review feedback: fail locally on missing-DLL errors - Missing-DLL errors now Write-Error instead of reporting success - CI message distinguishes version mismatches (auto-fixable) from missing-DLL errors (manual removal needed) - Addresses Copilot review comments on lines 133 and 138 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix em-dash encoding in verify-binding-redirects.ps1 Replace Unicode em-dash (U+2014) with ASCII hyphen in comments and strings. The em-dash gets corrupted to multi-byte garbage on CI's PowerShell, causing a parse error that breaks the entire validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove FileSystemGlobbing from allow-list It ships in the package, so allowing it would mask a future packaging regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
verify-binding-redirects.ps1silently skipped redirects whose DLL wasn't in the package layout. This allowed #15765 — the DiagnosticSource redirect shipped in testhost.exe.config but the DLL was excluded from the.nuspec.Now it's an error: if the package exists but a redirect's target DLL is missing, the script fails. The whole-package-missing case (e.g. VMR where the exe isn't found at all) is still a skip.