Skip to content

Commit dd70714

Browse files
authored
Fix UnityEngine.SerializeField name (#1419)
1 parent c2b0479 commit dd70714

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

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

1516
## [4.11.0] - 2024-02-19
1617

src/Analyzers/CSharp/Analysis/MakeMemberReadOnly/MakeMemberReadOnlyAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public sealed class MakeMemberReadOnlyAnalyzer : BaseDiagnosticAnalyzer
1818
private static readonly MetadataName Microsoft_AspNetCore_Components_CascadingParameterAttribute = MetadataName.Parse("Microsoft.AspNetCore.Components.CascadingParameterAttribute");
1919
private static readonly MetadataName Microsoft_AspNetCore_Components_InjectAttribute = MetadataName.Parse("Microsoft.AspNetCore.Components.InjectAttribute");
2020
private static readonly MetadataName Newtonsoft_Json_JsonPropertyAttribute = MetadataName.Parse("Newtonsoft.Json.JsonPropertyAttribute");
21-
private static readonly MetadataName UnityEngine_SerializeFieldAttribute = MetadataName.Parse("UnityEngine.SerializeFieldAttribute");
21+
private static readonly MetadataName UnityEngine_SerializeField = MetadataName.Parse("UnityEngine.SerializeField");
2222

2323
private static ImmutableArray<DiagnosticDescriptor> _supportedDiagnostics;
2424

@@ -140,7 +140,7 @@ private static void AnalyzeTypeDeclaration(
140140
&& !fieldSymbol.IsVolatile
141141
&& ValidateType(fieldSymbol.Type)
142142
&& (context.IsUnityCodeAnalysisEnabled() != true
143-
|| !fieldSymbol.HasAttribute(UnityEngine_SerializeFieldAttribute)))
143+
|| !fieldSymbol.HasAttribute(UnityEngine_SerializeField)))
144144
{
145145
symbols[fieldSymbol.Name] = (declarator, fieldSymbol);
146146
}

src/Tests/Analyzers.Tests/RCS1169MakeFieldReadOnlyTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class C
393393
394394
namespace UnityEngine
395395
{
396-
class SerializeFieldAttribute : Attribute
396+
class SerializeField : Attribute
397397
{
398398
}
399399
}

0 commit comments

Comments
 (0)