Browse Source

finish last , rework

IXLLEGACYIXL 2 years ago
parent
commit
7673c3cb5e

+ 10 - 7
en/diagnostics/STRDIAG000.md

@@ -1,14 +1,14 @@
 # Diagnostics Warning STRDIAG000
 
 > There is an Attribute Contradiction on '{0}' Member. `[DataMemberIgnore]` Attribute on a `[DataMember]` is not supported.
-Except if it has also `[DataMemberUpdatable]` Attribute.
+> Except if it has also `[DataMemberUpdatable]` Attribute.
 
 ## Explanation
 
-Adding `[DataMember]` and `[DataMemberIgnore]` to the same member is not supported. This would be a contradiction.
-It would mean the Serializer should serialize the member and ignore it at the same time. The `DataMemberUpdatable` attribute makes the combination valid again as it negates the `DataMemberIgnore` for the binary Serializer.
+Adding @Stride.Core.DataMemberAttribute and @Stride.Core.DataMemberIgnoreAttribute to the same member is not supported. This would be a contradiction.
+It would mean the Serializer should serialize the member and ignore it at the same time. The @Stride.Updater.DataMemberUpdatableAttribute  makes the combination valid again as it negates the @Stride.Core.DataMemberIgnoreAttribute for the binary Serializer.
 
-## Example
+## Example: Invalid cases
 
 The following example generates STRDIAG000 on each property:
 
@@ -28,8 +28,11 @@ public class STRDIAG000
 }
 ```
 
-There is a special case if the @Stride.Updater.DataMemberUpdatableAttribute is applied.
-This Attribute negates the @Stride.Core.DataMemberIgnoreAttribute for the binary Serializer, so it becomes valid again.
+## Example: Special Case `DataMemberUpdatable`
+
+> [!IMPORTANT]
+> There is a special case if the @Stride.Updater.DataMemberUpdatableAttribute is applied.
+> This Attribute negates the @Stride.Core.DataMemberIgnoreAttribute for the binary Serializer, so it becomes valid again.
 
 ```csharp
 using Stride.Core;
@@ -45,7 +48,7 @@ public class STRDIAG000
 
 ## Solution
 
-To resolve the warning, pick either the @Stride.Core.DataMemberAttribute or the @Stride.Core.DataMemberIgnoreAttribute.
+> To resolve the warning, pick either the @Stride.Core.DataMemberAttribute or the @Stride.Core.DataMemberIgnoreAttribute.
 If the `YamlSerializer` and the Editor should ignore the member but the binary Serializer not, then add the @Stride.Core.DataMemberIgnoreAttribute.
 
 ## References

+ 3 - 3
en/diagnostics/STRDIAG001.md

@@ -4,14 +4,13 @@
 
 ## Explanation
 
-The `[DataContract]` attribute can only be applied to public/internal type. Any Access that is lower than that will cause STRDIAG001 on the target type.
+The @Stride.Core.DataContractAttribute can only be applied to public/internal type. Any lower Access  will cause STRDIAG001 on the target type.
 
 ## Example: private inner class
 
 The following example generates STRDIAG001:
 
 ```csharp
-// STRDIAG000.cs
 using Stride.Core;
 
 public class STRDIAG001
@@ -25,6 +24,7 @@ public class STRDIAG001
 
 ```csharp
 using Stride.Core;
