Skip to content

Commit ccaf794

Browse files
committed
Merge branch 'mikejo-br10' of https://github.com/mikejo5000/visualstudio-docs-pr into mikejo-br10
2 parents bc35cd7 + 273d55d commit ccaf794

File tree

960 files changed

+6937
-45688
lines changed

Some content is hidden

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

960 files changed

+6937
-45688
lines changed

.openpublishing.publish.config.json

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
{
22
"build_entry_point": "docs",
33
"docsets_to_publish": [
4-
{
5-
"docset_name": "b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70",
6-
"build_source_folder": "b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70",
7-
"build_output_subfolder": "b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70",
8-
"locale": "en-us",
9-
"monikers": [],
10-
"moniker_ranges": [],
11-
"open_to_public_contributors": false,
12-
"type_mapping": {
13-
"Conceptual": "Content",
14-
"ManagedReference": "Content",
15-
"RestApi": "Content"
16-
},
17-
"build_entry_point": "docs",
18-
"template_folder": "_themes"
19-
},
204
{
215
"docset_name": "connected-environment",
226
"build_source_folder": "connected-environment",
@@ -129,11 +113,11 @@
129113
]
130114
},
131115
"need_generate_pdf_url_template": true,
132-
"Targets": {
133-
"Pdf": {
134-
"template_folder": "_themes.pdf"
135-
}
136-
},
116+
"targets": {
117+
"Pdf": {
118+
"template_folder": "_themes.pdf"
119+
}
120+
},
137121
"need_generate_pdf": false,
138122
"need_generate_intellisense": false
139123
}

.openpublishing.redirection.json

Lines changed: 2820 additions & 0 deletions
Large diffs are not rendered by default.

b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70/TOC.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70/breadcrumb/toc.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70/docfx.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

b362ae64-b1c1-4f4d-a0af-76fe2cfdbd70/index.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/code-quality/ca1300-specify-messageboxoptions.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ ms.assetid: 9357a724-026e-4a3d-a03a-f14635064ec6
1414
author: gewarren
1515
ms.author: gewarren
1616
manager: douge
17+
dev_langs:
18+
- CSharp
19+
- VB
1720
ms.workload:
1821
- "multiple"
1922
---
2023
# CA1300: Specify MessageBoxOptions
24+
2125
|||
2226
|-|-|
2327
|TypeName|SpecifyMessageBoxOptions|
@@ -26,23 +30,29 @@ ms.workload:
2630
|Breaking Change|Non-breaking|
2731

2832
## Cause
29-
A method calls an overload of the <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=fullName> method that does not take a <xref:System.Windows.Forms.MessageBoxOptions?displayProperty=fullName> argument.
3033

31-
## Rule Description
32-
To display a message box correctly for cultures that use a right-to-left reading order, the <xref:System.Windows.Forms.MessageBoxOptions> and <xref:System.Windows.Forms.MessageBoxOptions> members of the <xref:System.Windows.Forms.MessageBoxOptions> enumeration must be passed to the <xref:System.Windows.Forms.MessageBox.Show%2A> method. Examine the <xref:System.Windows.Forms.Control.RightToLeft%2A?displayProperty=fullName> property of the containing control to determine whether to use a right-to-left reading order.
34+
A method calls an overload of the <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=fullName> method that does not take a <xref:System.Windows.Forms.MessageBoxOptions?displayProperty=fullName> argument.
35+
36+
## Rule description
37+
38+
To display a message box correctly for cultures that use a right-to-left reading order, pass the [MessageBoxOptions.RightAlign](<xref:System.Windows.Forms.MessageBoxOptions.RightAlign>) and [MessageBoxOptions.RtlReading](<xref:System.Windows.Forms.MessageBoxOptions.RtlReading>) fields to the <xref:System.Windows.Forms.MessageBox.Show%2A> method. Examine the <xref:System.Windows.Forms.Control.RightToLeft%2A?displayProperty=fullName> property of the containing control to determine whether to use a right-to-left reading order.
39+
40+
## How to fix violations
3341

34-
## How to Fix Violations
35-
To fix a violation of this rule, call an overload of the <xref:System.Windows.Forms.MessageBox.Show%2A> method that takes a <xref:System.Windows.Forms.MessageBoxOptions> argument.
42+
To fix a violation of this rule, call an overload of the <xref:System.Windows.Forms.MessageBox.Show%2A> method that takes a <xref:System.Windows.Forms.MessageBoxOptions> argument.
3643

37-
## When to Suppress Warnings
38-
It is safe to suppress a warning from this rule when the code library will not be localized for a culture that uses a right-to-left reading order.
44+
## When to suppress warnings
45+
46+
It is safe to suppress a warning from this rule when the code library will not be localized for a culture that uses a right-to-left reading order.
3947

