tags:

views:

61

answers:

1

I'm calling a UpdateUser on AuthenticationBase class in the System.ServiceModel.DomainServices.Server assembly installed by the WCF RIA Services installer. This works on my Win 7 desktop but on my Win 7 laptop, I get the following exception.

Any ideas on what I ought to be looking for or how I can determine what is different between the two systems? Thanks.

System.MethodAccessException was unhandled
      Message=Attempt by method 'System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1<T>.IsReadOnly(System.Reflection.PropertyInfo)' to access method 'System.Linq.Enumerable.Cast<System.ComponentModel.DataAnnotations.EditableAttribute>(System.Collections.IEnumerable)' failed.
      Source=System.ServiceModel.DomainServices.Server
      StackTrace:
           at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.IsReadOnly(PropertyInfo propertyInfo)
           at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateProfile(T user)
           at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateUserCore(T user)
           at System.ServiceModel.DomainServices.Server.ApplicationServices.AuthenticationBase`1.UpdateUser(T user)
A: 

It sounds like you do not have Reflection permission on the laptop instance.

Are you perhaps running it under another user account?

Have a look at the MethodAccessException docs.

Also, make sure both are running the same version of .NET as there are security changes introduced in .NET 4.

leppie
Yes. Both local accounts. How do I determine whether the user has reflection permission?
Tyler Jensen
You would have to use `ReflectionPermission.Demand()`. Updating answer with more info.
leppie
I do not know how to do that. I've been looking for clues but finding none. Does the permission go on the assembly being called or on the client assembly calling the code?
Tyler Jensen
I never did resolve this. Just went around it.
Tyler Jensen