Skip to content

Commit d0c6840

Browse files
committed
CSHARP-5797: Add C# 14 testing
1 parent d06d817 commit d0c6840

File tree

23 files changed

+225
-85
lines changed

23 files changed

+225
-85
lines changed

CSharpDriver.sln

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,72 +64,105 @@ Global
6464
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6565
Debug|Any CPU = Debug|Any CPU
6666
Release|Any CPU = Release|Any CPU
67+
Release_CSharp_14|Any CPU = Release_CSharp_14|Any CPU
6768
EndGlobalSection
6869
GlobalSection(ProjectConfigurationPlatforms) = postSolution
6970
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7071
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
7172
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
7273
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Release|Any CPU.Build.0 = Release|Any CPU
74+
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
75+
{9FCB42A5-3BC6-492B-8EA0-53EF32E9F8CD}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
7376
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7477
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
7578
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
7679
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Release|Any CPU.Build.0 = Release|Any CPU
80+
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
81+
{3CE61F2A-B852-45F9-B607-E0FFFEF9DBC6}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
7782
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7883
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Debug|Any CPU.Build.0 = Debug|Any CPU
7984
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Release|Any CPU.ActiveCfg = Release|Any CPU
8085
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
87+
{4D6F0AD1-91CE-4736-AD4E-D9B11E49F206}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
8188
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8289
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
8390
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
8491
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Release|Any CPU.Build.0 = Release|Any CPU
92+
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
93+
{756980B3-0DCF-42F0-A324-C386B1A3E9F4}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
8594
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8695
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
8796
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
8897
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
99+
{253DBC37-A955-4CCE-8EAF-9CF4A91895DB}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
89100
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
90101
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Debug|Any CPU.Build.0 = Debug|Any CPU
91102
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Release|Any CPU.ActiveCfg = Release|Any CPU
92103
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Release|Any CPU.Build.0 = Release|Any CPU
104+
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
105+
{FD003B6D-C0C3-4D1E-832D-1AA96AF0244C}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
93106
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94107
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
95108
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
96109
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Release|Any CPU.Build.0 = Release|Any CPU
110+
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
111+
{F2E68945-76FC-49D5-8CB2-B23C76FF09C7}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
97112
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
98113
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Debug|Any CPU.Build.0 = Debug|Any CPU
99114
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release|Any CPU.ActiveCfg = Release|Any CPU
100115
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release|Any CPU.Build.0 = Release|Any CPU
116+
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
117+
{C50D554C-2771-4CC1-9B2C-BB17FB27F935}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
101118
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
102119
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Debug|Any CPU.Build.0 = Debug|Any CPU
103120
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Release|Any CPU.ActiveCfg = Release|Any CPU
104121
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Release|Any CPU.Build.0 = Release|Any CPU
122+
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
123+
{B90F025F-89D3-436A-AD78-6AA304A6E240}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
105124
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
106125
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
107126
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
108127
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Release|Any CPU.Build.0 = Release|Any CPU
128+
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
129+
{B711A69F-A337-452C-95E1-A6B15C727CBA}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
109130
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110131
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
111132
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
112133
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Release|Any CPU.Build.0 = Release|Any CPU
134+
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
135+
{DF888021-744F-4A8B-9324-831DEFC48AB8}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
113136
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114137
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Debug|Any CPU.Build.0 = Debug|Any CPU
115138
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Release|Any CPU.ActiveCfg = Release|Any CPU
116139
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Release|Any CPU.Build.0 = Release|Any CPU
140+
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
141+
{CF670F4A-49DD-4030-A4A0-1F4D600EB70A}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
117142
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
118143
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Debug|Any CPU.Build.0 = Debug|Any CPU
119144
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.ActiveCfg = Release|Any CPU
120145
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release|Any CPU.Build.0 = Release|Any CPU
146+
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
147+
{33B11279-DA4A-46EA-99BF-9DEDCAC50D95}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
121148
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
122149
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
123150
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
124151
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release|Any CPU.Build.0 = Release|Any CPU
152+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
153+
{642518BC-D28A-4ABC-851C-BC18CC34EEDA}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
125154
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.ActiveCfg = Release|Any CPU
126155
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release|Any CPU.Build.0 = Release|Any CPU
127156
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
128157
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Debug|Any CPU.Build.0 = Debug|Any CPU
158+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
159+
{AB4AD0CB-756C-444F-9F37-26DA35148934}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
129160
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130161
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
131162
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
132163
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release|Any CPU.Build.0 = Release|Any CPU
164+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release_CSharp_14|Any CPU.ActiveCfg = Release_CSharp_14|Any CPU
165+
{A0CAC199-457E-4862-AF9E-971C7A77CBF9}.Release_CSharp_14|Any CPU.Build.0 = Release_CSharp_14|Any CPU
133166
EndGlobalSection
134167
GlobalSection(SolutionProperties) = preSolution
135168
HideSolutionNode = FALSE

