Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .NET 9 #2946

Merged
merged 83 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
1eeaea4
Update to .NET 9 preview 6
ErikEJ Jul 15, 2024
5b05bd4
Testing Net9 SDK support on pipelines
Jul 23, 2024
2913009
Revert NuGet.config change
ErikEJ Jul 26, 2024
e54daf3
Update pipeline
ErikEJ Jul 27, 2024
c010bd3
Suppressed error codes IL2093 and CA2022 when compiled using msbuild.
arellegue Sep 12, 2024
65710d6
Revert "Suppressed error codes IL2093 and CA2022 when compiled using …
arellegue Sep 12, 2024
119d70b
Derived from ErikEJ's issue-2669 branch and added fixes for msbuild C…
arellegue Sep 16, 2024
179fa81
Updated packages for .net9.0 to rc-1 versions.
arellegue Sep 18, 2024
4ee429f
Merge main
mdaigle Oct 31, 2024
b2a0c4b
Merge changes from Aris's branch
mdaigle Nov 1, 2024
8324368
merge main
mdaigle Nov 1, 2024
61da001
Add usedotnet task before build.
mdaigle Nov 4, 2024
c32d351
Fix formatting.
mdaigle Nov 4, 2024
54e4850
dotnet location debug logs.
mdaigle Nov 4, 2024
df7c8e8
List sdk and runtime versions and locations.
mdaigle Nov 4, 2024
ceb4f19
Switch image for nuget restore job.
mdaigle Nov 4, 2024
174ae48
Bump image for nuget restore.
mdaigle Nov 4, 2024
257868b
Temporarily remove test steps to reduce wait time. Remove dotnet 9 in…
mdaigle Nov 4, 2024
81756b3
Add global.json file to lock sdk version.
mdaigle Nov 4, 2024
fc60090
Fix target frameworks for netcore ref.
mdaigle Nov 4, 2024
5c7ab1c
Try base image with dotnet installed according to global.json
mdaigle Nov 5, 2024
0710337
Merge branch 'main' into net9-add-support
mdaigle Nov 5, 2024
7197ae7
Install dotnet 8 sdk.
mdaigle Nov 5, 2024
17667e2
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 5, 2024
76232f6
Allow multi level lookup and roll forward.
mdaigle Nov 5, 2024
3851ecc
Switch to runtime install. Clean up comments. Add test steps back int…
mdaigle Nov 5, 2024
417d199
Switch 8 install to sdk.
mdaigle Nov 5, 2024
bd5d2f4
Update target net version.
mdaigle Nov 5, 2024
29286a7
Use Stream extension to address CA2022.
mdaigle Nov 6, 2024
52b9cab
Merge branch 'main' into net9-add-support
mdaigle Nov 6, 2024
58a8b1d
Fix ReadExactly logic and preserve exceptions.
mdaigle Nov 6, 2024
6a74a48
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 6, 2024
0fb79bb
Fix certificate loading for net 8.
mdaigle Nov 6, 2024
fcefe05
Add debug assert on cert type.
mdaigle Nov 6, 2024
0444346
Remove other test configs
mdaigle Nov 6, 2024
82a8179
Use debug config.
mdaigle Nov 6, 2024
9e0db47
Set debug config.
mdaigle Nov 6, 2024
81c6bc3
Unset debug config.
mdaigle Nov 6, 2024
dd3bb15
Add pkcs package reference. Parse enclave health check cert as pkcs7.
mdaigle Nov 7, 2024
eb7fb98
Remove accidental using.
mdaigle Nov 7, 2024
e130803
Log health report cert type.
mdaigle Nov 7, 2024
e640ff2
Switch health report cert parsing to X509.
mdaigle Nov 7, 2024
d5ea073
Revert "Remove other test configs"
mdaigle Nov 7, 2024
61d64fa
PackageReference cleanup. Precompile symbol cleanup.
mdaigle Nov 7, 2024
91654f9
Remove extra property.
mdaigle Nov 7, 2024
3dc8485
Update stream test.
mdaigle Nov 7, 2024
0fd48c4
Remove test assertion.
mdaigle Nov 8, 2024
7308499
Install net9 via powershell.
mdaigle Nov 11, 2024
5f47358
Merge branch 'main' into net9-add-support
mdaigle Nov 11, 2024
c1cd969
Use task without global.json
mdaigle Nov 11, 2024
63e122a
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 11, 2024
acc9dcb
Remove .net8
mdaigle Nov 11, 2024
c21d029
Use multilevellookup
mdaigle Nov 11, 2024
e96b9e7
Try installing to program files
mdaigle Nov 12, 2024
03edd8c
fix input. use default for mac/linux.
mdaigle Nov 12, 2024
bf40390
Remove net9 install for windows. Remove pr triggers.
mdaigle Nov 18, 2024
69fcaa7
Merge branch 'main' into net9-add-support
mdaigle Nov 18, 2024
8d500a3
Try artifact again.
mdaigle Nov 21, 2024
121b486
Install net 9 via task. Update packages.
mdaigle Nov 21, 2024
63cb959
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 21, 2024
84ccf87
Add license statements.
mdaigle Nov 21, 2024
7128075
Use regular mms.
mdaigle Nov 21, 2024
a929807
Move stream extensions. Use new certificate functionality for all tar…
mdaigle Nov 21, 2024
f728c54
Fix dynamic accessed member types warning
mdaigle Nov 21, 2024
8762a8c
Fix service point manager warning. Add back stream extensions for tests.
mdaigle Nov 21, 2024
5a3b272
Use certificate loader.
mdaigle Nov 21, 2024
898288b
Adjust tests.
mdaigle Nov 21, 2024
8d735e7
Fix tests.
mdaigle Nov 21, 2024
e2c4e30
Fix tests.
mdaigle Nov 21, 2024
fe363e2
How did these get dropped?
mdaigle Nov 22, 2024
393b66e
Address review comments.
mdaigle Nov 22, 2024
43a709f
Add System.ServiceProcess.ServiceController to manual tests in netfx.
mdaigle Nov 22, 2024
b2e5579
Update for package build
cheenamalhotra Nov 22, 2024
baea11f
Reference System.Transactions
mdaigle Nov 22, 2024
a701b8a
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 22, 2024
8936f45
Fix System.Transaction reference.
mdaigle Nov 22, 2024
789a76a
Add pkcs to manual tests project to support package pipeline, lacking…
mdaigle Nov 22, 2024
32df37c
Add pkcs to functional tests project to support package pipeline, lac…
mdaigle Nov 22, 2024
0a0f389
Add Microsoft.Bcl.Cryptography
mdaigle Nov 22, 2024
d68d275
Merge branch 'main' into net9-add-support
mdaigle Nov 22, 2024
45d4497
Address review comments.
mdaigle Nov 25, 2024
d10cbad
Merge branch 'net9-add-support' of github.com:mdaigle/SqlClient into …
mdaigle Nov 25, 2024
6ac682e
Bump ExtUtilities to net9.
mdaigle Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<IsEnabledWindows Condition="'$(TargetsUnix)' == 'true'">false</IsEnabledWindows>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsWindows)' == 'true'">Windows</TestOS>
<TestOS Condition="'$(TestTargetOS)' == '' AND '$(TargetsUnix)' == 'true'">Unix</TestOS>
<TF Condition="$(TF) == ''">net8.0</TF> <!-- Default Target Framework -->
<TF Condition="$(TF) == ''">net9.0</TF> <!-- Default Target Framework -->
<TFGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TF)))' == '.NETFramework'">netfx</TFGroup>
<TFGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TF)))' == '.NETCoreApp'">netcore</TFGroup>
<TargetGroup Condition="'$(TFGroup)' == 'netfx'" >netfx</TargetGroup>
Expand Down Expand Up @@ -187,7 +187,7 @@

