Mono bug with dynamic key word (CS1061)

I had this bug: CS1061: Type `object’ does not contain a definition for [some property].

It took me a couple of hours to figure out that this is a minor bug in the “var” keyword in mono.

The problem occurs when “casting” a dynamic variable to var. In this process it is being treated as an Object by the compiler. E.g. something like:

dynamic d = some obj
var v = d;
v.MyProperty // CS1061 exception

In .NET, however, this works fine. To resolve the issue, rename the var keyword to dynamic.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s