evergreen/compile-sources.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
set -o errexit # Exit the script with error if any of the commands fail
33

44
SOURCE_PROJECT=${1:-CSharpDriver.sln}
5+
CONFIGURATION=${CONFIGURATION:-'Release'}
6+
57
if [ -z "$PACKAGE_VERSION" ]; then
68
PACKAGE_VERSION=$(bash ./evergreen/get-version.sh)
79
echo Calculated PACKAGE_VERSION value: "$PACKAGE_VERSION"
@@ -30,4 +32,4 @@ do
3032
sleep $DELAY
3133
done
3234

33-
dotnet build "${SOURCE_PROJECT}" -c Release --no-restore -p:Version="$PACKAGE_VERSION"
35+
dotnet build "${SOURCE_PROJECT}" -c "${CONFIGURATION}" --no-restore -p:Version="$PACKAGE_VERSION"

evergreen/evergreen.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ functions:
341341
shell: "bash"
342342
include_expansions_in_env:
343343
- "FRAMEWORK"
344+
- "CONFIGURATION"
344345
script: |
345346
${PREPARE_SHELL}
346347
bash ./evergreen/run-unit-tests.sh
@@ -1138,6 +1139,16 @@ tasks:
11381139
DOTNET_SDK_VERSION: 10.0
11391140
- func: run-unit-tests
11401141

1142+
- name: unit-tests-net100-v14
1143+
commands:
1144+
- func: configure-framework
1145+
vars:
1146+
FRAMEWORK: net10.0
1147+
DOTNET_SDK_VERSION: 10.0
1148+
- func: run-unit-tests
1149+
vars:
1150+
CONFIGURATION: "Release_CSharp_14"
1151+
11411152
- name: test-net472
11421153
commands:
11431154
- func: setup-csfle-secrets
@@ -2409,6 +2420,7 @@ buildvariants:
24092420
- name: unit-tests-netstandard21
24102421
- name: unit-tests-net60
24112422
- name: unit-tests-net100
2423+
- name: unit-tests-net100-v14
24122424

24132425
- name: unit-tests-ubuntu
24142426
display_name: Unit Tests on Ubuntu
@@ -2419,6 +2431,7 @@ buildvariants:
24192431
- name: unit-tests-netstandard21
24202432
- name: unit-tests-net60
24212433
- name: unit-tests-net100
2434+
- name: unit-tests-net100-v14
24222435

24232436
- name: unit-tests-macos
24242437
display_name: Unit Tests on MacOs
@@ -2429,6 +2442,7 @@ buildvariants:
24292442
- name: unit-tests-netstandard21
24302443
- name: unit-tests-net60
24312444
- name: unit-tests-net100
2445+
- name: unit-tests-net100-v14
24322446

24332447
- name: unit-tests-macos-arm
24342448
display_name: Unit Tests on MacOs Arm
@@ -2438,6 +2452,7 @@ buildvariants:
24382452
tasks:
24392453
- name: unit-tests-net60
24402454
- name: unit-tests-net100
2455+
- name: unit-tests-net100-v14
24412456

24422457
- matrix_name: stable-api-tests
24432458
matrix_spec: { version: ["5.0", "6.0", "7.0", "8.0", "rapid", "latest"], topology: ["standalone", "sharded-cluster"], auth: "auth", ssl: "nossl", os: "windows-64" }

evergreen/run-unit-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
set -o errexit # Exit the script with error if any of the commands fail
33

44
FRAMEWORK=${FRAMEWORK:-net6.0}
5+
CONFIGURATION=${CONFIGURATION:-'Release'}
56

67
if [ "$FRAMEWORK" = "netstandard2.1" ]; then
78
FRAMEWORK="netcoreapp3.1"
89
fi
910

1011
export ADD_NET10_TFM="1" # Remove after cake removal
1112
./evergreen/compile-sources.sh
12-
dotnet test -c Release --no-build --filter "Category!=Integration" -f "$FRAMEWORK" --results-directory ./build/test-results --logger "junit;verbosity=detailed;LogFileName=TEST-{assembly}.xml;FailureBodyFormat=Verbose" --logger "console;verbosity=detailed"
13+
dotnet test -c "${CONFIGURATION}" --no-build --filter "Category!=Integration" -f "$FRAMEWORK" --results-directory ./build/test-results --logger "junit;verbosity=detailed;LogFileName=TEST-{assembly}.xml;FailureBodyFormat=Verbose" --logger "console;verbosity=detailed"

src/Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<CodeAnalysisRuleSet>..\..\MongoDB.ruleset</CodeAnalysisRuleSet>
1111
</PropertyGroup>
1212

13+
<PropertyGroup Condition=" '$(Configuration)' == 'Release_CSharp_14' ">
14+
<!--Do not update LangVersion to 14 in Driver-->
15+
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
16+
</PropertyGroup>
17+
1318
<PropertyGroup>
1419
<Company>MongoDB Inc.</Company>
1520
<Copyright>Copyright © 2010-present MongoDB Inc.</Copyright>

tests/BuildProps/Tests.Build.props

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
66
</PropertyGroup>
77

8+
<PropertyGroup>
9+
<Configurations>Debug;Release;Release_CSharp_14</Configurations>
10+
<Platforms>AnyCPU</Platforms>
11+
</PropertyGroup>
12+
13+
<PropertyGroup Condition=" '$(Configuration)' == 'Release_CSharp_14' ">
14+
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
15+
<DefineConstants>$(DefineConstants);CSHARP_14</DefineConstants>
16+
<LangVersion>14</LangVersion>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition=" '$(Configuration)' != 'Release_CSharp_14' ">
20+
<LangVersion>12</LangVersion>
21+
</PropertyGroup>
22+
823
<PropertyGroup>
924
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
1025
<TargetFrameworks Condition="'$(IsWindows)'=='true'">$(TargetFrameworks);net472</TargetFrameworks>
@@ -15,10 +30,18 @@
1530
</PropertyGroup>
1631

1732
<PropertyGroup>
18-
<LangVersion>12</LangVersion>
1933
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2034
</PropertyGroup>
2135

36+
<!-- <PropertyGroup Condition="'$(LANG_VERSION)'=='14'">-->
37+
<!-- <DefineConstants>$(DefineConstants);CSHARP_14</DefineConstants>-->
38+
<!-- <LangVersion>14</LangVersion>-->
39+
<!-- </PropertyGroup>-->
40+
41+
<!-- <PropertyGroup Condition="'$(LANG_VERSION)'==''">-->
42+
<!-- <LangVersion>12</LangVersion>-->
43+
<!-- </PropertyGroup>-->
44+
2245
<PropertyGroup Condition="'$(Version)'==''">
2346
<Version>0.0.0-local</Version>
2447
</PropertyGroup>
@@ -29,7 +52,7 @@
2952
</PropertyGroup>
3053

3154
<PropertyGroup>
32-
<DefineConstants>TRACE</DefineConstants>
55+
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
3356
</PropertyGroup>
3457
<PropertyGroup Condition="'$(IsWindows)'=='true'">
3558
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>

