-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add telemetry logger support for API-based MSBuild usage with BannedApiAnalyzer protection #51068
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
Open
Copilot
wants to merge
11
commits into
release/10.0.2xx
Choose a base branch
from
copilot/fix-ba8acda9-cc96-4c6c-9d69-08d913f1b898
base: release/10.0.2xx
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+545
−112
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a486b0f
Add telemetry logger support for API-based MSBuild usage
Copilot e7615ba
Add tests for ProjectInstanceExtensions telemetry logger creation
Copilot 9ad23cf
Fix telemetry logger to use distributed logging pattern with central …
Copilot 145a66f
Fix ForwardingLoggerRecord to use central logger instance with forwar…
Copilot c73c4cc
Share telemetry central logger instance between ProjectCollection and…
Copilot e3dccd6
Add integration test for telemetry logger receiving events from API-b…
Copilot fb7514c
Add telemetry logger support to VirtualProjectBuildingCommand
Copilot d62f17c
Add telemetry logger support to PackageAddCommand for project evaluation
Copilot fe985de
Add BannedApiAnalyzer to prevent direct MSBuild API usage without tel…
Copilot ff93c8b
Scope BannedApiAnalyzer to src/Cli and fix all ProjectCollection viol…
Copilot 25752f9
Merge branch 'release/10.0.2xx' into copilot/fix-ba8acda9-cc96-4c6c-9…
baronfel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Ban direct usage of MSBuild API Build methods to ensure telemetry logger is always attached | ||
| # Use BuildWithTelemetry extension methods from ProjectInstanceExtensions instead | ||
|
|
||
| # Ban ProjectInstance.Build() methods | ||
| M:Microsoft.Build.Execution.ProjectInstance.Build();Use BuildWithTelemetry() from ProjectInstanceExtensions instead | ||
| M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>);Use BuildWithTelemetry() from ProjectInstanceExtensions instead | ||
| M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Logging.ForwardingLoggerRecord>);Use BuildWithTelemetry() from ProjectInstanceExtensions instead | ||
| M:Microsoft.Build.Execution.ProjectInstance.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Logging.ForwardingLoggerRecord>,Microsoft.Build.Evaluation.Context.EvaluationContext);Use BuildWithTelemetry() from ProjectInstanceExtensions instead | ||
|
|
||
| # Ban Project.Build() methods | ||
| M:Microsoft.Build.Evaluation.Project.Build();Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(Microsoft.Build.Framework.ILogger);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(System.String);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(System.String[]);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(System.String,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
| M:Microsoft.Build.Evaluation.Project.Build(System.String[],System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Logging.ForwardingLoggerRecord>);Use BuildWithTelemetry() on the Project's ProjectInstance instead | ||
|
|
||
| # Ban ProjectCollection constructor without telemetry - use CreateLoggersWithTelemetry() helper | ||
| M:Microsoft.Build.Evaluation.ProjectCollection.#ctor();Use constructor with loggers from CreateLoggersWithTelemetry() | ||
| M:Microsoft.Build.Evaluation.ProjectCollection.#ctor(System.Collections.Generic.IDictionary`2<System.String,System.String>);Use constructor with loggers from CreateLoggersWithTelemetry() | ||
| M:Microsoft.Build.Evaluation.ProjectCollection.#ctor(Microsoft.Build.Evaluation.ToolsetDefinitionLocations);Use constructor with loggers from CreateLoggersWithTelemetry() | ||
| M:Microsoft.Build.Evaluation.ProjectCollection.#ctor(System.Collections.Generic.IDictionary`2<System.String,System.String>,System.Collections.Generic.IEnumerable`1<Microsoft.Build.Framework.ILogger>,Microsoft.Build.Evaluation.ToolsetDefinitionLocations);Ensure telemetry logger is included via CreateLoggersWithTelemetry() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| <Project> | ||
| <ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true'"> | ||
| <PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" Condition="'$(EnableStyleCopAnalyzer)' == 'true'" /> | ||
| <PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="all" Condition="$(MSBuildProjectDirectory.Contains('src\Cli')) OR $(MSBuildProjectDirectory.Contains('src/Cli'))" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(DotNetBuildSourceOnly)' != 'true' AND ($(MSBuildProjectDirectory.Contains('src\Cli')) OR $(MSBuildProjectDirectory.Contains('src/Cli')))"> | ||
| <AdditionalFiles Include="$(MSBuildThisFileDirectory)../BannedSymbols.txt" /> | ||
| </ItemGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we use eng/Version.Details.props like for the other packages instead of hard-coding the version here?