Re: [Mono-dev] [Mono-list] Help with garbled email headers when adding attachment

2006-09-01 Thread Andreas Färber
Am 29.08.2006 um 11:11 schrieb Vladimir Lushnikov:Hi,I have looked at trunk implementation and it seems that it's marked as a todo item. However, it has been marked over 5 months as that, so re-sending to mono-devel.If I knew the standard I would be happy to implement the functionality in mono, but I wouldn't be using the classes if I did that. Could someone help me out please?If you quoted correctly, then the newline after a MIME boundary and before the "Content-Type" is wrong; also after the last part the end is missing - should be "--", boundary name, "--".Andreas Thank you,Vladimir LushnikovOn 8/28/06, Vladimir Lushnikov [EMAIL PROTECTED]  wrote:Hi,I'm trying to send an email with mono using smtp. If I send one normally, I get the following:---Subject: Mail testMIME-Version: 1.0Content-Type: text/html; charset=us-ascii
Message-Id: <.>Date: Mon, 28 Aug 2006 15:33:16 -0700 (PDT)This is a mail testThis is a newline---However, as soon as I add an attachment, headers go wild:---Subject: Hotbackup r22MIME-Version: 1.0Content-Type: multipart/mixed; charset=us-ascii; boundary=--boundary_0_6ab9cc28-7330-47d7-ad54-569f53fe2014Message-Id: <.>Date: Mon, 28 Aug 2006 15:43:44 -0700 (PDT)
boundary_0_6ab9cc28-7330-47d7-ad54-569f53fe2014content-type: multipart/alternativecontent-transfer-encoding: quoted-printableThis is a mail testThis is a newlineboundary_0_6ab9cc28-7330-47d7-ad54-569f53fe2014
content-type: multipart/alternativecontent-transfer-encoding: base64SGVsbG8sIHdvcmxkLi4uCg==--- My code is:  // Create  the file attachment for this e-mail message.    Attachment data = "" Attachment(file.FullName, MediaTypeNames.Application.Octet);     // Add time stamp information for the file.    ContentDisposition disposition = data.ContentDisposition;    disposition.CreationDate = File.GetCreationTime(file.FullName );    disposition.ModificationDate = File.GetLastWriteTime(file.FullName);    disposition.ReadDate = File.GetLastAccessTime(file.FullName);    mail.Attachments.Add(data); Where mail is MailMessage object, file is a FileInfo object. I am using gmcs and trunk build (from yesterday).All help would be appreciated.Regards,Vladimir Lushnikov -- Vladimir "Vlad#" Lushnikov  http://www.vladsharp.com - The Crests of Reason - Journey to a better object... -- Vladimir "Vlad#" Lushnikovhttp://www.vladsharp.com - The Crests of Reason - Journey to a better object...___Mono-list maillist  -  Mono-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-list ___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Building Mono on Linux/Alpha

2006-09-01 Thread Zoltan Varga
   Hi,

  The patch is now in SVN. Thanks !

   Zoltan

On 9/1/06, Servey Tikhonov [EMAIL PROTECTED] wrote:
 Hello Zoltan,

 Here is another set of patches for mono on Linux/Alpha. The changes are:
 - Added -mieee option to gcc
 - Added support for floats (comparing them)
 - The size of generated code could be more than 32Kb
 - Internal debug messages are controlled by MONO_ALPHA_DEBUG env. variable
 - Added LMF support
 - Support for atomic operations contibuted by Jakub Boqusz
 [EMAIL PROTECTED]
 - Fixed exception handling and unwinding
 - Implemented exception rethrowning

 As result - 10 tests out of 194 in mono/tests - passed, all tests in
 mono/mini - passed.
 The mcs compiler shows help, correcly complains if there is no file to
 compile,
 completes parsing stage without visible errors (mcs is ran with --parse
 option).

 Regards,
 Sergey.

 [EMAIL PROTECTED]
 Solvo Ltd.




___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Announce: Mono.Fuse 0.2.0 (+ Required mcs mono patches)

