Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V308…

Examples of errors detected by the V3080 diagnostic

V3080. Possible null dereference.


Barotrauma

V3080 Possible null dereference. Consider inspecting 'value'. MetadataModels.cs 132


public void RecreateSprites()
{
  ....
  if (_deformSprite != null)
  {
    _deformSprite.Remove();

    var source = _deformSprite.Sprite.SourceElement;

    _deformSprite = new DeformableSprite(source, ....);
  }
  ....
  for (int i = 0; i < DecorativeSprites.Count; i++)
  {
    var decorativeSprite = DecorativeSprites[i];

    decorativeSprite.Remove();

    var source = decorativeSprite.Sprite.SourceElement;        // <=

    DecorativeSprites[i] = new DecorativeSprite(source, ....);
  }
}

Stride

V3080 Possible null dereference. Consider inspecting 'value'. MetadataModels.cs 132


public Palette GlobalPalette
{
  get {....}
  set
  {
    SetTagValue("GlobalPalette", (value != null) ? null : value.Data);
  }
}

Stride

V3080 Possible null dereference. Consider inspecting 'PreviewService'. PreviewViewModel.cs 109


private IAssetPreviewService PreviewService
{
  get
  {
    if (previewService != null)
      return previewService;

    previewService = ServiceProvider.TryGet<IAssetPreviewService>();
    if (previewService == null)
      return null;

    previewService.PreviewAssetUpdated += PreviewAssetUpdated;
      return previewService;
  }
}

....

private void SetIsVisible(bool isVisible)
{
  if (isVisible)
    PreviewService.OnShowPreview();
  else
    PreviewService.OnHidePreview();
}

Accord.Net

V3080 Possible null dereference. Consider inspecting 'fmt'. Accord.Statistics MultivariateMixture'1.cs 697


public override string ToString(string format,
                                IFormatProvider formatProvider)
{
  ....
  var fmt = components[i] as IFormattable;
  if (fmt != null)
    sb.AppendFormat(fmt.ToString(format, formatProvider));
  else
    sb.AppendFormat(fmt.ToString());
  ....
}

