Skip to content

Commit 384262a

Browse files
authored
Merge pull request stride3d#169 from VaclavElias/master
Diagnostics docs content improvements
2 parents f0e4e44 + d2e8e58 commit 384262a

File tree

13 files changed

+63
-59
lines changed

13 files changed

+63
-59
lines changed

BuildDocs.ps1

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,26 @@ function Ask-IncludeAPI {
8383
Write-Host ""
8484
Write-Host -ForegroundColor Cyan "Do you want to include API?"
8585
Write-Host ""
86-
Write-Host -ForegroundColor Yellow " [Y] Yes"
86+
Write-Host -ForegroundColor Yellow " [Y] Yes or ENTER"
8787
Write-Host -ForegroundColor Yellow " [N] No"
8888
Write-Host ""
8989

90-
return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
90+
$input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
91+
92+
return ($input -eq "Y" -or $input -eq "y" -or $input -eq "")
9193
}
9294

9395
function Ask-UseExistingAPI {
9496
Write-Host ""
9597
Write-Host -ForegroundColor Cyan "Do you want to use already generated API metadata?"
9698
Write-Host ""
97-
Write-Host -ForegroundColor Yellow " [Y] Yes"
99+
Write-Host -ForegroundColor Yellow " [Y] Yes or ENTER"
98100
Write-Host -ForegroundColor Yellow " [N] No"
99101
Write-Host ""
100102

101-
return (Read-Host -Prompt "Your choice (Y/N)").ToLower() -eq "y"
103+
$input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
104+
105+
return ($input -eq "Y" -or $input -eq "y" -or $input -eq "")
102106
}
103107

104108
function Copy-ExtraItems {
@@ -446,8 +450,15 @@ else {
446450
{
447451
$API = Ask-IncludeAPI
448452

449-
if ($API) {
450-
$ReuseAPI = Ask-UseExistingAPI
453+
if ($API)
454+
{
455+
# Check for .yml files
456+
$ymlFiles = Get-ChildItem -Path "en/api/" -Filter "*.yml"
457+
458+
if ($ymlFiles.Count -gt 0)
459+
{
460+
$ReuseAPI = Ask-UseExistingAPI
461+
}
451462
}
452463

453464
} elseif ($isCanceled) {

en/diagnostics/STRDIAG000.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## Explanation
77

88
Adding @Stride.Core.DataMemberAttribute and @Stride.Core.DataMemberIgnoreAttribute to the same member is not supported. This would be a contradiction.
9-
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.
9+
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.
1010

1111
## Example: Invalid cases
1212

@@ -49,8 +49,8 @@ public class STRDIAG000
4949
## Solution
5050

5151
> To resolve the warning, pick either the @Stride.Core.DataMemberAttribute or the @Stride.Core.DataMemberIgnoreAttribute.
52-
If the `YamlSerializer` and the Editor should ignore the member but the binary Serializer not, then add the @Stride.Core.DataMemberIgnoreAttribute.
52+
If the `YamlSerializer` and the Editor should ignore the member but the binary serializer not, then add the @Stride.Core.DataMemberIgnoreAttribute.
5353

5454
## References
5555

56-
- [Serialisation](../manual/scripts/serialization.md)
56+
- [Serialisation](../manual/scripts/serialization.md)

en/diagnostics/STRDIAG001.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Explanation
66

7-
The @Stride.Core.DataContractAttribute can only be applied to public/internal type. Any lower Access will cause STRDIAG001 on the target type.
7+
The @Stride.Core.DataContractAttribute can only be applied to `public`/`internal` type. Any lower access will cause STRDIAG001 on the target type.
88

99
## Example: private inner class
1010

@@ -33,7 +33,7 @@ file class STRDIAG001
3333

3434
## Solution
3535

36-
To resolve the warning, increase the accessibility of the type to pulic/internal or remove the @Stride.CoreDataContractAttribute .
36+
To resolve the warning, increase the accessibility of the type to `public`/`internal` or remove the @Stride.Core.DataContractAttribute.
3737

3838
## References
3939

en/diagnostics/STRDIAG002.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
66
## Explanation
77

8-
The Content Mode mutates the object which is currently in the member.
9-
As this is not possible with the current Serializers, only mutable Types are supported for Content Mode.
10-
Immutable types in this context are none reference types and string.
8+
The [DataMemberMode.Content](xref:Stride.Core.DataMemberMode) mutates the object which is currently in the member.
9+
As this is not possible with the current serializers, only mutable types are supported for `DataMemberMode.Content`. Immutable types in this context are none reference types and string.
1110

1211
## Example
1312

@@ -19,7 +18,7 @@ using Stride.Core;
1918
public class STRDIAG002
2019
{
2120
[DataMember(DataMemberMode.Content)]
22-
public int Value { get; set;}
21+
public int Value { get; set; }
2322

2423
[DataMember(DataMemberMode.Content)]
2524
public string Value;
@@ -28,4 +27,4 @@ public class STRDIAG002
2827

2928
## Solution
3029

31-
To resolve the warning, pick either a reference type for the member or use `DataMemberMode.Assign` for Immutable types.
30+
To resolve the warning, pick either a reference type for the member or use `DataMemberMode.Assign` for Immutable types.

en/diagnostics/STRDIAG003.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Diagnostics Warning STRDIAG003
22

3-
> 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.
3+
> The member '{0}' with `[DataMember]` is not accessible to the serializer. Only public/internal/internal > protected visibility is supported, when the `[DataMember]` attribute is applied.
44
55
## Explanation
66

7-
The Serialization concept in Stride expects public/internal/internal protected visibility of properties.
8-
Other Accessibility won't be considered for Serialization.
9-
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.
7+
The serialization concept in Stride expects `public`/`internal`/`internal protected` visibility of properties. Other accessibility won't be considered for serialization.
8+
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.
109

1110
## Example
1211

@@ -18,7 +17,7 @@ using Stride.Core;
1817
public class STRDIAG003
1918
{
2019
[DataMember]
21-
private int Value { get; set;}
20+
private int Value { get; set; }
2221

2322
[DataMember]
2423
protected string Value;
@@ -30,4 +29,4 @@ public class STRDIAG003
3029

3130
## Solution
3231

33-
To resolve the warning, increase the Accessibility to public/internal/internal protected of the member or remove the @Stride.Core.DataMemberAttribute Attribute.
32+
To resolve the warning, increase the Accessibility to `public`/`internal`/`internal protected` of the member or remove the @Stride.Core.DataMemberAttribute Attribute.

en/diagnostics/STRDIAG004.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
66
## Explanation
77

8-
All Serializers need a getter on a property to be able to get the content of the property.
9-
This is required for all Serializers in Stride.
10-
Non existent getters will result in error message 1.
11-
Non visible getters will result in error message 2.
8+
All serializers need a getter on a property to be able to get the content of the property.
9+
This is required for all serializers in Stride.
10+
- Non existent getters will result in error message 1.
11+
- Non visible getters will result in error message 2.
1212

1313
## Example
1414

@@ -34,8 +34,8 @@ public class STRDIAG004
3434
```
3535

3636
> [!WARNING]
37-
> There is an edge case with internal/internal protected, it will count as non visible when the @Stride.Core.DataMemberAttribute isn't applied.
38-
> But when the Attribute is applied then the getter counts as visible and therfore is correct.
37+
> There is an edge case with `internal`/`internal protected`, it will count as non visible when the @Stride.Core.DataMemberAttribute isn't applied.
38+
> But when the attribute is applied then the getter counts as visible and therefore is correct.
3939
4040
```csharp
4141
// STRDIAG000.cs
@@ -44,10 +44,10 @@ using Stride.Core;
4444
public class STRDIAG004
4545
{
4646
// will throw STRDIAG004
47-
public int Value { internal get; set;}
47+
public int Value { internal get; set; }
4848

4949
// will throw STRDIAG004
50-
public int Value { internal protected get; set;}
50+
public int Value { internal protected get; set; }
5151

5252
// won't throw STRDIAG004
5353
[DataMember]
@@ -61,6 +61,6 @@ public class STRDIAG004
6161

6262
## Solution
6363

64-
To resolve the warning 1, add a getter to the property with a public/internal/internal protected Accessibility or remove the @Stride.Core.DataMemberAttribute .
64+
To resolve the warning 1, add a getter to the property with a `public`/`internal`/`internal protected` accessibility or remove the @Stride.Core.DataMemberAttribute .
6565

66-
To resolve the warning 2, increase the Accessibility of the property getter to public/internal/internal protected Accessibility or remove the @Stride.Core.DataMemberAttribute .
66+
To resolve the warning 2, increase the accessibility of the property getter to `public`/`internal`/`internal protected` accessibility or remove the @Stride.Core.DataMemberAttribute .

en/diagnostics/STRDIAG005.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Explanation
66

7-
Having no set possibility automatically lets the serializers automatically use the `DataMemberMode.Content.`
7+
Having no set possibility automatically lets the serializers automatically use the [DataMemberMode.Content](xref:Stride.Core.DataMemberMode).
88
For immutable types the `DataMemberMode.Content` is never valid.
99
Immutable types in this context are none reference types and string.
1010

@@ -26,5 +26,6 @@ public class STRDIAG005
2626

2727
## Solution
2828

29-
To resolve the warning for fields, remove the \[DataMember] Attribute or remove the readonly modifier.
30-
To resolve the warning for properties, alter the type of the property to a supported type or remove the \[DataMember] Attribute.
29+
To resolve the warning for fields, remove the `[DataMember]` attribute or remove the `readonly` modifier.
30+
31+
To resolve the warning for properties, alter the type of the property to a supported type or remove the `[DataMember]` attribute.

en/diagnostics/STRDIAG006.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Diagnostics Warning STRDIAG006
22

3-
> Invalid DataMembermode for the specified `[DataMember]` member '{0}'. A public/internal/internal protected setter is required for 'DataMemberMode.Assign'.
3+
> Invalid DataMemberMode for the specified `[DataMember]` member '{0}'. A public/internal/internal protected setter is required for 'DataMemberMode.Assign'.
44
55
## Explanation
66

7-
The @Stride.Core.DataMemberMode.Assign let's the Serializers create new objects and sets them into the target property.
8-
The Property needs an accessible/visible setter.
7+
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.
98

109
## Example: Invalid Cases
1110

@@ -18,6 +17,7 @@ public class STRDIAG006
1817
{
1918
// non existent setters count as non visible
2019
[DataMember(DataMemberMode.Assign)]
20+
[DataMember(DataMemberMode.Assign)]
2121
public int Property1 { get; }
2222

2323
[DataMember(DataMemberMode.Assign)]
@@ -31,11 +31,11 @@ public class STRDIAG006
3131
}
3232
```
3333

34-
## Example: Special Case internal
34+
## Example: Special Case `internal`
3535

3636
> [!IMPORTANT]
3737
> To explicitly set the `DataMemberMode.Assign` the @Stride.Core.DataMemberAttribute has to be applied.
38-
> Internal visibility counts then as visible for the Serializers and becomes valid.
38+
> Internal visibility counts then as visible for the serializers and becomes valid.
3939
4040
```csharp
4141
using Stride.Core;
@@ -53,8 +53,7 @@ public class STRDIAG006
5353

5454
## Solution
5555

56-
To resolve the warning, increase the accessibility of the Properties set to pulic/internal.
57-
Or remove the explicit `DataMemberMode.Assign`, this can result in the `DataMemberMode.Content`, if the Property is a non valuetype/string type.
56+
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.
5857

5958
## References
6059

en/diagnostics/STRDIAG007.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
55
## Explanation
66

7-
Delegates can't be serialized by the Serializers in Stride.
8-
So the @Stride.Core.DataMemberAttribute is always invalid on a delegate member in a type.
7+
Delegates can't be serialized by the serializers in Stride. Therefore, the @Stride.Core.DataMemberAttribute is always invalid when applied to a delegate member in a type.
98

109
## Example: Invalid Cases
1110

@@ -26,7 +25,7 @@ public class STRDIAG007
2625

2726
## Solution
2827

29-
To resolve the warning, remove the @Stride.Core.DataMemberAttribute .
28+
To resolve the warning, remove the @Stride.Core.DataMemberAttribute.
3029

3130
## References
3231

en/diagnostics/STRDIAG008.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Diagnostics Warning STRDIAG008
22

3-
> Struct members with the 'fixed' Modifier are not supported as a Serialization target on member '{0}'..
3+
> Struct members with the 'fixed' Modifier are not supported as a Serialization target on member '{0}'.
44
55
## Explanation
66

7-
The Stride Serializers can't handle fixed members in structs.
8-
The @Stride.Core.DataMemberAttribute is always invalid on such a member.
7+
The Stride serializers can't handle `fixed` members in structs. The @Stride.Core.DataMemberAttribute is always invalid on such a member.
98

109
## Example: Invalid Cases
1110

@@ -23,7 +22,7 @@ public unsafe struct STRDIAG008
2322

2423
## Solution
2524

26-
To resolve the warning, remove the @Stride.Core.DataMemberAttribute .
25+
To resolve the warning, remove the @Stride.Core.DataMemberAttribute.
2726

2827
## References
2928

0 commit comments

Comments
 (0)