Skip to content

Commit

Permalink
Use NullableContextAttribute to detect nullable ref types
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-englert committed Mar 31, 2020
1 parent cdb5e72 commit 6562a9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions NullGuard.Fody/ExplicitModeAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public static class ExplicitModeExtensions
const string ItemNotNullAttributeTypeName = "ItemNotNullAttribute";
const string CanBeNullAttributeTypeName = "CanBeNullAttribute";
const string JetBrainsAnnotationsAssemblyName = "JetBrains.Annotations";
const string NullableAttributeFullName = "System.Runtime.CompilerServices.NullableAttribute";
const string NullableContextAttributeFullName = "System.Runtime.CompilerServices.NullableContextAttribute";

public static NullGuardMode AutoDetectMode(this ModuleDefinition moduleDefinition)
{
if (moduleDefinition.GetTypes().Any(typeDefinition => typeDefinition.CustomAttributes.Any(attr => attr.AttributeType.FullName == NullableAttributeFullName)))
if (moduleDefinition.GetTypes().Any(typeDefinition => typeDefinition.CustomAttributes.Any(attr => attr.AttributeType.FullName == NullableContextAttributeFullName)))
{
return NullGuardMode.NullableReferenceTypes;
}
Expand Down

0 comments on commit 6562a9a

Please sign in to comment.