Old NASA World Wind (C#)

V3080 Possible null dereference. Consider inspecting 'm_gpsIcon'. GpsTrackerPlugin.SourceSetup.cs 68


public GpsSetup(....)
{
  ....
  if (m_gpsIcon!=null)
  {
    ....
    labelTitle.Text = "Set options for " +
                      m_gpsIcon.m_RenderInfo.sDescription;
  }
  else
  if (m_gpsTrackLine != null)
  {
    ....
    labelTitle.Text = "Set options for " +
                      m_gpsIcon.m_RenderInfo.sDescription; // <=
  }
  ....
}

Unity3D

V3080 Possible null dereference. Consider inspecting 't.staticFieldBytes'. MemoryProfiller CrawledDataUnpacker.cs 20


public static CrawledMemorySnapshot Unpack(....)
{
  ....
  var result = new CrawledMemorySnapshot
  {
    ....
    staticFields = packedSnapshot.typeDescriptions
      .Where(t =>
        t.staticFieldBytes != null & // <=
        t.staticFieldBytes.Length > 0)
      .Select(t => UnpackStaticFields(t))
      .ToArray(),
    ....
  };
  ....
}

PowerShell

V3080 Possible null dereference. Consider inspecting 'ItemSelectionCondition'. System.Management.Automation displayDescriptionData_List.cs 352


internal bool SafeForExport()
{
  return DisplayEntry.SafeForExport() &&
         ItemSelectionCondition == null
      || ItemSelectionCondition.SafeForExport();
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'EntrySelectedBy'. System.Management.Automation displayDescriptionData_Wide.cs 247

PowerShell

V3080 Possible null dereference. Consider inspecting 'providerName'. System.Management.Automation SessionStateProviderAPIs.cs 1004


internal Collection<ProviderInfo> GetProvider(
  PSSnapinQualifiedName providerName)
{
  ....
  if (providerName == null)
  {
    ProviderNotFoundException e =
      new ProviderNotFoundException(
          providerName.ToString(),
          SessionStateCategory.CmdletProvider,
          "ProviderNotFound",
          SessionStateStrings.ProviderNotFound);

    throw e;
  }
  ....
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'job'. System.Management.Automation PowerShellETWTracer.cs 1088

Umbraco

V3080 Possible null dereference. Consider inspecting 'context.Request'. StateHelper.cs 369


public static bool HasCookies
{
  get
  {
    var context = HttpContext;
    return context != null && context.Request != null &
           context.Request.Cookies != null &&
           context.Response != null &&
           context.Response.Cookies != null;
  }
}

Media Portal 2

V3080 Possible null dereference. Consider inspecting 'BannerPath'. TvdbBannerWithThumb.cs 91


public bool LoadThumb(bool replaceOld)
{
  ....
  if (ThumbPath == null &&
     (BannerPath != null || BannerPath.Equals(""))) // <=
  {
    ThumbPath = String.Concat("_cache/", BannerPath);
  }
  ....
}

.NET Core Libraries (CoreFX)

V3080 Possible null dereference. Consider inspecting 'tabClasses'. PropertyTabAttribute.cs 225


private void InitializeArrays(string[] tabClassNames,
  Type[] tabClasses, PropertyTabScope[] tabScopes)
{
  if (tabClasses != null)
  {
    if (tabScopes != null &&
        tabClasses.Length != tabScopes.Length)
    {
      ....
    }
    _tabClasses = (Type[])tabClasses.Clone();
  }
  else if (tabClassNames != null)
  {
    if (tabScopes != null &&
        tabClasses.Length != tabScopes.Length) // <=
    {
      ....
    }
    _tabClassNames = (string[])tabClassNames.Clone();
    _tabClasses = null;
  }

  ....
}

Used 'tabClasses' instead of 'tabClassNames'.

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'BaseSimpleType'. SimpleType.cs 368

PascalABC.NET

V3080 Possible null dereference. Consider inspecting 'tc'. CodeCompletion CodeCompletionPCUReader.cs 736


private TypeScope GetTemplateInstance()
{
  TypeScope tc = null;//GetTemplateClassReference();
  int params_count = br.ReadInt32();
  for (int i = 0; i < params_count; i++)
  {
    tc.AddGenericInstanciation(GetTypeReference());  // <=
  }
  return tc;
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'bfc'. TreeConverter syntax_tree_visitor.cs 7334
  • V3080 Possible null dereference. Consider inspecting 'bfc'. TreeConverter syntax_tree_visitor.cs 7336
  • V3080 Possible null dereference. Consider inspecting 'bfc'. TreeConverter syntax_tree_visitor.cs 7338
  • And 5 additional diagnostic messages.

Unity C# reference source code

V3080 CWE-476 Possible null dereference. Consider inspecting 'm_Parent'. EditorWindow.cs 449


public void ShowPopup()
{
  if (m_Parent == null)
  {
    ....
    Rect r = m_Parent.borderSize.Add(....);
    ....
  }
}

Unity C# reference source code

V3080 CWE-476 Possible null dereference. Consider inspecting 'm_Parent'. EditorWindow.cs 470


internal void ShowWithMode(ShowMode mode)
{
  if (m_Parent == null)
  {
    ....
    Rect r = m_Parent.borderSize.Add(....);
    ....
}

Unity C# reference source code

V3080 CWE-476 Possible null dereference. Consider inspecting 'objects'. TypeSelectionList.cs 48


public TypeSelection(string typeName, Object[] objects)
{
  System.Diagnostics.Debug.Assert(objects != null ||
                                  objects.Length >= 1);
  ....
}

Unity C# reference source code

V3080 CWE-476 Possible null dereference. Consider inspecting 'm_RowRects'. TreeViewControlGUI.cs 272


public override void GetFirstAndLastRowVisible(....)
{
  ....
  if (rowCount != m_RowRects.Count)
  {
    m_RowRects = null;
    throw new InvalidOperationException(string.Format("....",
              rowCount, m_RowRects.Count));
  }
  ....
}

Unity C# reference source code

V3080 CWE-476 Possible null dereference. Consider inspecting 'additionalOptions'. MonoCrossCompile.cs 279


static void CrossCompileAOT(....)
{
  ....
  if (additionalOptions != null & additionalOptions.Trim().Length
      > 0)
    arguments += additionalOptions.Trim() + ",";
  ....
}

Infer.NET

V3080 Possible null dereference. Consider inspecting 'value'. Compiler WriteHelpers.cs 78


public static void WriteAttribute(TextWriter writer,
                                  string name,
                                  object defaultValue,
                                  object value,
                                  Func<object, string> converter = null)
{
  if (defaultValue == null && value == null || value.Equals(defaultValue))
  {
    return;
  }

  string stringValue = converter == null ? value.ToString() : converter(value);
  writer.Write($"{name}=\"{stringValue}\" ");
}

Infer.NET

V3080 Possible null dereference. Consider inspecting 'traitFeatureWeightDistribution'. Recommender FeatureParameterDistribution.cs 65


public FeatureParameterDistribution(
         GaussianMatrix traitFeatureWeightDistribution,
         GaussianArray biasFeatureWeightDistribution)
{
  Debug.Assert(
    (traitFeatureWeightDistribution == null &&
     biasFeatureWeightDistribution == null)
     ||
     traitFeatureWeightDistribution.All(
       w =>    w != null
            && w.Count == biasFeatureWeightDistribution.Count),
    "The provided distributions should be valid
     and consistent in the number of features.");
  ....
}

.NET Core Libraries (CoreFX)

V3080 Possible null dereference. Consider inspecting 'attr'. DbConnectionStringBuilder.cs 534


private PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
  ....
  foreach (Attribute attribute in attributes)
  {
    Attribute attr = property.Attributes[attribute.GetType()];
    if (   (attr == null && !attribute.IsDefaultAttribute())
        || !attr.Match(attribute))
      ....
  }
  ....
}

.NET Core Libraries (CoreFX)

V3080 Possible null dereference. Consider inspecting 'hasher'. PKCS1MaskGenerationMethod.cs 37


public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn)
{
  using (HashAlgorithm hasher
    = (HashAlgorithm)CryptoConfig.CreateFromName(_hashNameValue)) // <=
  {
    ....
    for (....)
    {
      ....
      hasher.TransformBlock(rgbSeed, 0, rgbSeed.Length, rgbSeed, 0); // <=
      ....
    }
    return rgbT;
  }
}

public static object CreateFromName(string name)
{
  return CreateFromName(name, null);
}

public static object CreateFromName(string name, params object[] args)
{
  ....
  if (retvalType == null)
  {
    return null;
  }
  ....
  if (cons == null)
  {
    return null;
  }
  ....

  if (candidates.Count == 0)
  {
    return null;
  }
  ....
  if (rci == null || typeof(Delegate).IsAssignableFrom(rci.DeclaringType))
  {
    return null;
  }
  ....
  return retval;
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'item'. SignatureDescription.cs 31
  • V3080 Possible null dereference. Consider inspecting 'item'. SignatureDescription.cs 38

Roslyn Analyzers

V3080 Possible null dereference of method return value. Consider inspecting: GetCandidateReferencedSymbols(...). SyntaxNodeHelper.cs 78


public static IEnumerable<IMethodSymbol> GetCandidateCalleeMethodSymbols(
  SyntaxNode node, SemanticModel semanticModel)
{
  foreach (ISymbol symbol in GetCandidateReferencedSymbols(
                              node, semanticModel))
  {
     if (symbol != null && symbol.Kind == SymbolKind.Method)
     {
        yield return (IMethodSymbol)symbol;
     }
  }
}

Roslyn Analyzers

V3080 Possible null dereference. Consider inspecting 'oldIdName'. CodeFixProvider.cs 1476


private async Task<Document> IdDeclTypeAsync(....)
{
  ....
  ExpressionSyntax oldIdName = null;
  foreach (MemberDeclarationSyntax memberSyntax in members)
  {
     var fieldDeclaration = memberSyntax as FieldDeclarationSyntax;
     if (fieldDeclaration == null)
       continue;
     if (fieldDeclaration.Declaration.Type is IdentifierNameSyntax fieldType
         && fieldType.Identifier.Text == "DiagnosticDescriptor")
     {
       ....
       for (int i = 0; i < ruleArgumentList.Arguments.Count; i++)
       {
         ArgumentSyntax currentArg = ruleArgumentList.Arguments[i];
         string currentArgName = currentArg.NameColon.Name.Identifier.Text;
         if (currentArgName == "id")
         {
           oldIdName = currentArg.Expression;
           break;
         }
       }
       continue;
    }
    ....
  }
  var newRule = rule.ReplaceNode(oldIdName.Ancestors()   // <=
                    .OfType<ArgumentSyntax>()
                    .First(), newArg);
  ....
}

Roslyn Analyzers

V3080 Possible null dereference. Consider inspecting 'methodDeclaration'. DiagnosticAnalyzer.cs 506


private bool CheckIfStatementAnalysis(...
  IMethodSymbol analysisMethodSymbol)
{
  var methodDeclaration = AnalysisGetStatements(analysisMethodSymbol)
                           as MethodDeclarationSyntax;
  var body = methodDeclaration.Body as BlockSyntax;
  if (body == null)
  { return false; }
  ....
}

private MethodDeclarationSyntax AnalysisGetStatements(
   IMethodSymbol
   analysisMethodSymbol)
{
  MethodDeclarationSyntax result = null;
  if (analysisMethodSymbol == null)
  {
     return result;
  }
  var methodDeclaration = analysisMethodSymbol
                            .DeclaringSyntaxReferences[0]
                            .GetSyntax() as MethodDeclarationSyntax;
  if (methodDeclaration == null)
  {
     return result;
  }
  return methodDeclaration;
}

Orchard CMS

V3080 Possible null dereference. Consider inspecting 'itemTag'. CoreShapes.cs 92


public async Task<IHtmlContent> List(.... string ItemTag....)
{
  ....
  string itemTagName = null;
  if (ItemTag != "-")
  {
    itemTagName = string.IsNullOrEmpty(ItemTag) ? "li" : ItemTag;
  }
  var index = 0;
  foreach (var item in items)
  {
    var itemTag = String.IsNullOrEmpty(itemTagName) ? null : ....;
    ....
    itemTag.InnerHtml.AppendHtml(itemContent);
    listTag.InnerHtml.AppendHtml(itemTag);
    ++index;
  }
  return listTag;
}

Orchard CMS

V3080 Possible null dereference of method return value. Consider inspecting: CreateScope(). SetupService.cs 136


public async Task<string> SetupInternalAsync(SetupContext context)
{
  ....
  using (var shellContext = await ....)
  {
    await shellContext.CreateScope().UsingAsync(....);
  }
  ....
}

public ShellScope CreateScope()
{
  if (_placeHolder)
  {
    return null;
  }
  var scope = new ShellScope(this);
  // A new scope can be only used on a non released shell.
  if (!released)
  {
    return scope;
  }
  scope.Dispose();
  return null;
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference of method return value. Consider inspecting: CreateScope(). SetupService.cs 192

Orchard CMS

V3080 Possible null dereference. Consider inspecting 'request'. GraphQLMiddleware.cs 148


private async Task ExecuteAsync(HttpContext context....)
{
  ....
  GraphQLRequest request = null;
  ....
  if (HttpMethods.IsPost(context.Request.Method))
  {
    ....
  }
  else if (HttpMethods.IsGet(context.Request.Method))
  {
    ....
    request = new GraphQLRequest();
    ....
  }
  var queryToExecute = request.Query;
  ....
}

public static TElement Get<TElement>(this ContentElement contentElement....)
        where TElement : ContentElement
{
    return (TElement)contentElement.Get(typeof(TElement), name);
}

public static ContentElement Get(this ContentElement contentElement....)
{
  ....
  var elementData = contentElement.Data[name] as JObject;
  if (elementData == null)
  {
    return null;
  }
  ....
}

Orchard CMS

V3080 Possible null dereference of method return value. Consider inspecting: Get<ContentPart>(...). ContentPartHandlerCoordinator.cs 190


public override async Task LoadingAsync(LoadContentContext context)
{
  ....
  context.ContentItem.Get<ContentPart>(typePartDefinition.Name)
                     .Weld(fieldName, fieldActivator.CreateInstance());
  ....
}

public static async Task<IEnumerable> QueryAsync(....)
{
  ....
  var query = await queryManager.GetQueryAsync(queryName);
  if (query == null)
  {
    return null;
  }
  ....
}

Orchard CMS

V3080 Possible null dereference. Consider inspecting 'results'. ContentQueryOrchardRazorHelperExtensions.cs 19


public static async Task<IEnumerable<ContentItem>> ContentQueryAsync(....)
{
  var results = await orchardHelper.QueryAsync(queryName, parameters);
  ....
  foreach (var result in results)
  {
    ....
  }
  ....
}

Azure SDK for .NET

V3080 Possible null dereference. Consider inspecting 'eventPropertyValue'. AmqpMessageConverter.cs 650


private static bool TryCreateEventPropertyForAmqpProperty(
  object amqpPropertyValue,
  out object eventPropertyValue)
{
  eventPropertyValue = null;
  ....
  switch (GetTypeIdentifier(amqpPropertyValue))
  {
    case AmqpProperty.Type.Byte:
    ....
    case AmqpProperty.Type.String:
      eventPropertyValue = amqpPropertyValue;
      return true;
    ....
  }
  ....
  switch (amqpPropertyValue)
  {
    case AmqpSymbol symbol:
      eventPropertyValue = ....;
      break;

    case byte[] array:
      eventPropertyValue = ....;
      break;

    case ArraySegment<byte> segment when segment.Count == segment.Array.Length:
      eventPropertyValue = ....;
      break;

    case ArraySegment<byte> segment:
      ....
      eventPropertyValue = ....;
      break;

    case DescribedType described when (described.Descriptor is AmqpSymbol):
      eventPropertyValue = ....;
      break;

    default:
      var exception = new SerializationException(
        string.Format(...., eventPropertyValue.GetType().FullName));  // <=
      ....
  }
  ....
}

AvaloniaUI

V3080 Possible null dereference of method return value. Consider inspecting: TranslatePoint(...). VisualExtensions.cs 23


public static Point PointToClient(this IVisual visual, PixelPoint point)
{
  var rootPoint = visual.VisualRoot.PointToClient(point);
  return visual.VisualRoot.TranslatePoint(rootPoint, visual).Value;
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'p'. VisualExtensions.cs 35
  • V3080 Possible null dereference. Consider inspecting 'controlPoint'. Scene.cs 176

AvaloniaUI

V3080 Possible null dereference of method return value. Consider inspecting: TransformToVisual(...). ViewportManager.cs 381


private void OnEffectiveViewportChanged(TransformedBounds? bounds)
{
  ....
  var transform = _owner.GetVisualRoot().TransformToVisual(_owner).Value;
  ....
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'transform'. MouseDevice.cs 80

AvaloniaUI

V3080 Possible null dereference. Consider inspecting 'tabItem'. TabItemContainerGenerator.cs 22


protected override IControl CreateContainer(object item)
{
  var tabItem = (TabItem)base.CreateContainer(item);
  tabItem.ParentTabControl = Owner;
  ....
}

osu!

V3080 [CWE-476] Possible null dereference. Consider inspecting 'Beatmap'. WorkingBeatmap.cs 57


protected virtual Track GetVirtualTrack()
{
  ....
  var lastObject = Beatmap.HitObjects.LastOrDefault();
  ....
}

public IBeatmap Beatmap
{
  get
  {
    try
    {
      return LoadBeatmapAsync().Result;
    }
    catch (TaskCanceledException)
    {
      return null;
    }
  }
}

RunUO

V3080 Possible null dereference. Consider inspecting 'winner'. CTF.cs 1302


private void Finish_Callback()
{
  ....
  CTFTeamInfo winner = ( teams.Count > 0 ? teams[0] : null );

  ....

  m_Context.Finish( m_Context.Participants[winner.TeamID] as Participant );
}

Open XML SDK

V3080 Possible null dereference. Consider inspecting 'previousSibling'. OpenXmlCompositeElement.cs 380


public OpenXmlElement PreviousSibling()
{
    if (!(Parent is OpenXmlCompositeElement parent))
    {
        return null;
    }
    ....
}

public override T InsertBefore<T>(T newChild, OpenXmlElement referenceChild)
{
    ....
    OpenXmlElement previousSibling = nextNode.PreviousSibling();
    prevNode.Next = nextNode;
    previousSibling.Next = prevNode;    // <=
    ....
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'prevNode'. OpenXmlCompositeElement.cs 489
  • V3080 Possible null dereference. Consider inspecting 'prevNode'. OpenXmlCompositeElement.cs 497

QuantConnect Lean

V3080 Possible null dereference. Consider inspecting 'buyingPowerModel'. BasicTemplateFuturesAlgorithm.cs 107


public override void OnEndOfAlgorithm()
{
  var buyingPowerModel = Securities[_contractSymbol].BuyingPowerModel;
  var futureMarginModel = buyingPowerModel as FutureMarginModel;
  if (buyingPowerModel == null)
  {
    throw new Exception($"Invalid buying power model. " +
                        $"Found: {buyingPowerModel.GetType().Name}. " +
                        $"Expected: {nameof(FutureMarginModel)}");
  }
  ....
}

Ryujinx

V3080 Possible null dereference. Consider inspecting 'firmwareVersion'. MainWindow.cs 605


public SystemVersion GetCurrentFirmwareVersion()
{
    LoadEntries();

    lock (_lock)
    {
        ....

        if (romfs.OpenFile(out IFile systemVersionFile,
            "/file".ToU8Span(),
            OpenMode.Read).IsSuccess())
        {
            return new SystemVersion(systemVersionFile.AsStream());
        }
        ....
    }

    return null;                                                         // <=
}

public void LoadApplication(string path)
{
    ....
    firmwareVersion = _contentManager.GetCurrentFirmwareVersion();       // <=

    RefreshFirmwareLabel();

    string message =
    $"No installed firmware was found but Ryujinx was able to install firmware
      {firmwareVersion.VersionString} from the provided game.            // <=
      \nThe emulator will now start.";
    ....
}

Similar errors can be found in some other places:

  • V3080 Possible null dereference. Consider inspecting 'region'. KMemoryManager.cs 46
  • V3080 Possible null dereference. Consider inspecting 'node'. KPageTableBase.cs 2250
  • V3080 Possible null dereference. Consider inspecting 'node'. KPageTableBase.cs 2316
  • And 18 additional diagnostic messages.

PeachPie

V3080 Possible null dereference. Consider inspecting 'data'. PhpStream.cs 1382


public string ReadStringContents(int maxLength)
{
  if (!CanRead) return null;
  var result = StringBuilderUtilities.Pool.Get();

  if (maxLength >= 0)
  {
    while (maxLength > 0 && !Eof)
    {
      string data = ReadString(maxLength);
      if (data == null && data.Length > 0) break; // EOF or error.
      maxLength -= data.Length;
      result.Append(data);
    }
  }
  ....
}

PeachPie

V3080 Possible null dereference. Consider inspecting 'langVersion'. AnalysisFacts.cs 20


public static bool IsAutoloadDeprecated(Version langVersion)
{
  // >= 7.2
  return    langVersion != null && langVersion.Major > 7
         || (langVersion.Major == 7 && langVersion.Minor >= 2);
}

MonoGame

V3080 Possible null dereference. Consider inspecting 'processor'. MonoGame.Framework.Content.Pipeline PipelineProcessorContext.cs 55


public override TOutput Convert<TInput, TOutput>(
  TInput input,
  string processorName,
  OpaqueDataDictionary processorParameters)
{
  var processor = _manager.CreateProcessor(processorName,
                                           processorParameters);
  var processContext = new PipelineProcessorContext(....);
  var processedObject = processor.Process(input, processContext);
  ....
}

MonoGame

V3080 Possible null dereference inside method at 'type.IsArray'. Consider inspecting the 1st argument: collectionElementType. MonoGame.Framework.Content.Pipeline GenericCollectionHelper.cs 48


public GenericCollectionHelper(IntermediateSerializer serializer,
                               Type type)
{
  var collectionElementType = GetCollectionElementType(type, false);
  _contentSerializer =
                serializer.GetTypeSerializer(collectionElementType);
  ....
}

Cloudscribe

V3080 Possible null dereference. Consider inspecting 'TargetValue'. RequiredWhenAttribute.cs 78


protected override ValidationResult IsValid(....)
{
  if (field != null)
  {
    ....

    // compare the value against the target value
    if ((dependentValue == null && TargetValue == null) ||
        (dependentValue != null &&
         (TargetValue.Equals("*") ||
          dependentValue.Equals(TargetValue))))
    {
      ....
    }
  }

  return ValidationResult.Success;
}

Orchard Core

V3080 Possible null dereference. Consider inspecting 'metadata.CreateRouteValues'. ContentAnchorTag.cs 188


public async ValueTask<Completion> WriteToAsync(....)
{
  ....
  if (metadata.CreateRouteValues == null)
  {
    if (routeValues != null)
    {
      foreach (var attribute in routeValues)
      {
        metadata.CreateRouteValues.Add(attribute.Key, attribute.Value);
      }
    }
    ....
  }
  ....
}

Eto.Forms

V3080 Possible null dereference. Consider inspecting 'Control'. Eto.Gtk3 RadioMenuItemHandler.cs 143


public bool Enabled
{
  get { return Control != null ? enabled : Control.Sensitive; }
  set {
    if (Control != null)
      Control.Sensitive = value;
    else
      enabled = value;
  }
}

Discord.NET

V3080 Possible null dereference. Consider inspecting 'type'. NullableComponentConverter.cs 15


internal class NullableComponentConverter<T> : ComponentTypeConverter<T>
{
  ....

  public NullableComponentConverter(InteractionService interactionService,
                                    IServiceProvider services)
  {
    var type = Nullable.GetUnderlyingType(typeof(T));

    if (type is null)
      throw new ArgumentException($"No type {nameof(TypeConverter)}" +
                                  $"is defined for this {type.FullName}",  // <=
                                  "type");

    _typeConverter = interactionService
                       .GetComponentTypeConverter(type, services);
  }
  ....
}

OrchardCore

V3080 Possible null dereference. Consider inspecting 'metadata.CreateRouteValues'. ContentAnchorTag.cs 188


public async ValueTask<Completion> WriteToAsync(
             List<FilterArgument> argumentsList,
             IReadOnlyList<Statement> statements,
             TextWriter writer,
             TextEncoder encoder,
             LiquidTemplateContext context)
{
  if (displayFor != null)
  {
    ....
  }
  else if (removeFor != null)
  {
    ....

    if (metadata.RemoveRouteValues != null)
    {
      if (routeValues != null)
      {
        foreach (var attribute in routeValues)
        {
          metadata.RemoveRouteValues.Add(attribute.Key, attribute.Value);
        }
      }

        ....
    }
  }
  else if (createFor != null)
  {
    ....
    var metadata = await contentManager
                   .PopulateAspectAsync<ContentItemMetadata>(createFor);

    if (metadata.CreateRouteValues == null)                       // <=
    {
      if (routeValues != null)
      {
        foreach (var attribute in routeValues)
        {
          metadata.CreateRouteValues.Add(attribute.Key,           // <=
                                         attribute.Value);
        }
      }
      ....
    }
  }
  ....
}

GrandNode

V3080 Possible null dereference. Consider inspecting 'selectedContactAttributes'. ContactUsSendCommandHandler.cs 356


private async Task<IList<ContactUsModel.ContactAttributeModel>>
PrepareContactAttributeModel(IList<CustomAttribute> selectedContactAttributes,
                             string storeId)
{
  ....
  if (selectedContactAttributes != null || selectedContactAttributes.Any())
    ....
  ....
}

protobuf-net

V3080 Possible null dereference. Consider inspecting 'method'. Helpers.cs 74


internal static MethodInfo GetGetMethod(....)
{
  if (property is null) return null;
  MethodInfo method = property.GetGetMethod(nonPublic);
  if (method is null && !nonPublic && allowInternal)
  {
    method = property.GetGetMethod(true);
    if (method is null && !(   method.IsAssembly           // <=
                            || method.IsFamilyOrAssembly))
    {
      method = null;
    }
  }
  return method;
}

Ryujinx

V3080 Possible null dereference of method return value. Consider inspecting: GetTextureSpecState(...). ShaderSpecializationState.cs 408


private Box<....> GetTextureSpecState(....)
{
  TextureKey key = new TextureKey(stageIndex, handle, cbufSlot);
  if (_textureSpecialization.TryGetValue(key,
        out Box<TextureSpecializationState> state))
  {
    return state;
  }
  return null;   // <=
}

public (uint, bool) GetFormat(....)
{
  TextureSpecializationState state =
    GetTextureSpecState(stageIndex, handle, cbufSlot).Value;   // <=
  ....
}

Ryujinx

V3080 Possible null dereference. Consider inspecting 'firmwareVersion'. AppHost.cs 541


public SystemVersion GetCurrentFirmwareVersion()
{
  LoadEntries();
  lock (_lock)
  {
    ....
    if (....)
    {
      return new SystemVersion(systemVersionFile.AsStream());
    }
    ....
  }
  return null;   // <=
}

public async Task<bool> LoadGuestApplication(){
  ....
  firmwareVersion = ContentManager.GetCurrentFirmwareVersion();

  await ContentDialogHelper.CreateInfoDialog(
    LocaleManager.Instance.UpdateAndGetDynamicValue(
      ....,
      firmwareVersion.VersionString),                  // <=
    LocaleManager.Instance.UpdateAndGetDynamicValue(
      ....,
      firmwareVersion.VersionString),                  // <=
    ....);
  ....
}

Microsoft PowerToys

V3080 Possible null dereference. Consider inspecting 'updatingSettingsConfig'. LauncherViewModel.cs 138


public static UpdatingSettings LoadSettings()
{
  FileSystem fileSystem = new FileSystem();
  var localAppDataDir = Environment.GetFolderPath(....);
  var file = localAppDataDir + SettingsFilePath + SettingsFile;

  if (fileSystem.File.Exists(file))
  {
    try
    {
      Stream inputStream = fileSystem.File.Open(file, FileMode.Open);
      StreamReader reader = new StreamReader(inputStream);
      string data = reader.ReadToEnd();
      ....
    }
    catch (Exception)
    {}
  }

  return null; // <=
}

public LauncherViewModel(....)
{
  ....

  if (updatingSettingsConfig == null)
  {
    updatingSettingsConfig = new UpdatingSettings();
  }

  updatingSettingsConfig = UpdatingSettings.LoadSettings();

  if (updatingSettingsConfig.State == ....) // <=
  ....
}

TowerDefense-GameFramework-Demo

V3080 Possible null dereference. Consider inspecting 'data'. DataManager.cs 122


public void RemoveData(Data data)
{
  if (data == null)
  {
    throw new GameFrameworkException(Utility.Text.Format("Data '{0}' is null.",
                                                         data.Name.ToString()));
  }

  ....
}

Garnet

V3080 Possible null dereference. Consider inspecting 'sessionTransactionProcMap[id].Item1'. CustomCommandManagerSession.cs 28


public (....) GetCustomTransactionProcedure(....)
{
  if (sessionTransactionProcMap[id].Item1 == null)
  {
    var entry = customCommandManager.transactionProcMap[id];
    sessionTransactionProcMap[id].Item1 = entry.proc != null ? entry.proc()
                                                             : null;
    sessionTransactionProcMap[id].Item2 = entry.NumParams;

    sessionTransactionProcMap[id].Item1.txnManager = txnManager;
    sessionTransactionProcMap[id].Item1.scratchBufferManager =
      scratchBufferManager;
  }
  return sessionTransactionProcMap[id];
}

WolvenKit

V3080 Possible null dereference. Consider inspecting 'Archive'. FileEntry.cs 87


public void Extract(Stream output, bool decompressBuffers)
{
  if (Archive is not { } ar)
  {
    throw new InvalidParsingException(
      $"{Archive.ArchiveAbsolutePath} is not a cyberpunk77 archive.");
  }

  ar.CopyFileToStream(output, NameHash64, decompressBuffers);
}