Examples of errors detected by the V3177 diagnostic
V3177. Logical literal belongs to second operator with a higher priority. It is possible literal was intended to belong to '??' operator instead.
S&Box
V3177 The 'false' literal belongs to the '&&' operator with a higher priority. It is possible the literal was intended to belong to '??' operator instead. ComponentGenericTypePass.cs 346
private void RewriteTypeNames(....)
{
....
foreach ( var attribute in node.Attributes )
{
....
if ( attribute.BoundAttribute?.IsGenericTypedProperty()
?? false && attribute.TypeName != null ) {....}
else if ( attribute.TypeName == null &&
(attribute.BoundAttribute?.IsDelegateProperty() ?? false) ) {....}
else if ( attribute.TypeName == null &&
(attribute.BoundAttribute?.IsEventCallbackProperty() ?? false) ) {....}
else if ( attribute.TypeName == null ) {....}
}
....
}
Files
V3177 The 'false' literal belongs to the '||' operator with a higher priority. It is possible the literal was intended to belong to '??' operator instead. Files.App InfoPaneViewModel.cs 122
public bool LoadTagsList
=> SelectedItem?.HasTags ?? false &&
PreviewPaneState is PreviewPaneStates.NoPreviewAvailable ||
PreviewPaneState is PreviewPaneStates.PreviewAndDetailsAvailable;
MudBlazor
V3177 The 'true' literal belongs to the '&&' operator with a higher priority. It is possible the literal was intended to belong to '??' operator instead. DataGridColumnResizeService.cs 52
internal async Task<bool> StartResizeColumn(....)
{
....
// In case resize mode is column, we have to find any column right
// of the current one that can also be resized and is not hidden.
var nextResizableColumn = _columns.Skip(_....) + 1)
.FirstOrDefault(c =>
c.Resizable ?? true && !c.Hidden); // <=
....
}