Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build does not fail upon .editorconfig rule violations in Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final #47835

Closed
Metrowerks opened this issue Sep 18, 2020 · 8 comments
Labels
Area-Infrastructure Resolution-By Design The behavior reported in the issue matches the current design

Comments

@Metrowerks
Copy link

Version Used:
Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final

Steps to Reproduce:

  1. Using Visual Studio 2019 to create a .net core 3.1 project and then reference the nuget package Microsoft.CodeAnalysis.CSharp.CodeStyle -Version 3.8.0-3.final in the project
  2. Add .editorconfig file to the root folder of the project
  3. Add some code that violates a rule that is defined in .editorconfig file, e.g. a variable naming that will be flagged as error by the .editorconfig file
  4. Build the project

Expected Behavior:

  • Build fails due to the naming violation
  • There are not any CS8032 warnings or errors

Actual Behavior:

  • Visual Studio show the naming violation as error but the build does not fail.
  • There are a tons of CS8032 warnings (as attached at the bottom)

Further observation:

  • Using the same project as above, but instead reference an older version of the package from myget.org (Microsoft.CodeAnalysis.CSharp.CodeStyle 3.8.0-1.20330.5), it works fine (i.e. expected behavior).

CS8032 warnings:

1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseNullPropagation.CSharpUseNullPropagationDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseThrowExpression.CSharpUseThrowExpressionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseCoalesceExpression.CSharpUseCoalesceExpressionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToTuple.CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.QualifyMemberAccess.CSharpQualifyMemberAccessDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseDeconstruction.CSharpUseDeconstructionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseSimpleUsingStatement.UseSimpleUsingStatementDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.SimplifyInterpolation.CSharpSimplifyInterpolationDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CodeStyle.CSharpFormattingAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseCollectionInitializer.CSharpUseCollectionInitializerDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions.CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseDefaultLiteral.CSharpUseDefaultLiteralDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.Diagnostics.NamingStyles.CSharpNamingStyleDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle.CSharpUseExplicitTypeDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues.CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForAssignmentDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle.CSharpUseImplicitTypeDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions.CSharpRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.InlineDeclaration.CSharpInlineDeclarationDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.AddRequiredParentheses.CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnreachableCode.CSharpRemoveUnreachableCodeDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.ConvertTypeOfToNameOf.CSharpConvertTypeOfToNameOfDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseAutoProperty.CSharpUseAutoPropertyAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.MakeStructFieldsWritable.CSharpMakeStructFieldsWritableDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveUnusedMembers.CSharpRemoveUnusedMembersDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseObjectInitializer.CSharpUseObjectInitializerDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchExpressionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchStatementDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives.MisplacedUsingDirectivesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression.ConvertSwitchStatementToExpressionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.InvokeDelegateWithConditionalAccess.InvokeDelegateWithConditionalAccessAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.ValidateFormatString.CSharpValidateFormatStringDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.FileHeaders.CSharpFileHeaderDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.OrderModifiers.CSharpOrderModifiersDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.AddRequiredParentheses.CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.SimplifyBooleanExpression.CSharpSimplifyConditionalDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.AddAccessibilityModifiers.CSharpAddAccessibilityModifiersDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundAssignmentDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseCoalesceExpression.CSharpUseCoalesceExpressionForNullableDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.CSharp.UseInferredMemberName.CSharpUseInferredMemberNameDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
1>CSC : error CS8032: An instance of analyzer Microsoft.CodeAnalysis.MakeFieldReadonly.MakeFieldReadonlyDiagnosticAnalyzer cannot be created from ....nuget\packages\microsoft.codeanalysis.csharp.codestyle\3.8.0-3.final\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CodeStyle.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..

@jmarolf
Copy link
Contributor

jmarolf commented Sep 18, 2020

cc: @mavasani

@mavasani
Copy link
Contributor

