Skip to content

Commit eb68e1b

Browse files
author
Javad
authored
Add | Adding net8 support (#2230)
1 parent 8663853 commit eb68e1b

File tree

16 files changed

+92
-93
lines changed

16 files changed

+92
-93
lines changed

BUILDGUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ msbuild -t:RunTests -p:configuration=Release -p:DotnetPath=C:\net6-win-x86\
102102
To specify custom target framework, use `TF` property:
103103

104104
```bash
105-
msbuild -t:RunTests -p:configuration=Release -p:TF=net7.0
105+
msbuild -t:RunTests -p:configuration=Release -p:TF=net8.0
106106
msbuild -t:RunTests -p:configuration=Release -p:TF=net48
107107
# Runs tests for specified target framework.
108108
# TargetNetCoreVersion and TargetNetFxVersion are not to be used with TF property, they will take precedence over TF if provided.
@@ -293,7 +293,7 @@ msbuild -t:BuildTestsNetFx -p:TargetNetFxVersion=net462
293293
```bash
294294
msbuild -t:BuildTestsNetCore -p:TargetNetCoreVersion=net6.0
295295
# Build the tests for custom TargetFramework (.NET)
296-
# Applicable values: net6.0 | net7.0
296+
# Applicable values: net6.0 | net8.0
297297
```
298298

299299
### Running Tests with custom target framework (traditional)
@@ -305,7 +305,7 @@ dotnet test -p:TargetNetFxVersion=net462 ...
305305

306306
dotnet test -p:TargetNetCoreVersion=net6.0 ...
307307
# Use above property to run Functional Tests with custom TargetFramework (.NET)
308-
# Applicable values: net6.0 | net7.0
308+
# Applicable values: net6.0 | net8.0
309309
```
310310

311311
## Using Managed SNI on Windows
@@ -389,7 +389,7 @@ Configure `runnerconfig.json` file with connection string and preferred settings
389389

390390
```bash
391391
cd src\Microsoft.Data.SqlClient\tests\PerformanceTests
392-
dotnet run -c Release -f net6.0|net7.0
392+
dotnet run -c Release -f net6.0|net8.0
393393
```
394394

395395
_Only "**Release** Configuration" applies to Performance Tests_

RunPackageReferenceTests.cmd

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

RunProjectReferenceTests.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ set netcoreVersion=net6.0
66

77
:: Accept two parameters for .NET Framework and .NET versions.
88
:: Examples:
9-
:: - uses net48 and net7.0:
10-
:: > RunProjectReferenceTests.cmd net48 net7.0
9+
:: - uses net48 and net8.0:
10+
:: > RunProjectReferenceTests.cmd net48 net8.0
1111
:: - uses default target frameworks:
1212
:: > RunProjectReferenceTests.cmd
1313
:: - uses net48 and default target frameworks for netcore:

doc/snippets/Microsoft.Data.SqlClient/SqlException.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,7 @@ catch (Exception ex) {
140140
<altmember cref="T:Microsoft.Data.SqlClient.SqlError" />
141141
</Errors>
142142
<GetObjectData>
143-
<param name="si">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
144-
<param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
145-
<summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception.</summary>
146-
<remarks>
147-
<format type="text/markdown"><![CDATA[
148-
149-
## Remarks
150-
`GetObjectData` sets a `SerializationInfo` with all the exception object data targeted for serialization. During deserialization, the exception is reconstituted from the `SerializationInfo` transmitted over the stream.
151-
152-
]]></format>
153-
</remarks>
154-
<exception cref="T:System.ArgumentNullException">The <paramref name="si" /> parameter is a null reference (<see langword="Nothing" /> in Visual Basic).</exception>
143+
<inheritdoc cref="System.Exception.GetObjectData" />
155144
</GetObjectData>
156145
<LineNumber>
157146
<summary>Gets the line number within the Transact-SQL command batch or stored procedure that generated the error.</summary>

src/Microsoft.Data.SqlClient/add-ons/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<Otherwise>
3737
<PropertyGroup>
3838
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetstandard' OR '$(TestTargetOS)' == 'Unixnetstandard'">netstandard2.0;netstandard2.1</TargetFrameworks>
39-
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">net6.0;net7.0</TargetFrameworks>
39+
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetcoreapp' OR '$(TestTargetOS)' == 'Unixnetcoreapp'">net6.0;net8.0</TargetFrameworks>
4040
<TargetFrameworks Condition="'$(TestTargetOS)' == 'Windowsnetfx'">net462</TargetFrameworks>
4141
</PropertyGroup>
4242
</Otherwise>

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,9 +1443,13 @@ internal SqlException() { }
14431443
public override string Source { get { throw null; } }
14441444
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlException.xml' path='docs/members[@name="SqlException"]/State/*'/>
14451445
public byte State { get { throw null; } }
1446+
14461447
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlException.xml' path='docs/members[@name="SqlException"]/GetObjectData/*'/>
14471448
#if !NET6_0_OR_GREATER
14481449
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
1450+
#endif
1451+
#if NET8_0_OR_GREATER
1452+
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
14491453
#endif
14501454
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
14511455
/// <include file='../../../../doc/snippets/Microsoft.Data.SqlClient/SqlException.xml' path='docs/members[@name="SqlException"]/ToString/*'/>

src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
4-
<TargetFrameworks>net7.0;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
55
<TargetFrameworks Condition="$(ReferenceType)=='NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1'">netstandard2.1</TargetFrameworks>
66
<IntermediateOutputPath>$(ObjFolder)$(Configuration)\$(AssemblyName)\ref\</IntermediateOutputPath>
77
<OutputPath>$(BinFolder)$(Configuration)\$(AssemblyName)\ref\</OutputPath>

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<AssemblyName>Microsoft.Data.SqlClient</AssemblyName>
4-
<TargetFrameworks>net7.0;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net6.0;netstandard2.0;netstandard2.1</TargetFrameworks>
55
<TargetFrameworks Condition="$(ReferenceType)=='NetStandard' AND $(TargetNetStandardVersion)=='netstandard2.1'">netstandard2.1</TargetFrameworks>
66
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(OSGroup)' == 'AnyOS'">Microsoft.Data.SqlClient is not supported on this platform.</GeneratePlatformNotSupportedAssemblyMessage>
77
<OSGroup Condition="'$(OSGroup)' == ''">$(OS)</OSGroup>
@@ -666,8 +666,8 @@
666666
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObject.netcore.cs" />
667667
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObjectManaged.cs" />
668668
</ItemGroup>
669-
<!--This will exclude SqlTypeWorkarounds.netcore.cs from Net7 and greater versions-->
670-
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">
669+
<!--This will exclude SqlTypeWorkarounds.netcore.cs from Net8 and greater versions-->
670+
<ItemGroup Condition="'$(OSGroup)' != 'AnyOS' AND !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
671671
<Compile Include="Microsoft\Data\SqlTypes\SqlTypeWorkarounds.netcore.cs" />
672672
</ItemGroup>
673673
<!-- Windows only -->

src/Microsoft.Data.SqlClient/src/Microsoft/Data/OperationAbortedException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ private OperationAbortedException(string message, Exception innerException) : ba
1818
HResult = unchecked((int)0x80131936);
1919
}
2020

21+
#if NET8_0_OR_GREATER
22+
[Obsolete]
23+
#endif
2124
private OperationAbortedException(SerializationInfo info, StreamingContext context) : base(info, context)
2225
{
2326
}

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlException.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ private SqlException(string message, SqlErrorCollection errorCollection, Excepti
4242
_errors = errorCollection;
4343
_clientConnectionId = conId;
4444
}
45-
45+
#if NET8_0_OR_GREATER
46+
[System.Obsolete]
47+
#endif
4648
private SqlException(SerializationInfo si, StreamingContext sc) : base(si, sc)
4749
{
4850
#if NETFRAMEWORK
@@ -60,6 +62,9 @@ private SqlException(SerializationInfo si, StreamingContext sc) : base(si, sc)
6062
}
6163

6264
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlException.xml' path='docs/members[@name="SqlException"]/GetObjectData/*' />
65+
#if NET8_0_OR_GREATER
66+
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
67+
#endif
6368
public override void GetObjectData(SerializationInfo si, StreamingContext context)
6469
{
6570
base.GetObjectData(si, context);

0 commit comments

Comments
 (0)