<Target Name="RunManualTests">
<!-- Windows -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:Target$(TFGroup)Version=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Windows$(TargetGroup) --filter &quot;category!=non$(TargetGroup)tests&amp;category!=failing&amp;category!=nonwindowstests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Windows$(TargetGroup)-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' == 'true'"/>

Check failure on line 190 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient (Win22_Azure_ARM64_Sql net8_0_AnyCPU_ManagedSNI_3)

build.proj#L190

build.proj(190,5): Error MSB3073: The command "dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Project --no-build -l "console;verbosity=normal" --collect "Code coverage" -p:TestSet=3 --results-directory TestResults -p:TestTargetOS=Windowsnetcoreapp --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" "--logger:trx;LogFilePrefix=Manual-Windowsnetcoreapp-3"" exited with code 1.

Check failure on line 190 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package (Win22_Sql22_named_instance net8_0_AnyCPU_ManagedSNI_3)

build.proj#L190

build.proj(190,5): Error MSB3073: The command "dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package --no-build -l "console;verbosity=normal" --collect "Code coverage" -p:TestSet=3 --results-directory TestResults -p:TestTargetOS=Windowsnetcoreapp --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" "--logger:trx;LogFilePrefix=Manual-Windowsnetcoreapp-3"" exited with code 1.

Check failure on line 190 in build.proj

View check run for this annotation

Azure Pipelines / CI-SqlClient-Package

build.proj#L190

build.proj(190,5): Error MSB3073: The command "dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Configuration=Release -p:TargetnetcoreVersion=net8.0 -p:ReferenceType=Package --no-build -l "console;verbosity=normal" --collect "Code coverage" -p:TestSet=3 --results-directory TestResults -p:TestTargetOS=Windowsnetcoreapp --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests" "--logger:trx;LogFilePrefix=Manual-Windowsnetcoreapp-3"" exited with code 1.
<!-- Unix -->
<Exec ConsoleToMsBuild="true" Command="$(DotnetPath)dotnet test &quot;@(ManualTestsProj)&quot; -p:Configuration=$(Configuration) -p:TargetNetCoreVersion=$(TF) -p:ReferenceType=$(ReferenceType) --no-build -l &quot;console;verbosity=normal&quot; --collect &quot;Code coverage&quot; -p:TestSet=$(TestSet) --results-directory $(ResultsDirectory) -p:TestTargetOS=Unixnetcoreapp --filter &quot;category!=nonnetcoreapptests&amp;category!=failing&amp;category!=nonlinuxtests&amp;category!=nonuaptests&quot; &quot;--logger:trx;LogFilePrefix=Manual-Unixnetcoreapp-$(TestSet)&quot;" Condition="'$(IsEnabledWindows)' != 'true'"/>
</Target>
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/common/templates/steps/ci-prebuild-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ parameters:
- Package

steps:
- task: UseDotNet@2
displayName: 'Use .NET 9.x sdk'
inputs:
packageType: sdk
version: '9.x'

- task: UseDotNet@2
displayName: 'Install .NET 8.x runtime'
inputs:
packageType: runtime
version: '8.x'

- ${{if eq(parameters.debug, true)}}:
- powershell: |
Get-ChildItem env: | Sort-Object Name
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/common/templates/steps/ci-project-build-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ parameters:
- all

steps:
- task: UseDotNet@2
displayName: 'Use .NET 9.x sdk'
inputs:
packageType: sdk
version: '9.x'

- task: UseDotNet@2
displayName: 'Install .NET 8.x runtime'
inputs:
packageType: runtime
version: '8.x'

- ${{ if or(eq(parameters.operatingSystem, 'Windows'), eq(parameters.operatingSystem, 'deferedToRuntime')) }}:
- ${{ if or(eq(parameters.build, 'MDS'), eq(parameters.build, 'all')) }}:
- task: MSBuild@1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ parameters:
default:
- net462
- net8.0
- net9.0

- name: product
default: MDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:

- name: targetFramework
type: string
default: net8.0
default: net9.0

steps:
- task: DotNetCoreCLI@2
Expand Down
8 changes: 4 additions & 4 deletions eng/pipelines/dotnet-sqlclient-ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The .NET Foundation licenses this file to you under the MIT license. #
# See the LICENSE file in the project root for more information. #
#################################################################################
parameters: # parameters are shown up in ADO UI in a build queue time
parameters:
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
Expand All @@ -12,17 +12,17 @@ parameters: # parameters are shown up in ADO UI in a build queue time
- name: targetFrameworks
displayName: 'Target Frameworks on Windows'
type: object
default: [net462, net8.0]
default: [net462, net8.0, net9.0]

- name: targetFrameworksLinux
displayName: 'Target Frameworks on Non-Windows'
type: object
default: [net8.0]
default: [net8.0, net9.0]

- name: netcoreVersionTestUtils
displayName: 'Netcore Version for Test Utilities'
type: object
default: net8.0
default: net9.0

- name: buildPlatforms
displayName: 'Build Platforms on Windows'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
- name: targetFrameworks
displayName: 'Target Frameworks on Windows'
type: object
default: [net462, net8.0]
default: [net462, net8.0, net9.0]

- name: targetFrameworksLinux
displayName: 'Target Frameworks on Non-Windows'
type: object
default: [net8.0]
default: [net8.0, net9.0]

- name: buildPlatforms
displayName: 'Build Platforms on Windows'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ parameters: # parameters are shown up in ADO UI in a build queue time
- name: targetFrameworks
displayName: 'Target Frameworks on Windows'
type: object
default: [net462, net8.0]
default: [net462, net8.0, net9.0]

- name: targetFrameworksLinux
displayName: 'Target Frameworks on Non-Windows'
type: object
default: [net8.0]
default: [net8.0, net9.0]

- name: buildPlatforms
displayName: 'Build Platforms on Windows'
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/libraries/mds-validation-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ variables:
- name: expectedFolderNames
value: lib,ref,runtimes
- name: expectedDotnetVersions
value: net462,net8.0
value: net462,net8.0,net9.0
- name: Database
value: Northwind
- name: platform
value: AnyCPU
- name: TargetNetFxVersion
value: net481
- name: TargetNetCoreVersion
value: net8.0
value: net9.0
- name: SQLTarget
value: localhost
- name: encrypt
Expand Down
1 change: 0 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@

<!-- Provides Version properties -->
<Import Project="$(ToolsDir)props\Versions.props" />
<Import Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))" Project="$(ToolsDir)props\VersionsNet8OrLater.props" />
<!-- Provides Tool properties -->
<Import Project="$(ToolsDir)props\Tools.props" />
<!-- Provides Build properties -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
// NOTE: The current Microsoft.VSDesigner editor attributes are implemented for System.Data.SqlClient, and are not publicly available.
// New attributes that are designed to work with Microsoft.Data.SqlClient and are publicly documented should be included in future.

using System;
#if NET
using System.Diagnostics.CodeAnalysis;
#endif

