Skip to content

Commit 0f2044d

Browse files
Merge pull request #168 from akkadotnet/dev
v0.9.15 Release
2 parents b6a4f25 + cb48350 commit 0f2044d

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
### 0.9.14 February 13 2020 ####
1+
### 0.9.15 February 27 2020 ####
22

3-
* [Added support for serializing and deserializing `IDictionary<TKey, TValue>` with private and protected default constructor] (https://github.com/akkadotnet/Hyperion/pull/162)
3+
* [Fix `Type.GetGenericTypeDefinition()` interface error](https://github.com/akkadotnet/Hyperion/pull/166)

src/Hyperion.Tests/GenericDictionarySerializerTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,15 @@ public ProtectedCustomDictionary(Dictionary<TKey, TValue> dict) : base(new Dicti
7171
{ }
7272
}
7373

74+
// Dictionary serializer fails to fetch the generic IDictionary interface if
75+
// Type.GetInterfaces() returns a non-generic interface before the IDictionary interface
7476
/// <summary>
7577
/// Just a custom class wrapper for another <see cref="IDictionary{TKey,TValue}"/>
7678
/// </summary>
77-
class CustomDictionary<TKey, TValue> : IDictionary<TKey, TValue>
79+
class CustomDictionary<TKey, TValue> :
80+
IEnumerable,
81+
IDictionary<TKey, TValue>,
82+
IEquatable<CustomDictionary<TKey, TValue>>
7883
{
7984
private readonly IDictionary<TKey, TValue> _dictGeneric;
8085

@@ -162,6 +167,11 @@ public bool TryGetValue(TKey key, out TValue value)
162167
return _dictGeneric.TryGetValue(key, out value);
163168
}
164169

170+
public bool Equals(CustomDictionary<TKey, TValue> other)
171+
{
172+
return true;
173+
}
174+
165175
/// <inheritdoc />
166176
public TValue this[TKey key]
167177
{

src/Hyperion/SerializerFactories/DictionarySerializerFactory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ public override ValueSerializer BuildSerializer(Serializer serializer, Type type
9797

9898
private GenericDictionaryTypes GetKeyValuePairType(Type dictImplementationType)
9999
{
100-
var dictInterface = dictImplementationType.GetInterfaces().First(i => i.GetGenericTypeDefinition() == typeof (IDictionary<,>));
100+
var dictInterface = dictImplementationType
101+
.GetInterfaces()
102+
.Where(i => i.GetTypeInfo().IsGenericType)
103+
.First(i => i.GetGenericTypeDefinition() == typeof(IDictionary<,>));
101104
var keyType = dictInterface.GetGenericArguments()[0];
102105
var valueType = dictInterface.GetGenericArguments()[1];
103106
return new GenericDictionaryTypes()

src/common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<PropertyGroup>
33
<Copyright>Copyright © 2016-2017 Akka.NET Team</Copyright>
44
<Authors>Akka.NET Team</Authors>
5-
<VersionPrefix>0.9.13</VersionPrefix>
6-
<PackageReleaseNotes>[Added support for serializing and deserializing `IDictionary&lt;TKey, TValue&gt;`](https://github.com/akkadotnet/Hyperion/pull/156)</PackageReleaseNotes>
5+
<VersionPrefix>0.9.15</VersionPrefix>
6+
<PackageReleaseNotes>[Fix `Type.GetGenericTypeDefinition()` interface error](https://github.com/akkadotnet/Hyperion/pull/166)</PackageReleaseNotes>
77
<PackageIconUrl>http://getakka.net/images/akkalogo.png</PackageIconUrl>
88
<PackageProjectUrl>https://github.com/akkadotnet/Hyperion</PackageProjectUrl>
99
<PackageLicenseUrl>https://github.com/akkadotnet/Hyperion/blob/master/LICENSE</PackageLicenseUrl>

0 commit comments

Comments
 (0)