Reduce IVT by using Embedded attribute and source link#7443
Draft
Evangelink wants to merge 3 commits intomainfrom
Draft
Reduce IVT by using Embedded attribute and source link#7443Evangelink wants to merge 3 commits intomainfrom
Evangelink wants to merge 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request reduces the InternalsVisibleTo (IVT) surface area by marking internal helper classes with the [Embedded] attribute and source-linking them into consuming projects. This approach allows types to be embedded at compile time rather than accessing them via InternalsVisibleTo, reducing binary coupling and avoiding breaking changes when modifying these types.
Changes:
- Added
[Embedded]attribute to internal helper classes (ApplicationStateGuard, ExitCodes, EnvironmentVariableConstants, RoslynString, TimeoutHelper, TimeSpanParser, TargetFrameworkParser) - Removed 4 InternalsVisibleTo entries that are no longer needed
- Added
TESTING_PLATFORM_SOURCE_EMBEDDEDconditional compilation symbol to projects that embed sources - Added conditional compilation to use hardcoded error messages in embedded contexts instead of resource files
- Replaced hardcoded string with constant reference in MSBuild task
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj | Removed 4 IVT entries that are no longer needed (TrxReport.Abstractions, VSTestBridge.TestAdapter, MSTest.Acceptance.IntegrationTests, MSTest.IntegrationTests) |
| src/Platform/Microsoft.Testing.Platform/Helpers/*.cs | Added [Embedded] attribute to helper classes (ApplicationStateGuard, ExitCodes, EnvironmentVariableConstants, RoslynString, TimeoutHelper, TimeSpanParser) |
| src/Platform/Microsoft.Testing.Platform/OutputDevice/TargetFrameworkParser.cs | Added [Embedded] attribute |
| src/Platform/Microsoft.Testing.Platform/IPC/NamedPipeServer.cs | Added conditional compilation to use hardcoded error messages when TESTING_PLATFORM_SOURCE_EMBEDDED is defined |
| src/Platform/Microsoft.Testing.Platform/IPC/NamedPipeBase.cs | Added conditional compilation to use hardcoded error messages when TESTING_PLATFORM_SOURCE_EMBEDDED is defined |
| src/Platform/Microsoft.Testing.Platform.MSBuild/Microsoft.Testing.Platform.MSBuild.csproj | Added TESTING_PLATFORM_SOURCE_EMBEDDED constant, embedded helper files, added CS0436 to NoWarn |
| src/Platform/Microsoft.Testing.Platform.MSBuild/Tasks/InvokeTestingPlatformTask.cs | Replaced hardcoded "TestResults" reference with proper string literal (removing dependency on AggregatedConfiguration) |
| src/Platform/Microsoft.Testing.Extensions.*/**.csproj | Added TESTING_PLATFORM_SOURCE_EMBEDDED constant and embedded necessary helper files from Microsoft.Testing.Platform |
| test//.csproj | Added TESTING_PLATFORM_SOURCE_EMBEDDED constant, embedded helper files, and added Polyfill package where needed |
src/Platform/Microsoft.Testing.Platform.MSBuild/Microsoft.Testing.Platform.MSBuild.csproj
Show resolved
Hide resolved
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.