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

Violations of SA1113 are not reported in the MSBuild output #1659

Closed
sharwell opened this issue Oct 20, 2015 · 11 comments · Fixed by #1674
Closed

Violations of SA1113 are not reported in the MSBuild output #1659

sharwell opened this issue Oct 20, 2015 · 11 comments · Fixed by #1674
Assignees
Milestone

Comments

@sharwell
Copy link
Member

See #1658 for a clear example. The pull request introduces two violations of SA1113, in addition to violations of SA1116 and SA1117. When you open the solution in Visual Studio, all of these warnings are reported in the Error List window. When you build the project, only SA1116 and SA1117 are included in the build output (see AppVeyor for example).

📝 SA1113 is implemented in SA1113CommaMustBeOnSameLineAsPreviousParameter.

@tmeschter
Copy link

@sharwell Any chance the analyzer is failing to load with an AD0001 diagnostic? You might have to bump up the MSBuild logging verbosity and then search the build log to find it.

@sharwell
Copy link
Member Author

1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1012OpeningCurlyBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1016OpeningAttributeBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1001CommasMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1023DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1013ClosingCurlyBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1017ClosingAttributeBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1010OpeningSquareBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1008OpeningParenthesisMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1026CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'Microsoft.CodeAnalysis.CSharp.Analyzers.FixAnalyzers.CSharpFixerWithFixAllAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'Microsoft.CodeAnalysis.Analyzers.FixAnalyzers.FixerWithFixAllAnalyzer`1' threw an exception.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1020IncrementDecrementSymbolsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1019MemberAccessSymbolsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1006PreprocessorKeywordsMustNotBePrecededBySpace' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1000KeywordsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1024ColonsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1113CommaMustBeOnSameLineAsPreviousParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1014OpeningGenericBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1022PositiveSignsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1000KeywordsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1015ClosingGenericBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1112ClosingParenthesisMustBeOnLineOfOpeningParenthesis' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1011ClosingSquareBracketsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1021NegativeSignsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1009ClosingParenthesisMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.SpacingRules.SA1002SemicolonsMustBeSpacedCorrectly' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1111ClosingParenthesisMustBeOnLineOfLastParameter' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)
1>  info AD0001: The Compiler Analyzer 'StyleCop.Analyzers.ReadabilityRules.SA1110OpeningParenthesisMustBeOnDeclarationLine' threw an exception of type 'System.IO.FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.'. (TaskId:31)

@tmeschter
Copy link

@sharwell That would be a definitive "yes". Your analyzer appears to have a dependency on Microsoft.CodeAnalysis.Workspaces, which isn't part of the compilers. It is part of VS and is almost certainly being copied over for your unit test runs, which is why the analyzers load and run there.

Unfortunately a quick perusal of the code doesn't reveal any obvious dependencies.

@sharwell
Copy link
Member Author

@tmeschter The analyzer in question referenced a static member of a type which was derived from CodeFixProvider. Even though the analyzer didn't use anything from Microsoft.CodeAnalysis.Workspaces, the assembly needed to at least be present.

📝 This design is a disaster for the way analyzers and code fixes are currently structured in samples and now in various projects. The only way to be certain at compile time that analyzers will work is to place all analyzers in one assembly (which does not reference Microsoft.CodeAnalysis.Workspaces), and all code fixes for those analyzers in a different assembly.

@mattfrear
Copy link

Hi Sam,

Has this been fixed? I'm still seeing AD0001 errors when compiling using "dotnet build" but not seeing those errors in Visual Studio.

Some of the analysers must be loading OK and appear to be working because I am seeing violations of SA1505 which is good, but I am seeing AD0001 for the SpecialRules and DocumentationRules analyzers.

CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.SpecialRules.SA0002InvalidSettingsFile' threw an exception of type 'System.TypeLoadException' with message 'Could not load type 'System.Runtime.Serialization.Formatters.FormatterAssemblyStyle' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.'.

CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.DocumentationRules.SA1642ConstructorSummaryDocumentationMustBeginWithStandardText' threw an exception of type 'System.TypeLoadException' with message 'Could not load type 'System.Runtime.Serialization.Formatters.FormatterAssemblyStyle' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.'.`

@sharwell
Copy link
Member Author

@mattfrear That's a different error, related to the use of StyleCop Analyzers with .NET Core. We've had several challenges with stabilizing behavior for users working with that toolchain.

@jnm2
Copy link
Contributor

jnm2 commented Dec 18, 2017

This design is a disaster for the way analyzers and code fixes are currently structured in samples and now in various projects. The only way to be certain at compile time that analyzers will work is to place all analyzers in one assembly (which does not reference Microsoft.CodeAnalysis.Workspaces), and all code fixes for those analyzers in a different assembly.

How crazy would I be to try to bundle Microsoft.CodeAnalysis.Workspaces.dll in the nupkg for CSC? My analyzer needs to run logic in Workspaces in order to determine whether to report a diagnostic, so it's either that or copy and paste the logic.

@tmeschter
Copy link

@jnm2 There are both design an implementation issue with that idea.

From a design point of view analyzers are meant to sit on top of the Compiler layer, not the Workspaces layer. By taking a dependency on MS.CA.Workspaces.dll you're working against the intended layering.

As for the implementation issues, a lot of the hosts (VS, csc, vbc, vbcscompiler, etc.) are going to have binding redirects to force their version of MS.CA.Workspaces.dll, so the one you include might never be loaded. Or worse, yours gets loaded instead of the one provided by the host and you've potentially broken other things. Or maybe both get loaded, and someone MEF imports the "same" type from both assemblies and, well, who knows. Also, including MS.CS.Workspace.dll probably requires you also include a matching copy of Microsoft.CodeAnalysis.dll, and then maybe also System.Collections.Immutable.dll, and perhaps others, all of which will be subject to similar problems.

So instead of bundling MS.CA.Workspaces.dll, I suggest attacking the root issue: what functionality do you need from it, and why?

@jnm2
Copy link
Contributor

jnm2 commented Jan 2, 2018

So instead of bundling MS.CA.Workspaces.dll, I suggest attacking the root issue: what functionality do you need from it, and why?

The alternative is being blocked on dotnet/roslyn#23842, if you move that logic at all, or copying and pasting that logic into my analyzers.

@tmeschter
Copy link

I think your best bet in the short term is to copy that code to your own project.

@jnm2
Copy link
Contributor

jnm2 commented Jan 2, 2018

Okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants