-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fail on compiler errors #25
Conversation
* fail on errors and warnings (except level 4) * include assembly references by name (easier to fix errors) * build class library (instead of console app, so Main isn't needed)
}; | ||
|
||
private static readonly IReadOnlyList<MetadataReference> s_metadataReferences = s_assemblyReferences | ||
.Select(x => (MetadataReference) MetadataReference.CreateFromFile(Assembly.Load(x).Location)).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: move these to the end of the class if we're rewriting them anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -58,7 +69,10 @@ protected static Diagnostic[] GetSortedDiagnosticsFromDocuments(DiagnosticAnalyz | |||
var diagnostics = new List<Diagnostic>(); | |||
foreach (var project in projects) | |||
{ | |||
var compilationWithAnalyzers = project.GetCompilationAsync().Result.WithAnalyzers(ImmutableArray.Create(analyzer)); | |||
var compilation = project.GetCompilationAsync().Result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pre-existing bug, but should prefer .GetAwaiter().GetResult()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.AddMetadataReference(projectId, CSharpSymbolsReference) | ||
.AddMetadataReference(projectId, CodeAnalysisReference); | ||
.WithProjectCompilationOptions(projectId, new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)) | ||
.AddMetadataReferences(projectId, s_metadataReferences); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Various changes, but, most importantly, fails on compiler errors (and fixes them). Bradley helped.