2006-09-01 Thread Jonathan Pryor
Mono.Fuse is a binding for the FUSE library, permitting user-space 
file systems to be written in C#.

Why?
===

I read Robert Love's announcement of beaglefs, a FUSE program that 
exposes Beagle searches as a filesystem.  My first thought: Why 
wasn't that done in C# (considering that the rest of Beagle is C#)?


What about SULF?
===

Stackable User-Level Filesystem, or SULF 
(http://arg0.net/users/vgough/sulf/), is a pre-existing FUSE binding 
in C#, started by Valient Gough in 2004.  It has since been replaced
by fusewrapper, http://arg0.net/darcs/fusewrapper.

Mono.Fuse has no relation to SULF or fusewrapper, for two reasons:

  1.  It goes to great efforts to avoid a Mono.Posix.dll dependency,
  duplicating Mono.Unix.Native.Stat (Fuse.Stat),
  Mono.Unix.Native.Statvfs (Fuse.StatFS), and many methods from
  Mono.Unix.Native.Syscall (Fuse.Wrapper).

  2.  I don't like the SULF API.  (Not that I spent a great deal of
  time looking at it, but what I did see I didn't like.)
  SULF is an inode-based API, while Mono.Fuse is a path-based 
  API.  I think paths are easier to deal with, and Valient Gough
  believes inodes are.

  3.  SULF wraps the FUSE kernel-level interface, while Mono.Fuse
  wraps the higher level libfuse C interface

I find (1) the most appalling, if only because I'm the Mono.Posix
maintainer and I'd like to see my work actually used. :-)

Once I started writing Mono.Fuse, I discovered a good reason to avoid
Mono.Posix: it's currently impossible to use from outside of Mono.
I figured this would be a good opportunity to rectify that, making it
easier for additional libraries to build upon the Mono.Posix
infrastructure.


Implementation:
==

Mono.Fuse requires patches to the mcs, mono, and mono-tools modules,
changes which need to be proposed and discussed.

mcs:
---

There are two major changes:

  * The addition of several new methods public to
Mono.Unix.Native.NativeConvert:

  class Mono.Unix.Native.NativeConvert {
public static bool TryCopy (ref Flock source, IntPtr destination);
public static void Copy (ref Flock source, IntPtr destination);
public static bool TryCopy (IntPtr source, out Flock destination);
public static void Copy (IntPtr source, out Flock source);

/* repeat for most other structure types, e.g. Stat, Statvfs,
   Pollfd, Timeval, Timezone, Utimbuf... */
  }

  * class/Mono.Posix/Mono.Unix.Native/make-map.cs has been moved to
mono-tools/create-native-map/src/create-native-map.cs.

Those are the public changes.  Internally, MapAttribute has been
revamped considerably, as has create-native-map.exe, but MapAttribute
remains an internal attribute and is not part of the public API.

The new methods on NativeConvert are required to permit extending the
current Mono.Posix infrastructure, so that Mono.Fuse can make use of
Mono.Posix's Stat  Statvfs structure copying support (among other
types).

