Bug 319848 (MONO77041) - Static and non static properties
Summary: Static and non static properties
Status: RESOLVED FIXED
: 373190 (view as bug list)
Alias: MONO77041
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: SVN
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Marek Safar
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on: 411209
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-20 01:15 UTC by Jean-Baptiste Evain
Modified: 2011-03-30 08:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:41:49 UTC


---- Reported by mono@evain.net 2005-12-19 18:15:53 MST ----

mcs emits the same propertyinfo for static and non static properties.

class Test {

	public static string A {
		get { return ""; }
	}
	
	public string B {
		get { return ""; }
	}
}

For this code, mcs emits the same property signature.
The first one should have it's hasThis bit set to one in the CallingConvention.

Additional Information:
The problem is that there is no way in the current S.R.E API to define whether an PropertyBuilder 
is an instance property or a class one. This leads to bugs like #77040.



---- Additional Comments From rharinath@novell.com 2005-12-20 03:16:22 MST ----

Is there a way to deduce that?  Will a heuristic like the following
work: if the get_S method is static, then S is static




---- Additional Comments From rharinath@novell.com 2005-12-20 03:17:37 MST ----

I mean: apply the heuristic in SRE.PropertyBuilder.SetGetMethod -- in
this case #77040 will likely continue to fail, but for a different reason.




---- Additional Comments From mono@evain.net 2005-12-20 03:36:49 MST ----

According to the spec the CLS says that if all the methods of the property are instance 
methods, it's an instance property. If not it's a class one. Maybe we can check on both 
SetGetMethod and SetSetMethod ?



---- Additional Comments From rharinath@novell.com 2005-12-20 04:04:11 MST ----

Sounds good.  Anyway, not much we can do to mcs...

--> CORLIB



---- Additional Comments From mono@evain.net 2005-12-20 04:09:22 MST ----

I'm not sure mcs can't do anything. At stated in https://bugzilla.novell.com/show_bug.cgi?id=MONO77040, MS's SRE always emits static 
properties. Can we imagine a private corlib methods called in the same way we did for 
resource embedding ?

Comment 1 Gert Driesen 2008-03-23 18:50:52 UTC
In .NET 2.0 SP1, MS introduced a new DefineProperty overload on TypeBuilder that allows the calling convention to be set.

We can use that one for gmcs. For mcs, we'll need to mark that method as internal and invoke it using reflection.
Comment 2 Gert Driesen 2008-03-23 18:51:19 UTC
*** Bug 373190 has been marked as a duplicate of this bug. ***
Comment 3 Rodrigo Kumpera 2010-09-13 16:14:19 UTC
Hey Marek, has this been fixed? Can we close it?
Comment 4 Marek Safar 2010-09-13 16:17:50 UTC
I should be but I am waiting for Cecil upgrade in master to test it.
Comment 5 Marek Safar 2011-03-30 08:24:21 UTC
Already fixed in master