Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
Examples of errors detected by the...

Examples of errors detected by the V3063 diagnostic

V3063. A part of conditional expression is always true/false if it is evaluated.


Radarr

V3063 A part of conditional expression is always false if it is evaluated: videoFormat.ContainsIgnoreCase("MPEG-4 Visual"). 199_mediainfo_to_ffmpeg.cs 205

 private void MigrateVideoCodec(MediaInfo198 mediaInfo, MediaInfo199 m, string sceneName) { if (videoFormat.ContainsIgnoreCase("MPEG-4 Visual")) { m.VideoFormat = "mpeg4"; .... return; } if ( videoFormat.ContainsIgnoreCase("MPEG-4 Visual") // <= || videoFormat.ContainsIgnoreCase("mp4v")) { m.VideoFormat = "mpeg4"; .... return; } .... } 

Radarr

V3063 A part of conditional expression is always false if it is evaluated: service.Status == ServiceControllerStatus.StopPending. ServiceProvider.cs 55

 public virtual bool IsServiceRunning(string name) { _logger.Debug("Checking if '{0}' service is running", name); .... return service != null && ( service.Status != ServiceControllerStatus.Stopped || service.Status == ServiceControllerStatus.StopPending // <= || service.Status == ServiceControllerStatus.Paused || service.Status == ServiceControllerStatus.PausePending); } 

Radarr

V3063 A part of conditional expression is always true if it is evaluated: l != null. MovieFileController.cs 122

 public object SetMovieFile([FromBody] MovieFileListResource resource) { var movieFiles = _mediaFileService.GetMovies(resource.MovieFileIds); foreach (var movieFile in movieFiles) { .... if (resource.Languages != null) { // Don't allow user to set movieFile with 'Any' or 'Original' language movieFile.Languages = resource.Languages .Where(l => l != Language.Any || l != Language.Original || l != null) .ToList(); } .... } .... } 

WolvenKit

V3063 A part of conditional expression is always false if it is evaluated: indexx == -1. ChunkViewModel.cs 4201

 private void AddCurrent(worldNodeData current) { .... if (Parent?.Data is DataBuffer db && db.Buffer.Data is IRedType irt) { if (irt is IRedArray ira && ira.InnerType.IsAssignableTo(current.GetType())) { var indexx = Parent.GetIndexOf(this) + 1; if (indexx == -1 || indexx > ira.Count) // <= { indexx = ira.Count; } ira.Insert(indexx, current); } } } .... public int GetIndexOf(ChunkViewModel child) { if (child.NodeIdxInParent > -1) { return child.NodeIdxInParent; } for (var i = 0; i < Properties.Count; i++) { if (ReferenceEquals(Properties[i], child)) { child.NodeIdxInParent = i; return i; } } return -1; } 

Entity Framework Core

V3063 A part of conditional expression is always true if it is evaluated: TryGetPartitionKeyProperty(entityType, out var partitionKeyProperty). CosmosQueryableMethodTranslatingExpressionVisitor.cs 105

 public override Expression Visit(Expression expression) { .... if ( TryGetPartitionKeyProperty(entityType, out var partitionKeyProperty) && entityTypePrimaryKeyProperties.SequenceEqual(queryProperties) && (partitionKeyProperty == null || ....) && ....) { var propertyParameterList = queryProperties.Zip(....); var readItemExpression = new ReadItemExpression(entityType, propertyParameterList); return ....; } .... } static bool TryGetPartitionKeyProperty(IEntityType entityType, out IProperty partitionKeyProperty) { var partitionKeyPropertyName = entityType.GetPartitionKeyPropertyName(); if (partitionKeyPropertyName is null) { partitionKeyProperty = null; return true; } partitionKeyProperty = entityType.FindProperty(partitionKeyPropertyName); return true; } 

Entity Framework Core

V3063 A part of conditional expression is always true if it is evaluated: !string.IsNullOrEmpty(databaseModel.DatabaseName). RelationalScaffoldingModelFactory.cs 169

 protected virtual ModelBuilder VisitDatabaseModel(....) { .... if (!string.IsNullOrEmpty(databaseModel.DatabaseName)) // <= { modelBuilder.Model.SetDatabaseName( !_options.UseDatabaseNames && !string.IsNullOrEmpty(databaseModel.DatabaseName) // <= ? _candidateNamingService.GenerateCandidateIdentifier(....) : databaseModel.DatabaseName ); } .... } 

Bitwarden

V3063 A part of conditional expression is always false if it is evaluated: sponsorship.SponsorshipLapsedDate.HasValue. OrganizationSponsorshipService.cs 308

 internal async Task DoRemoveSponsorshipAsync( Organization sponsoredOrganization, OrganizationSponsorship sponsorship = null) { .... sponsorship.SponsoredOrganizationId = null; sponsorship.FriendlyName = null; sponsorship.OfferedToEmail = null; sponsorship.PlanSponsorshipType = null; sponsorship.TimesRenewedWithoutValidation = 0; sponsorship.SponsorshipLapsedDate = null; // <= if (sponsorship.CloudSponsor || sponsorship.SponsorshipLapsedDate.HasValue) { await _organizationSponsorshipRepository.DeleteAsync(sponsorship); } else { await _organizationSponsorshipRepository.UpsertAsync(sponsorship); } } 

Bitwarden

V3063 A part of conditional expression is always false if it is evaluated: globalSettings.SelfHosted. PremiumRequestModel.cs 23

 public bool Validate(GlobalSettings globalSettings) { if(!(License == null && !globalSettings.SelfHosted) || (License != null && globalSettings.SelfHosted)) // <= { return false; } return globalSettings.SelfHosted || !string.IsNullOrWhiteSpace(Country); } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always false if it is evaluated: License != null. PremiumRequestModel.cs 23

LINQ to DB

V3063 A part of conditional expression is always true if it is evaluated: field.Field.CreateFormat != null. BasicSqlBuilder.cs 1255

 protected virtual void BuildCreateTableStatement(....) { .... if (field.Field.CreateFormat != null) { if (field.Field.CreateFormat != null && field.Identity.Length == 0) { .... } } .... } 

PeachPie

V3063 A part of conditional expression is always true if it is evaluated: num <= long.MaxValue % 16. Conversions.cs 994

 internal static NumberInfo IsNumber(....) { .... int num = AlphaNumericToDigit(c); // unexpected character: if (num <= 15) { if (l == -1) { if ( longValue < long.MaxValue / 16 || ( longValue == long.MaxValue / 16 && num <= long.MaxValue % 16)) // <= { .... } .... } .... } .... } 

Ryujinx

V3063 A part of conditional expression is always true if it is evaluated: value >= 0. NumberFormatter.cs 96

 public static string FormatUint(uint value) { if (value <= MaxDecimal && value >= 0) { return value.ToString(CultureInfo.InvariantCulture) + "u"; } .... } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always false if it is evaluated: flush. TextureManager.cs 942
  • V3063 A part of conditional expression is always false if it is evaluated: backendDisconnected. SoundIoHardwareDeviceDriver.cs 68
  • V3063 A part of conditional expression is always true if it is evaluated: info != null. SynchronizationManager.cs 132

EFCore

V3063 A part of conditional expression is always true if it is evaluated: targetType != null. EFCore InternalEntityTypeBuilder.cs 3370

 public virtual InternalEntityTypeBuilder? GetTargetEntityTypeBuilder(....) { .... var memberType = navigation.MemberInfo?.GetMemberType(); if (memberType != null) { targetType = memberType.TryGetSequenceType() ?? memberType; if ( targetType != null // <= && targetEntityType.Name == Metadata.Model .GetDisplayName(targetType)) { targetEntityType = new TypeIdentity(targetType, Metadata.Model); } } .... } 

OpenRA

V3063 A part of conditional expression is always true if it is evaluated: terrainGeometryTrait != null. MapEditorLogic.cs 35

 public class MapEditorLogic : ChromeLogic { public MapEditorLogic(....) { var editorViewport = widget .Get<EditorViewportControllerWidget>("MAP_EDITOR"); var gridButton = widget.GetOrNull<ButtonWidget>("GRID_BUTTON"); var terrainGeometryTrait = world.WorldActor .Trait<TerrainGeometryOverlay>(); if (gridButton != null && terrainGeometryTrait != null) // <= { .... } var copypasteButton = widget.GetOrNull<ButtonWidget>("COPYPASTE_BUTTON"); if (copypasteButton != null) { .... } var copyFilterDropdown = widget.Get<DropDownButtonWidget>(....); copyFilterDropdown.OnMouseDown = _ => { copyFilterDropdown.RemovePanel(); copyFilterDropdown.AttachPanel(CreateCategoriesPanel()); }; var coordinateLabel = widget.GetOrNull<LabelWidget>("COORDINATE_LABEL"); if (coordinateLabel != null) { .... } .... } .... } public sealed class Actor : .... { .... public T Trait<T>() { return World.TraitDict.Get<T>(this); } .... } class TraitDictionary { .... public T Get<T>(Actor actor) { CheckDestroyed(actor); return InnerGet<T>().Get(actor); // InnerGet<T> returns TraitContainer<T> } .... } class TraitContainer<T> : ITraitContainer { .... public T Get(Actor actor) { var result = GetOrDefault(actor); if (result == null) throw new InvalidOperationException(....); return result; } .... } 

OpenRA

V3063 A part of conditional expression is always true if it is evaluated: cancelButton != null. ConfirmationDialogs.cs 78

 public static void ButtonPrompt(....) { .... var cancelButton = prompt.GetOrNull<ButtonWidget>( "CANCEL_BUTTON" ); .... if (onCancel != null && cancelButton != null) { cancelButton.Visible = true; cancelButton.Bounds.Y += headerHeight; cancelButton.OnClick = () => { Ui.CloseWindow(); if (onCancel != null) onCancel(); }; if (!string.IsNullOrEmpty(cancelText) && cancelButton != null) cancelButton.GetText = () => cancelText; } .... } 

RavenDB

V3063 A part of conditional expression is always false if it is evaluated: m_curEdgeBlock != null. DotNetHeapDumpGraphReader.cs(803) Raven.Debug

 private Address GetNextEdge() { if (m_curEdgeBlock == null || m_curEdgeBlock.Count <= m_curEdgeIdx) { m_curEdgeBlock = null; if (m_edgeBlocks.Count == 0) { throw new ApplicationException( "Error not enough edge data. Giving up on heap dump." ); } var nextEdgeBlock = m_edgeBlocks.Dequeue(); if ( m_curEdgeBlock != null && // <= nextEdgeBlock.Index != m_curEdgeBlock.Index + 1 ) { throw new ApplicationException( "Error expected Node Index " + (m_curEdgeBlock.Index + 1) + " Got " + nextEdgeBlock.Index + " Giving up on heap dump." ); } m_curEdgeBlock = nextEdgeBlock; m_curEdgeIdx = 0; } return m_curEdgeBlock.Values(m_curEdgeIdx++).Target; } 

RavenDB

V3063 A part of conditional expression is always true if it is evaluated: isMethod. QueryParser.cs(1797) Raven.Server

 private bool Operator(OperatorField fieldOption, out QueryExpression op) { .... switch (match) { .... case "(": var isMethod = Method(field, out var method); // <= op = method; if ( isMethod && Operator(OperatorField.Optional, out var methodOperator) ) { .... } return isMethod; .... } } private bool Method(FieldExpression field, out MethodExpression op) { var args = ReadMethodArguments(); op = new MethodExpression(field.FieldValue, args); return true; } 

RavenDB

V3063 A part of conditional expression is always true if it is evaluated: Attributes != null. LicenseStatus.cs(28) Raven.Server

 public LicenseType Type { get { if (ErrorMessage != null) return LicenseType.Invalid; if (Attributes == null) return LicenseType.None; if (Attributes != null && // <= Attributes.TryGetValue("type", out object type) && type is int ) { var typeAsInt = (int)type; if (Enum.IsDefined(typeof(LicenseType), typeAsInt)) return (LicenseType)typeAsInt; } return LicenseType.Community; } } 

RunUO

V3063 A part of conditional expression is always true if it is evaluated: m_Serial <= 0x7FFFFFFF. Serial.cs 83

 public bool IsItem { get { return ( m_Serial >= 0x40000000 && m_Serial <= 0x7FFFFFFF ); } } 

OpenCvSharp

V3063 A part of conditional expression is always false if it is evaluated: data == null. Mat.cs 3539

 private void CheckArgumentsForConvert(....) { .... if (data == null) throw new ArgumentNullException(nameof(data)); MatType t = Type(); if (data == null || (data.Length * dataDimension) // <= (data.Length * dataDimension) % t.Channels != 0) .... } 

.NET Core Libraries (CoreFX)

V3063 A part of conditional expression is always true if it is evaluated: _rangelist.Count > 0. RegexCharClass.cs 523

 public void AddRange(char first, char last) { _rangelist.Add(new SingleRange(first, last)); // <= if (.... && _rangelist.Count > 0 // <= && ....) .... } 

AWS SDK for .NET

V3063 [CWE-571] A part of conditional expression is always true if it is evaluated: string.IsNullOrEmpty(inferredIndexName). AWSSDK.DynamoDBv2.PCL ContextInternal.cs 802

 private static string GetQueryIndexName(....) { .... string inferredIndexName = null; if (string.IsNullOrEmpty(specifiedIndexName) && indexNames.Count == 1) { inferredIndexName = indexNames[0]; } else if (indexNames.Contains(specifiedIndexName, StringComparer.Ordinal)) { inferredIndexName = specifiedIndexName; } else if (string.IsNullOrEmpty(inferredIndexName) && // <= indexNames.Count > 0) throw new InvalidOperationException("Local Secondary Index range key conditions are used but no index could be inferred from model. Specified index name = " + specifiedIndexName); .... } 

Unity C# reference source code

V3063 CWE-571 A part of conditional expression is always true if it is evaluated: pageSize <= 1000. UNETInterface.cs 584

 public override bool IsValid() { .... return base.IsValid() && (pageSize >= 1 || pageSize <= 1000) && totalFilters <= 10; } 

GitExtensions

V3063 A part of conditional expression is always true if it is evaluated: button.Enabled. GitUI FormStash.cs 301

 private void toolStripButton(...) { var button = (ToolStripButton)sender; if (!button.Enabled) { StashMessage.ReadOnly = true; } else if (button.Enabled && button.Checked) // <= { StashMessage.ReadOnly = false; } } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always false if it is evaluated: string.IsNullOrEmpty(_mergetool). GitUI FormResolveConflicts.cs 482

Unity3D

V3063 A part of conditional expression is always false: connId < 0. UnityEngine.Networking ConnectionArray.cs 59

 public NetworkConnection Get(int connId) { if (connId < 0) { return m_LocalConnections[Mathf.Abs(connId) - 1]; } if (connId < 0 || connId > m_Connections.Count) // <= { .... return null; } return m_Connections[connId]; } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always true: currentTest != null. UnityTestTools TestRunner.cs 237
  • V3063 A part of conditional expression is always false: connId < 0. UnityEngine.Networking ConnectionArray.cs 86
  • V3063 A part of conditional expression is always true: m_IsServer. UnityEngine.Networking NetworkIdentity.cs 53

Old NASA World Wind (C#)

V3063 A part of conditional expression is always false: currentSurfaceImage == null. SurfaceTile.cs 1069

 private bool checkSurfaceImageChange() { .... SurfaceImage currentSurfaceImage = m_ParentWorldSurfaceRenderer.SurfaceImages[i] as SurfaceImage; if(currentSurfaceImage.LastUpdate > m_LastUpdate || currentSurfaceImage.Opacity != currentSurfaceImage.ParentRenderable.Opacity) { if(currentSurfaceImage == null || // <= currentSurfaceImage.ImageTexture == null || currentSurfaceImage.ImageTexture.Disposed || !currentSurfaceImage.Enabled || ....) { continue; } else { return true; } } .... } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always true: iWildIndex==-1. GPSTrackerPlugin.APRS.cs 87
  • V3063 A part of conditional expression is always true: iWildIndex==-1. GPSTrackerPlugin.NMEA.cs 169
  • V3063 A part of conditional expression is always false: newvalue == null. SchemaTypes.cs 860

Accord.Net

V3063 A part of conditional expression is always false: i < low. Accord.Math JaggedEigenvalueDecompositionF.cs 571

 private void hqr2() { .... int low = 0; .... for (int i = 0; i < nn; i++) { if (i < low | i > high) .... } .... } 

Similar errors can be found in some other places:

  • V3063 A part of conditional expression is always false: i < low. Accord.Math JaggedEigenvalueDecompositionF.cs 972
  • V3063 A part of conditional expression is always false: i < low. Accord.Math JaggedEigenvalueDecomposition.cs 571
  • V3063 A part of conditional expression is always false: i < low. Accord.Math JaggedEigenvalueDecomposition.cs 972
  • And 1 additional diagnostic messages.

ML.NET

V3063 A part of conditional expression is always false if it is evaluated: type == IntArrayType.Dense. IntArray.cs 129

 public static IntArray New(...., IntArrayType type, IntArrayBits bitsPerItem) { .... Contracts.CheckParam(type == IntArrayType.Current || type == IntArrayType.Repeat || type == IntArrayType.Segmented, nameof(type)); if (type == IntArrayType.Dense || bitsPerItem == IntArrayBits.Bits0) { .... } else if (type == IntArrayType.Sparse) return new DeltaSparseIntArray(length, bitsPerItem); .... return null; } 

Xamarin.Forms

V3063 A part of conditional expression is always true: exception == null. Xamarin.Forms.Xaml ApplyPropertiesVisitor.cs 280

 static BindableProperty GetBindableProperty(Type elementType, string localName, IXmlLineInfo lineInfo, bool throwOnError = false) { .... Exception exception = null; if (exception == null && bindableFieldInfo == null) { exception = new XamlParseException( string.Format("BindableProperty {0} not found on {1}", localName + "Property", elementType.Name), lineInfo); } .... }