Migrates unit tests to use RoslynCodeTaskFactory to enable running tests under .NET Core#13500
Migrates unit tests to use RoslynCodeTaskFactory to enable running tests under .NET Core#13500jankratochvilcz wants to merge 1 commit intomainfrom
Conversation
…sts under .NET Core
| /// <summary> | ||
| /// If an item being output from a task has null metadata, we shouldn't crash. | ||
| /// </summary> | ||
| [Fact(Skip = "This test fails when diagnostic logging is available, as deprecated EscapingUtilities.UnescapeAll method cannot handle null value. This is not relevant to non-deprecated version of this method.")] |
There was a problem hiding this comment.
Happy to discuss this, I deleted this mostly since I don't see a ticket to bring this back online, let me know what would be a good other action here
| { | ||
| string projectContents = @" | ||
| <Project xmlns='msbuildnamespace' ToolsVersion='msbuilddefaulttoolsversion'> | ||
| <UsingTask TaskName=`NullMetadataTask_v12` TaskFactory=`CodeTaskFactory` AssemblyFile=`$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll`> |
There was a problem hiding this comment.
Would be curious about the meaning of "v12" here, it seems a bit arbitrary but there could be some reason I'm not catching.
There was a problem hiding this comment.
Pull request overview
This PR migrates a first batch of unit tests away from CodeTaskFactory to RoslynCodeTaskFactory to enable running the tests under .NET Core, aligning with the repo direction described in #248.
Changes:
- Updated several inline-task-based test projects to use
RoslynCodeTaskFactoryinstead ofCodeTaskFactory. - Removed
FEATURE_CODETASKFACTORYcompilation guards around the updated tests so they run in more configurations. - Deleted a couple of previously skipped legacy inline-task tests (that relied on older task assemblies / behavior).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Build.UnitTests/BackEnd/TaskHost_Tests.cs |
Switches inline tasks in “log after task is done” tests to RoslynCodeTaskFactory and modernizes the embedded project XML. |
src/Build.UnitTests/BackEnd/TaskBuilder_Tests.cs |
Updates the null-metadata inline-task test to RoslynCodeTaskFactory, adjusts test naming/comment text, and removes skipped legacy inline-task tests. |
@dotnet-policy-service agree company="Microsoft" |
Fixes #248
Context
I'm trying to migrate the tests so we can run them on .NET Core as indicated in the task.
Doing a small first batch first to catch any concerns and understand repo mechanics, will do a bigger volume in a follow-up PR.
Changes Made
Testing
Tests should be passing for both Framework and Core flavors.
Notes