+
 [DataContract]
 file class STRDIAG001
 {
@@ -33,7 +33,7 @@ file class STRDIAG001
 
 ## Solution
 
-To resolve the warning, increase the accessibility of the type to pulic/internal or remove the DataContractAttribute.
+To resolve the warning, increase the accessibility of the type to pulic/internal or remove the @Stride.CoreDataContractAttribute .
 
 ## References
 

+ 3 - 4
en/diagnostics/STRDIAG002.md

@@ -1,7 +1,7 @@
 # Diagnostics Warning STRDIAG002
 
-The 'DataMemberMode.Content' is not valid for the member '{0}'.
-Only mutable reference types are supported for 'DataMemberMode.Content' Mode members.
+> The 'DataMemberMode.Content' is not valid for the member '{0}'.
+> Only mutable reference types are supported for 'DataMemberMode.Content' Mode members.
 
 ## Explanation
 
@@ -14,7 +14,6 @@ Immutable types in this context are none reference types and string.
 The following example generates STRDIAG002 on each property:
 
 ```csharp
-// STRDIAG000.cs
 using Stride.Core;
 
 public class STRDIAG002
@@ -29,4 +28,4 @@ public class STRDIAG002
 
 ## Solution
 
-To resolve the warning, pick either a reference type for the member or use DataMemberMode.Assign for ImmutableTypes.
+To resolve the warning, pick either a reference type for the member or use `DataMemberMode.Assign` for Immutable types.

+ 3 - 4
en/diagnostics/STRDIAG003.md

@@ -1,19 +1,18 @@
 # Diagnostics Warning STRDIAG003
 
-The member '{0}' with \[DataMember] is not accesssible to the serializer. Only public/internal/internal protected visibility is supported, when the \[DataMember] attribute is applied.
+> The member '{0}' with `[DataMember]` is not accesssible to the serializer. Only public/internal/internal > protected visibility is supported, when the `[DataMember]` attribute is applied.
 
 ## Explanation
 
 The Serialization concept in Stride expects public/internal/internal protected visibility of properties.
 Other Accessibility won't be considered for Serialization.
-To count internal/internal protected as visible to the Editor the \[DataMember] Attribute has to be applied, else it's considered as not visible.
+To count internal/internal protected as visible to the Editor the @Stride.Core.DataMemberAttribute has to be applied, else it's considered as not visible.
 
 ## Example
 
 The following example generates STRDIAG003 on each property:
 
 ```csharp
-// STRDIAG000.cs
 using Stride.Core;
 
 public class STRDIAG003
@@ -31,4 +30,4 @@ public class STRDIAG003
 
 ## Solution
 
-To resolve the warning, increase the Accessibility to public/internal/internal protected of the member or remove the \[DataMember] Attribute.
+To resolve the warning, increase the Accessibility to public/internal/internal protected of the member or remove the @Stride.Core.DataMemberAttribute Attribute.

+ 7 - 7
en/diagnostics/STRDIAG004.md

@@ -1,7 +1,7 @@
 # Diagnostics Warning STRDIAG004
 
-1. The property '{0}' with \[DataMember] does not have a getter which is required for serialization.
-2. The property '{0}' with \[DataMember] does not have an accessible getter which is required for serialization. A public/internal/internal protected getter is expected.
+> 1. The property '{0}' with `[DataMember]` does not have a getter which is required for serialization.
+> 2. The property '{0}' with `[DataMember]` does not have an accessible getter which is required for serialization. A public/internal/internal protected getter is expected.
 
 ## Explanation
 
@@ -15,7 +15,6 @@ Non visible getters will result in error message 2.
 The following example generates STRDIAG004 on each property:
 
 ```csharp
-// STRDIAG000.cs
 using Stride.Core;
 
 public class STRDIAG004
@@ -34,8 +33,9 @@ public class STRDIAG004
 }
 ```
 
-There is an edge case with internal/internal protected, it will count as non visible when the [DataMember] Attribute isn't applied.
-But when the Attribute is applied then the getter counts as visible and therfore is correct.
+> [!WARNING]
+> There is an edge case with internal/internal protected, it will count as non visible when the @Stride.Core.DataMemberAttribute isn't applied.
+> But when the Attribute is applied then the getter counts as visible and therfore is correct.
 
 ```csharp
 // STRDIAG000.cs
@@ -61,6 +61,6 @@ public class STRDIAG004
 
 ## Solution
 
-To resolve the warning 1, add a getter to the property with a public/internal/internal protected Accessibility or remove the \[DataMember] Attribute.
+To resolve the warning 1, add a getter to the property with a public/internal/internal protected Accessibility or remove the @Stride.Core.DataMemberAttribute .
 
-To resolve the warning 2, increase the Accessibility of the property getter to public/internal/internal protected Accessibility or remove the \[DataMember] Attribute.
+To resolve the warning 2, increase the Accessibility of the property getter to public/internal/internal protected Accessibility or remove the @Stride.Core.DataMemberAttribute .

+ 3 - 3
en/diagnostics/STRDIAG005.md

@@ -1,11 +1,11 @@
 # Diagnostics Warning STRDIAG005
 
-The \[DataMember] Attribute is applied to a read-only member '{0}' with a non supported type. Only mutable reference types are supported for read-only members.
+> The `[DataMember]` Attribute is applied to a read-only member '{0}' with a non supported type. Only mutable reference types are supported for read-only members.
 
 ## Explanation
 
-Having no set possibility automatically lets the serializers automatically use the DataMemberMode.Content.
-For immutable types the DataMemberMode.Content is never valid.
+Having no set possibility automatically lets the serializers automatically use the `DataMemberMode.Content.`
+For immutable types the `DataMemberMode.Content` is never valid.
 Immutable types in this context are none reference types and string.
 
 ## Example

+ 61 - 0
en/diagnostics/STRDIAG006.md

@@ -0,0 +1,61 @@
+# Diagnostics Warning STRDIAG006
+
+> Invalid DataMembermode for the specified `[DataMember]` member '{0}'. A public/internal/internal protected setter is required for 'DataMemberMode.Assign'.
+
+## 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.
+
+## Example: Invalid Cases
+
+The following example generates STRDIAG006:
+
+```csharp
+using Stride.Core;
+
+public class STRDIAG006
+{
+    // non existent setters count as non visible
+    [DataMember(DataMemberMode.Assign)]
+    public int Property1 { get; }
+
+    [DataMember(DataMemberMode.Assign)]
+    public int Property2 { get; private set; }
+    
+    [DataMember(DataMemberMode.Assign)]
+    public int Property3 { get; protected set; }
+    
+    [DataMember(DataMemberMode.Assign)]
+    public int Property4 { get; private protected set; }
+}
+```
+
+## Example: Special Case internal
+
+> [!IMPORTANT]
+> 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.
+
+```csharp
+using Stride.Core;
+
+public class STRDIAG006
+{
+    // non existent setters count as non visible
+    [DataMember(DataMemberMode.Assign)]
+    public int Property1 { get; internal set; }
+
+    [DataMember(DataMemberMode.Assign)]
+    public int Property2 { get; internal protected set; }
+}
+```
+
+## 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.
+
+## References
+
+- [Serialisation](../manual/scripts/serialization.md)

+ 33 - 0
en/diagnostics/STRDIAG007.md

@@ -0,0 +1,33 @@
+# Diagnostics Warning STRDIAG007
+
+> Invalid `[DataMember]` Attribute on the member '{0}'. A Delegate is not serializable.
+
+## Explanation
+
+Delegates can't be serialized by the Serializers in Stride.
+So the @Stride.Core.DataMemberAttribute is always invalid on a delegate member in a type.
+
+## Example: Invalid Cases
+
+The following example generates STRDIAG007:
+
+```csharp
+using Stride.Core;
+
+public class STRDIAG007
+{
+    [DataMember]
+    public Action SomeDelegate;
+
+    [DataMember]
+    public Action SomeDelegate2 { get; set; }
+}
+```
+
+## Solution
+
+To resolve the warning, remove the @Stride.Core.DataMemberAttribute .
+
+## References
+
+- [Serialisation](../manual/scripts/serialization.md)

+ 30 - 0
en/diagnostics/STRDIAG008.md

@@ -0,0 +1,30 @@
+# Diagnostics Warning STRDIAG008
+
+> Struct members with the 'fixed' Modifier are not supported as a Serialization target on member '{0}'..
+
+## Explanation
+
+The Stride Serializers can't handle fixed members in structs.
+The @Stride.Core.DataMemberAttribute is always invalid on such a member.
+
+## Example: Invalid Cases
+
+The following example generates STRDIAG008:
+
+```csharp
+using Stride.Core;
+
+public unsafe struct STRDIAG008
+{
+    [DataMember]
+    public fixed byte Value[10];
+}
+```
+
+## Solution
+
+To resolve the warning, remove the @Stride.Core.DataMemberAttribute .
+
+## References
+
+- [Serialisation](../manual/scripts/serialization.md)

+ 38 - 0
en/diagnostics/STRDIAG009.md

@@ -0,0 +1,38 @@
+# Diagnostics Warning STRDIAG009
+
+> The member '{0}' implements IDictionary<T,K> with an unsupported type for the key. Only primitive types ( like int,float,.. ) are supported or string or enums as the Dictionary Key in asset serialization. When used in other contexts the warning may not apply and can be suppressed."
+
+## Explanation
+
+Per Default Stride Serializers only Support primitive types and string as a IDictionary Key.
+It is possible to make them supported, so this warning isn't fully accurate in every case.
+
+## Example
+
+The following example generates STRDIAG009:
+
+```csharp
+using Stride.Core;
+
+public class STRDIAG009
+{
+    [DataMember]
+    public Dictionary<ClassType, AnyType>
+
+    [DataMember]
+    public Dictionary<StructType, AnyType>
+
+    [DataMember]
+    public Dictionary<InterfaceType, AnyType>
+}
+```
+
+## Solution
+
+To resolve the warning, remove the @Stride.Core.DataMemberAttribute .
+Or change the Key of the IDictionary to a supported type.
+Add a pragma Suppression in the IDE if it is a valid type.
+
+## References
+
+- [Serialisation](../manual/scripts/serialization.md)