diff --git a/src/Framework/Microsoft.Build.Framework.csproj b/src/Framework/Microsoft.Build.Framework.csproj index 0ca9a27dbb5..77051baf3da 100644 --- a/src/Framework/Microsoft.Build.Framework.csproj +++ b/src/Framework/Microsoft.Build.Framework.csproj @@ -143,6 +143,8 @@ + @@ -212,6 +214,18 @@ + + + + + + + <_PackageFiles Include="@(_TaskAnalyzerOutput)" PackagePath="analyzers/dotnet/cs" /> + + + - false + true false $(NoWarn);NU5128;RS1038;RS2001 diff --git a/src/TaskAnalyzer/TransitiveCallChainAnalyzer.cs b/src/TaskAnalyzer/TransitiveCallChainAnalyzer.cs index 9dc9d26aa99..d5855578a9a 100644 --- a/src/TaskAnalyzer/TransitiveCallChainAnalyzer.cs +++ b/src/TaskAnalyzer/TransitiveCallChainAnalyzer.cs @@ -50,7 +50,7 @@ private void OnCompilationStart(CompilationStartAnalysisContext compilationConte return; } - // Read scope option from .editorconfig + // Read scope option bool analyzeAllTasks = SharedAnalyzerHelpers.ReadAnalyzeAllTasksOption(compilationContext.Options.AnalyzerConfigOptionsProvider); var iMultiThreadableTaskType = compilationContext.Compilation.GetTypeByMetadataName(WellKnownTypeNames.IMultiThreadableTaskFullName); diff --git a/src/TaskAnalyzer/UnsupportedTaskItemTypeAnalyzer.cs b/src/TaskAnalyzer/UnsupportedTaskItemTypeAnalyzer.cs index b5bde275f21..f215016290f 100644 --- a/src/TaskAnalyzer/UnsupportedTaskItemTypeAnalyzer.cs +++ b/src/TaskAnalyzer/UnsupportedTaskItemTypeAnalyzer.cs @@ -95,6 +95,13 @@ property.ContainingType is not null && ITypeSymbol typeArg = namedPropertyType.TypeArguments[0]; + // A generic task can be constructed with a supported type. Its open type + // parameter does not provide enough information for a binding diagnostic. + if (typeArg.TypeKind == TypeKind.TypeParameter) + { + continue; + } + if (SupportedTaskItemTypes.IsConvertChangeTypeTaskItemType(typeArg.SpecialType)) { symbolContext.ReportDiagnostic(Diagnostic.Create(