4048
## Example
41-
The following example shows a method that displays a message box that has options that are appropriate for the reading order of the culture. A resource file, which is not shown, is required to build the example. Follow the comments in the example to build the example without a resource file and to test the right-to-left feature.
4249

43-
[!code-vb[FxCop.Globalization.SpecifyMBOptions#1](../code-quality/codesnippet/VisualBasic/ca1300-specify-messageboxoptions_1.vb)]
44-
[!code-csharp[FxCop.Globalization.SpecifyMBOptions#1](../code-quality/codesnippet/CSharp/ca1300-specify-messageboxoptions_1.cs)]
50+
The following example shows a method that displays a message box that has options that are appropriate for the reading order of the culture. A resource file, which is not shown, is required to build the example. Follow the comments in the example to build the example without a resource file and to test the right-to-left feature.
51+
52+
[!code-vb[FxCop.Globalization.SpecifyMBOptions#1](../code-quality/codesnippet/VisualBasic/ca1300-specify-messageboxoptions_1.vb)]
53+
[!code-csharp[FxCop.Globalization.SpecifyMBOptions#1](../code-quality/codesnippet/CSharp/ca1300-specify-messageboxoptions_1.cs)]
54+
55+
## See also
4556

46-
## See Also
47-
<xref:System.Resources.ResourceManager?displayProperty=fullName>
48-
[Resources in Desktop Apps](/dotnet/framework/resources/index)
57+
- <xref:System.Resources.ResourceManager?displayProperty=fullName>
58+
- [Resources in desktop apps (.NET Framework)](/dotnet/framework/resources/index)
Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "CA1304: Specify CultureInfo"
3-
ms.date: 11/04/2016
3+
ms.date: 06/30/2018
44
ms.prod: visual-studio-dev15
55
ms.technology: vs-ide-code-analysis
66
ms.topic: reference
@@ -18,6 +18,7 @@ ms.workload:
1818
- "multiple"
1919
---
2020
# CA1304: Specify CultureInfo
21+
2122
|||
2223
|-|-|
2324
|TypeName|SpecifyCultureInfo|
@@ -26,49 +27,58 @@ ms.workload:
2627
|Breaking Change|Non-breaking|
2728

2829
## Cause
29-
A method or constructor calls a member that has an overload that accepts a <xref:System.Globalization.CultureInfo?displayProperty=fullName> parameter, and the method or constructor does not call the overload that takes the <xref:System.Globalization.CultureInfo> parameter. This rule ignores calls to the following methods:
3030

31-
- <xref:System.Activator.CreateInstance%2A?displayProperty=fullName>
31+
A method or constructor calls a member that has an overload that accepts a <xref:System.Globalization.CultureInfo?displayProperty=nameWithType> parameter, and the method or constructor does not call the overload that takes the <xref:System.Globalization.CultureInfo> parameter. This rule ignores calls to the following methods:
32+
33+
- <xref:System.Activator.CreateInstance%2A?displayProperty=nameWithType>
34+
- <xref:System.Resources.ResourceManager.GetObject%2A?displayProperty=nameWithType>
35+
- <xref:System.Resources.ResourceManager.GetString%2A?displayProperty=nameWithType>
36+
37+
## Rule description
38+
39+
When a <xref:System.Globalization.CultureInfo> or <xref:System.IFormatProvider?displayProperty=nameWithType> object is not supplied, the default value that is supplied by the overloaded member might not have the effect that you want in all locales. Also, .NET Framework members choose default culture and formatting based on assumptions that might not be correct for your code. To ensure the code works as expected for your scenarios, you should supply culture-specific information according to the following guidelines:
40+
41+
- If the value will be displayed to the user, use the current culture. See <xref:System.Globalization.CultureInfo.CurrentCulture%2A?displayProperty=nameWithType>.
3242

33-
- <xref:System.Resources.ResourceManager.GetObject%2A?displayProperty=fullName>
43+
- If the value will be stored and accessed by software, that is, persisted to a file or database, use the invariant culture. See <xref:System.Globalization.CultureInfo.InvariantCulture%2A?displayProperty=nameWithType>.
3444

35-
- <xref:System.Resources.ResourceManager.GetString%2A?displayProperty=fullName>
45+
- If you do not know the destination of the value, have the data consumer or provider specify the culture.
3646

37-
## Rule Description
38-
When a <xref:System.Globalization.CultureInfo> or <xref:System.IFormatProvider?displayProperty=fullName> object is not supplied, the default value that is supplied by the overloaded member might not have the effect that you want in all locales. Also, [!INCLUDE[dnprdnshort](../code-quality/includes/dnprdnshort_md.md)] members choose default culture and formatting based on assumptions that might not be correct for your code. To ensure the code works as expected for your scenarios, you should supply culture-specific information according to the following guidelines:
47+
Even if the default behavior of the overloaded member is appropriate for your needs, it is better to explicitly call the culture-specific overload so that your code is self-documenting and more easily maintained.
3948

40-
- If the value will be displayed to the user, use the current culture. See <xref:System.Globalization.CultureInfo.CurrentCulture%2A?displayProperty=fullName>.
49+
> [!NOTE]
50+
> <xref:System.Globalization.CultureInfo.CurrentUICulture%2A?displayProperty=nameWithType> is used only to retrieve localized resources by using an instance of the <xref:System.Resources.ResourceManager?displayProperty=nameWithType> class.
4151
42-
- If the value will be stored and accessed by software, that is, persisted to a file or database, use the invariant culture. See <xref:System.Globalization.CultureInfo.InvariantCulture%2A?displayProperty=fullName>.
52+
## How to fix violations
4353

44-
- If you do not know the destination of the value, have the data consumer or provider specify the culture.
54+
To fix a violation of this rule, use the overload that takes a <xref:System.Globalization.CultureInfo> argument.
4555

46-
Note that <xref:System.Globalization.CultureInfo.CurrentUICulture%2A?displayProperty=fullName> is used only to retrieve localized resources by using an instance of the <xref:System.Resources.ResourceManager?displayProperty=fullName> class.
56+
## When to suppress warnings
4757

48-
Even if the default behavior of the overloaded member is appropriate for your needs, it is better to explicitly call the culture-specific overload so that your code is self-documenting and more easily maintained.
58+
It is safe to suppress a warning from this rule when it is certain that the default culture is the correct choice, and where code maintainability is not an important development priority.
4959

50-
## How to Fix Violations
51-
To fix a violation of this rule, use the overload that takes a <xref:System.Globalization.CultureInfo> or <xref:System.IFormatProvider> and specify the argument according to the guidelines that were listed earlier.
60+
## Example showing how to fix violations
5261

53-
## When to Suppress Warnings
54-
It is safe to suppress a warning from this rule when it is certain that the default culture/format provider is the correct choice, and where code maintainability is not an important development priority.
62+
In the following example, `BadMethod` causes two violations of this rule. `GoodMethod` corrects the first violation by passing the invariant culture to <xref:System.String.Compare%2A?displayProperty=nameWithType>, and corrects the second violation by passing the current culture to <xref:System.String.ToLower%2A?displayProperty=nameWithType> because `string3` is displayed to the user.
5563

56-
## Example
57-
In the following example, `BadMethod` causes two violations of this rule. `GoodMethod` corrects the first violation by passing the invariant culture to System.String.Compare, and corrects the second violation by passing the current culture to <xref:System.String.ToLower%2A> because `string3` is displayed to the user.
64+
[!code-csharp[FxCop.Globalization.CultureInfo#1](../code-quality/codesnippet/CSharp/ca1304-specify-cultureinfo_1.cs)]
5865

59-
[!code-csharp[FxCop.Globalization.CultureInfo#1](../code-quality/codesnippet/CSharp/ca1304-specify-cultureinfo_1.cs)]
66+
## Example showing formatted output
6067

61-
## Example
62-
The following example shows the effect of current culture on the default <xref:System.IFormatProvider> that is selected by the <xref:System.DateTime> type.
68+
The following example shows the effect of current culture on the default <xref:System.IFormatProvider> that is selected by the <xref:System.DateTime> type.
6369

64-
[!code-csharp[FxCop.Globalization.IFormatProvider#1](../code-quality/codesnippet/CSharp/ca1304-specify-cultureinfo_2.cs)]
70+
[!code-csharp[FxCop.Globalization.IFormatProvider#1](../code-quality/codesnippet/CSharp/ca1304-specify-cultureinfo_2.cs)]
6571

66-
This example produces the following output.
72+
This example produces the following output:
73+
74+
**6/4/1900 12:15:12 PM**
6775

68-
**6/4/1900 12:15:12 PM**
6976
**06/04/1900 12:15:12**
70-
## Related Rules
71-
[CA1305: Specify IFormatProvider](../code-quality/ca1305-specify-iformatprovider.md)
7277

73-
## See Also
74-
[Using the CultureInfo Class](/dotnet/standard/globalization-localization/globalization#Cultures)
78+
## Related rules
79+
80+
- [CA1305: Specify IFormatProvider](../code-quality/ca1305-specify-iformatprovider.md)
81+
82+
## See also
83+
84+
- [Using the CultureInfo Class](/dotnet/standard/globalization-localization/globalization#Cultures)

0 commit comments

Comments
 (0)