Skip to content

Commit 3dac33a

Browse files
Potential fix for code scanning alert no. 82: Missed opportunity to use Where
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent f692404 commit 3dac33a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Caliburn.Micro.Core/SimpleContainer.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,9 @@ public IEnumerable<object> GetAllInstances(Type service, string key = null)
181181

182182
var instances = currentEntry.Select(e => e(this));
183183

184-
foreach (var instance in instances)
184+
foreach (var instance in instances.Where(instance => EnablePropertyInjection && instance != null))
185185
{
186-
if (EnablePropertyInjection && instance != null)
187-
{
188-
BuildUp(instance);
189-
}
186+
BuildUp(instance);
190187
}
191188

192189
return instances;

0 commit comments

Comments
 (0)