Migrate FindAssembliesWithReferencesTo to IMultiThreadableTask#54748
Migrate FindAssembliesWithReferencesTo to IMultiThreadableTask#54748OvesN wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Razor SDK task FindAssembliesWithReferencesTo to MSBuild’s IMultiThreadableTask model (per dotnet/msbuild#14051), flowing TaskEnvironment through to reference scanning so file I/O resolves relative paths correctly under multi-threaded builds.
Changes:
- Mark
FindAssembliesWithReferencesToas[MSBuildMultiThreadableTask], implementIMultiThreadableTask, and passTaskEnvironmentinto the resolver. - Update
ReferenceResolverto resolve assembly paths viaTaskEnvironment.GetAbsolutePath(...)before performingFile.Exists/File.OpenRead. - Add a new
agency.tomlconfiguration file at repo root.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/RazorSdk/Tasks/ReferenceResolver.cs | Accepts TaskEnvironment and uses it to absolutize paths; refactors lookup dictionary initialization. |
| src/RazorSdk/Tasks/FindAssembliesWithReferencesTo.cs | Migrates the task to IMultiThreadableTask and flows TaskEnvironment into ReferenceResolver. |
| agency.toml | Introduces an MCP server configuration entry (appears unrelated to the PR’s stated purpose). |
Expert review —
|
jankratochvilcz
left a comment
There was a problem hiding this comment.
Thank you! The main bit for me is the architectural comment
| public ReferenceResolver( | ||
| IReadOnlyList<string> targetAssemblies, | ||
| IReadOnlyList<AssemblyItem> assemblyItems, | ||
| TaskEnvironment? taskEnvironment) |
There was a problem hiding this comment.
Hm, it worries me here that we have the pattern of passing around environment, which makes things quite implicit - we discussed previously that we want to use tasks as a boundary and do the transforms there without passing the environment deeper into the call chain. Looking here, it seems like here it would mean that we change the AssemblyItem.Path to an AbsolutePath - I briefly checked and the AssemblyItem seems not that widely used, so it might be viable. What do you think @OvesN?
| [Fact] | ||
| public void GetReferences_RelativePath_ResolvesAgainstTaskEnvironmentProjectDirectory() | ||
| { | ||
| // The point of the migration: relative paths must be absolutized against |
There was a problem hiding this comment.
Please let's not reference "the migration" as it's unclear what that means outside of the context of the PR
|
|
||
|
|
||
| [Fact] | ||
| public void Execute_PassesTaskEnvironmentToResolver_AndResolvesRelativeAssemblyItemSpecs() |
There was a problem hiding this comment.
Should we also add a negative test?
Fixes dotnet/msbuild#14051
Migrate FindAssembliesWithReferencesTo to IMultiThreadableTask