Skip to content

Commit 309bc69

Browse files
committed
Apply Library.Template pattern
Also add tests and fix some handling of CombinatorialMemberDataAttribute types.
1 parent 1290183 commit 309bc69

File tree

100 files changed

+3202
-1087
lines changed

Some content is hidden

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

100 files changed

+3202
-1087
lines changed

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:5.0.400-focal
2+
3+
# Installing mono makes `dotnet test` work without errors even for net472.
4+
# But installing it takes a long time, so it's excluded by default.
5+
#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
6+
#RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list
7+
#RUN apt-get update
8+
#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mono-devel
9+
10+
# Clear the NUGET_XMLDOC_MODE env var so xml api doc files get unpacked, allowing a rich experience in Intellisense.
11+
# See https://github.com/dotnet/dotnet-docker/issues/2790 for a discussion on this, where the prioritized use case
12+
# was *not* devcontainers, sadly.
13+
ENV NUGET_XMLDOC_MODE=

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "Dev space",
3+
"dockerFile": "Dockerfile",
4+
"settings": {
5+
"terminal.integrated.shell.linux": "/usr/bin/pwsh"
6+
},
7+
"postCreateCommand": "./init.ps1 -InstallLocality machine",
8+
"extensions": [
9+
"ms-azure-devops.azure-pipelines",
10+
"ms-dotnettools.csharp",
11+
"k--kato.docomment",
12+
"editorconfig.editorconfig",
13+
"pflannery.vscode-versionlens",
14+
"davidanson.vscode-markdownlint",
15+
"dotjoshjohnson.xml",
16+
"ms-vscode-remote.remote-containers",
17+
"ms-azuretools.vscode-docker",
18+
"ms-vscode.powershell"
19+
]
20+
}

.editorconfig

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# EditorConfig is awesome:http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Don't use tabs for indentation.
7+
[*]
8+
indent_style = space
9+
10+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
11+
12+
[*.yml]
13+
indent_size = 2
14+
indent_style = space
15+
16+
# Code files
17+
[*.{cs,csx,vb,vbx,h,cpp,idl}]
18+
indent_size = 4
19+
insert_final_newline = true
20+
trim_trailing_whitespace = true
21+
22+
# Xml project files
23+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}]
24+
indent_size = 2
25+
26+
# Xml config files
27+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}]
28+
indent_size = 2
29+
30+
# JSON files
31+
[*.json]
32+
indent_size = 2
33+
indent_style = space
34+
35+
# Dotnet code style settings:
36+
[*.{cs,vb}]
37+
# Sort using and Import directives with System.* appearing first
38+
dotnet_sort_system_directives_first = true
39+
dotnet_style_qualification_for_field = true:warning
40+
dotnet_style_qualification_for_property = true:warning
41+
dotnet_style_qualification_for_method = true:warning
42+
dotnet_style_qualification_for_event = true:warning
43+
44+
# Use language keywords instead of framework type names for type references
45+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
46+
dotnet_style_predefined_type_for_member_access = true:suggestion
47+
48+
# Suggest more modern language features when available
49+
dotnet_style_object_initializer = true:suggestion
50+
dotnet_style_collection_initializer = true:suggestion
51+
dotnet_style_coalesce_expression = true:suggestion
52+
dotnet_style_null_propagation = true:suggestion
53+
dotnet_style_explicit_tuple_names = true:suggestion
54+
55+
# Non-private static fields are PascalCase
56+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
57+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
58+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
59+
60+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
61+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected
62+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
63+
64+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
65+
66+
# Constants are PascalCase
67+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
68+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
69+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
70+
71+
dotnet_naming_symbols.constants.applicable_kinds = field, local
72+
dotnet_naming_symbols.constants.required_modifiers = const
73+
74+
dotnet_naming_style.constant_style.capitalization = pascal_case
75+
76+
# Static fields are camelCase
77+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
78+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
79+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
80+
81+
dotnet_naming_symbols.static_fields.applicable_kinds = field
82+
dotnet_naming_symbols.static_fields.required_modifiers = static
83+
84+
dotnet_naming_style.static_field_style.capitalization = camel_case
85+
86+
# Instance fields are camelCase
87+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
88+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
89+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
90+
91+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
92+
93+
dotnet_naming_style.instance_field_style.capitalization = camel_case
94+
95+
# Locals and parameters are camelCase
96+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
97+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
98+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
99+
100+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
101+
102+
dotnet_naming_style.camel_case_style.capitalization = camel_case
103+
104+
# Local functions are PascalCase
105+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
106+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
107+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
108+
109+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
110+
111+
dotnet_naming_style.local_function_style.capitalization = pascal_case
112+
113+
# By default, name items with PascalCase
114+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
115+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
116+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
117+
118+
dotnet_naming_symbols.all_members.applicable_kinds = *
119+
120+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
121+
122+
# CSharp code style settings:
123+
[*.cs]
124+
# Indentation preferences
125+
csharp_indent_block_contents = true
126+
csharp_indent_braces = false
127+
csharp_indent_case_contents = true
128+
csharp_indent_switch_labels = true
129+
csharp_indent_labels = flush_left
130+
131+
# Prefer "var" everywhere
132+
csharp_style_var_for_built_in_types = false
133+
csharp_style_var_when_type_is_apparent = true:suggestion
134+
csharp_style_var_elsewhere = false:warning
135+
136+
# Prefer method-like constructs to have a block body
137+
csharp_style_expression_bodied_methods = false:none
138+
csharp_style_expression_bodied_constructors = false:none
139+
csharp_style_expression_bodied_operators = false:none
140+
141+
# Prefer property-like constructs to have an expression-body
142+
csharp_style_expression_bodied_properties = true:none
143+
csharp_style_expression_bodied_indexers = true:none
144+
csharp_style_expression_bodied_accessors = true:none
145+
146+
# Suggest more modern language features when available
147+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
148+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
149+
csharp_style_inlined_variable_declaration = true:suggestion
150+
csharp_style_throw_expression = true:suggestion
151+
csharp_style_conditional_delegate_call = true:suggestion
152+
153+
# Newline settings
154+
csharp_new_line_before_open_brace = all
155+
csharp_new_line_before_else = true
156+
csharp_new_line_before_catch = true
157+
csharp_new_line_before_finally = true
158+
csharp_new_line_before_members_in_object_initializers = true
159+
csharp_new_line_before_members_in_anonymous_types = true
160+
161+
# Blocks are allowed
162+
csharp_prefer_braces = true:silent
163+
164+
# SA1130: Use lambda syntax
165+
dotnet_diagnostic.SA1130.severity = silent
166+
167+
# SA1133: Do not combine attributes
168+
dotnet_diagnostic.SA1133.severity = silent
169+
170+
# CA1508: Avoid dead conditional code
171+
dotnet_diagnostic.CA1508.severity = warning
172+
173+
# IDE1006: Naming Styles - StyleCop handles these for us
174+
dotnet_diagnostic.IDE1006.severity = none
175+
176+
[*.sln]
177+
indent_style = tab

