diff --git a/src/contrib/testkits/Akka.TestKit.Xunit/Internals/AkkaAssertEqualityComparer.cs b/src/contrib/testkits/Akka.TestKit.Xunit/Internals/AkkaAssertEqualityComparer.cs index 2dd3a7c6f4c..d7b3de40fb7 100644 --- a/src/contrib/testkits/Akka.TestKit.Xunit/Internals/AkkaAssertEqualityComparer.cs +++ b/src/contrib/testkits/Akka.TestKit.Xunit/Internals/AkkaAssertEqualityComparer.cs @@ -22,7 +22,7 @@ namespace Akka.TestKit.Xunit.Internals public class AkkaAssertEqualityComparer : IEqualityComparer { private static readonly IEqualityComparer DefaultInnerComparer = new AkkaAssertEqualityComparerAdapter(new AkkaAssertEqualityComparer()); - private static readonly TypeInfo NullableTypeInfo = typeof(Nullable<>).GetTypeInfo(); + private static readonly Type NullableType = typeof(Nullable<>); private readonly Func _innerComparerFactory; private readonly bool _skipTypeCheck; @@ -43,10 +43,10 @@ public AkkaAssertEqualityComparer(bool skipTypeCheck = false, IEqualityComparer public bool Equals(T x, T y) { - var typeInfo = typeof(T).GetTypeInfo(); + var type = typeof(T); // Null? - if(!typeInfo.IsValueType || (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition().GetTypeInfo().IsAssignableFrom(NullableTypeInfo))) + if(!type.IsValueType || (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom(NullableType))) { if(object.Equals(x, default(T))) return object.Equals(y, default(T)); diff --git a/src/contrib/testkits/Akka.TestKit.Xunit2/Internals/AkkaAssertEqualityComparer.cs b/src/contrib/testkits/Akka.TestKit.Xunit2/Internals/AkkaAssertEqualityComparer.cs index f872e08779a..1e11cbcf0c5 100644 --- a/src/contrib/testkits/Akka.TestKit.Xunit2/Internals/AkkaAssertEqualityComparer.cs +++ b/src/contrib/testkits/Akka.TestKit.Xunit2/Internals/AkkaAssertEqualityComparer.cs @@ -22,7 +22,7 @@ namespace Akka.TestKit.Xunit2.Internals public class AkkaAssertEqualityComparer : IEqualityComparer { private static readonly IEqualityComparer DefaultInnerComparer = new AkkaAssertEqualityComparerAdapter(new AkkaAssertEqualityComparer()); - private static readonly TypeInfo NullableTypeInfo = typeof(Nullable<>).GetTypeInfo(); + private static readonly Type NullableType = typeof(Nullable<>); private readonly Func _innerComparerFactory; private readonly bool _skipTypeCheck; @@ -43,10 +43,10 @@ public AkkaAssertEqualityComparer(bool skipTypeCheck = false, IEqualityComparer public bool Equals(T x, T y) { - var typeInfo = typeof(T).GetTypeInfo(); + var type = typeof(T); // Null? - if(!typeInfo.IsValueType || (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition().GetTypeInfo().IsAssignableFrom(NullableTypeInfo))) + if(!type.IsValueType || (type.IsGenericType && type.GetGenericTypeDefinition().IsAssignableFrom(NullableType))) { if(object.Equals(x, default(T))) return object.Equals(y, default(T)); diff --git a/src/core/Akka.Cluster/Configuration/ClusterConfigFactory.cs b/src/core/Akka.Cluster/Configuration/ClusterConfigFactory.cs index 22d29fc0ee8..c5bd0c00a74 100644 --- a/src/core/Akka.Cluster/Configuration/ClusterConfigFactory.cs +++ b/src/core/Akka.Cluster/Configuration/ClusterConfigFactory.cs @@ -35,7 +35,7 @@ public static Config Default() /// The configuration defined in the current executing assembly. internal static Config FromResource(string resourceName) { - var assembly = typeof(ClusterConfigFactory).GetTypeInfo().Assembly; + var assembly = typeof(ClusterConfigFactory).Assembly; using (var stream = assembly.GetManifestResourceStream(resourceName)) { diff --git a/src/core/Akka.Persistence/Serialization/PersistenceMessageSerializer.cs b/src/core/Akka.Persistence/Serialization/PersistenceMessageSerializer.cs index daf45a84972..c8fc431651e 100644 --- a/src/core/Akka.Persistence/Serialization/PersistenceMessageSerializer.cs +++ b/src/core/Akka.Persistence/Serialization/PersistenceMessageSerializer.cs @@ -33,7 +33,7 @@ public override byte[] ToBinary(object obj) if (obj is AtomicWrite aw) return GetAtomicWrite(aw).ToByteArray(); if (obj is AtLeastOnceDeliverySnapshot snap) return GetAtLeastOnceDeliverySnapshot(snap).ToByteArray(); if (obj is PersistentFSM.StateChangeEvent stateEvent) return GetStateChangeEvent(stateEvent).ToByteArray(); - if (obj.GetType().GetTypeInfo().IsGenericType + if (obj.GetType().IsGenericType && obj.GetType().GetGenericTypeDefinition() == typeof(PersistentFSM.PersistentFSMSnapshot<>)) return GetPersistentFSMSnapshot(obj).ToByteArray(); throw new ArgumentException($"Can't serialize object of type [{obj.GetType()}] in [{GetType()}]"); @@ -156,7 +156,7 @@ public override object FromBinary(byte[] bytes, Type type) if (type == typeof(AtomicWrite)) return GetAtomicWrite(bytes); if (type == typeof(AtLeastOnceDeliverySnapshot)) return GetAtLeastOnceDeliverySnapshot(bytes); if (type == typeof(PersistentFSM.StateChangeEvent)) return GetStateChangeEvent(bytes); - if (type.GetTypeInfo().IsGenericType + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(PersistentFSM.PersistentFSMSnapshot<>)) return GetPersistentFSMSnapshot(type, bytes); throw new SerializationException($"Unimplemented deserialization of message with type [{type}] in [{GetType()}]"); diff --git a/src/core/Akka.Remote/Configuration/RemoteConfigFactory.cs b/src/core/Akka.Remote/Configuration/RemoteConfigFactory.cs index 86c797361b4..bceac5035bb 100644 --- a/src/core/Akka.Remote/Configuration/RemoteConfigFactory.cs +++ b/src/core/Akka.Remote/Configuration/RemoteConfigFactory.cs @@ -35,7 +35,7 @@ public static Config Default() /// The configuration defined in the current executing assembly. internal static Config FromResource(string resourceName) { - var assembly = typeof(RemoteConfigFactory).GetTypeInfo().Assembly; + var assembly = typeof(RemoteConfigFactory).Assembly; using (var stream = assembly.GetManifestResourceStream(resourceName)) { diff --git a/src/core/Akka.Streams/Implementation/Fusing/Fusing.cs b/src/core/Akka.Streams/Implementation/Fusing/Fusing.cs index 86a02837f59..b64dfc9522f 100644 --- a/src/core/Akka.Streams/Implementation/Fusing/Fusing.cs +++ b/src/core/Akka.Streams/Implementation/Fusing/Fusing.cs @@ -906,7 +906,7 @@ private bool IsCopiedModuleWithGraphStageAndMaterializedValue(IModule module) Type stageType; return copiedModule != null && (graphStageModule = copiedModule.CopyOf as GraphStageModule) != null - && (stageType = graphStageModule.Stage.GetType()).GetTypeInfo().IsGenericType + && (stageType = graphStageModule.Stage.GetType()).IsGenericType && stageType.GetGenericTypeDefinition() == typeof(MaterializedValueSource<>); } diff --git a/src/core/Akka.Streams/Util/TypeExtensions.cs b/src/core/Akka.Streams/Util/TypeExtensions.cs index 7cdb2e7bde8..45400093aaa 100644 --- a/src/core/Akka.Streams/Util/TypeExtensions.cs +++ b/src/core/Akka.Streams/Util/TypeExtensions.cs @@ -27,7 +27,7 @@ public static Type GetSubscribedType(this Type type) return type .GetInterfaces() - .Single(i => i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof (ISubscriber<>)) + .Single(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof (ISubscriber<>)) .GetGenericArguments() .First(); } @@ -42,7 +42,7 @@ public static Type GetPublishedType(this Type type) return type .GetInterfaces() - .Single(i => i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof (IPublisher<>)) + .Single(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof (IPublisher<>)) .GetGenericArguments() .First(); } diff --git a/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs b/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs index 436d456abb3..0ac5a404dce 100644 --- a/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs +++ b/src/core/Akka.TestKit.Tests/TestKit_Config_Tests.cs @@ -21,7 +21,7 @@ public void DefaultValues_should_be_correct() TestKitSettings.SingleExpectDefault.ShouldBe(TimeSpan.FromSeconds(3)); TestKitSettings.TestEventFilterLeeway.ShouldBe(TimeSpan.FromSeconds(3)); TestKitSettings.TestTimeFactor.ShouldBe(1); - var callingThreadDispatcherTypeName = typeof(CallingThreadDispatcherConfigurator).FullName + ", " + typeof(CallingThreadDispatcher).GetTypeInfo().Assembly.GetName().Name; + var callingThreadDispatcherTypeName = typeof(CallingThreadDispatcherConfigurator).FullName + ", " + typeof(CallingThreadDispatcher).Assembly.GetName().Name; Assert.False(Sys.Settings.Config.IsEmpty); Sys.Settings.Config.GetString("akka.test.calling-thread-dispatcher.type", null).ShouldBe(callingThreadDispatcherTypeName); Sys.Settings.Config.GetString("akka.test.test-actor.dispatcher.type", null).ShouldBe(callingThreadDispatcherTypeName); diff --git a/src/core/Akka.Tests/MatchHandler/PartialActionBuilderTests.cs b/src/core/Akka.Tests/MatchHandler/PartialActionBuilderTests.cs index 4464981a2f0..3b2b04561a2 100644 --- a/src/core/Akka.Tests/MatchHandler/PartialActionBuilderTests.cs +++ b/src/core/Akka.Tests/MatchHandler/PartialActionBuilderTests.cs @@ -448,7 +448,7 @@ private static void AssertAreSame(object[] delegateArguments, object[] updatedAr { for(int i = 0; i < delegateArguments.Length; i++) { - if(delegateArguments[i].GetType().GetTypeInfo().IsValueType) + if(delegateArguments[i].GetType().IsValueType) Assert.Equal(delegateArguments[i], updatedArgs[i]); else Assert.Same(delegateArguments[i], updatedArgs[i]); diff --git a/src/core/Akka.Tests/Serialization/SerializationSpec.cs b/src/core/Akka.Tests/Serialization/SerializationSpec.cs index 57b41b8a3ab..28de99f5f4f 100644 --- a/src/core/Akka.Tests/Serialization/SerializationSpec.cs +++ b/src/core/Akka.Tests/Serialization/SerializationSpec.cs @@ -562,11 +562,11 @@ public void Can_apply_a_config_based_serializer_by_the_binding() private static string LegacyTypeQualifiedName(Type type) { - string coreAssemblyName = typeof(object).GetTypeInfo().Assembly.GetName().Name; - var assemblyName = type.GetTypeInfo().Assembly.GetName().Name; + string coreAssemblyName = typeof(object).Assembly.GetName().Name; + var assemblyName = type.Assembly.GetName().Name; var shortened = assemblyName.Equals(coreAssemblyName) - ? type.GetTypeInfo().FullName - : $"{type.GetTypeInfo().FullName}, {assemblyName}"; + ? type.FullName + : $"{type.FullName}, {assemblyName}"; return shortened; } diff --git a/src/core/Akka/Actor/Internal/ActorSystemImpl.cs b/src/core/Akka/Actor/Internal/ActorSystemImpl.cs index 2b307554fc2..7d9c78a988c 100644 --- a/src/core/Akka/Actor/Internal/ActorSystemImpl.cs +++ b/src/core/Akka/Actor/Internal/ActorSystemImpl.cs @@ -298,7 +298,7 @@ private void LoadExtensions() foreach(var extensionFqn in _settings.Config.GetStringList("akka.extensions", new string[] { })) { var extensionType = Type.GetType(extensionFqn); - if(extensionType == null || !typeof(IExtensionId).IsAssignableFrom(extensionType) || extensionType.GetTypeInfo().IsAbstract || !extensionType.GetTypeInfo().IsClass) + if(extensionType == null || !typeof(IExtensionId).IsAssignableFrom(extensionType) || extensionType.IsAbstract || !extensionType.IsClass) { _log.Error("[{0}] is not an 'ExtensionId', skipping...", extensionFqn); continue; diff --git a/src/core/Akka/Configuration/ConfigurationFactory.cs b/src/core/Akka/Configuration/ConfigurationFactory.cs index 5d03b38dd11..b2fa21d33b7 100644 --- a/src/core/Akka/Configuration/ConfigurationFactory.cs +++ b/src/core/Akka/Configuration/ConfigurationFactory.cs @@ -83,7 +83,7 @@ public static Config Default() /// The configuration defined in the current executing assembly. internal static Config FromResource(string resourceName) { - var assembly = typeof(ConfigurationFactory).GetTypeInfo().Assembly; + var assembly = typeof(ConfigurationFactory).Assembly; return FromResource(resourceName, assembly); } @@ -98,9 +98,9 @@ internal static Config FromResource(string resourceName) public static Config FromResource(string resourceName, object instanceInAssembly) { if (instanceInAssembly is Type type) - return FromResource(resourceName, type.GetTypeInfo().Assembly); + return FromResource(resourceName, type.Assembly); var assembly = instanceInAssembly as Assembly; - return FromResource(resourceName, assembly != null ? assembly : instanceInAssembly.GetType().GetTypeInfo().Assembly); + return FromResource(resourceName, assembly != null ? assembly : instanceInAssembly.GetType().Assembly); } /// @@ -112,7 +112,7 @@ public static Config FromResource(string resourceName, object instanceInAssembly /// The configuration defined in the assembly that contains the type . public static Config FromResource(string resourceName) { - return FromResource(resourceName, typeof(TAssembly).GetTypeInfo().Assembly); + return FromResource(resourceName, typeof(TAssembly).Assembly); } /// diff --git a/src/core/Akka/Dispatch/Mailboxes.cs b/src/core/Akka/Dispatch/Mailboxes.cs index 63522946b28..caf0fbde0a6 100644 --- a/src/core/Akka/Dispatch/Mailboxes.cs +++ b/src/core/Akka/Dispatch/Mailboxes.cs @@ -88,11 +88,11 @@ public Mailboxes(ActorSystem system) /// true if this actor has a message queue type requirement. false otherwise. public bool HasRequiredType(Type actorType) { - var interfaces = actorType.GetTypeInfo().GetInterfaces(); + var interfaces = actorType.GetInterfaces(); for (int i = 0; i < interfaces.Length; i++) { var element = interfaces[i]; - if (element.GetTypeInfo().IsGenericType && element.GetGenericTypeDefinition() == RequiresMessageQueueGenericType) + if (element.IsGenericType && element.GetGenericTypeDefinition() == RequiresMessageQueueGenericType) { return true; } @@ -108,11 +108,11 @@ public bool HasRequiredType(Type actorType) /// true if this mailboxtype produces queues. false otherwise. public bool ProducesMessageQueue(Type mailboxType) { - var interfaces = mailboxType.GetTypeInfo().GetInterfaces(); + var interfaces = mailboxType.GetInterfaces(); for (int i = 0; i < interfaces.Length; i++) { var element = interfaces[i]; - if (element.GetTypeInfo().IsGenericType && element.GetGenericTypeDefinition() == ProducesMessageQueueGenericType) + if (element.IsGenericType && element.GetGenericTypeDefinition() == ProducesMessageQueueGenericType) { return true; } @@ -229,11 +229,11 @@ private Config Config(string id) /// TBD public Type GetRequiredType(Type actorType) { - var interfaces = actorType.GetTypeInfo().GetInterfaces(); + var interfaces = actorType.GetInterfaces(); for (int i = 0; i < interfaces.Length; i++) { var element = interfaces[i]; - if (element.GetTypeInfo().IsGenericType && element.GetGenericTypeDefinition() == RequiresMessageQueueGenericType) + if (element.IsGenericType && element.GetGenericTypeDefinition() == RequiresMessageQueueGenericType) { return element.GetGenericArguments()[0]; } @@ -245,11 +245,11 @@ public Type GetRequiredType(Type actorType) private static readonly Type ProducesMessageQueueGenericType = typeof (IProducesMessageQueue<>); private Type GetProducedMessageQueueType(MailboxType mailboxType) { - var interfaces = mailboxType.GetType().GetTypeInfo().GetInterfaces(); + var interfaces = mailboxType.GetType().GetInterfaces(); for (int i = 0; i < interfaces.Length; i++) { var element = interfaces[i]; - if (element.GetTypeInfo().IsGenericType && element.GetGenericTypeDefinition() == ProducesMessageQueueGenericType) + if (element.IsGenericType && element.GetGenericTypeDefinition() == ProducesMessageQueueGenericType) { return element.GetGenericArguments()[0]; } diff --git a/src/core/Akka/Util/MatchHandler/MatchExpressionBuilder.cs b/src/core/Akka/Util/MatchHandler/MatchExpressionBuilder.cs index 65dcb2695c2..e55fcccdc49 100644 --- a/src/core/Akka/Util/MatchHandler/MatchExpressionBuilder.cs +++ b/src/core/Akka/Util/MatchHandler/MatchExpressionBuilder.cs @@ -72,7 +72,7 @@ public MatchExpressionBuilderResult BuildLambdaExpression(IReadOnlyList