-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-platform exception serialization support (#7222)
* Add cross-platform exception serialization support * Add unit tests * Exclude net471 test in Linux * Disable net471 build in linux * Fix silly mistake * Disable SSL tests that are not compatible with net471 API
- Loading branch information
Showing
10 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/core/Akka.Remote.Tests/Serialization/Bugfix7215Spec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="Bugfix7215Spec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2024 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2024 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.IO; | ||
using Akka.Actor; | ||
using Akka.Remote.Serialization; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using FluentAssertions; | ||
using static FluentAssertions.FluentActions; | ||
|
||
namespace Akka.Remote.Tests.Serialization; | ||
|
||
public class Bugfix7215Spec: TestKit.Xunit2.TestKit | ||
{ | ||
public Bugfix7215Spec(ITestOutputHelper output) : base(nameof(Bugfix7215Spec), output) | ||
{ | ||
} | ||
|
||
[Theory(DisplayName = "Should be able to deserialize InvalidOperationException from all frameworks")] | ||
[InlineData("Net471")] | ||
[InlineData("Net481")] | ||
[InlineData("Net6.0")] | ||
[InlineData("Net8.0")] | ||
public void DeserializeNet471Test(string framework) | ||
{ | ||
var bytes = File.ReadAllBytes($"./test-files/SerializedException-{framework}.bin"); | ||
var helper = new ExceptionSupport((ExtendedActorSystem)Sys); | ||
|
||
Exception exception = null; | ||
Invoking(() => exception = helper.DeserializeException(bytes)).Should().NotThrow(); | ||
exception.Should().BeOfType<InvalidOperationException>(); | ||
exception.Message.Should().Be("You can't do this."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+134 Bytes
src/core/Akka.Remote.Tests/test-files/SerializedException-Net471.bin
Binary file not shown.
Binary file added
BIN
+204 Bytes
src/core/Akka.Remote.Tests/test-files/SerializedException-Net481.bin
Binary file not shown.
Binary file added
BIN
+226 Bytes
src/core/Akka.Remote.Tests/test-files/SerializedException-Net6.0.bin
Binary file not shown.
Binary file added
BIN
+226 Bytes
src/core/Akka.Remote.Tests/test-files/SerializedException-Net8.0.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters