Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix abstract dictionary types in winRT causes Exception.
  • Loading branch information
yfakariya committed May 24, 2014
commit 02143bcb1fea96af3749393a656457331162df5c
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,8 @@ Release 0.4.4 - 2014/4/13
BUG FIXES
* Fix creating serializer for IDictionary<TKey, TValue> causes NullReferenceException.
* Fix serializers' default constructor IL (it is not used in the library, but can be called via reflection).

Release 0.4.5

BUF FIXES
* Fix creating serializer for abstract dictionary types causes exception in WinRT.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ public MapExpressionMessagePackSerializer( SerializationContext context, Collect
this._valueSerializer = traits.ElementType.GetIsGenericType() ? context.GetSerializer( traits.ElementType.GetGenericArguments()[ 1 ] ) : context.GetSerializer( typeof( MessagePackObject ) );
this._getCount = ExpressionSerializerLogics.CreateGetCount<T>( traits );

var constructor = ExpressionSerializerLogics.GetCollectionConstructor( context, typeof( T ) );
var targetType = typeof( T );
if ( targetType.GetIsAbstract() || targetType.GetIsInterface() )
{
targetType = context.DefaultCollectionTypes.GetConcreteType( targetType );
}

var constructor = ExpressionSerializerLogics.GetCollectionConstructor( context, targetType );

if ( constructor == null )
{
this._createInstance = () => { throw SerializationExceptions.NewTargetDoesNotHavePublicDefaultConstructorNorInitialCapacity( typeof( T ) ); };
this._createInstance = () => { throw SerializationExceptions.NewTargetDoesNotHavePublicDefaultConstructorNorInitialCapacity( targetType ); };
this._createInstanceWithCapacity = null;
}
else if ( constructor.GetParameters().Length == 1 )
Expand Down