Commit 3cf33153 authored by csharptest's avatar csharptest Committed by rogerk

Fix for GetProperty(string, Type[]) incompatible with Silverlight

parent 0e152e43
...@@ -66,9 +66,9 @@ namespace Google.ProtocolBuffers.FieldAccess ...@@ -66,9 +66,9 @@ namespace Google.ProtocolBuffers.FieldAccess
internal RepeatedPrimitiveAccessor(string name) internal RepeatedPrimitiveAccessor(string name)
{ {
PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List", ReflectionUtil.EmptyTypes); PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List");
PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List", ReflectionUtil.EmptyTypes); PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List");
PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count", ReflectionUtil.EmptyTypes); PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count");
MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes); MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes);
getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] {typeof(int)}); getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] {typeof(int)});
clrType = getElementMethod.ReturnType; clrType = getElementMethod.ReturnType;
......
...@@ -58,14 +58,10 @@ namespace Google.ProtocolBuffers.FieldAccess ...@@ -58,14 +58,10 @@ namespace Google.ProtocolBuffers.FieldAccess
internal SinglePrimitiveAccessor(string name) internal SinglePrimitiveAccessor(string name)
{ {
PropertyInfo messageProperty = typeof(TMessage).GetProperty(name, ReflectionUtil.EmptyTypes); PropertyInfo messageProperty = typeof(TMessage).GetProperty(name, null, ReflectionUtil.EmptyTypes);
PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name, ReflectionUtil.EmptyTypes); PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name, null, ReflectionUtil.EmptyTypes);
if (builderProperty == null) PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name);
{ MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name);
builderProperty = typeof(TBuilder).GetProperty(name, ReflectionUtil.EmptyTypes);
}
PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name, ReflectionUtil.EmptyTypes);
MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, ReflectionUtil.EmptyTypes);
if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null) if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null)
{ {
throw new ArgumentException("Not all required properties/methods available"); throw new ArgumentException("Not all required properties/methods available");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment