|
@@ -1,11 +1,10 @@
|
|
|
# Diagnostics Warning STRDIAG006
|
|
# Diagnostics Warning STRDIAG006
|
|
|
|
|
|
|
|
-> Invalid DataMembermode for the specified `[DataMember]` member '{0}'. A public/internal/internal protected setter is required for 'DataMemberMode.Assign'.
|
|
|
|
|
|
|
+> Invalid DataMemberMode for the specified `[DataMember]` member '{0}'. A public/internal/internal protected setter is required for 'DataMemberMode.Assign'.
|
|
|
|
|
|
|
|
## Explanation
|
|
## Explanation
|
|
|
|
|
|
|
|
-The @Stride.Core.DataMemberMode.Assign let's the Serializers create new objects and sets them into the target property.
|
|
|
|
|
-The Property needs an accessible/visible setter.
|
|
|
|
|
|
|
+The @Stride.Core.DataMemberMode.Assign let's the serializers create new objects and sets them into the target property. The Property needs an accessible/visible setter.
|
|
|
|
|
|
|
|
## Example: Invalid Cases
|
|
## Example: Invalid Cases
|
|
|
|
|
|
|
@@ -18,6 +17,7 @@ public class STRDIAG006
|
|
|
{
|
|
{
|
|
|
// non existent setters count as non visible
|
|
// non existent setters count as non visible
|
|
|
[DataMember(DataMemberMode.Assign)]
|
|
[DataMember(DataMemberMode.Assign)]
|
|
|
|
|
+ [DataMember(DataMemberMode.Assign)]
|
|
|
public int Property1 { get; }
|
|
public int Property1 { get; }
|
|
|
|
|
|
|
|
[DataMember(DataMemberMode.Assign)]
|
|
[DataMember(DataMemberMode.Assign)]
|
|
@@ -31,11 +31,11 @@ public class STRDIAG006
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-## Example: Special Case internal
|
|
|
|
|
|
|
+## Example: Special Case `internal`
|
|
|
|
|
|
|
|
> [!IMPORTANT]
|
|
> [!IMPORTANT]
|
|
|
> To explicitly set the `DataMemberMode.Assign` the @Stride.Core.DataMemberAttribute has to be applied.
|
|
> To explicitly set the `DataMemberMode.Assign` the @Stride.Core.DataMemberAttribute has to be applied.
|
|
|
-> Internal visibility counts then as visible for the Serializers and becomes valid.
|
|
|
|
|
|
|
+> Internal visibility counts then as visible for the serializers and becomes valid.
|
|
|
|
|
|
|
|
```csharp
|
|
```csharp
|
|
|
using Stride.Core;
|
|
using Stride.Core;
|
|
@@ -53,8 +53,7 @@ public class STRDIAG006
|
|
|
|
|
|
|
|
## Solution
|
|
## Solution
|
|
|
|
|
|
|
|
-To resolve the warning, increase the accessibility of the Properties set to pulic/internal.
|
|
|
|
|
-Or remove the explicit `DataMemberMode.Assign`, this can result in the `DataMemberMode.Content`, if the Property is a non valuetype/string type.
|
|
|
|
|
|
|
+To resolve the warning, increase the accessibility of the properties set to `public`/`internal`. Or remove the explicit `DataMemberMode.Assign`, this can result in the `DataMemberMode.Content`, if the property is a non valuetype/string type.
|
|
|
|
|
|
|
|
## References
|
|
## References
|
|
|
|
|
|