This is my first foray into using Reflection.Emit. I'm dynamically building a proxy for a provided object. The proxy passes any public property accesses through to the provided object. The error I'm receiving is:
Property accessor 'AccessorName' on object 'ProxyObject' threw the following exception: Attempt by method 'ProxyObject.get_AccessorName()' to access method 'NS.CoreObject.get_AccessorName() failed.
From what I can assume and gather, this would be due to the automatically-generated property getter method being private and hidden. But how do I work around this using a MethodBuilder
?
According to the post at Create DynamicMethod to assign value to a property?, you can do it with a DynamicMethod by declaring the method to be "associated" with the target module, but I need to build a full class. Is there an equivalent "association" that can be achieved through Reflection.Emit?
This is a basic operation I'm trying to perform, so I'm certain that it's something straight-forward and simple that I'm unaware of.