Skip to content

Commit 18c05b5

Browse files
committed
debug logging and debugger breakpoint
1 parent 8ac1084 commit 18c05b5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
45
using Microsoft.Build.Framework;
56
using Microsoft.Extensions.Logging;
67
using Microsoft.Extensions.Logging.MSBuild;
@@ -62,6 +63,22 @@ internal async Task<bool> ExecuteAsync(CancellationToken cancellationToken)
6263
Registry? sourceRegistry = IsLocalPull ? null : new Registry(BaseRegistry, logger, sourceRegistryMode);
6364
SourceImageReference sourceImageReference = new(sourceRegistry, BaseImageName, BaseImageTag, BaseImageDigest);
6465

66+
// easy debugging to see if host object is present in a .NET Task-host-using world.
67+
Debugger.Launch();
68+
69+
if (HostObject is System.Collections.Generic.IEnumerable<ITaskItem> items)
70+
{
71+
Log.LogMessage(MessageImportance.Low, "HostObject is present");
72+
foreach (var item in items)
73+
{
74+
Log.LogMessage(MessageImportance.Low, $"HostObject item: {item.ItemSpec} with metadata:");
75+
foreach (string name in item.MetadataNames)
76+
{
77+
Log.LogMessage(MessageImportance.Low, $" {name} = {item.GetMetadata(name)}");
78+
}
79+
}
80+
}
81+
6582
DestinationImageReference destinationImageReference = DestinationImageReference.CreateFromSettings(
6683
Repository,
6784
ImageTags,

0 commit comments

Comments
 (0)