private static T ReadFile()

in src/PSDocs.Azure/Pipeline/TemplatePipeline.cs [135:153]


        private static T ReadFile<T>(string path)
        {
            if (string.IsNullOrEmpty(path) || !File.Exists(path))
                throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, PSDocsResources.TemplateFileNotFound, path), path);

            try
            {
                return JsonConvert.DeserializeObject<T>(File.ReadAllText(path));
            }
            catch (InvalidCastException)
            {
                // Discard exception
                return default;
            }
            catch (Exception inner)
            {
                throw new TemplateReadException(string.Format(Thread.CurrentThread.CurrentCulture, PSDocsResources.JsonFileFormatInvalid, path, inner.Message), inner, path, null);
            }
        }