Examples of errors detected by the V3220 diagnostic
V3220. The result of the LINQ method with deferred execution is never used. The method will not be executed.
QuantConnect Lean
V3220 The result of the 'Where' LINQ method with deferred execution is never used. The method will not be executed. AddOptionWithOnMarketOpenOnlyFilterRegressionAlgorithm.cs 58
public override void OnSecuritiesChanged(SecurityChanges changes)
{
if (changes.AddedSecurities.All(s => s.Type != SecurityType.Option))
{
return;
}
var changeOptions = changes.AddedSecurities
.Concat(changes.RemovedSecurities
.Where(s => s.Type == SecurityType.Option);
if (Time != Time.Date)
{
throw new RegressionTestException($"Expected options filter to be run
only at midnight. Actual was {Time}");
}
}