When I try to access that data in a handler (which is in another assembly, in case that's relevant), all I get is an exception that object doesn't have a definition for Action, even though I re-cast the Data property to dynamic. Even the DebuggerVisualizer for dynamic objects shows that there is a property Action on the object.

However, I get the mentioned exception.

Here's an image of what I'm trying to do in the event handler, all together with the info from the debugger. In the image the debugger has stopped on a breakpoint. The next step throws the exception.

Any idea of what causes this exception? What am I doing wrong?

The problem is that anonymous types are declared internal, so the members you are trying to access are not visible in your other assembly and the DLR actually does the same compile-time analysis on member accessibility at run-time. It will not let you access at run-time something you could not access at compile-time. It sees the anonymous type is internal and throws a RuntimeBinderException.

One solution is to write the reflection code explicitly rather than using dynamic. A more maintainable, long-term solution would be to remove dynamic from the event args and define more precisely how your components are communicating with each other.

Related Articles

I am trying to find some official confirmation on a theory with respect to C functions. In a simple project of mine, I have a function which I only want to be visible within the .c file in which it is defined. The function prototype is: static int su

I'm trying to create a LINQ query to pull specific subTypes, which are stored as Bytes in the table. I've tried several variations, and got it working forcing in and out of strings; but I can't get a numeric version to work. I assume it's some sort o

I am creating a RESTful web service and I try to follow the conventions and recomendations for creating a good web service. Now I have come to a halt though. I have a User entity in my system that I have regular CRUD paths for. I want to expose an AP

I Know i m asking a peculiar question but i have to question this because this question is in my mind from long time. While using Visual Studio as soon as we write "A" while creating new "Actionresult" i.e while we write 'ActionResult'

Forms have an action attribute to specify where (for example a .php file) to post to. Do <input> elements have the action attribute? The answer is most likely no. But I wish to know what concept am I getting wrong here? Is there a equivalent of acti

Ok, that's weird. I've received this error for one of my activities, the weird thing is that the bitmap is used in every Activity! I don't even know how to reproduce the exception, it's working fine for me (and others I think). This is the whole stac

I have try to pass the action information like ( Save or Edit ) from my struts2 action class ( CommonAction.java ) to jsp file ( test.jsp ). In action class, I used the below code to set action value. request.setAttribute("action","Save&quo

In a RESTful application, how do we differentiate between an "action" and an HTTP verb (GET, POST, PUT, DELETE)? For example, as I understand it, a GET request to the resource /products should return a list of all products. A POST request to /pr

I have a question and i would be grateful for the answer if somebody knows one. Ok, to the point. In one of my scripts i have following expression, it is not clear for me form man page what effect it should produce: if ! [[ -s "$the_file_to_check&quo

Hi so I am creating a recipe submission app. On the submit page I have a drop down list to pick the category they want the recipe to be under. When I hit submit I get the error in my Recipes controller: undefined method `each' for "1":String hig

During my training, I'm working on a website and we use Ruby on Rails. We need to send mails to users so I created a mailer. I have tried to put the smtp in both development.rb and environment.rb config.action_mailer.default_url_options = {host: '0.0

I see some Swing apps (like Eclipse) that load with a Welcome!/"splash" page. What kind of Swing component is this? Its sort of like a web page (like the old <imagemap>s!) embedded inside a Swing app and is very cool.You could design the s