Version 3.8.0-3.final of the NuGet package requires VS2019 16.8 Preview3 - I verified it works fine that VS version. We have recently moved CodeStyle NuGet package to always build against the latest Roslyn bits, hence the requirement. You have following options:

  1. Move to VS2019 16.8 Preview3 to consume this NuGet package.
  2. Uninstall the NuGet package and instead directly use the CodeStyle assemblies inserted into .NET5 SDK (starting .NET5 RC2). You will then get newer version of this package as and when you upgrade your .NET SDK. See documentation here: https://docs.microsoft.com/dotnet/fundamentals/productivity/code-analysis#code-style-analysis
  3. Move back to the older CodeStyle NuGet package version that works for you with whichever VS2019 version you are on. If you only prefer staying on last stable non pre-release VS versions, then you can upgrade to CodeStyle package 3.8.0 whenever you move to VS2019 16.8, once both of these are available.

(2) is our recommended approach, which allows you completely get away from managing/upgrading CodeStyle Nuget package versions and just get the analyzers directly from .NET SDK.

@sharwell sharwell added Area-Infrastructure Resolution-By Design The behavior reported in the issue matches the current design labels Sep 21, 2020
@Metrowerks
Copy link
Author

  1. Uninstall the NuGet package and instead directly use the CodeStyle assemblies inserted into .NET5 SDK (starting .NET5 RC2). You will then get newer version of this package as and when you upgrade your .NET SDK. See documentation here: https://docs.microsoft.com/dotnet/fundamentals/productivity/code-analysis#code-style-analysis

(2) is our recommended approach, which allows you completely get away from managing/upgrading CodeStyle Nuget package versions and just get the analyzers directly from .NET SDK.

@mavasani
Our project is in .Net Core 3.1. Will option (2) work?

@mavasani
Copy link
Contributor

Yes, you just need to upgrade to the .NET5 RC2 or later SDK for your repo, your project can have any pre-Net5 framework as your TargetFramework. Basically, NET5 SDK is the shipping vehicle for these style analyzers; analyzers themselves are framework independent.

@mavasani
Copy link
Contributor

Also tagging @gewarren - we should probably add the above point to the CodeStyle analysis doc section as a Note, already couple of folks have asked me if they require moving their projects to Net5 target framework for EnforceCodeStyleInBuild property to work.

@Metrowerks
Copy link
Author

It seems (3) is the only feasible solution for us. We can't upgrade to .NET5 at the time due to other dependencies. I'm surprised that it worked for other version of the CodeStyle (in myget.org) and older version of VS 2019 (16.7.x) but the final release in nuget only works for 16.8 and later.

@mavasani
Copy link
Contributor

We can't upgrade to .NET5 at the time due to other dependencies

Note the suggestion is not to migrate/upgrade your projects to .NET5. It is just switching to the .NET5 SDK, without changing any of the target framework for your projects.

I'm surprised that it worked for other version of the CodeStyle (in myget.org) and older version of VS 2019 (16.7.x) but the final release in nuget only works for 16.8 and later.

All the published CodeStyle NuGet packages on myget were just daily packages produced from Roslyn repo over the last few months. They were built against older Roslyn bits, hence it worked on older VS builds. Going forward the NuGet package is not our primary recommended route for getting these analyzers, they should only be used for exceptional circumstances (note that newly published NuGet package on nuget.org will only work with latest VS release/pre-release). Analyzers ship with the .NET SDK, and they should be enabled from the SDK for regular consumption.

@MightyCreak
Copy link

Hi @mavasani,

While I understand the rationale behind that, it is not very practical in concrete use cases.

Note: at our job, all the projects have enabled "warning as error".

Case #1:

Not all the developers are working on the same projects, and not all the developers are at the same SDKs. So, after cloning a project, some developers will have compilation errors because the installed the .NET 6 SDK, while others will be fine.

Case #2:

We all are on .NET 5 and everything is working fine, but the IT team decides to upgrade our GitLab worker image with the .NET 6 SDK, and then all the pipelines fail.

We are struggling BIG TIME with this change right now because we have all at once:

  1. Projects not all on the same SDK
  2. Developers not all on the same SDK
  3. Our GitLab worker image has been upgraded to .NET 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure Resolution-By Design The behavior reported in the issue matches the current design
Projects
None yet
Development

No branches or pull requests

5 participants