Skip to content

[tools] Use instance-based Log methods.#25566

Merged
rolfbjarne merged 8 commits into
mainfrom
dev/rolf/tools-less-static-state-log
Jun 2, 2026
Merged

[tools] Use instance-based Log methods.#25566
rolfbjarne merged 8 commits into
mainfrom
dev/rolf/tools-less-static-state-log

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

This will become important soon, because much of the code here will run from
inside an MSBuild task, and we mustn't call Console.[Error.]WriteLine from
inside an MSBuild task (it can cause tasks to deadlock). With these changes
it'll be much easier to remap Log calls to MSBuild's Task.LogMessage method.

This will become important soon, because much of the code here will run from
inside an MSBuild task, and we mustn't call Console.[Error.]WriteLine from
inside an MSBuild task (it can cause tasks to deadlock). With these changes
it'll be much easier to remap Log calls to MSBuild's Task.LogMessage method.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors tool logging from static Driver/console-based calls to instance-based IToolLog plumbing, preparing shared tooling code to run safely inside MSBuild tasks without direct console writes.

Changes:

  • Introduces IToolLog and implements it for tool applications, bgen, console logging, and MSBuild tasks.
  • Threads logging instances through shared helpers such as Driver, ErrorHelper, FileCopier, cache, resolver, Mach-O, and linker steps.
  • Updates MSBuild task verbosity and file-copy integration to use the new logging abstraction.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/mtouch/mtouch.csproj Links the shared logging abstraction into mtouch.
tools/mtouch/AssemblyResolver.cs Threads Application logging into assembly resolution.
tools/linker/RegistrarRemovalTrackingStep.cs Uses application-scoped logging/warnings.
tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs Replaces static logging with linker context app logging.
tools/linker/CoreOptimizeGeneratedCode.cs Threads logging through optimization helpers and warnings.
tools/dotnet-linker/Steps/ManagedRegistrarStep.cs Passes app logger to error reporting.
tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs Uses app logging for diagnostic messages.
tools/dotnet-linker/Steps/InlineDlfcnMethodsStep.cs Uses app logging for inlining diagnostics.
tools/dotnet-linker/Steps/InlineClassGetHandleStep.cs Uses app logging and instance-based file writes.
tools/dotnet-linker/Steps/ExceptionalMarkHandler.cs Exposes Application to derived handlers.
tools/dotnet-linker/PreserveSmartEnumConversionsStep.cs Adds app logging for smart enum diagnostics.
tools/dotnet-linker/LinkerConfiguration.cs Moves linker verbosity/log output to Application/IToolLog.
tools/dotnet-linker/DotNetResolver.cs Adds constructor shape for app-aware resolver creation.
tools/dotnet-linker/dotnet-linker.csproj Links the shared logging abstraction into dotnet-linker.
tools/dotnet-linker/BackingFieldDelayHandler.cs Passes app logger into validation helpers.
tools/common/Target.cs Threads logging through realpath, file writes, and generated main verbosity.
tools/common/StaticRegistrar.cs Updates registrar logging/error reporting to use App.
tools/common/PInvokeWrapperGenerator.cs Uses instance-aware file writing.
tools/common/MachO.cs Replaces console diagnostics with IToolLog.
tools/common/IToolLog.cs Adds the shared logging interface, extensions, and console implementation.
tools/common/Frameworks.cs Uses app logging for framework filtering diagnostics.
tools/common/FileCopier.cs Reworks copy/update logging and callbacks around IToolLog.
tools/common/ErrorHelper.tools.cs Makes warning/error display logger-aware.
tools/common/Driver.execution.cs Makes command execution logger-aware.
tools/common/Driver.cs Removes static verbosity/log helpers and threads IToolLog.
tools/common/CoreResolver.cs Threads logging through resolver load/search warnings.
tools/common/cache.cs Makes cache location/comparison logging instance-aware.
tools/common/Assembly.cs Uses application logging/cache APIs throughout assembly processing.
tools/common/Application.cs Implements IToolLog and initializes app-scoped resolver/verbosity.
src/ObjCRuntime/Registrar.cs Updates registrar warning dispatch/signatures.
src/ObjCRuntime/DynamicRegistrar.cs Updates override signature for nullable args.
src/bgen/BindingTouch.cs Implements IToolLog for bgen and uses instance verbosity.
src/bgen/bgen.csproj Includes the shared logging abstraction in bgen.
msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj Links the shared logging abstraction into MSBuild tasks.
msbuild/Xamarin.MacDev.Tasks/VerbosityUtils.cs Converts verbosity rendering/parsing to integer levels.
msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs Implements IToolLog for MSBuild tasks.
msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArguments.cs Hides base verbosity for existing output property.
msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundles.cs Uses task logging with FileCopier.
msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackage.cs Uses task logging with FileCopier.
msbuild/Xamarin.MacDev.Tasks/Tasks/BGen.cs Renders verbosity through the new helper.
msbuild/Xamarin.MacDev.Tasks/Decompress.cs Uses task logging with FileCopier up-to-date checks.

Comment thread msbuild/Xamarin.MacDev.Tasks/Tasks/BGen.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review May 28, 2026 17:36
@rolfbjarne rolfbjarne requested a review from mauroa as a code owner May 28, 2026 17:36
@rolfbjarne

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) June 1, 2026 06:50
@rolfbjarne

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@rolfbjarne

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #5dac028] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 5dac0288166f37a84b73a30ce7732bff4a4446e4 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #5dac028] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 5dac0288166f37a84b73a30ce7732bff4a4446e4 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 5dac0288166f37a84b73a30ce7732bff4a4446e4 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ [PR Build #5dac028] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 5dac0288166f37a84b73a30ce7732bff4a4446e4 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #5dac028] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 193 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 5dac0288166f37a84b73a30ce7732bff4a4446e4 [PR build]

@rolfbjarne rolfbjarne merged commit a6b6c3c into main Jun 2, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants