Skip to content

Commit

Permalink
Update relevant parts to net8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Jan 18, 2024
1 parent 87933e5 commit 6c96b0f
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: .NET 7.0
- name: .NET 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion include.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ function Check-ExitCode() {
}

function Get-UsedTargetFramework() {
return 'net7.0'
return 'net8.0'
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<ItemGroup Condition="'$(SkipSourceLink)'!='true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Figure out a way to run it on net4.8 (FirebirdSql.Data.TestsBase uses IAsyncDisposable) -->
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<SkipSourceLink>true</SkipSourceLink>
Expand All @@ -12,7 +11,8 @@
<OutputType>Exe</OutputType>
<StartupObject>FirebirdSql.Data.TestsBase.Program</StartupObject>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
<!-- left in repo as an example/documentation for .NET Framework -->
<None Remove="app.config" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public abstract class EntityFrameworkTestsBase : FbTestsBase
static EntityFrameworkTestsBase()
{
#if !NETFRAMEWORK
// example/documentation for .NET Framework
System.Data.Common.DbProviderFactories.RegisterFactory(FbProviderServices.ProviderInvariantName, FirebirdClientFactory.Instance);
#endif
DbConfiguration.SetConfiguration(new FbTestDbContext.Conf());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<SkipSourceLink>true</SkipSourceLink>
Expand Down
15 changes: 0 additions & 15 deletions src/FirebirdSql.Data.FirebirdClient/Common/IscException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

namespace FirebirdSql.Data.Common;

[Serializable]
internal sealed class IscException : Exception
{
private string _message;
Expand Down Expand Up @@ -117,27 +116,13 @@ public static IscException ForIOException(IOException exception)
return ForErrorCodes(new[] { IscCodes.isc_net_write_err, IscCodes.isc_net_read_err }, exception);
}

private IscException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Errors = (List<IscError>)info.GetValue(nameof(Errors), typeof(List<IscError>));
ErrorCode = info.GetInt32(nameof(ErrorCode));
}

public void BuildExceptionData()
{
BuildErrorCode();
BuildSqlState();
BuildExceptionMessage();
}

public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue(nameof(Errors), Errors);
info.AddValue(nameof(ErrorCode), ErrorCode);
}

private void BuildErrorCode()
{
ErrorCode = Errors.Count != 0 ? Errors[0].ErrorCode : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

namespace FirebirdSql.Data.FirebirdClient;

#if !NET8_0_OR_GREATER
[Serializable]
#endif
public sealed class FbException : DbException
{
#region Fields
Expand All @@ -50,22 +52,26 @@ private FbException(string message, Exception innerException)
: base(message, innerException)
{ }

#if !NET8_0_OR_GREATER
private FbException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection));
}
#endif

#endregion

#region Methods

#if !NET8_0_OR_GREATER
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);

info.AddValue("errors", _errors);
}
#endif

#endregion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net48;netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<AssemblyName>FirebirdSql.Data.FirebirdClient</AssemblyName>
<RootNamespace>FirebirdSql.Data</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down Expand Up @@ -53,6 +53,8 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net8.0'">
</ItemGroup>
<ItemGroup>
<PackageReference Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<SkipSourceLink>true</SkipSourceLink>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<SkipSourceLink>true</SkipSourceLink>
Expand Down
2 changes: 1 addition & 1 deletion src/Perf/Perf.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<SkipSourceLink>true</SkipSourceLink>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Scratchpad/Scratchpad.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<SkipSourceLink>true</SkipSourceLink>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\FirebirdSql.Data.TestsBase\FirebirdSql.Data.TestsBase.snk</AssemblyOriginatorKeyFile>
Expand Down

0 comments on commit 6c96b0f

Please sign in to comment.