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

Fail on compiler errors #25

Merged
merged 4 commits into from
Jan 4, 2019
Merged

Conversation

ejball
Copy link
Member

@ejball ejball commented Jan 4, 2019

Various changes, but, most importantly, fails on compiler errors (and fixes them). Bradley helped.

* 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)
@ejball ejball requested a review from bgrainger January 4, 2019 00:15
};

private static readonly IReadOnlyList<MetadataReference> s_metadataReferences = s_assemblyReferences
.Select(x => (MetadataReference) MetadataReference.CreateFromFile(Assembly.Load(x).Location)).ToList();
Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

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().

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bgrainger bgrainger merged commit 66d33b6 into Faithlife:master Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants