diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6639d17..7f1ef82 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -6,8 +6,6 @@ name: "CodeQL" on: - push: - branches: [main] pull_request: # The branches below must be a subset of the branches above branches: [main] @@ -30,7 +28,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. @@ -43,7 +41,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -54,7 +52,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -68,4 +66,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index afee888..22e1ef5 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,8 +1,6 @@ name: .NET on: - push: - branches: [ main ] pull_request: branches: [ main ] @@ -12,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: [ '8.0.x' ] + dotnet-version: [ '8.0.x', '9.0.x' ] steps: - uses: actions/checkout@v4 @@ -31,12 +29,12 @@ jobs: run: dotnet build --no-restore - name: Test timeout-minutes: 2 - run: dotnet test --no-build --verbosity normal --blame-hang-timeout 45s --blame-hang-dump-type full - - name: Archive test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: TestResults - path: | - /home/runner/work/Activout.RestClient/Activout.RestClient/Activout.RestClient.Test/TestResults/ + run: dotnet test --no-build +# - name: Archive test results +# uses: actions/upload-artifact@v4 +# if: always() +# with: +# name: TestResults +# path: | +# /home/runner/work/Activout.RestClient/Activout.RestClient/Activout.RestClient.Test/TestResults/ diff --git a/Activout.RestClient.Test/Activout.RestClient.Test.csproj b/Activout.RestClient.Test/Activout.RestClient.Test.csproj index 2b4a7ef..480f9d8 100644 --- a/Activout.RestClient.Test/Activout.RestClient.Test.csproj +++ b/Activout.RestClient.Test/Activout.RestClient.Test.csproj @@ -1,15 +1,16 @@  false - net6.0;net7.0 + net8.0 + default - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Activout.RestClient/Activout.RestClient.csproj b/Activout.RestClient/Activout.RestClient.csproj index 72f843f..fdbf3bd 100644 --- a/Activout.RestClient/Activout.RestClient.csproj +++ b/Activout.RestClient/Activout.RestClient.csproj @@ -1,11 +1,12 @@  - net6.0;net7.0 + net8.0 + default - - - + + + diff --git a/Activout.RestClient/RestClientException.cs b/Activout.RestClient/RestClientException.cs index 47f37bf..98bc25d 100644 --- a/Activout.RestClient/RestClientException.cs +++ b/Activout.RestClient/RestClientException.cs @@ -1,28 +1,8 @@ using System; using System.Net; -using System.Runtime.Serialization; -using System.Security.Permissions; namespace Activout.RestClient { - internal static class Extensions - { - public static T GetValue(this SerializationInfo self, string name) - { - return (T)self.GetValue(name, typeof(T)); - } - - public static bool IsSerializable(this object obj) - { - if (obj == null) - return false; - - var t = obj.GetType(); - return t.IsSerializable; - } - } - - [Serializable] public class RestClientException : Exception { public RestClientException(Uri requestUri, HttpStatusCode statusCode, object errorResponse) : base(errorResponse?.ToString()) @@ -40,17 +20,6 @@ public RestClientException(Uri requestUri, HttpStatusCode statusCode, string err ErrorResponse = errorResponse; } - protected RestClientException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - StatusCode = info.GetValue(nameof(StatusCode)); - var typeName = info.GetString(nameof(Type)); - if (typeName != null) - { - ErrorResponse = info.GetValue(nameof(ErrorResponse), Type.GetType(typeName)); - } - } - public Uri RequestUri { get; } public HttpStatusCode StatusCode { get; } @@ -61,27 +30,6 @@ public T GetErrorResponse() return (T)ErrorResponse; } -#if !NET5_0_OR_GREATER - [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)] -#endif - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - if (info == null) throw new ArgumentNullException(nameof(info)); - - info.AddValue(nameof(StatusCode), StatusCode); - if (ErrorResponse.IsSerializable()) - { - info.AddValue(nameof(Type), ErrorResponse.GetType().AssemblyQualifiedName); - info.AddValue(nameof(ErrorResponse), ErrorResponse); - } - else - { - info.AddValue(nameof(Type), null); - } - - base.GetObjectData(info, context); - } - public override string ToString() { return $"{base.ToString()}, {nameof(RequestUri)}: {RequestUri}, {nameof(StatusCode)}: {StatusCode}, {nameof(ErrorResponse)}: {ErrorResponse}";