Closed
Fix PowerShell 7 suggestion text not showing for service-level hooks#5454
Conversation
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] PowerShell 7 suggestion text not showing for service-level hooks
Fix PowerShell 7 suggestion text not showing for service-level hooks
Jul 8, 2025
b998650 to
e43ab79
Compare
Contributor
|
I don't think we want to modify cli/azd/test/recording/testdata/recordings/TestBlobClientGetProperties.yaml and this solution is limited to one error only. Closing this PR and continue in #5468 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an issue where PowerShell 7 installation suggestion text was not displayed when service-level hooks failed due to missing PowerShell, while the same suggestion worked correctly for command-level hooks and direct hook execution.
Problem
When PowerShell 7 is not installed and a service uses PowerShell hooks, the expected suggestion text was missing:
azd package web(service hook)azd provision(command hook)azd hooks run prepackage --service webExpected behavior: All scenarios should show:
Root Cause
The issue occurred in the
EventDispatcher.RaiseEvent()method, which handles service lifecycle events. When a PowerShell hook failed:ErrorWithSuggestionwith installation guidanceerrors.New(strings.Join(...))ErrorWithSuggestionbecause it was converted to a generic errorCommand hooks work correctly because they bypass the event dispatcher and go directly through the middleware chain.
Solution
Modified
EventDispatcher.RaiseEvent()to preserve error types when there's only one handler error:Testing
ErrorWithSuggestionpreservation through event dispatcherImpact
This is a minimal, targeted fix that:
ErrorWithSuggestion, not just PowerShellFixes #5453.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd_fixed env new test-env(dns block)/home/REDACTED/work/azure-dev/azure-dev/cli/azd/azd_fixed hooks run prepackage --service web(dns block)downloads.bicep.azure.com/tmp/go-build2958173432/b906/bicep.test -test.testlogfile=/tmp/go-build2958173432/b906/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.