Skip to content

Commit

Permalink
Fix UnityEngine.SerializeField name (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Mar 6, 2024
1 parent c2b0479 commit dd70714
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix analyzer [RCS1267](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1267) ([PR](https://github.com/dotnet/roslynator/pull/1412))
- Fix "Unknown value 'Default'" exception ([PR](https://github.com/dotnet/roslynator/pull/1411))
- Fix name of `UnityEngine.SerializeField` attribute ([PR](https://github.com/dotnet/roslynator/pull/1419))

## [4.11.0] - 2024-02-19

Expand Down
Expand Up @@ -18,7 +18,7 @@ public sealed class MakeMemberReadOnlyAnalyzer : BaseDiagnosticAnalyzer
private static readonly MetadataName Microsoft_AspNetCore_Components_CascadingParameterAttribute = MetadataName.Parse("Microsoft.AspNetCore.Components.CascadingParameterAttribute");
private static readonly MetadataName Microsoft_AspNetCore_Components_InjectAttribute = MetadataName.Parse("Microsoft.AspNetCore.Components.InjectAttribute");
private static readonly MetadataName Newtonsoft_Json_JsonPropertyAttribute = MetadataName.Parse("Newtonsoft.Json.JsonPropertyAttribute");
private static readonly MetadataName UnityEngine_SerializeFieldAttribute = MetadataName.Parse("UnityEngine.SerializeFieldAttribute");
private static readonly MetadataName UnityEngine_SerializeField = MetadataName.Parse("UnityEngine.SerializeField");

private static ImmutableArray<DiagnosticDescriptor> _supportedDiagnostics;

Expand Down Expand Up @@ -140,7 +140,7 @@ private static void AnalyzeTypeDeclaration(SyntaxNodeAnalysisContext context)
&& !fieldSymbol.IsVolatile
&& ValidateType(fieldSymbol.Type)
&& (context.IsUnityCodeAnalysisEnabled() != true
|| !fieldSymbol.HasAttribute(UnityEngine_SerializeFieldAttribute)))
|| !fieldSymbol.HasAttribute(UnityEngine_SerializeField)))
{
symbols[fieldSymbol.Name] = (declarator, fieldSymbol);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Analyzers.Tests/RCS1169MakeFieldReadOnlyTests.cs
Expand Up @@ -393,7 +393,7 @@ class C
namespace UnityEngine
{
class SerializeFieldAttribute : Attribute
class SerializeField : Attribute
{
}
}
Expand Down

0 comments on commit dd70714

Please sign in to comment.