.gitattributes

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
###############################################################################
44
* text=auto
55

6+
# Ensure shell scripts use LF line endings (linux only accepts LF)
7+
*.sh eol=lf
8+
*.ps1 eol=lf
9+
610
###############################################################################
711
# Set default behavior for command prompt diff.
812
#
@@ -17,7 +21,7 @@
1721
#
1822
# Merging from the command prompt will add diff markers to the files if there
1923
# are conflicts (Merging from VS is not affected by the settings below, in VS
20-
# the diff markers are never inserted). Diff markers may cause the following
24+
# the diff markers are never inserted). Diff markers may cause the following
2125
# file extensions to fail to load in VS. An alternative would be to treat
2226
# these files as binary and thus will always conflict and require user
2327
# intervention with every merge. To do so, just uncomment the entries below
@@ -46,9 +50,9 @@
4650

4751
###############################################################################
4852
# diff behavior for common document formats
49-
#
53+
#
5054
# Convert binary document formats to text before diffing them. This feature
51-
# is only available from the command line. Turn it on by uncommenting the
55+
# is only available from the command line. Turn it on by uncommenting the
5256
# entries below.
5357
###############################################################################
5458
#*.doc diff=astextplain

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: nuget
7+
directory: /
8+
schedule:
9+
interval: monthly

.github/workflows/Linux.runsettings

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>

.github/workflows/Windows.runsettings

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>

.github/workflows/build.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- validate/*
8+
pull_request:
9+
10+
env:
11+
TreatWarningsAsErrors: true
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
13+
BUILDCONFIGURATION: Release
14+
codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/
15+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
16+
17+
jobs:
18+
build:
19+
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os:
25+
- ubuntu-20.04
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
31+
- name: Install prerequisites
32+
run: |
33+
./init.ps1 -UpgradePrerequisites
34+
dotnet --info
35+
shell: pwsh
36+
- name: Set pipeline variables based on source
37+
run: azure-pipelines/variables/_pipelines.ps1
38+
shell: pwsh
39+
- name: build
40+
run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog"
41+
- name: pack
42+
run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog"
43+
- name: test
44+
run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings"
45+
- name: Update pipeline variables based on build outputs
46+
run: azure-pipelines/variables/_pipelines.ps1
47+
shell: pwsh
48+
- name: Collect artifacts
49+
run: azure-pipelines/artifacts/_stage_all.ps1
50+
shell: pwsh
51+
if: always()
52+
- name: Upload project.assets.json files
53+
if: always()
54+
uses: actions/upload-artifact@v1
55+
with:
56+
name: projectAssetsJson-${{ runner.os }}
57+
path: obj/_artifacts/projectAssetsJson
58+
continue-on-error: true
59+
- name: Upload variables
60+
uses: actions/upload-artifact@v1
61+
with:
62+
name: variables-${{ runner.os }}
63+
path: obj/_artifacts/variables
64+
continue-on-error: true
65+
- name: Upload build_logs
66+
if: always()
67+
uses: actions/upload-artifact@v1
68+
with:
69+
name: build_logs-${{ runner.os }}
70+
path: obj/_artifacts/build_logs
71+
continue-on-error: true
72+
- name: Upload testResults
73+
if: always()
74+
uses: actions/upload-artifact@v1
75+
with:
76+
name: testResults-${{ runner.os }}
77+
path: obj/_artifacts/testResults
78+
continue-on-error: true
79+
- name: Upload coverageResults
80+
if: always()
81+
uses: actions/upload-artifact@v1
82+
with:
83+
name: coverageResults-${{ runner.os }}
84+
path: obj/_artifacts/coverageResults
85+
continue-on-error: true
86+
- name: Upload symbols
87+
uses: actions/upload-artifact@v1
88+
with:
89+
name: symbols-${{ runner.os }}
90+
path: obj/_artifacts/symbols
91+
continue-on-error: true
92+
- name: Upload deployables
93+
uses: actions/upload-artifact@v1
94+
with:
95+
name: deployables-${{ runner.os }}
96+
path: obj/_artifacts/deployables
97+
if: always()
98+
- name: Publish code coverage results to codecov.io
99+
run: bash <(curl -s https://codecov.io/bash)
100+
shell: bash
101+
timeout-minutes: 3
102+
continue-on-error: true

.github/workflows/macOS.runsettings

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)