c# - MethodAccessException with Reflection on Windows Phone 7 -
while working reflection, got point wanted access object (in fact, static instance of object).
the object defined internal class, therefore there no other way access it. instead of directly getting parametrized constructor, can access static instance via instance property. of reflection, able property , set propertyinfo
instance - detected correctly.
however, not able value of property via getvalue
(since called via get_instance() in internal class itself) , set object because getting methodaccessexception
.
the internal class marked securitysafecritical
, believe shouldn't problem.
any ideas on why getting exception?
have @ methodaccessexception
.
it says
this exception thrown in situations such following:
* private, protected, or internal method not accessible normal compiled code accessed partially trusted code using reflection. * security-critical method accessed transparent code. * access level of method in class library has changed, , 1 or more assemblies reference library have not been recompiled.
check if assembly compiled , application has proper privileges.
Comments
Post a Comment