Skip to content

Comments

Refactor string and output methods out of WizardImplementation.cs#6244

Draft
guimafelipe wants to merge 1 commit intomainfrom
user/felipeda/wizardrefactor
Draft

Refactor string and output methods out of WizardImplementation.cs#6244
guimafelipe wants to merge 1 commit intomainfrom
user/felipeda/wizardrefactor

Conversation

@guimafelipe
Copy link
Contributor

Summary

  • Extracts CreateErrorMessage, CreateDetailedErrorMessage, LogError, and ShowLocalizationErrorDialog into new WizardErrorHelper.cs static utility class
  • WizardImplementation.cs now delegates to the helper, reducing its size and improving maintainability
  • No behavior changes

Fixes #6017

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 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.cs with static utility methods for error handling
  • Modified WizardImplementation.cs to delegate error handling to the new helper class
  • Changed logging source identifier from instance ToString() to nameof(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);
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, nameof(NuGetPackageInstaller), message);
log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, typeof(NuGetPackageInstaller).FullName, message);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor string and output methods out of WizardImplementation.cs

1 participant