Skip to content

Commit

Permalink
Fix an access violation error on WP 8.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
SolalPirelli committed Aug 3, 2015
1 parent b1580e6 commit 25024c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ThriftSharp/Internals/ThriftClientMessageReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ private static LambdaExpression CreateReaderForMethod( ThriftMethod method )
Expression.IsFalse(
Expression.Call(
Methods.Enum_IsDefined,
Expression.Constant( typeof( ThriftMessageType ) ),
// The second argument is absolutely crucial here.
// System.Type is an abstract class, implemented by an internal framework class System.RuntimeType
// Not specifying the argument leads to the expression's type being typeof(System.RuntimeType),
// which crashes on frameworks that restrict access to non-public framework types, such as Windows Phone 8.1
Expression.Constant( typeof( ThriftMessageType ), typeof( Type ) ),
Expression.Convert(
Expression.Field( headerVariable, Fields.ThriftMessageHeader_MessageType ),
typeof( object )
Expand Down

0 comments on commit 25024c0

Please sign in to comment.