Skip to content

Commit

Permalink
Added eventSource to BuildCheck logger (#10061)
Browse files Browse the repository at this point in the history
Context
In some cases when running BuildCheck during build (non restore phase), the analyzers will not receive any property information and therefore will not trigger correctly.
This is caused by backwards compatibility logger stuff, so " subscribing" the logger to a newer data format lets the analyzer receive all necessary information to run correctly.

Changes Made
Subscribed logger to newer eventSource version during initialization.
  • Loading branch information
maridematte authored Apr 23, 2024
1 parent 9cdb361 commit 3112852
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public void Initialize(IEventSource eventSource)
{
eventSource.AnyEventRaised += EventSource_AnyEventRaised;
eventSource.BuildFinished += EventSource_BuildFinished;

if (eventSource is IEventSource4 eventSource4)
{
eventSource4.IncludeEvaluationPropertiesAndItems();
}
}

private void EventSource_AnyEventRaised(object sender, BuildEventArgs e)
Expand Down

0 comments on commit 3112852

Please sign in to comment.