Statvfs is particularly nice, as mono/support/sys-statvfs.c is a
#ifdef-infested scourge, largely by trying to support Linux (statvfs)
and OS X/*BSD (statfs) and make them look identical to managed code.


mono:


create-native-map.exe now has support to generate structure
declarations, to better ensure that managed  native structures are
identical (as opposed to doing this by hand).

map-icalls.h has been removed, its contents inserted into map.h.

map.c and map.h have additional methods for copying structures between
managed  native representations, e.g. Mono_Posix_ToStat
(native-managed) and Mono_Posix_FromStat (managed-native).

Many of the .c files have been changed to update their prototypes to
match the current create-native-map-generated declarations in map.h,
and to remove the hand-created structure definitions (as
create-native-map.exe generates these now).

A cached version of create-native-map.exe is now kept as
mono/support/create-native-map.exe, so that mono-tools isn't required
to run `make refresh'.  The `update-cnm' target updates the cached
program.

Otherwise, no public API changes or additions (since MonoPosixHelper
is considered to be an internal API, any changes aren't public).


mono-tools:
--

Adds create-native-map.exe, and adds a create-native-map.pc file so
that pkg-config can be used to update a cached copy of
create-native-map.exe  MapAttribute.cs.


HOWTO:
=

Go to http://www.jprl.com/mono-fuse for the patches and source download.

Apply ``mcs.patch'' to a ``mcs'' checkout, rebuild, and install.
Apply ``mono.patch'' to a ``mono'' checkout, rebuild, and install.
Build ``mono-fuse-0.2.0.tar.gz'' in the standard manner.

Optionally, apply ``mono-tools.patch'' to a ``mono-tools'' checkout,
rebuild, and install.


Questions:
=

  - How should we cope with unstable APIs which make use of native 
code?  The Application Deployment Guidelines [1] don't address
this issue.

For example, the Guidelines stat that 

[Mono-dev] xsp2 on debian

2006-09-01 Thread Matt Dockerty
Hi,

I'm having real difficulty getting mod_mono/xsp2 up and running on Debian
(Etch). After experimenting, it appears to be down to a line in
machine.config that xsp2 doesn't understand. It's not too clear which line
of the configuration is failing so I correct it. Any pointers on what I
could look at to get that info?

My mono version is the latest in the Debian distribution - 1.1.13.8.

beyond-dev1:/home/beyond/htdocs# xsp2

Unhandled Exception: System.InvalidCastException: Cannot cast from source
type to destination type.
in 0x0003f System.Configuration.ConfigurationManager:get_AppSettings ()
in 0x7 Mono.XSP.Server:get_AppSettings ()
in 0x00149 Mono.XSP.Server:Main (System.String[] args)

Cheers,
Matt

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] IE7 RC1 and browsercaps.ini

2006-09-01 Thread Hubert FONGARNAND




Hello 
I've written a little aspx page that show a pb with IE7

	public class Default : Page
	{
		protected System.Web.UI.HtmlControls.HtmlForm form1;
		protected System.Web.UI.WebControls.Label textBox1;
	
		
		protected override void OnInit(System.EventArgs a)
		{
			this.Load+=this.OnLoad;
			Console.WriteLine(bonjour);
		}
		

		protected void OnLoad(object o,System.EventArgs a)
		{
			textBox1.Text=Version :+Request.Browser.Version+ +Request.Browser.Browser;
		}
		
		

	}

When i load the page with IE7 : Mono show : Version: Unknown
With MS.NET 1.1 it show IE7

I've notified that browsercaps.ini has entries for IE7 
([Mozilla/4.0 (compatible; MSIE 7.0b; *Windows XP*.NET CLR*)*])

but with ethereal (wireshark) i've seen that the new string is ([Mozilla/4.0 (compatible; MSIE 7.0; *Windows XP*.NET CLR*)*])

Here's the patch for browscap.ini

Thanks to commit!

Index: mono/data/browscap.ini
===
--- mono/data/browscap.ini (rvision 64676)
+++ mono/data/browscap.ini (copie de travail)
@@ -13397,6 +13397,40 @@
 platform=WinXP
 netclr=True

+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.1*)*]
+parent=IE 7.0
+platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.1*.NET CLR*)*]
+parent=IE 7.0
+platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2*)*]
+parent=IE 7.0
+platform=Win2003
+netclr=True
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 5.2*.NET CLR*)*]
+parent=IE 7.0
+platform=Win2003
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 6.0*)*]
+parent=IE 7.0
+platform=WinVI
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows NT 6.0*.NET CLR*)*]
+parent=IE 7.0
+platform=WinVI
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows XP*)*]
+parent=IE 7.0
+platform=WinXP
+
+[Mozilla/4.0 (compatible; MSIE 7.0; *Windows XP*.NET CLR*)*]
+parent=IE 7.0
+platform=WinXP
+netclr=True
+
  Default Browser

 [*]

___Ce message et les éventuels documents joints peuvent contenir des informations confidentielles.Au cas où il ne vous serait pas destiné, nous vous remercions de bien vouloir le supprimer et en aviser immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou publication, totale ou partielle et quel qu'en soit le moyen est formellement interdite.Les communications sur internet n'étant pas sécurisées, l'intégrité de ce message n'est pas assurée et la société émettrice ne peut être tenue pour responsable de son contenu.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] xsp2 on debian

2006-09-01 Thread Michael Schurter
Matt Dockerty wrote:
 I'm having real difficulty getting mod_mono/xsp2 up and running on Debian
 (Etch). After experimenting, it appears to be down to a line in
 machine.config that xsp2 doesn't understand. It's not too clear which line
 of the configuration is failing so I correct it. Any pointers on what I
 could look at to get that info?
 
 My mono version is the latest in the Debian distribution - 1.1.13.8.

I had the exact same problem.  See this bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=372281

As of yesterday I still couldn't get xsp2 to work on Debian Etch which 
is why today I built everything Mono related from source.  I'm happy to 
report xsp2 from the svn-trunk seems to work fine.

The Debian Mono Group is doing an excellent job packaging Mono for Etch, 
so I have no idea why this bug has stayed open for so long.

-- 
Michael Schurter
Synthesys Solutions
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] mono/interpreter/interp.c build problems

2006-09-01 Thread Mark E Mason
Hello all,

I'm attempting to bring mono up under a Linux/MIPS environment (Debian
if anyone cares), and as the JIT for mips doesn't exist yet, I thought
the best thing to do was configure and build an interpreter version
first (as recommended).

Doing this from the svn head (updated as of 10 minutes ago), yields the
following errors (I've manually cut the warnings for clarity):

interp.c: In function 'ves_exec_method_with_context':
interp.c:2667: error: 'struct MonoVTable' has no member named
'interface_offsets'
interp.c:2691: error: 'struct MonoVTable' has no member named
'interface_offsets'
interp.c:3957: error: dereferencing pointer to incomplete type
interp.c:4004: error: dereferencing pointer to incomplete type

I guess my first question is - how up to-date is the interpreter build
of mono?  Since most of the popular architectures (except MIPS) have
JITs, has it been built or tested recently?

Thanks in advance,
Mark

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mono/interpreter/interp.c build problems

2006-09-01 Thread Zoltan Varga
  Hi,

  The interpreter is deprecated and is no longer maintained. It will be removed
entirely in the (near) future.

Zoltan

On 9/1/06, Mark E Mason [EMAIL PROTECTED] wrote:
 Hello all,

 I'm attempting to bring mono up under a Linux/MIPS environment (Debian
 if anyone cares), and as the JIT for mips doesn't exist yet, I thought
 the best thing to do was configure and build an interpreter version
 first (as recommended).

 Doing this from the svn head (updated as of 10 minutes ago), yields the
 following errors (I've manually cut the warnings for clarity):

 interp.c: In function 'ves_exec_method_with_context':
 interp.c:2667: error: 'struct MonoVTable' has no member named
 'interface_offsets'
 interp.c:2691: error: 'struct MonoVTable' has no member named
 'interface_offsets'
 interp.c:3957: error: dereferencing pointer to incomplete type
 interp.c:4004: error: dereferencing pointer to incomplete type

 I guess my first question is - how up to-date is the interpreter build
 of mono?  Since most of the popular architectures (except MIPS) have
 JITs, has it been built or tested recently?

 Thanks in advance,
 Mark

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mono/interpreter/interp.c build problems

2006-09-01 Thread Mark E Mason
Hello,

Ah - thanks.  Straight on to the JIT port for mips then. ;-)

Thx,
Mark 

 -Original Message-
 From: Zoltan Varga [mailto:[EMAIL PROTECTED] 
 Sent: Friday, September 01, 2006 1:20 PM
 To: Mark E Mason
 Cc: mono-devel-list@lists.ximian.com
 Subject: Re: [Mono-dev] mono/interpreter/interp.c build problems
 
   Hi,
 
   The interpreter is deprecated and is no longer maintained. 
 It will be removed
 entirely in the (near) future.
 
 Zoltan
 
 On 9/1/06, Mark E Mason [EMAIL PROTECTED] wrote:
  Hello all,
 
  I'm attempting to bring mono up under a Linux/MIPS 
 environment (Debian
  if anyone cares), and as the JIT for mips doesn't exist 
 yet, I thought
  the best thing to do was configure and build an interpreter version
  first (as recommended).
 
  Doing this from the svn head (updated as of 10 minutes 
 ago), yields the
  following errors (I've manually cut the warnings for clarity):
 
  interp.c: In function 'ves_exec_method_with_context':
  interp.c:2667: error: 'struct MonoVTable' has no member named
  'interface_offsets'
  interp.c:2691: error: 'struct MonoVTable' has no member named
  'interface_offsets'
  interp.c:3957: error: dereferencing pointer to incomplete type
  interp.c:4004: error: dereferencing pointer to incomplete type
 
  I guess my first question is - how up to-date is the 
 interpreter build
  of mono?  Since most of the popular architectures (except MIPS) have
  JITs, has it been built or tested recently?
 
  Thanks in advance,
  Mark
 
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 
 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [PATCH] BUG in TypeDescriptor.GetAttributes : Ignores overriden attributes

2006-09-01 Thread Ivan N. Zlatev

The current implementation of TypeDescriptor.GetAttributes ignores
overriden attributes and returns the bottom most in the inheritance
tree. The attached patch fixes that. I have also attached a test case
so you can observe the wrong behaviour. The patch also does whitespace
cleanup.

Please review and commit.

P.S: The fix is this and everything else is just the whitespace cleanup:

=== START ===
protected AttributeCollection GetAttributes (IComponent comp)
{
if (_attributes != null)
return _attributes;
-   
+
bool cache = true;
object[] ats = _infoType.GetCustomAttributes (true);
Hashtable t = new Hashtable ();
-   foreach (Attribute at in ats)
-   t [at.TypeId] = at;
-   
-   if (comp != null  comp.Site != null)
+
+   // Filter the custom attributes, so that only the top
+   // level of the same type are left.
+   //
+   for (int i = ats.Length -1; i  0; i--) {
+   t [((Attribute) ats[i]).TypeId] = ats[i];
+   }
+
+   if (comp != null  comp.Site != null)
{
ITypeDescriptorFilterService filter =
(ITypeDescriptorFilterService) comp.Site.GetService
(typeof(ITypeDescriptorFilterService));
cache = filter.FilterAttributes (comp, t);
}
=== END ===
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
GPG Key: http://files.i-nZ.net/i-nZ.asc
It's all some kind of whacked out conspiracy.
Index: class/System/System.ComponentModel/TypeDescriptor.cs
===
--- class/System/System.ComponentModel/TypeDescriptor.cs	(revision 64506)
+++ class/System/System.ComponentModel/TypeDescriptor.cs	(working copy)
@@ -17,10 +17,10 @@
 // distribute, sublicense, and/or sell copies of the Software, and to
 // permit persons to whom the Software is furnished to do so, subject to
 // the following conditions:
-// 
+//
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
-// 
+//
 // THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -61,14 +61,14 @@
 	{
 		string tn = designerBaseType.AssemblyQualifiedName;
 		AttributeCollection col = GetAttributes (component);
-		
+
 		foreach (Attribute at in col) {
 			DesignerAttribute dat = at as DesignerAttribute;
 			if (dat != null  tn == dat.DesignerBaseTypeName) {
 return (IDesigner) Activator.CreateInstance (GetTypeFromName (component, dat.DesignerTypeName));
 			}
 		}
-
+
 		return null;
 	}
 
@@ -193,7 +193,7 @@
 
 		if (noCustomTypeDesc == false  component is ICustomTypeDescriptor) {
 			return ((ICustomTypeDescriptor) component).GetConverter ();
-		} 
+		}
 		else {
 			Type t = null;
 			AttributeCollection atts = GetAttributes (component, false);
@@ -201,7 +201,7 @@
 			if (tca != null  tca.ConverterTypeName.Length  0) {
 t = GetTypeFromName (component as IComponent, tca.ConverterTypeName);
 			}
-			
+
 			if (t != null) {
 ConstructorInfo ci = t.GetConstructor (new Type[] { typeof(Type) });
 if (ci != null)
@@ -220,7 +220,7 @@
 			lock (creatingDefaultConverters) {
 if (defaultConverters != null)
 	return defaultConverters;
-
+
 defaultConverters = new Hashtable ();
 defaultConverters.Add (typeof (bool), typeof (BooleanConverter));
 defaultConverters.Add (typeof (byte), typeof (ByteConverter));
@@ -248,20 +248,20 @@
 			return defaultConverters;
 		}
 	}
-	
+
 	public static TypeConverter GetConverter (Type type)
 	{
 		TypeConverterAttribute tca = null;
 		Type t = null;
 		object [] atts = type.GetCustomAttributes (typeof(TypeConverterAttribute), true);
-		
+
 		if (atts.Length  0)
 			tca = (TypeConverterAttribute)atts[0];
-		
+
 		if (tca != null) {
 			t = GetTypeFromName (null, tca.ConverterTypeName);
 		}
-		
+
 		if (t == null) {
 			if (type.IsEnum) {
 // EnumConverter needs to know the enum type
@@ -270,7 +270,7 @@
 return new ArrayConverter ();
 			}
 		}
-		
+
 		if (t == null)
 			t = FindConverterType (type);
 
@@ -295,19 +295,19 @@
 	private static Type FindConverterType (Type type)
 	{
 		Type t = null;
-		
+
 		// Is there a default converter
 		t = (Type) DefaultConverters [type];
 		if (t != null)
 			return t;
-		
+
 		// Find default converter with a type this type is assignable to
 		foreach (Type defType in DefaultConverters.Keys) {
 			if (defType.IsInterface  defType.IsAssignableFrom (type)) {
 

Re: [Mono-dev] [PATCH] BUG in TypeDescriptor.GetAttributes : Ignores overriden attributes

2006-09-01 Thread Ivan N. Zlatev

Excuse me, made a typo in the previous patch. Please review this one
(basically changed i  0 to i = 0)

Cheers,
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
GPG Key: http://files.i-nZ.net/i-nZ.asc
It's all some kind of whacked out conspiracy.
Index: class/System/System.ComponentModel/TypeDescriptor.cs
===
--- class/System/System.ComponentModel/TypeDescriptor.cs	(revision 64506)
+++ class/System/System.ComponentModel/TypeDescriptor.cs	(working copy)
@@ -17,10 +17,10 @@
 // distribute, sublicense, and/or sell copies of the Software, and to
 // permit persons to whom the Software is furnished to do so, subject to
 // the following conditions:
-// 
+//
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
-// 
+//
 // THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -61,14 +61,14 @@
 	{
 		string tn = designerBaseType.AssemblyQualifiedName;
 		AttributeCollection col = GetAttributes (component);
-		
+
 		foreach (Attribute at in col) {
 			DesignerAttribute dat = at as DesignerAttribute;
-			if (dat != null  tn == dat.DesignerBaseTypeName) {
+			if (dat != null  tn == dat.DesignerBaseTypeName) {
 return (IDesigner) Activator.CreateInstance (GetTypeFromName (component, dat.DesignerTypeName));
 			}
 		}
-
+
 		return null;
 	}
 
@@ -193,7 +193,7 @@
 
 		if (noCustomTypeDesc == false  component is ICustomTypeDescriptor) {
 			return ((ICustomTypeDescriptor) component).GetConverter ();
-		} 
+		}
 		else {
 			Type t = null;
 			AttributeCollection atts = GetAttributes (component, false);
@@ -201,7 +201,7 @@
 			if (tca != null  tca.ConverterTypeName.Length  0) {
 t = GetTypeFromName (component as IComponent, tca.ConverterTypeName);
 			}
-			
+
 			if (t != null) {
 ConstructorInfo ci = t.GetConstructor (new Type[] { typeof(Type) });
 if (ci != null)
@@ -220,7 +220,7 @@
 			lock (creatingDefaultConverters) {
 if (defaultConverters != null)
 	return defaultConverters;
-
+
 defaultConverters = new Hashtable ();
 defaultConverters.Add (typeof (bool), typeof (BooleanConverter));
 defaultConverters.Add (typeof (byte), typeof (ByteConverter));
@@ -248,20 +248,20 @@
 			return defaultConverters;
 		}
 	}
-	
+
 	public static TypeConverter GetConverter (Type type)
 	{
 		TypeConverterAttribute tca = null;
 		Type t = null;
 		object [] atts = type.GetCustomAttributes (typeof(TypeConverterAttribute), true);
-		
+
 		if (atts.Length  0)
 			tca = (TypeConverterAttribute)atts[0];
-		
+
 		if (tca != null) {
 			t = GetTypeFromName (null, tca.ConverterTypeName);
 		}
-		
+
 		if (t == null) {
 			if (type.IsEnum) {
 // EnumConverter needs to know the enum type
@@ -270,7 +270,7 @@
 return new ArrayConverter ();
 			}
 		}
-		
+
 		if (t == null)
 			t = FindConverterType (type);
 
@@ -295,19 +295,19 @@
 	private static Type FindConverterType (Type type)
 	{
 		Type t = null;
-		
+
 		// Is there a default converter
 		t = (Type) DefaultConverters [type];
 		if (t != null)
 			return t;
-		
+
 		// Find default converter with a type this type is assignable to
 		foreach (Type defType in DefaultConverters.Keys) {
 			if (defType.IsInterface  defType.IsAssignableFrom (type)) {
 return (Type) DefaultConverters [defType];
 			}
 		}
-		
+
 		// Nothing found, try the same with our base type
 		if (type.BaseType != null)
 			return FindConverterType (type.BaseType);
@@ -367,8 +367,8 @@
 		object [] atts = componentType.GetCustomAttributes (typeof(EditorAttribute), true);
 		if (atts == null || atts.Length == 0)
 			return null;
-		
-		
+
+
 		foreach (EditorAttribute ea in atts)
 		{
 			t = GetTypeFromName (null, ea.EditorTypeName);
@@ -566,7 +566,7 @@
 	}
 
 	public static event RefreshEventHandler Refreshed;
-	
+
 	internal static ComponentInfo GetComponentInfo (IComponent com)
 	{
 		lock (componentTable)
@@ -583,7 +583,7 @@
 			return ci;
 		}
 	}
-	
+
 	internal static TypeInfo GetTypeInfo (Type type)
 	{
 		lock (typeTable)
@@ -596,7 +596,7 @@
 			return ci;
 		}
 	}
-	
+
 	static Type GetTypeFromName (IComponent component, string typeName)
 	{
 		if (component != null  component.Site != null) {
@@ -604,7 +604,7 @@
 			if (resver != null)
 return resver.GetType (typeName, true, false);
 		}
-		
+
 		Type t = Type.GetType (typeName);
 		if (t == null) throw new ArgumentException (Type ' + typeName + ' not found);
 		return t;
@@ -619,21 +619,21 @@
 		PropertyDescriptor _defaultProperty;
 		bool _gotDefaultProperty;
 		AttributeCollection _attributes;
-		
+
 		public Info (Type infoType)
 		{
 			_infoType = infoType;
 		}
-		
+
 		public abstract AttributeCollection GetAttributes ();
 		public abstract EventDescriptorCollection GetEvents ();
 		public abstract 

[Mono-dev] [Patch] 2 Bugs in ReflectorPropertyDescriptor: ignores Design-Time properties

2006-09-01 Thread Ivan N. Zlatev

This patch fixed the following 2 bugs. Please review and commit

1) The ReflectionPropretyDescriptor must be able to operate with non
public properties.

2) The current implementation ignores the fact that the component can
be in design mode. In design mode some of the properties (the
design-time ones) are supposed to be redirected to the designer. The
component which should be used to access the property is retrieved by
using MemberDescriptor.GetInvokee (implemented in the patch). Updated
the ReflectorPropertyDescriptor to use GetInvokee to decide which
component should it use.

P.S: Whitespace cleanup in the patch too.

Cheers,
--
Ivan N. Zlatev

Web: http://www.i-nZ.net
GPG Key: http://files.i-nZ.net/i-nZ.asc
It's all some kind of whacked out conspiracy.
Index: class/System/System.ComponentModel/MemberDescriptor.cs
===
--- class/System/System.ComponentModel/MemberDescriptor.cs	(revision 64506)
+++ class/System/System.ComponentModel/MemberDescriptor.cs	(working copy)
@@ -4,6 +4,7 @@
 // Author:
 //  Miguel de Icaza ([EMAIL PROTECTED])
 //  Andreas Nahr ([EMAIL PROTECTED])
+//  Ivan N. Zlatev (contact i-nZ.net)
 //
 // (C) Ximian, Inc.  http://www.ximian.com
 // (C) 2003 Andreas Nahr
@@ -17,10 +18,10 @@
 // distribute, sublicense, and/or sell copies of the Software, and to
 // permit persons to whom the Software is furnished to do so, subject to
 // the following conditions:
-// 
+//
 // The above copyright notice and this permission notice shall be
 // included in all copies or substantial portions of the Software.
-// 
+//
 // THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -34,18 +35,19 @@
 using System.Collections;
 using System.Reflection;
 using System.Runtime.InteropServices;
+using System.ComponentModel.Design;
 
 namespace System.ComponentModel
 {
 
 [ComVisible (true)]
-public abstract class MemberDescriptor 
+public abstract class MemberDescriptor
 {
 
 private string name;
 private Attribute [] attrs;
 private AttributeCollection attrCollection;
-		
+
 protected MemberDescriptor (string name, Attribute [] attrs)
 {
 this.name = name;
@@ -69,15 +71,15 @@
 attrs = reference.AttributeArray;
 }
 
-protected virtual Attribute [] AttributeArray 
+protected virtual Attribute [] AttributeArray
 {
-get 
+get
 {
-if (attrs == null) 
+if (attrs == null)
 {
 	ArrayList list = new ArrayList ();
 	FillAttributes (list);
-	
+
 	ArrayList filtered = new ArrayList ();
 	foreach (Attribute at in list) {
 		bool found = false;
@@ -88,11 +90,11 @@
 	}
 	attrs = (Attribute[]) filtered.ToArray (typeof(Attribute));
 }
-
+
 return attrs;
 }
 
-set 
+set
 {
 attrs = value;
 }
@@ -105,7 +107,7 @@
 
 public virtual AttributeCollection Attributes
 {
-get 
+get
 {
 if (attrCollection == null)
 attrCollection = CreateAttributeCollection ();
@@ -117,18 +119,18 @@
 {
 return new AttributeCollection (AttributeArray);
 }
-			
-public virtual string Category 
+
+public virtual string Category
 {
-get 
+get
 {
 return ((CategoryAttribute) Attributes [typeof (CategoryAttribute)]).Category;
 }
 }
 
-public virtual string Description 
+public virtual string Description
 {
-get 
+get
 {
 foreach (Attribute attr in AttributeArray)
 {
@@ -139,9 +141,9 @@
 }
 }
 
-public virtual bool DesignTimeOnly 
+public virtual bool DesignTimeOnly
 {
-get 
+get
 {
 foreach (Attribute attr in AttributeArray)
 {
@@ -153,25 +155,25 @@
 }
 }
 
-public virtual string DisplayName 
+public virtual string DisplayName
 {
-get 
+get
 {
 return name;
 }
 }
 
-public virtual string Name 
+public virtual string Name
 {
-get 
+get
 {
 return name;
 }
 }
 
-public virtual bool IsBrowsable 
+public virtual bool IsBrowsable
 {
-get 
+get
 {
 foreach (Attribute attr in AttributeArray)
 {
@@ -183,15 +185,15 @@
 }
 }
 
-protected virtual