-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add DotNetComponent #1363
Add DotNetComponent #1363
Conversation
The DotNetComponent type is used to report usage of the .NET SDK version This is important as the .NET SDK will add redistributable content to the project, so using an older version may mean your application contains unserviced copies of the host or runtime. The TargetFramework and project type is reported as well since these influence what content the SDK may reference.
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.
PR Overview
This PR adds the DotNetComponent type and its corresponding detector along with tests and service configuration to enable detection of .NET SDK usage and project details. Key changes include:
- Introduction of DotNetComponent with properties for SDK version, target framework, and project type.
- Creation of DotNetComponentDetector to analyze project assets and global.json for .NET SDK version discovery.
- Addition of unit tests and configuration updates to wire up the new detector.
Reviewed Changes
File | Description |
---|---|
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs | Added new DotNetComponent type with an Id property and PackageURL implementation. |
src/Microsoft.ComponentDetection.Orchestrator/Experiments/DotNetDetectorExperiment.cs | Added a new experimental configuration for the .NET detector. |
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs | Introduced the DotNetComponentDetector to process .NET project files and determine the SDK version. |
test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs | Added unit tests to validate the behavior of the new detector. |
src/Microsoft.ComponentDetection.Contracts/TypedComponent/ComponentType.cs | Updated enum to include the new DotNet component type. |
src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Updated service registrations to include the new .NET detector and experiment. |
src/Microsoft.ComponentDetection.Detectors/yarn/YarnLockComponentDetector.cs | Minor update to namespace import using global qualifier. |
src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs | Fixed parameter usage in command location check. |
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs
Show resolved
Hide resolved
test/Microsoft.ComponentDetection.Detectors.Tests/DotNetComponentDetectorTests.cs
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1363 +/- ##
======================================
Coverage 89.4% 89.5%
======================================
Files 398 402 +4
Lines 31029 31480 +451
Branches 1869 1928 +59
======================================
+ Hits 27757 28183 +426
- Misses 2867 2879 +12
- Partials 405 418 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
src/Microsoft.ComponentDetection.Detectors/yarn/YarnLockComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs
Outdated
Show resolved
Hide resolved
b31822a
to
342e415
Compare
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs
Outdated
Show resolved
Hide resolved
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.
PR Overview
This PR introduces a new DotNetComponent and its corresponding detector, enabling detection and reporting of the .NET SDK version as well as related project data. Changes include implementation of the DotNetComponent type, creation of a DotNetComponentDetector with caching and concurrency support, and necessary updates to documentation and service registration.
Reviewed Changes
File | Description |
---|---|
src/Microsoft.ComponentDetection.Contracts/TypedComponent/DotNetComponent.cs | Adds a new component type to capture .NET SDK, TargetFramework, and ProjectType information. |
docs/detectors/dotnet.md | Provides documentation regarding DotNet SDK detection and its strategy. |
src/Microsoft.ComponentDetection.Orchestrator/Experiments/DotNetDetectorExperiment.cs | Introduces an experiment configuration for the new DotNet detector. |
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs | Implements a new detector for DotNet components with caching and recursive SDK version lookup. |
src/Microsoft.ComponentDetection.Contracts/TypedComponent/ComponentType.cs | Extends the enum with a new DotNet value. |
src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs | Registers the new DotNet detector and experiment in the service collection. |
src/Microsoft.ComponentDetection.Detectors/yarn/YarnLockComponentDetector.cs | Updates the using directive to correctly reference the DotNet.Globbing namespace. |
src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs | Modifies execution call parameters to pass along the working directory. |
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
src/Microsoft.ComponentDetection.Detectors/dotnet/DotNetComponentDetector.cs
Show resolved
Hide resolved
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
The DotNetComponent type is used to report usage of the .NET SDK version
This is important as the .NET SDK will add redistributable content to the project, so using an older version may mean your application contains unserviced copies of the host or runtime. The TargetFramework and project type is reported as well since these influence what content the SDK may reference.
Some remaining work: