Skip to content

Commit dc83fd9

Browse files
authored
Merge pull request #3114 from MicrosoftDocs/master636912081691463933
For protected CLA branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 79caed1 + 4fcd33d commit dc83fd9

File tree

89 files changed

+432
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+432
-160
lines changed

.markdownlint.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"MD027": false,
1717
"MD028": false,
1818
"MD029": false,
19-
"MD031": false,
2019
"MD032": false,
2120
"MD033": {
2221
"allowed_elements": [

docs/ai/installation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Deep learning frameworks rely on pip for their own installation.
8181
Then, we need to verify whether Python 3.5 is installed correctly, and upgrade pip to the latest version by executing the following commands in a terminal:
8282

8383
- **Windows**
84+
8485
```cmd
8586
C:\Users\test>python -V
8687
Python 3.5.4
@@ -92,6 +93,7 @@ Then, we need to verify whether Python 3.5 is installed correctly, and upgrade p
9293
```
9394
9495
- **macOS**
96+
9597
```bash
9698
MyMac:~ test$ python3.5 -V
9799
Python 3.5.4
@@ -153,10 +155,13 @@ Visit [here](https://caffe2.ai/docs/getting-started.html) to build from source c
153155
To install MXNet, run the following command in a terminal:
154156

155157
- With GPU
158+
156159
```bash
157160
pip3.5 install mxnet-cu80==0.12.0
158161
```
162+
159163
- Without GPU
164+
160165
```bash
161166
pip3.5 install mxnet==0.12.0
162167
```

docs/azure/vs-azure-tools-diagnostics-for-cloud-services-and-virtual-machines.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ If you're using Azure SDK 2.5 and want to specify a custom data source, you can
148148
<DataSource name="CustomDataSource!*" />
149149
</WindowsEventLog>
150150
```
151+
151152
### Performance counters
152153
Performance counter information can help you locate system bottlenecks and fine-tune system and application performance. For more information, see [Create and use performance counters in an Azure application](https://msdn.microsoft.com/library/azure/hh411542.aspx). To capture performance counters, select the **Enable transfer of Performance Counters** check box. To increase or decrease the interval between the transfer of event logs to your storage account, change the **Transfer Period (min)** value. Select the check boxes for the performance counters that you want to track.
153154

docs/azure/vs-azure-tools-optimizing-azure-code-in-visual-studio.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ while (true)
209209
}
210210
}
211211
```
212+
212213
## Consider using asynchronous Service Bus methods
213214
### ID
214215
AP2003

docs/azure/vs-azure-tools-resource-groups-ci.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ The following procedures walk you through the steps necessary to configure conti
166166
```
167167
-_artifactsLocation $(artifactsLocation) -_artifactsLocationSasToken (ConvertTo-SecureString -String "$(artifactsLocationSasToken)" -AsPlainText -Force)
168168
```
169+
169170
![Configure Azure Resource Group Deployment Task](media/vs-azure-tools-resource-groups-ci-in-vsts/walkthrough18.png)
170171
7. After you’ve added all the required items, save the build pipeline and choose **Queue new build** at the top.
171172

docs/code-quality/C26404.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Once owner pointer releases or transfers its resource, it gets into an "invalid"
1818
Deleting such a pointer may lead to immediate memory corruption due to double delete, or to an access violation when the deleted resource is accessed from another owner pointer.
1919

2020
## Example 1: Deleting an owner after transferring its value
21+
2122
```cpp
2223
gsl::owner<State*> validState = nullptr;
2324
gsl::owner<State*> state = ReadState();
@@ -27,6 +28,7 @@ if (!IsValid(state))
2728
```
2829

2930
## Example 2: Deleting an uninitialized owner
31+
3032
```cpp
3133
gsl::owner<Message*> message;
3234
if (popLast)

docs/code-quality/C26405.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ms.workload:
1717
If an owner pointer already points to a valid memory buffer, it must not be assigned to another value without releasing its current resource first. Such assignment may lead to a resource leak even if the resource address is copied into some raw pointer (because raw pointers shouldn’t release resources).
1818

1919
## Example 1: Overwriting an owner in a loop
20+
2021
```cpp
2122
gsl::owner<Shape*> shape = nullptr;
2223
while (shape = NextShape()) // C26405

docs/code-quality/C26406.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ms.workload:
1717
Owners are initialized from allocations or from other owners. Assigning a value from a raw pointer to an owner pointer is not allowed. Raw pointers don’t guarantee ownership transfer; there is still may be an original owner which holds the resource and will attempt to release it. Note that assigning a value from owner to a raw pointer is fine; raw pointers are valid clients to access resources, but not to manage them.
1818

1919
## Example 1: Using address of object
20+
2021
```cpp
2122
gsl::owner<Socket*> socket = defaultSocket ? &defaultSocket : new Socket(); // C26406
2223
```

docs/code-quality/C26407.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,31 @@ To avoid unnecessary use of pointers we try to detect common patterns of local a
2323
- The pattern is detected only for local variables, so we don’t warn on cases where an allocation is assigned to, say, a global variable and then deleted in the same function.
2424

2525
## Example 1: Unnecessary object allocation on heap
26+
2627
```cpp
2728
auto tracer = new Tracer();
2829
ScanObjects(tracer);
2930
delete tracer; // C26407
3031
```
3132
3233
## Example 2: Unnecessary object allocation on heap (fixed with local object)
34+
3335
```cpp
3436
Tracer tracer; // OK
3537
ScanObjects(&tracer);
3638
```
3739

3840
## Example 3: Unnecessary buffer allocation on heap
41+
3942
```cpp
4043
auto value = new char[maxValueSize];
4144
if (ReadSetting(name, value, maxValueSize))
4245
CheckValue(value);
4346
delete[] value; // C26407
4447
```
48+
4549
## Example 4: Unnecessary buffer allocation on the heap (fixed with container)
50+
4651
```cpp
4752
auto value = std::vector<char>(maxValueSize); // OK
4853
if (ReadSetting(name, value.data(), maxValueSize))

docs/code-quality/C26410.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Generally, references to const unique pointer are meaningless. They can safely b
2121
- Template code may produce a lot of noise. Keep in mind that templates can be instantiated with various type parameters with different levels of indirection, including references. Some warnings may not be obvious and fixes may require some rework of templates (for example, explicit removal of reference indirection). If template code is intentionally generic, the warning can be suppressed.
2222

2323
## Example 1: Unnecessary reference
24+
2425
```cpp
2526
std::vector<std::unique_ptr<Tree>> roots = GetRoots();
2627
std::for_each(

docs/code-quality/C26450.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ int multiply()
3030
return c;
3131
}
3232
```
33+
3334
To correct this warning, use the following code.
3435

3536
```cpp
@@ -53,6 +54,7 @@ int add()
5354
return c;
5455
}
5556
```
57+
5658
To correct this warning, use the following code:
5759

5860
```cpp
@@ -64,6 +66,7 @@ long long add()
6466
return c;
6567
}
6668
```
69+
6770
## Example 3
6871

6972
```cpp
@@ -75,6 +78,7 @@ int subtract()
7578
return c;
7679
}
7780
```
81+
7882
To correct this warning, use the following code.
7983

8084
```cpp

docs/code-quality/C26451.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void leftshift(int i)
3030
// code
3131
}
3232
```
33+
3334
To correct this warning, use the following code:
3435
3536
```cpp
@@ -41,6 +42,7 @@ void leftshift(int i)
4142
// code
4243
}
4344
```
45+
4446
## Example 2
4547

4648
```cpp

docs/code-quality/C26452.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ unsigned __int64 combine(unsigned lo, unsigned hi)
2626
return (hi << 32) | lo; // C26252 here
2727
}
2828
```
29+
2930
To correct this warning, use the following code:
3031
3132
```cpp

docs/code-quality/C26454.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ unsigned int negativeunsigned()
2626
return x;
2727
}
2828
```
29+
2930
To correct this warning, use the following code:
3031

3132
```cpp

docs/code-quality/c28112.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ inter_var --;
3030
...
3131
InterlockedIncrement(&inter_var);
3232
```
33+
3334
The following code example avoids this warning:
3435
3536
```cpp

docs/code-quality/ca2104-do-not-declare-read-only-mutable-reference-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "CA2104: Do not declare read only mutable reference types"
2+
title: "CA2104: Do not declare read-only mutable reference types"
33
ms.date: 11/01/2018
44
ms.topic: reference
55
f1_keywords:
@@ -29,7 +29,7 @@ ms.workload:
2929
|Breaking Change|Non-breaking|
3030

3131
> [!NOTE]
32-
> Rule CA2104 is obsolete and will be removed in a future version of Visual Studio.
32+
> Rule CA2104 is obsolete and will be removed in a future version of Visual Studio. It will not be implemented as an [analyzer](roslyn-analyzers-overview.md) due to the complicated analysis that's required to determine the actual immutability of a type.
3333
3434
## Cause
3535

docs/code-quality/ca2300-do-not-use-insecure-deserializer-binaryformatter.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,17 @@ This rule finds <xref:System.Runtime.Serialization.Formatters.Binary.BinaryForma
3535
- If possible, use a secure serializer instead, and **don't allow an attacker to specify an arbitrary type to deserialize**. Some safer serializers include:
3636
- <xref:System.Runtime.Serialization.DataContractSerializer?displayProperty=nameWithType>
3737
- <xref:System.Runtime.Serialization.Json.DataContractJsonSerializer?displayProperty=nameWithType>
38-
- <xref:System.Web.Script.Serialization.JavaScriptSerializer?displayProperty=nameWithType> - Never use <xref:System.Web.Script.Serialization.SimpleTypeResolver?displayProperty=nameWithType>. If you must use a type resolver, you must restrict deserialized types to an expected list.
38+
- <xref:System.Web.Script.Serialization.JavaScriptSerializer?displayProperty=nameWithType> - Never use <xref:System.Web.Script.Serialization.SimpleTypeResolver?displayProperty=nameWithType>. If you must use a type resolver, restrict deserialized types to an expected list.
3939
- <xref:System.Xml.Serialization.XmlSerializer?displayProperty=nameWithType>
40-
- NewtonSoft Json.NET - Use TypeNameHandling.None. If you must use another value for TypeNameHandling, then you must restrict deserialized types to an expected list.
40+
- NewtonSoft Json.NET - Use TypeNameHandling.None. If you must use another value for TypeNameHandling, restrict deserialized types to an expected list with a custom ISerializationBinder.
4141
- Protocol Buffers
42-
- Make the serialized data tamper proof. After serialization, cryptographically sign the serialized data. Before deserializing, validate the cryptographic signature. You must protect the cryptographic key from being disclosed, and should design for key rotations.
42+
- Make the serialized data tamper-proof. After serialization, cryptographically sign the serialized data. Before deserialization, validate the cryptographic signature. Protect the cryptographic key from being disclosed, and design for key rotations.
4343
- Restrict deserialized types. Implement a custom <xref:System.Runtime.Serialization.SerializationBinder?displayProperty=nameWithType>. Before deserializing with <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>, set the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Binder> property to an instance of your custom <xref:System.Runtime.Serialization.SerializationBinder>. In the overridden <xref:System.Runtime.Serialization.SerializationBinder.BindToType%2A> method, if the type is unexpected then throw an exception.
44-
- If you restrict deserialized types, you may want to disable this rule and enable rules [CA2301](ca2301-do-not-call-binaryformatter-deserialize-without-first-setting-binaryformatter-binder.md) and [CA2302](ca2302-ensure-binaryformatter-binder-is-set-before-calling-binaryformatter-deserialize.md). Enabling rules [CA2301](ca2301-do-not-call-binaryformatter-deserialize-without-first-setting-binaryformatter-binder.md) and [CA2302](ca2302-ensure-binaryformatter-binder-is-set-before-calling-binaryformatter-deserialize.md) will help ensure that the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Binder> property is always set before deserializing.
44+
- If you restrict deserialized types, you may want to disable this rule and enable rules [CA2301](ca2301-do-not-call-binaryformatter-deserialize-without-first-setting-binaryformatter-binder.md) and [CA2302](ca2302-ensure-binaryformatter-binder-is-set-before-calling-binaryformatter-deserialize.md). Rules [CA2301](ca2301-do-not-call-binaryformatter-deserialize-without-first-setting-binaryformatter-binder.md) and [CA2302](ca2302-ensure-binaryformatter-binder-is-set-before-calling-binaryformatter-deserialize.md) help to ensure that the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Binder> property is always set before deserializing.
4545

4646
## When to suppress warnings
4747

48-
- It's safe to suppress a warning from this rule if you know the input is trusted. Consider that your application's trust boundary and data flows may change over time.
49-
- It's safe to suppress this warning if you've taken one of the precautions above.
48+
[!INCLUDE[insecure-deserializers-common-safe-to-suppress](includes/insecure-deserializers-common-safe-to-suppress-md.md)]
5049

5150
## Pseudo-code examples
5251

docs/code-quality/ca2301-do-not-call-binaryformatter-deserialize-without-first-setting-binaryformatter-binder.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ This rule finds <xref:System.Runtime.Serialization.Formatters.Binary.BinaryForma
3535
- If possible, use a secure serializer instead, and **don't allow an attacker to specify an arbitrary type to deserialize**. Some safer serializers include:
3636
- <xref:System.Runtime.Serialization.DataContractSerializer?displayProperty=nameWithType>
3737
- <xref:System.Runtime.Serialization.Json.DataContractJsonSerializer?displayProperty=nameWithType>
38-
- <xref:System.Web.Script.Serialization.JavaScriptSerializer?displayProperty=nameWithType> - Never use <xref:System.Web.Script.Serialization.SimpleTypeResolver?displayProperty=nameWithType>. If you must use a type resolver, you must restrict deserialized types to an expected list.
38+
- <xref:System.Web.Script.Serialization.JavaScriptSerializer?displayProperty=nameWithType> - Never use <xref:System.Web.Script.Serialization.SimpleTypeResolver?displayProperty=nameWithType>. If you must use a type resolver, restrict deserialized types to an expected list.
3939
- <xref:System.Xml.Serialization.XmlSerializer?displayProperty=nameWithType>
40-
- NewtonSoft Json.NET - Use TypeNameHandling.None. If you must use another value for TypeNameHandling, then you must restrict deserialized types to an expected list.
40+
- NewtonSoft Json.NET - Use TypeNameHandling.None. If you must use another value for TypeNameHandling, restrict deserialized types to an expected list with a custom ISerializationBinder.
4141
- Protocol Buffers
42-
- Make the serialized data tamper proof. After serialization, cryptographically sign the serialized data. Before deserializing, validate the cryptographic signature. You must protect the cryptographic key from being disclosed, and should design for key rotations.
42+
- Make the serialized data tamper-proof. After serialization, cryptographically sign the serialized data. Before deserialization, validate the cryptographic signature. Protect the cryptographic key from being disclosed, and design for key rotations.
4343
- Restrict deserialized types. Implement a custom <xref:System.Runtime.Serialization.SerializationBinder?displayProperty=nameWithType>. Before deserializing with <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter>, set the <xref:System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Binder> property to an instance of your custom <xref:System.Runtime.Serialization.SerializationBinder>. In the overridden <xref:System.Runtime.Serialization.SerializationBinder.BindToType%2A> method, if the type is unexpected then throw an exception.
4444

4545
## When to suppress warnings
4646

47-
- It's safe to suppress a warning from this rule if you know the input is trusted. Consider that your application's trust boundary and data flows may change over time.
48-
- It's safe to suppress this warning if you've taken one of the precautions above.
47+
[!INCLUDE[insecure-deserializers-common-safe-to-suppress](includes/insecure-deserializers-common-safe-to-suppress-md.md)]
4948

5049
## Pseudo-code examples
5150

@@ -114,6 +113,7 @@ End Class
114113
```
115114

116115
### Solution
116+
117117
```csharp
118118
using System;
119119
using System.IO;
@@ -135,7 +135,7 @@ public class BookRecordSerializationBinder : SerializationBinder
135135
}
136136
else
137137
{
138-
throw new ArgumentException("Unexpected type", "typeName");
138+
throw new ArgumentException("Unexpected type", nameof(typeName));
139139
}
140140
}
141141
}
@@ -188,7 +188,7 @@ Public Class BookRecordSerializationBinder
188188
If typeName = "BinaryFormatterVB.BookRecord" Or typeName = "BinaryFormatterVB.AisleLocation" Then
189189
Return Nothing
190190
Else
191-
Throw New ArgumentException("Unexpected type", "typeName")
191+
Throw New ArgumentException("Unexpected type", NameOf(typeName))
192192
End If
193193
End Function
194194
End Class

0 commit comments

Comments
 (0)