tests/MongoDB.Bson.Tests/IO/BsonChunkPoolTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ public bool _disposed
190190
{
191191
get
192192
{
193-
var field = typeof(BsonChunkPool).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
194-
return (bool)field.GetValue(_instance);
193+
var @field = typeof(BsonChunkPool).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
194+
return (bool)@field.GetValue(_instance);
195195
}
196196
}
197197
}
@@ -331,8 +331,8 @@ public bool _disposed
331331
{
332332
get
333333
{
334-
var field = _instance.GetType().GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
335-
return (bool)field.GetValue(_instance);
334+
var @field = _instance.GetType().GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
335+
return (bool)@field.GetValue(_instance);
336336
}
337337
}
338338
}

tests/MongoDB.Bson.Tests/IO/BsonStreamAdapterTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,35 +1701,35 @@ public bool _disposed
17011701
{
17021702
get
17031703
{
1704-
var field = typeof(BsonStreamAdapter).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
1705-
return (bool)field.GetValue(_instance);
1704+
var @field = typeof(BsonStreamAdapter).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
1705+
return (bool)@field.GetValue(_instance);
17061706
}
17071707
}
17081708

17091709
public bool _ownsStream
17101710
{
17111711
get
17121712
{
1713-
var field = typeof(BsonStreamAdapter).GetField("_ownsStream", BindingFlags.NonPublic | BindingFlags.Instance);
1714-
return (bool)field.GetValue(_instance);
1713+
var @field = typeof(BsonStreamAdapter).GetField("_ownsStream", BindingFlags.NonPublic | BindingFlags.Instance);
1714+
return (bool)@field.GetValue(_instance);
17151715
}
17161716
}
17171717

17181718
public Stream _stream
17191719
{
17201720
get
17211721
{
1722-
var field = typeof(BsonStreamAdapter).GetField("_stream", BindingFlags.NonPublic | BindingFlags.Instance);
1723-
return (Stream)field.GetValue(_instance);
1722+
var @field = typeof(BsonStreamAdapter).GetField("_stream", BindingFlags.NonPublic | BindingFlags.Instance);
1723+
return (Stream)@field.GetValue(_instance);
17241724
}
17251725
}
17261726

17271727
public byte[] _temp
17281728
{
17291729
get
17301730
{
1731-
var field = typeof(BsonStreamAdapter).GetField("_temp", BindingFlags.NonPublic | BindingFlags.Instance);
1732-
return (byte[])field.GetValue(_instance);
1731+
var @field = typeof(BsonStreamAdapter).GetField("_temp", BindingFlags.NonPublic | BindingFlags.Instance);
1732+
return (byte[])@field.GetValue(_instance);
17331733
}
17341734
}
17351735
}

tests/MongoDB.Bson.Tests/IO/BsonStreamExtensionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ public static bool[] __validBsonTypes
774774
{
775775
get
776776
{
777-
var field = typeof(BsonStreamExtensions).GetField("__validBsonTypes", BindingFlags.Static | BindingFlags.NonPublic);
778-
return (bool[])field.GetValue(null);
777+
var @field = typeof(BsonStreamExtensions).GetField("__validBsonTypes", BindingFlags.Static | BindingFlags.NonPublic);
778+
return (bool[])@field.GetValue(null);
779779
}
780780
}
781781
}

tests/MongoDB.Bson.Tests/IO/ByteArrayBufferTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -882,17 +882,17 @@ public byte[] _bytes
882882
{
883883
get
884884
{
885-
var field = typeof(ByteArrayBuffer).GetField("_bytes", BindingFlags.NonPublic | BindingFlags.Instance);
886-
return (byte[])field.GetValue(_instance);
885+
var @field = typeof(ByteArrayBuffer).GetField("_bytes", BindingFlags.NonPublic | BindingFlags.Instance);
886+
return (byte[])@field.GetValue(_instance);
887887
}
888888
}
889889

890890
public bool _disposed
891891
{
892892
get
893893
{
894-
var field = typeof(ByteArrayBuffer).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
895-
return (bool)field.GetValue(_instance);
894+
var @field = typeof(ByteArrayBuffer).GetField("_disposed", BindingFlags.NonPublic | BindingFlags.Instance);
895+
return (bool)@field.GetValue(_instance);
896896
}
897897
}
898898
}

0 commit comments

Comments
 (0)