From 0612ae9d486f1a36e276b9efef65ca8bd6b6a301 Mon Sep 17 00:00:00 2001 From: Nikolche Kolev Date: Mon, 11 Sep 2023 16:40:15 -0700 Subject: [PATCH] Add the concept of a decorator, add a vulnerability decorator (#24) --- .../PackageDependencyGraphTests.cs | 8 +- src/Common/GraphOptions.cs | 4 +- src/Common/IPackageDependencyNodeDecorator.cs | 7 ++ src/Common/PackageDependencyGraph.cs | 40 ++++++---- src/Common/VulnerabilityHelpers.cs | 49 ------------ ...ecker.cs => VulnerabilityInfoDecorator.cs} | 72 +++++++++-------- .../PackageDependencyVisualizerToolTests.cs | 6 +- src/DependencyVisualizerTool/Program.cs | 77 +++++++++++++++---- 8 files changed, 141 insertions(+), 122 deletions(-) create mode 100644 src/Common/IPackageDependencyNodeDecorator.cs delete mode 100644 src/Common/VulnerabilityHelpers.cs rename src/Common/{VulnerabilityChecker.cs => VulnerabilityInfoDecorator.cs} (79%) diff --git a/src/Common/Common.Test/Common.Test/PackageDependencyGraphTests.cs b/src/Common/Common.Test/Common.Test/PackageDependencyGraphTests.cs index 032dd06..ceeb6e9 100644 --- a/src/Common/Common.Test/Common.Test/PackageDependencyGraphTests.cs +++ b/src/Common/Common.Test/Common.Test/PackageDependencyGraphTests.cs @@ -13,7 +13,7 @@ public async Task FromAssetsFile_WithLargeGraph_ParsesGraphCorrectly() var assetsFileText = TestHelpers.GetResource("Common.Test.compiler.resources.nuget.common.assets.json", GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)); graphs.Should().HaveCount(2); var graph = graphs.First().Value; @@ -296,7 +296,7 @@ public async Task GenerateAllDependencyGraphsFromAssetsFile_WithMultipleFramewor var assetsFileText = TestHelpers.GetResource("Common.Test.compiler.resources.multitargeted.assets.json", GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - Dictionary graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + Dictionary graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)); var net472Graph = graphs["net472"]; net472Graph.Node.Identity.Id.Should().Be("TestProject"); @@ -330,7 +330,7 @@ public async Task FromAssetsFile_WithProjectReferenceWithAPackageId_ParsesGraphC var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); var dgSpec = DependencyGraphSpec.Load(tempFile.FilePath); - var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, dgSpec, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, dgSpec, new GraphOptions(generateProjectsOnly: false), new(), CancellationToken.None); graphs.Should().HaveCount(1); var graph = graphs.Single().Value; @@ -357,7 +357,7 @@ private PackageDependencyGraph GetOnlyDependencyGraph(string resourceName) var assetsFileText = TestHelpers.GetResource(resourceName, GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - var graphs = PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)).Result; + var graphs = PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)).Result; graphs.Should().HaveCount(1); var graph = graphs.Single().Value; return graph; diff --git a/src/Common/GraphOptions.cs b/src/Common/GraphOptions.cs index 637efab..305fc3e 100644 --- a/src/Common/GraphOptions.cs +++ b/src/Common/GraphOptions.cs @@ -2,13 +2,11 @@ { public class GraphOptions { - public GraphOptions(bool checkVulnerabilities, bool generateProjectsOnly) + public GraphOptions(bool generateProjectsOnly) { - CheckVulnerabilities = checkVulnerabilities; GenerateProjectsOnly = generateProjectsOnly; } - public bool CheckVulnerabilities { get; } public bool GenerateProjectsOnly { get; } } } diff --git a/src/Common/IPackageDependencyNodeDecorator.cs b/src/Common/IPackageDependencyNodeDecorator.cs new file mode 100644 index 0000000..5dbbd90 --- /dev/null +++ b/src/Common/IPackageDependencyNodeDecorator.cs @@ -0,0 +1,7 @@ +namespace Common +{ + public interface IPackageDependencyNodeDecorator + { + Task DecorateAsync(PackageDependencyNode dependencyNode, CancellationToken cancellationToken); + } +} diff --git a/src/Common/PackageDependencyGraph.cs b/src/Common/PackageDependencyGraph.cs index 019d38a..5d6a243 100644 --- a/src/Common/PackageDependencyGraph.cs +++ b/src/Common/PackageDependencyGraph.cs @@ -1,10 +1,8 @@ -using NuGet.Configuration; -using NuGet.Packaging.Core; +using NuGet.Packaging.Core; using NuGet.ProjectModel; -using NuGet.Protocol; -using NuGet.Protocol.Core.Types; using NuGet.Versioning; using System.Diagnostics; +using System.Threading; namespace Common { @@ -22,11 +20,19 @@ public PackageDependencyGraph(Node node) : /// /// If the assets file is not valid /// If the assets file is null - public static async Task> GenerateAllDependencyGraphsFromAssetsFileAsync(LockFile assetsFile, DependencyGraphSpec dependencyGraphSpec, GraphOptions graphOptions) + public static async Task> GenerateAllDependencyGraphsFromAssetsFileAsync( + LockFile assetsFile, + DependencyGraphSpec dependencyGraphSpec, + GraphOptions graphOptions, + List decorators, + CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(assetsFile); - DependencyNodeIdentity projectIdentity = new(assetsFile.PackageSpec.Name, assetsFile.PackageSpec.Version, DependencyType.Project); + ArgumentNullException.ThrowIfNull(dependencyGraphSpec); + ArgumentNullException.ThrowIfNull(graphOptions); + ArgumentNullException.ThrowIfNull(decorators); + DependencyNodeIdentity projectIdentity = new(assetsFile.PackageSpec.Name, assetsFile.PackageSpec.Version, DependencyType.Project); List frameworks = assetsFile.Targets.Where(e => string.IsNullOrEmpty(e.RuntimeIdentifier)).ToList(); if (frameworks.Count == 0) @@ -46,7 +52,7 @@ public static async Task> GenerateAll foreach (var framework in frameworks) { - PackageDependencyGraph dependencyGraph = await GenerateGraphForAGivenFramework(projectIdentity, framework, assetsFile.PackageSpec, projectPathToProjectNameMap, graphOptions.CheckVulnerabilities, graphOptions.GenerateProjectsOnly); + PackageDependencyGraph dependencyGraph = await GenerateGraphForAGivenFramework(projectIdentity, framework, assetsFile.PackageSpec, projectPathToProjectNameMap, graphOptions.GenerateProjectsOnly, decorators, cancellationToken); TargetFrameworkInformation alias = assetsFile.PackageSpec.GetTargetFramework(framework.TargetFramework); aliasToDependencyGraph.Add(alias.TargetAlias, dependencyGraph); } @@ -77,7 +83,7 @@ public static async Task> GenerateAll foreach (var framework in frameworks) { - var dependenyGraph = await GenerateGraphForAGivenFramework(projectIdentity, framework, assetsFile.PackageSpec, new(), graphOptions.CheckVulnerabilities, projectsOnly: false); + var dependenyGraph = await GenerateGraphForAGivenFramework(projectIdentity, framework, assetsFile.PackageSpec, new(), projectsOnly: false, new(), CancellationToken.None); var alias = assetsFile.PackageSpec.GetTargetFramework(framework.TargetFramework); aliasToDependencyGraph.Add(alias.TargetAlias, dependenyGraph); } @@ -90,8 +96,9 @@ private static async Task GenerateGraphForAGivenFramewor LockFileTarget framework, PackageSpec packageSpec, Dictionary projectPathToProjectNameMap, - bool checkVulnerabilities, - bool projectsOnly) + bool projectsOnly, + List decorators, + CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(projectIdentity); ArgumentNullException.ThrowIfNull(framework); @@ -101,11 +108,6 @@ private static async Task GenerateGraphForAGivenFramewor Dictionary packageIdToNode = GenerateNodesForAllPackagesInGraph(framework, projectsOnly); - if (checkVulnerabilities) - { - await VulnerabilityHelpers.GenerateVulnerabilitiesAsync(packageSpec, packageIdToNode, CancellationToken.None); - } - packageIdToNode.Add(graph.Node.Identity.Id, (PackageDependencyNode)graph.Node); // Populate Node to Node edges @@ -156,6 +158,14 @@ private static async Task GenerateGraphForAGivenFramewor node.ParentNodes.Add((graph.Node, versionRange)); } + foreach ((string _, PackageDependencyNode packageIdNode) in packageIdToNode) + { + foreach (var decorator in decorators) + { + await decorator.DecorateAsync(packageIdNode, cancellationToken); + } + } + return graph; static Dictionary GenerateNodesForAllPackagesInGraph(LockFileTarget framework, bool projectsOnly) diff --git a/src/Common/VulnerabilityHelpers.cs b/src/Common/VulnerabilityHelpers.cs deleted file mode 100644 index acd0418..0000000 --- a/src/Common/VulnerabilityHelpers.cs +++ /dev/null @@ -1,49 +0,0 @@ -using NuGet.Configuration; -using NuGet.Packaging.Core; -using NuGet.ProjectModel; -using NuGet.Protocol; -using NuGet.Protocol.Core.Types; - -namespace Common -{ - internal static class VulnerabilityHelpers - { - internal static async Task GenerateVulnerabilitiesAsync(PackageSpec packageSpec, Dictionary packageIdToNode, CancellationToken cancellationToken) - { - var sourceRepositories = GetHTTPSourceRepositories(packageSpec); - var vulnerabilityChecker = new VulnerabilityChecker(sourceRepositories, new SourceCacheContext() { MaxAge = DateTimeOffset.UtcNow }); - - foreach (var package in packageIdToNode) - { - var packageIdentity = (PackageIdentity)package.Value.Identity; - if (await vulnerabilityChecker.IsPackageVulnerableAsync(packageIdentity, cancellationToken)) - { - package.Value.Identity.Vulnerable = true; - } - } - - static List GetHTTPSourceRepositories(PackageSpec projectPackageSpec) - { - using var settingsLoadContext = new SettingsLoadingContext(); - - Dictionary sourceRepositoryCache = new(); - - var settings = Settings.LoadImmutableSettingsGivenConfigPaths(projectPackageSpec.RestoreMetadata.ConfigFilePaths, settingsLoadContext); - var sources = projectPackageSpec.RestoreMetadata.Sources; - - IEnumerable> providers = Repository.Provider.GetCoreV3(); - - foreach (PackageSource source in sources) - { - if (source.IsHttp) - { - SourceRepository sourceRepository = Repository.CreateSource(providers, source, FeedType.Undefined); - sourceRepositoryCache[source] = sourceRepository; - } - } - - return sourceRepositoryCache.Values.ToList(); - } - } - } -} \ No newline at end of file diff --git a/src/Common/VulnerabilityChecker.cs b/src/Common/VulnerabilityInfoDecorator.cs similarity index 79% rename from src/Common/VulnerabilityChecker.cs rename to src/Common/VulnerabilityInfoDecorator.cs index 6e896f0..4c7842e 100644 --- a/src/Common/VulnerabilityChecker.cs +++ b/src/Common/VulnerabilityInfoDecorator.cs @@ -1,32 +1,53 @@ -using NuGet.Protocol.Core.Types; -using NuGet.Protocol.Model; +using NuGet.Packaging.Core; +using NuGet.Protocol.Core.Types; using NuGet.Protocol; -using NuGet.Common; -using Logging; +using NuGet.Protocol.Model; using Microsoft.Extensions.Logging; -using NuGet.Packaging.Core; +using Logging; namespace Common { - internal class VulnerabilityChecker + public class VulnerabilityInfoDecorator : IPackageDependencyNodeDecorator { - private readonly Microsoft.Extensions.Logging.ILogger _logger; + private readonly ILogger _logger; private readonly List _sourceRepositories; private readonly SourceCacheContext _sourceCacheContext; - private IReadOnlyList>> _vulnerabilityData; + private IReadOnlyList>>? _vulnerabilityData; private bool _vulnerabilityDataChecked; - public VulnerabilityChecker(List sourceRepositories, SourceCacheContext sourceCacheContext) + public VulnerabilityInfoDecorator(List sourceRepositories, SourceCacheContext sourceCacheContext) { - _logger = AppLogger.Logger; _sourceRepositories = sourceRepositories ?? throw new ArgumentNullException(nameof(sourceRepositories)); _sourceCacheContext = sourceCacheContext ?? throw new ArgumentNullException(nameof(sourceCacheContext)); + _logger = AppLogger.Logger; + } + + public async Task DecorateAsync(PackageDependencyNode dependencyNode, CancellationToken cancellationToken) + { + if (!_vulnerabilityDataChecked) + { + IReadOnlyList>>? loadedVulnerabilityData = await LoadVulnerabilitiesAsync(_sourceRepositories, _sourceCacheContext, cancellationToken); + if (loadedVulnerabilityData is not null) + { + _vulnerabilityData = loadedVulnerabilityData; + } + _vulnerabilityDataChecked = true; + } + + if (_vulnerabilityData != null) + { + var packageIdentity = (PackageIdentity)dependencyNode.Identity; + if (IsPackageVulnerable(_vulnerabilityData, packageIdentity)) + { + dependencyNode.Identity.Vulnerable = true; + } + } } private async Task>>?> LoadVulnerabilitiesAsync( - List sourceRepositories, - SourceCacheContext sourceCacheContext, - CancellationToken cancellationToken) + List sourceRepositories, + SourceCacheContext sourceCacheContext, + CancellationToken cancellationToken) { GetVulnerabilityInfoResult? allVulnerabilityData = await GetAllVulnerabilityDataAsync(sourceRepositories, sourceCacheContext, cancellationToken); @@ -58,26 +79,11 @@ static bool IsAnyVulnerabilityDataFound(IReadOnlyList IsPackageVulnerableAsync( - PackageIdentity packageIdentity, - CancellationToken cancellationToken) + internal static bool IsPackageVulnerable( + IReadOnlyList>> vulnerabilityData, + PackageIdentity packageIdentity) { - if (!_vulnerabilityDataChecked) - { - IReadOnlyList>>? loadedVulnerabilityData = await LoadVulnerabilitiesAsync(_sourceRepositories, _sourceCacheContext, cancellationToken); - if (loadedVulnerabilityData is not null) - { - _vulnerabilityData = loadedVulnerabilityData; - } - _vulnerabilityDataChecked = true; - } - - if (_vulnerabilityData == null) - { - return false; - } - foreach (var singleDataFile in _vulnerabilityData) + foreach (var singleDataFile in vulnerabilityData) { if (singleDataFile.TryGetValue(packageIdentity.Id, out var vulnerabilityList)) { @@ -157,7 +163,7 @@ public async Task IsPackageVulnerableAsync( { return null; } - return await vulnerabilityInfoResource.GetVulnerabilityInfoAsync(cacheContext, NullLogger.Instance, CancellationToken.None); + return await vulnerabilityInfoResource.GetVulnerabilityInfoAsync(cacheContext, NuGet.Common.NullLogger.Instance, CancellationToken.None); } } } diff --git a/src/DependencyVisualizerTool/DependencyVisualizerTool.Test/PackageDependencyVisualizerToolTests.cs b/src/DependencyVisualizerTool/DependencyVisualizerTool.Test/PackageDependencyVisualizerToolTests.cs index 3d9c5be..fbdeb39 100644 --- a/src/DependencyVisualizerTool/DependencyVisualizerTool.Test/PackageDependencyVisualizerToolTests.cs +++ b/src/DependencyVisualizerTool/DependencyVisualizerTool.Test/PackageDependencyVisualizerToolTests.cs @@ -62,7 +62,7 @@ public async Task TransGraphToDGMLXDocument_multitargeted_CreateDGMLCorrectly() var assetsFileText = TestHelpers.GetResource("DependencyVisualizerTool.Test.compiler.resources.multitargeted.assets.json", GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)); graphs.Should().HaveCount(2); var graph = graphs.First().Value; @@ -79,7 +79,7 @@ public async Task TransGraphToDGMLXDocument_nugetcommon_CreateDGMLCorrectly() var assetsFileText = TestHelpers.GetResource("DependencyVisualizerTool.Test.compiler.resources.nuget.common.assets.json", GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)); graphs.Should().HaveCount(2); var graph = graphs.First().Value; @@ -149,7 +149,7 @@ private async Task GetOnlyDependencyGraphAsync(string re var assetsFileText = TestHelpers.GetResource(resourceName, GetType()); var assetsFile = new LockFileFormat().Parse(assetsFileText, Path.GetTempPath()); - var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(checkVulnerabilities: false, generateProjectsOnly: false)); + var graphs = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetsFile, new GraphOptions(generateProjectsOnly: false)); graphs.Should().HaveCount(1); var graph = graphs.Single().Value; return graph; diff --git a/src/DependencyVisualizerTool/Program.cs b/src/DependencyVisualizerTool/Program.cs index ebeb33d..9d25040 100644 --- a/src/DependencyVisualizerTool/Program.cs +++ b/src/DependencyVisualizerTool/Program.cs @@ -1,10 +1,12 @@ -// See https://aka.ms/new-console-template for more information -using System.CommandLine; +using System.CommandLine; using Common; using Logging; using Microsoft.Build.Locator; using Microsoft.Extensions.Logging; +using NuGet.Configuration; using NuGet.ProjectModel; +using NuGet.Protocol.Core.Types; +using NuGet.Protocol; using static DependencyVisualizerTool.MSBuildUtility; namespace DependencyVisualizerTool @@ -63,7 +65,7 @@ private static async Task GenerateGraph(FileInfo projectFile, string? outpu { MSBuildLocator.RegisterDefaults(); string projectExtensionsPath = GetMSBuildProjectExtensionsPath(projectFile.FullName); - LockFile assetFile = GetAssetsFilePath(projectExtensionsPath); + LockFile? assetFile = GetAssetsFilePath(projectExtensionsPath); DependencyGraphSpec dgspecFile = GetDgspecFilePath(projectExtensionsPath, projectFile); if (outputFolder == null) @@ -80,7 +82,16 @@ private static async Task GenerateGraph(FileInfo projectFile, string? outpu return 1; } - Dictionary dictGraph = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync(assetFile, dgspecFile, new GraphOptions(checkVulnerabilities == true, projectsOnly == true)); + var decorators = CreateDecorators(assetFile.PackageSpec, checkVulnerabilities == true); + + Dictionary dictGraph = await PackageDependencyGraph.GenerateAllDependencyGraphsFromAssetsFileAsync( + assetFile, + dgspecFile, + new GraphOptions(projectsOnly == true), + decorators, + CancellationToken.None); + + var outputFiles = new List(dictGraph.Count); foreach (var keyValuePair in dictGraph) { string projectName = Path.GetFileNameWithoutExtension(projectFile.Name); @@ -89,6 +100,7 @@ private static async Task GenerateGraph(FileInfo projectFile, string? outpu try { DGMLDependencyVisualizerTool.TransGraphToDGMLFile(keyValuePair.Value, dgmlFileName, projectsOnly != true); + outputFiles.Add(dgmlFileName); } catch (Exception e) { @@ -97,12 +109,49 @@ private static async Task GenerateGraph(FileInfo projectFile, string? outpu return 1; } } - string infoMessage = $"Successfully created dependency graph file(s) under {outputFolder}"; + string infoMessage = $"Successfully created dependency graph file(s): {string.Join(Environment.NewLine, outputFiles)}"; AppLogger.Logger.LogInformation(infoMessage); Console.WriteLine(infoMessage); return 0; } - private static LockFile GetAssetsFilePath(string projectExtensionsPath) + + private static List CreateDecorators(PackageSpec packageSpec, bool visualizeVulnerabilities) + { + List decorators = new(); + + if (visualizeVulnerabilities) + { + var repositories = GetHTTPSourceRepositories(packageSpec); + decorators.Add(new VulnerabilityInfoDecorator(repositories, new SourceCacheContext())); + } + + return decorators; + + static List GetHTTPSourceRepositories(PackageSpec projectPackageSpec) + { + using var settingsLoadContext = new SettingsLoadingContext(); + + Dictionary sourceRepositoryCache = new(); + + var settings = Settings.LoadImmutableSettingsGivenConfigPaths(projectPackageSpec.RestoreMetadata.ConfigFilePaths, settingsLoadContext); + var sources = projectPackageSpec.RestoreMetadata.Sources; + + IEnumerable> providers = Repository.Provider.GetCoreV3(); + + foreach (PackageSource source in sources) + { + if (source.IsHttp) + { + SourceRepository sourceRepository = Repository.CreateSource(providers, source, FeedType.Undefined); + sourceRepositoryCache[source] = sourceRepository; + } + } + + return sourceRepositoryCache.Values.ToList(); + } + } + + private static LockFile? GetAssetsFilePath(string projectExtensionsPath) { ArgumentNullException.ThrowIfNull(projectExtensionsPath); string assetsFilePath = Path.Combine(projectExtensionsPath, LockFileFormat.AssetsFileName); @@ -120,13 +169,13 @@ private static LockFile GetAssetsFilePath(string projectExtensionsPath) { string errorMessage = $"Exception is thrown when reading the assets file at {assetsFilePath}."; AppLogger.Logger.LogError(errorMessage); - - //AppLogger.Logger.LogDebug(e.Message); - //AppLogger.Logger.LogDebug(e.StackTrace); + AppLogger.Logger.LogDebug(e.Message); + AppLogger.Logger.LogDebug(e.StackTrace); return null; } } + private static DependencyGraphSpec GetDgspecFilePath(string projectExtensionsPath, FileInfo projectFile) { ArgumentNullException.ThrowIfNull(projectExtensionsPath); @@ -147,9 +196,8 @@ private static DependencyGraphSpec GetDgspecFilePath(string projectExtensionsPat { string errorMessage = $"Exception is thrown when reading the dgspec file at {dgspecFileFullPath}."; AppLogger.Logger.LogError(errorMessage); - - //AppLogger.Logger.LogDebug(e.Message); - //AppLogger.Logger.LogDebug(e.StackTrace); + AppLogger.Logger.LogDebug(e.Message); + AppLogger.Logger.LogDebug(e.StackTrace); return null; } } @@ -166,9 +214,8 @@ private static void CreateOutputIfNotExists(string outputFolder) { var errorMessage = $"Exception is thrown when creating the outputFolder at: {outputFolder}"; AppLogger.Logger.LogError(errorMessage); - - //AppLogger.Logger.LogDebug(e.Message); - //AppLogger.Logger.LogDebug(e.StackTrace); + AppLogger.Logger.LogDebug(e.Message); + AppLogger.Logger.LogDebug(e.StackTrace); } } }