While working with reflection, I recently got to the point where I wanted to access the object (in fact, a static instance of the object).
The object itself is defined by the inner class, so there is no other way to access it. Instead of directly getting a parameterized constructor, I can access a static instance using the Instance property. Using reflection, I can also get this property and set it to an instance of PropertyInfo
- it is detected correctly.
However, I cannot get the value of the property via GetValue
(since it is called through get_Instance () in the inner class) and sets it to the object, because I get a MethodAccessException
.
The inner class is labeled SecuritySafeCritical
, but I believe this should not be a problem.
Any ideas on why I am getting this exception?
source share