private async Task <CreationResultStatus> EnterTemplateInvocationFlowAsync(ITemplateMatchInfo templateToInvoke) { templateToInvoke.Info.Tags.TryGetValue("language", out ICacheTag language); bool isMicrosoftAuthored = string.Equals(templateToInvoke.Info.Author, "Microsoft", StringComparison.OrdinalIgnoreCase); string framework = null; string auth = null; string templateName = TelemetryHelper.HashWithNormalizedCasing(templateToInvoke.Info.Identity); if (isMicrosoftAuthored) { _commandInput.InputTemplateParams.TryGetValue("Framework", out string inputFrameworkValue); framework = TelemetryHelper.HashWithNormalizedCasing(TelemetryHelper.GetCanonicalValueForChoiceParamOrDefault(templateToInvoke.Info, "Framework", inputFrameworkValue)); _commandInput.InputTemplateParams.TryGetValue("auth", out string inputAuthValue); auth = TelemetryHelper.HashWithNormalizedCasing(TelemetryHelper.GetCanonicalValueForChoiceParamOrDefault(templateToInvoke.Info, "auth", inputAuthValue)); } bool argsError = CheckForArgsError(templateToInvoke, out string commandParseFailureMessage); if (argsError) { _telemetryLogger.TrackEvent(CommandName + TelemetryConstants.CreateEventSuffix, new Dictionary <string, string> { { TelemetryConstants.Language, language?.ChoicesAndDescriptions.Keys.FirstOrDefault() }, { TelemetryConstants.ArgError, "True" }, { TelemetryConstants.Framework, framework }, { TelemetryConstants.TemplateName, templateName }, { TelemetryConstants.IsTemplateThirdParty, (!isMicrosoftAuthored).ToString() }, { TelemetryConstants.Auth, auth } }); if (commandParseFailureMessage != null) { Reporter.Error.WriteLine(commandParseFailureMessage.Bold().Red()); } Reporter.Error.WriteLine(string.Format(LocalizableStrings.RunHelpForInformationAboutAcceptedParameters, $"{CommandName} {TemplateName}").Bold().Red()); return(CreationResultStatus.InvalidParamValues); } else { bool success = true; try { return(await CreateTemplateAsync(templateToInvoke).ConfigureAwait(false)); } catch (ContentGenerationException cx) { success = false; Reporter.Error.WriteLine(cx.Message.Bold().Red()); if (cx.InnerException != null) { Reporter.Error.WriteLine(cx.InnerException.Message.Bold().Red()); } return(CreationResultStatus.CreateFailed); } catch (Exception ex) { success = false; Reporter.Error.WriteLine(ex.Message.Bold().Red()); } finally { _telemetryLogger.TrackEvent(CommandName + TelemetryConstants.CreateEventSuffix, new Dictionary <string, string> { { TelemetryConstants.Language, language?.ChoicesAndDescriptions.Keys.FirstOrDefault() }, { TelemetryConstants.ArgError, "False" }, { TelemetryConstants.Framework, framework }, { TelemetryConstants.TemplateName, templateName }, { TelemetryConstants.IsTemplateThirdParty, (!isMicrosoftAuthored).ToString() }, { TelemetryConstants.CreationResult, success.ToString() }, { TelemetryConstants.Auth, auth } }); } return(CreationResultStatus.CreateFailed); } }