Skip to content

Commit 8065666

Browse files
committed
Improve a comment and make the entire method conditional
1 parent ac7dd0f commit 8065666

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Build/BackEnd/Components/RequestBuilder/IntrinsicTasks/ItemGroupLoggingHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ internal static TaskParameterEventArgs CreateTaskParameterEventArgs(
272272
bool logItemMetadata,
273273
DateTime timestamp)
274274
{
275-
// Only run this method if we use AppDomains and not in the default AppDomain
275+
// Only create a snapshot of items if we use AppDomains
276276
#if FEATURE_APPDOMAIN
277277
CreateItemsSnapshot(ref items);
278278
#endif
@@ -287,14 +287,14 @@ internal static TaskParameterEventArgs CreateTaskParameterEventArgs(
287287
return args;
288288
}
289289

290+
#if FEATURE_APPDOMAIN
290291
private static void CreateItemsSnapshot(ref IList items)
291292
{
292293
if (items == null)
293294
{
294295
return;
295296
}
296297

297-
#if FEATURE_APPDOMAIN
298298
// If we're in the default AppDomain, but any of the items come from a different AppDomain
299299
// we need to take a snapshot of the items right now otherwise that AppDomain might get
300300
// unloaded by the time we want to consume the items.
@@ -320,7 +320,6 @@ private static void CreateItemsSnapshot(ref IList items)
320320
return;
321321
}
322322
}
323-
#endif
324323

325324
int count = items.Count;
326325
var cloned = new object[count];
@@ -340,6 +339,7 @@ private static void CreateItemsSnapshot(ref IList items)
340339

341340
items = cloned;
342341
}
342+
#endif
343343

344344
internal static string GetTaskParameterText(TaskParameterEventArgs args)
345345
=> GetTaskParameterText(args.Kind, args.ItemType, args.Items, args.LogItemMetadata);

0 commit comments

Comments
 (0)