Refactor string and output methods out of WizardImplementation.cs#6244
Refactor string and output methods out of WizardImplementation.cs#6244guimafelipe wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors error handling code from WizardImplementation.cs into a new WizardErrorHelper.cs static utility class to improve maintainability and reduce the size of the wizard implementation. The refactoring extracts four methods: CreateErrorMessage, CreateDetailedErrorMessage, LogError, and ShowLocalizationErrorDialog.
Changes:
- Created new
WizardErrorHelper.cswith static utility methods for error handling - Modified
WizardImplementation.csto delegate error handling to the new helper class - Changed logging source identifier from instance
ToString()tonameof(NuGetPackageInstaller)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dev/VSIX/Shared/WizardImplementation.cs | Removed error handling method implementations and replaced with delegation calls to WizardErrorHelper |
| dev/VSIX/Shared/WizardErrorHelper.cs | New static utility class containing extracted error handling methods |
| IVsActivityLog log = ServiceProvider.GlobalProvider.GetService(typeof(SVsActivityLog)) as IVsActivityLog; | ||
| if (log != null) | ||
| { | ||
| log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, nameof(NuGetPackageInstaller), message); |
There was a problem hiding this comment.
The source parameter changed from ToString() (which would return the fully qualified type name like "WindowsAppSDK.TemplateUtilities.NuGetPackageInstaller") to nameof(NuGetPackageInstaller) (which returns just "NuGetPackageInstaller"). This changes the log entry source and could affect log filtering or searching. Consider using typeof(NuGetPackageInstaller).FullName to preserve the original behavior, or document this as an intentional change in the PR description.
| log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, nameof(NuGetPackageInstaller), message); | |
| log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, typeof(NuGetPackageInstaller).FullName, message); |
Summary
CreateErrorMessage,CreateDetailedErrorMessage,LogError, andShowLocalizationErrorDialoginto newWizardErrorHelper.csstatic utility classWizardImplementation.csnow delegates to the helper, reducing its size and improving maintainabilityFixes #6017