Skip to content

Commit

Permalink
Remove restrictions required by netstandard 1.x but available in 2.0 (#…
Browse files Browse the repository at this point in the history
…3790)

* Enable features that are now in the netstandard2.0 library set (but were missing from the 1.x library set). #3668

* Correct version numbers for Clean target #3668

* Post-merge cleanup

* csproj and code cleanup

* Fix Akka.Persistence.TCK outdated journal spec, original assumption was wrong.

* Avoid hardwiring names, spec name isn't hardwired anymore.

* Add serialization support to exceptions (at least for those in the Akka and Akka.Remote package)

* Add support to wrap exceptions in custom fields for ExceptionSupport

* Add spec for ExceptionSupport

* Update APIApproval list

* Fix flaky spec

* Revert "Fix flaky spec"

This reverts commit c34b2a6.

* Fix flaky tests

Co-authored-by: matthew <matthew.heaton@transmax.com.au>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>
Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
  • Loading branch information
4 people committed May 10, 2021
1 parent fb61262 commit 55c1175
Show file tree
Hide file tree
Showing 143 changed files with 625 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public AsyncReplayTimeoutException(string message)
{
}

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="AsyncReplayTimeoutException"/> class.
/// </summary>
Expand All @@ -53,7 +52,6 @@ protected AsyncReplayTimeoutException(SerializationInfo info, StreamingContext c
: base(info, context)
{
}
#endif
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<ProjectReference Include="..\Akka.DistributedData\Akka.DistributedData.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected TestException(SerializationInfo info, StreamingContext context)

private ClusterSingletonManagerSettings NextSettings() => ClusterSingletonManagerSettings.Create(Sys).WithSingletonName(NextName());

private string LeaseNameFor(ClusterSingletonManagerSettings settings) => $"AkkaSpec-singleton-akka://AkkaSpec/user/{settings.SingletonName}";
private string LeaseNameFor(ClusterSingletonManagerSettings settings) => $"{Sys.Name}-singleton-akka://{Sys.Name}/user/{settings.SingletonName}";

[Fact]
public void ClusterSingleton_with_lease_should_not_start_until_lease_is_available()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<ProjectReference Include="..\..\..\core\Akka.Coordination\Akka.Coordination.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ public sealed class ClusterSingletonManagerIsStuckException : AkkaException
/// <param name="message">The message that describes the error.</param>
public ClusterSingletonManagerIsStuckException(string message) : base(message) { }

#if SERIALIZATION
/// <summary>
/// Initializes a new instance of the <see cref="ClusterSingletonManagerIsStuckException"/> class.
/// </summary>
Expand All @@ -534,7 +533,6 @@ public sealed class ClusterSingletonManagerIsStuckException : AkkaException
public ClusterSingletonManagerIsStuckException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endif
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetCoreTestVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<ProjectReference Include="..\..\..\core\Akka.Cluster\Akka.Cluster.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hyperion" Version="$(HyperionVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
Expand Down
2 changes: 0 additions & 2 deletions src/contrib/cluster/Akka.DistributedData/Durable/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ public LoadFailedException(string message, Exception cause) : base(message, caus
{
}

#if SERIALIZATION
public LoadFailedException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endif
}

public sealed class DurableDataEnvelope : IReplicatorMessage, IEquatable<DurableDataEnvelope>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ public override bool Equals(object obj)
/// <summary>
/// TBD
/// </summary>
[Serializable]
public class DataDeletedException : Exception
{
/// <summary>
Expand All @@ -1006,6 +1007,13 @@ public class DataDeletedException : Exception
public DataDeletedException(string message) : base(message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="DataDeletedException"/> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected DataDeletedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}

public interface IReplicatorMessage { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@
<ProjectReference Include="..\..\..\core\Akka\Akka.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="5.0.0" />
</ItemGroup>

Expand Down
24 changes: 0 additions & 24 deletions src/contrib/dependencyinjection/Akka.DI.Core/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
using System.Reflection;
using Akka.Actor;

#if CORECLR
using Microsoft.Extensions.DependencyModel;
#endif
namespace Akka.DI.Core
{
/// <summary>
Expand Down Expand Up @@ -78,28 +75,7 @@ public static Type GetTypeValue(this string typeName)
/// <returns>The list of loaded assemblies</returns>
private static IEnumerable<Assembly> GetLoadedAssemblies()
{
#if APPDOMAIN
return AppDomain.CurrentDomain.GetAssemblies();
#elif CORECLR
var assemblies = new List<Assembly>();
var dependencies = DependencyContext.Default.RuntimeLibraries;
foreach (var library in dependencies)
{
try
{
var assembly = Assembly.Load(new AssemblyName(library.Name));
assemblies.Add(assembly);
}
catch
{
//do nothing can't if can't load assembly
}
}
return assemblies;
#else
#warning Method not implemented
throw new NotImplementedException();
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
<ProjectReference Include="..\..\testkits\Akka.TestKit.Xunit2\Akka.TestKit.Xunit2.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
<DefineConstants>$(DefineConstants);APPDOMAIN</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<ProjectReference Include="..\Akka.Persistence.Sql.Common\Akka.Persistence.Sql.Common.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
<ProjectReference Include="..\..\..\core\Akka.Persistence\Akka.Persistence.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<ItemGroup>
<PackageReference Include="System.Data.Common" Version="4.3.0" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR;CONFIGURATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Akka.Actor;
Expand Down Expand Up @@ -257,14 +258,12 @@ protected BatchingSqlJournalSetup(Config config, QueryConfiguration namingConven
throw ConfigurationException.NullOrEmptyConfig<BatchingSqlJournalSetup>();

var connectionString = config.GetString("connection-string", null);
#if CONFIGURATION
if (string.IsNullOrWhiteSpace(connectionString))
{
connectionString = System.Configuration.ConfigurationManager
.ConnectionStrings[config.GetString("connection-string-name", "DefaultConnection")]?
.ConnectionString;
}
#endif

if (string.IsNullOrWhiteSpace(connectionString))
throw new ConfigurationException("No connection string for Sql Event Journal was specified");
Expand Down Expand Up @@ -1524,5 +1523,15 @@ public class JournalBufferOverflowException : AkkaException
+ " change it.")
{
}

/// <summary>
/// Initializes a new instance of the <see cref="JournalBufferOverflowException" /> class.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
protected JournalBufferOverflowException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -506,12 +506,10 @@ protected virtual string GetConnectionString()
{
var connectionString = _settings.ConnectionString;

#if CONFIGURATION
if (string.IsNullOrEmpty(connectionString))
{
connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[_settings.ConnectionStringName].ConnectionString;
}
#endif

return connectionString;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ protected virtual string GetConnectionString()
{
var connectionString = _settings.ConnectionString;

#if CONFIGURATION
if (string.IsNullOrEmpty(connectionString))
{
connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[_settings.ConnectionStringName].ConnectionString;
}
#endif

return connectionString;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkTestVersion)' ">
<DefineConstants>$(DefineConstants);SERIALIZABLE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
<PackageReference Include="Hyperion" Version="$(HyperionVersion)" />
<ProjectReference Include="..\..\..\core\Akka\Akka.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetStandardLibVersion)' ">
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkLibVersion)' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
<ItemGroup>
<ProjectReference Include="..\..\..\core\Akka.Tests.Shared.Internals\Akka.Tests.Shared.Internals.csproj" />
</ItemGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>

</Project>
Loading

0 comments on commit 55c1175

Please sign in to comment.