Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Commit 7e6076b

Browse files
authored
Merge pull request #590 from dotnet/libtemplateUpdate
Modernize codebase
2 parents 1e5436f + 2a0cec4 commit 7e6076b

File tree

104 files changed

+2188
-1756
lines changed

Some content is hidden

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

104 files changed

+2188
-1756
lines changed

.editorconfig

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trim_trailing_whitespace = true
1717

1818
# Xml project files
1919
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
20-
indent_size = 2
20+
indent_size = 4
2121

2222
# Xml config files
2323
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
@@ -61,7 +61,7 @@ dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
6161
# Constants are PascalCase
6262
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
6363
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
64-
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
64+
dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style
6565

6666
dotnet_naming_symbols.constants.applicable_kinds = field, local
6767
dotnet_naming_symbols.constants.required_modifiers = const
@@ -71,7 +71,7 @@ dotnet_naming_style.constant_style.capitalization = pascal_case
7171
# Static fields are camelCase
7272
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
7373
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
74-
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
74+
dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_style
7575

7676
dotnet_naming_symbols.static_fields.applicable_kinds = field
7777
dotnet_naming_symbols.static_fields.required_modifiers = static
@@ -81,7 +81,7 @@ dotnet_naming_style.static_field_style.capitalization = camel_case
8181
# Instance fields are camelCase
8282
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
8383
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
84-
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
84+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_style
8585

8686
dotnet_naming_symbols.instance_fields.applicable_kinds = field
8787

@@ -99,7 +99,7 @@ dotnet_naming_style.camel_case_style.capitalization = camel_case
9999
# Local functions are PascalCase
100100
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
101101
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
102-
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
102+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style
103103

104104
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
105105

@@ -108,12 +108,28 @@ dotnet_naming_style.local_function_style.capitalization = pascal_case
108108
# By default, name items with PascalCase
109109
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
110110
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
111-
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
111+
dotnet_naming_rule.members_should_be_pascal_case.style = non_private_static_field_style
112112

113113
dotnet_naming_symbols.all_members.applicable_kinds = *
114114

115115
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
116116

117+
# SA1629: Documentation text should end with a period
118+
dotnet_diagnostic.SA1629.severity = none
119+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
120+
dotnet_style_prefer_auto_properties = true:silent
121+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
122+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
123+
dotnet_style_prefer_conditional_expression_over_return = true:silent
124+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
125+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
126+
dotnet_style_prefer_compound_assignment = true:suggestion
127+
dotnet_style_prefer_simplified_interpolation = true:suggestion
128+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
129+
tab_width = 4
130+
end_of_line = crlf
131+
dotnet_style_namespace_match_folder = true:suggestion
132+
117133
# CSharp code style settings:
118134
[*.cs]
119135
# Indentation preferences
@@ -124,7 +140,7 @@ csharp_indent_switch_labels = true
124140
csharp_indent_labels = flush_left
125141

126142
# Prefer "var" everywhere
127-
csharp_style_var_for_built_in_types = true:suggestion
143+
csharp_style_var_for_built_in_types = false:suggestion
128144
csharp_style_var_when_type_is_apparent = true:suggestion
129145
csharp_style_var_elsewhere = false:suggestion
130146

@@ -150,8 +166,16 @@ csharp_new_line_before_open_brace = all
150166
csharp_new_line_before_else = true
151167
csharp_new_line_before_catch = true
152168
csharp_new_line_before_finally = true
153-
csharp_new_line_before_members_in_object_initializers = true
169+
csharp_new_line_before_members_in_object_initializers = tru
154170
csharp_new_line_before_members_in_anonymous_types = true
155171

156172
# Blocks are allowed
157173
csharp_prefer_braces = true:silent
174+
csharp_using_directive_placement = outside_namespace:silent
175+
csharp_prefer_simple_using_statement = true:suggestion
176+
csharp_style_namespace_declarations = block_scoped:silent
177+
csharp_style_expression_bodied_lambdas = true:silent
178+
csharp_style_expression_bodied_local_functions = false:silent
179+
csharp_style_prefer_null_check_over_type_check = true:suggestion
180+
csharp_prefer_simple_default_expression = true:suggestion
181+
csharp_style_deconstructed_variable_declaration = true:suggestion

.gitattributes

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
*.proj text
88
*.ps1 text
99

10+
# Ensure shell scripts use LF line endings (linux only accepts LF)
11+
*.sh eol=lf
12+
*.ps1 eol=lf
13+
1014
###############################################################################
1115
# Set default behavior for command prompt diff.
1216
#
@@ -21,7 +25,7 @@
2125
#
2226
# Merging from the command prompt will add diff markers to the files if there
2327
# are conflicts (Merging from VS is not affected by the settings below, in VS
24-
# the diff markers are never inserted). Diff markers may cause the following
28+
# the diff markers are never inserted). Diff markers may cause the following
2529
# file extensions to fail to load in VS. An alternative would be to treat
2630
# these files as binary and thus will always conflict and require user
2731
# intervention with every merge. To do so, just uncomment the entries below
@@ -50,9 +54,9 @@
5054

5155
###############################################################################
5256
# diff behavior for common document formats
53-
#
57+
#
5458
# Convert binary document formats to text before diffing them. This feature
55-
# is only available from the command line. Turn it on by uncommenting the
59+
# is only available from the command line. Turn it on by uncommenting the
5660
# entries below.
5761
###############################################################################
5862
#*.doc diff=astextplain

azure-pipelines.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
trigger:
2+
batch: true
23
branches:
34
include:
4-
- master
5+
- main
56
- 'validate/*'
67
paths:
78
exclude:
@@ -18,7 +19,7 @@ stages:
1819
BuildConfiguration: Release
1920
BuildPlatform: Any CPU
2021
codecov_token: e300ab17-4cd6-43b5-8292-e824cb320ed3
21-
ci_feed: 6ed146e5-8e9c-46d6-a40f-da9367ed50cd/c20edbb7-8403-4456-8f43-f46b47e360b1
22+
ci_feed: OSS/PublicCI
2223
NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages
2324
GeneratePInvokesTxt: true
2425
jobs:

azure-pipelines/Convert-PDB.ps1

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

azure-pipelines/Get-ProcDump.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<#
2+
.SYNOPSIS
3+
Downloads 32-bit and 64-bit procdump executables and returns the path to where they were installed.
4+
#>
5+
$version = '0.0.1'
6+
$baseDir = "$PSScriptRoot\..\obj\tools"
7+
$procDumpToolPath = "$baseDir\procdump.$version\bin"
8+
if (-not (Test-Path $procDumpToolPath)) {
9+
if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null }
10+
$baseDir = (Resolve-Path $baseDir).Path # Normalize it
11+
& (& $PSScriptRoot\Get-NuGetTool.ps1) install procdump -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://api.nuget.org/v3/index.json | Out-Null
12+
}
13+
14+
(Resolve-Path $procDumpToolPath).Path
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<#
2+
.SYNOPSIS
3+
Collect the list of PDBs built in this repo, after converting them from portable to Windows PDBs.
4+
.PARAMETER Path
5+
The root path to recursively search for PDBs.
6+
.PARAMETER Tests
7+
A switch indicating to find test-related PDBs instead of product-only PDBs.
8+
#>
9+
[CmdletBinding()]
10+
param (
11+
[parameter(Mandatory=$true)]
12+
[string]$Path,
13+
[switch]$Tests
14+
)
15+
16+
$WindowsPdbSubDirName = "symstore"
17+
18+
$ActivityName = "Collecting symbols from $Path"
19+
Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files"
20+
$PDBs = Get-ChildItem -rec "$Path/*.pdb" |? { $_.FullName -notmatch "\W$WindowsPdbSubDirName\W" }
21+
22+
# Filter PDBs to product OR test related.
23+
$testregex = "unittest|tests"
24+
if ($Tests) {
25+
$PDBs = $PDBs |? { $_.FullName -match $testregex }
26+
} else {
27+
$PDBs = $PDBs |? { $_.FullName -notmatch $testregex }
28+
}
29+
30+
Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols"
31+
$PDBsByHash = @{}
32+
$i = 0
33+
$PDBs |% {
34+
Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" -PercentComplete (100 * $i / $PDBs.Length)
35+
$hash = Get-FileHash $_
36+
$i++
37+
Add-Member -InputObject $_ -MemberType NoteProperty -Name Hash -Value $hash.Hash
38+
Write-Output $_
39+
} | Sort-Object CreationTime |% {
40+
# De-dupe based on hash. Prefer the first match so we take the first built copy.
41+
if (-not $PDBsByHash.ContainsKey($_.Hash)) {
42+
$PDBsByHash.Add($_.Hash, $_.FullName)
43+
Write-Output $_
44+
}
45+
} |% {
46+
# Collect the DLLs/EXEs as well.
47+
$dllPath = "$($_.Directory)/$($_.BaseName).dll"
48+
$exePath = "$($_.Directory)/$($_.BaseName).exe"
49+
if (Test-Path $dllPath) {
50+
$BinaryImagePath = $dllPath
51+
} elseif (Test-Path $exePath) {
52+
$BinaryImagePath = $exePath
53+
}
54+
55+
Write-Output $BinaryImagePath
56+
Write-Output $_
57+
}

azure-pipelines/Get-TempToolsPath.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
if ($env:AGENT_TOOLSDIRECTORY) {
2-
$path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools"
1+
if ($env:AGENT_TEMPDIRECTORY) {
2+
$path = "$env:AGENT_TEMPDIRECTORY\$env:BUILD_BUILDID"
33
} elseif ($env:localappdata) {
4-
$path = "$env:localappdata\vs-platform\tools"
4+
$path = "$env:localappdata\gitrepos\tools"
55
} else {
66
$path = "$PSScriptRoot\..\obj\tools"
77
}

azure-pipelines/Get-nbgv.ps1

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ if ($existingTool) {
1010
return $existingTool.Path
1111
}
1212

13-
if ($env:AGENT_TEMPDIRECTORY) {
14-
$toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID"
15-
} else {
16-
$toolInstallDir = "$PSScriptRoot/../obj/tools"
17-
}
13+
$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1"
1814

1915
$toolPath = "$toolInstallDir/nbgv"
2016
if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null }

azure-pipelines/Set-EnvVars.ps1

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<RunSettings>
2+
<DataCollectionRunSettings>
3+
<DataCollectors>
4+
<DataCollector friendlyName="blame" enabled="True">
5+
<Configuration>
6+
<CollectDump DumpType="full" />
7+
<CollectDumpOnTestSessionHang TestTimeout="30000" DumpType="full" />
8+
</Configuration>
9+
</DataCollector>
10+
</DataCollectors>
11+
</DataCollectionRunSettings>
12+
</RunSettings>

0 commit comments

Comments
 (0)