[Mono-bugs] [Bug 31535][Nor] New - Mono not call "set" code when SetValue() used with property obtained by reflection

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
1 Oct 2002 04:19:19 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mathpup@mylinuxisp.com.

http://bugzilla.ximian.com/show_bug.cgi?id=31535

--- shadow/31535	Tue Oct  1 00:19:19 2002
+++ shadow/31535.tmp.31283	Tue Oct  1 00:19:19 2002
@@ -0,0 +1,80 @@
+Bug#: 31535
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: SuSE 8.0
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: mathpup@mylinuxisp.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono not call "set" code when SetValue() used with property obtained by reflection
+
+Description of Problem:      
+     
+Mono does not invoke the "set" method when SetValue() is called on a     
+property obtain using reflection.     
+      
+Steps to reproduce the problem:      
+1.   Run the program below.    
+    
+using System;   
+using System.Reflection;   
+   
+public class MyClass   
+{   
+	public int flag = 0;   
+   
+	public int Property   
+	{   
+		set   
+		{   
+			Console.WriteLine("Property setter called");   
+			flag = value;   
+		}   
+	}   
+}   
+   
+   
+public class Testing   
+{   
+	public static void Main()   
+	{   
+		MyClass a = new MyClass();   
+		   
+		MemberInfo[] infoArray =   
+a.GetType().GetMember("Property");   
+		PropertyInfo info = (PropertyInfo) infoArray[0];   
+		   
+		Console.WriteLine( "flag = {0} (should be 0)", a.flag );   
+		info.SetValue( a, 34, null );   
+		Console.WriteLine( "flag = {0} (should be 34)", a.flag );   
+	}   
+}    
+    
+    
+Actual Results:  
+     
+flag = 0 (should be 0)  
+flag = 0 (should be 34)      
+      
+Expected Results:      
+      
+flag = 0 (should be 0) 
+Property setter called 
+flag = 34 (should be 34) 
+    
+How often does this happen?       
+      
+Every time 
+      
+Additional Information:      
+ 
+I'm not sure if the same problem exists with the "get" method for the 
+property, but I should assume so.