From 9f68b9ffb5dc7804d89734036befb4b321092766 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:07:53 +0900 Subject: [PATCH 1/2] chore: Add warnings for UnresolvedAnalyzerReference --- src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs b/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs index ebc70691622..0afe82d0665 100644 --- a/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs +++ b/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs @@ -7,6 +7,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Logging; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.MSBuild; #nullable enable @@ -132,6 +133,11 @@ await LoadCompilationFromProject(project.AbsolutePath) is { } compilation) await Process.Start("dotnet", $"restore \"{path}\"").WaitForExitAsync(); } project = await workspace.OpenProjectAsync(path, msbuildLogger); + + foreach (var unresolvedAnalyzer in project.AnalyzerReferences.OfType()) + { + Logger.LogWarning("There is .NET Analyzer that can't be resolved. Path: " + unresolvedAnalyzer.FullPath); + } } if (!project.SupportsCompilation) From 8230f09390a6b1621250e18087e36f7e924906c6 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:23:37 +0900 Subject: [PATCH 2/2] chore: update warning message --- src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs b/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs index 0afe82d0665..efd5b9e36e9 100644 --- a/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs +++ b/src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs @@ -136,7 +136,9 @@ await LoadCompilationFromProject(project.AbsolutePath) is { } compilation) foreach (var unresolvedAnalyzer in project.AnalyzerReferences.OfType()) { - Logger.LogWarning("There is .NET Analyzer that can't be resolved. Path: " + unresolvedAnalyzer.FullPath); + Logger.LogWarning($"There is .NET Analyzer that can't be resolved. " + + $"If this analyzer is .NET Source Generator project. " + + $"Try build with `dotnet build -c Release` command before running docfx. Path: {unresolvedAnalyzer.FullPath}"); } }