[assembly: System.CLSCompliant(true)]
namespace Microsoft.Data
{
Expand Down Expand Up @@ -1298,6 +1303,9 @@ public override void Close() { }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetEnumerator/*'/>
public override System.Collections.IEnumerator GetEnumerator() { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetFieldType/*'/>
#if NET
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public override System.Type GetFieldType(int i) { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetFieldValue/*'/>
public override T GetFieldValue<T>(int i) { throw null; }
Expand All @@ -1318,6 +1326,9 @@ public override void Close() { }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetOrdinal/*'/>
public override int GetOrdinal(string name) { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetProviderSpecificFieldType/*'/>
#if NET
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public override System.Type GetProviderSpecificFieldType(int i) { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetProviderSpecificValue/*'/>
public override object GetProviderSpecificValue(int i) { throw null; }
Expand Down Expand Up @@ -2278,6 +2289,9 @@ public SqlDataRecord(params Microsoft.Data.SqlClient.Server.SqlMetaData[] metaDa
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient.Server/SqlDataRecord.xml' path='docs/members[@name="SqlDataRecord"]/GetDouble/*'/>
public virtual double GetDouble(int ordinal) { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient.Server/SqlDataRecord.xml' path='docs/members[@name="SqlDataRecord"]/GetFieldType/*'/>
#if NET
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public virtual System.Type GetFieldType(int ordinal) { throw null; }
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient.Server/SqlDataRecord.xml' path='docs/members[@name="SqlDataRecord"]/GetFloat/*'/>
public virtual float GetFloat(int ordinal) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<IntermediateOutputPath>$(ObjFolder)$(Configuration)\$(AssemblyName)\ref\</IntermediateOutputPath>
<OutputPath>$(BinFolder)$(Configuration)\$(AssemblyName)\ref\</OutputPath>
<DocumentationFile>$(OutputPath)\$(TargetFramework)\Microsoft.Data.SqlClient.xml</DocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Microsoft.Data.SqlClient</AssemblyName>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(OSGroup)' == 'AnyOS'">Microsoft.Data.SqlClient is not supported on this platform.</GeneratePlatformNotSupportedAssemblyMessage>
<OSGroup Condition="'$(OSGroup)' == ''">$(OS)</OSGroup>
<TargetsWindows Condition="'$(OSGroup)'=='Windows_NT'">true</TargetsWindows>
Expand Down Expand Up @@ -861,6 +861,8 @@
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
</ItemGroup>
<Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" />
<Import Project="$(ToolsDir)targets\ResolveContract.targets" Condition="'$(OSGroup)' == 'AnyOS'" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ internal static bool ValidateSslServerCertificate(Guid connectionId, string targ
{
try
{
validationCertificate = new X509Certificate(validationCertFileName);
validationCertificate = X509CertificateLoader.LoadCertificateFromFile(validationCertFileName);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1334,8 +1334,6 @@ override public IEnumerator GetEnumerator()

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetFieldType/*' />
#if !NETFRAMEWORK
[SuppressMessage("ReflectionAnalysis", "IL2093:MismatchOnMethodReturnValueBetweenOverrides",
Justification = "Annotations for DbDataReader was not shipped in net6.0")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)]
#endif
override public Type GetFieldType(int i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,9 @@
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlDbTypeExtensions.cs">
<Link>Microsoft\Data\SqlDbTypeExtensions.cs</Link>
</Compile>
<Compile Include="$(CommonSourceRoot)System\IO\StreamExtensions.netfx.cs">
<Link>System\IO\StreamExtensions.netfx.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Common\Microsoft\Data\Common\NameValuePermission.cs" />
Expand Down Expand Up @@ -896,6 +899,8 @@
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensVersion)" />
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
</ItemGroup>
<Import Project="$(CommonSourceRoot)tools\targets\GenerateResourceStringsSource.targets" />
<Import Project="$(NetFxSource)tools\targets\GenerateThisAssemblyCs.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1448,8 +1448,6 @@ override public IEnumerator GetEnumerator()

/// <include file='../../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlDataReader.xml' path='docs/members[@name="SqlDataReader"]/GetFieldType/*' />
#if !NETFRAMEWORK
[SuppressMessage("ReflectionAnalysis", "IL2093:MismatchOnMethodReturnValueBetweenOverrides",
Justification = "Annotations for DbDataReader was not shipped in net6.0")]
[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)]
#endif
override public Type GetFieldType(int i)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace />
</PropertyGroup>
Expand All @@ -10,6 +10,8 @@
<ItemGroup>
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsVersion)" />
<PackageReference Include="Microsoft.Bcl.Cryptography" Version="$(MicrosoftBclCryptographyVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private object DeNormalizeInternal(
if (nullByte == 0)
{
result = _nullInstance;
s.Read(_padBuffer, 0, _padBuffer.Length);
s.ReadExactly(_padBuffer, 0, _padBuffer.Length);

return result;
}
}
Expand Down Expand Up @@ -288,7 +289,7 @@ protected void FlipAllBits(byte[] b)
protected object GetValue(FieldInfo fi, object obj) => fi.GetValue(obj);
#if NETFRAMEWORK
[System.Security.Permissions.ReflectionPermission(System.Security.Permissions.SecurityAction.Assert, MemberAccess = true)]
#endif
#endif
protected void SetValue(FieldInfo fi, object recvr, object value) => fi.SetValue(recvr, value);

internal abstract int Size { get; }
Expand Down Expand Up @@ -379,7 +380,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[2];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
b[0] ^= 0x80;
Expand All @@ -406,7 +407,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[2];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
Array.Reverse(b);
Expand All @@ -433,7 +434,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[4];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
mdaigle marked this conversation as resolved.
Show resolved Hide resolved
if (!_skipNormalize)
{
b[0] ^= 0x80;
Expand All @@ -460,7 +461,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[4];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
Array.Reverse(b);
Expand All @@ -487,7 +488,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[8];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
b[0] ^= 0x80;
Expand All @@ -514,7 +515,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[8];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
Array.Reverse(b);
Expand Down Expand Up @@ -559,7 +560,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[4];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
if ((b[0] & 0x80) > 0)
Expand Down Expand Up @@ -614,7 +615,7 @@ internal override void Normalize(FieldInfo fi, object obj, Stream s)
internal override void DeNormalize(FieldInfo fi, object recvr, Stream s)
{
byte[] b = new byte[8];
s.Read(b, 0, b.Length);
s.ReadExactly(b, 0, b.Length);
if (!_skipNormalize)
{
if ((b[0] & 0x80) > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ internal class HealthReport
public HealthReport(byte[] payload)
{
Size = payload.Length;
Certificate = new X509Certificate2(payload);
Certificate = X509CertificateLoader.LoadCertificate(payload);
}

public int GetSizeInPayload()
Expand Down
Loading
Loading