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.
S&Box
V3220 The result of the 'Where' LINQ method with deferred execution is never used. The method will not be executed. MountHost.cs 114
internal void UnregisterTypes( Assembly assembly )
{
var assetSourceType = typeof( BaseGameMount );
var types = assembly
.GetTypes().Where( t =>
assetSourceType.IsAssignableFrom( t )
&& !t.IsAbstract );
foreach ( var (ident, source) in Sources.ToArray() )
{
if ( source.GetType().Assembly != assembly ) continue;
if ( source.IsMounted ){ PendingMounts.Add( ident ); }
source.ShutdownInternal();
Sources.Remove( ident );
}
}
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}");
}
}