merging the Mainsoft branch to the trunk
[mono.git] / mcs / tools / corcompare / mono-api-info.cs
index 808f54ae2aa065818a60a93a4545b980cb7a9232..67a773f5d47b1cdab0212d23f01759a95b8db4b2 100644 (file)
@@ -4,7 +4,7 @@
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
 //
-// (C) 2003 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2003-2005 Novell, Inc (http://www.novell.com)
 //
 
 using System;
@@ -12,6 +12,7 @@ using System.Collections;
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
 using System.Text;
 using System.Xml;
 
@@ -765,8 +766,8 @@ namespace Mono.AssemblyInfo
 
                                if (parameter.IsOptional) {
                                        AddAttribute (paramNode, "optional", "true");
-                                       if (parameter.DefaultValue != null)
-                                               AddAttribute (paramNode, "defaultValue", parameter.DefaultValue.ToString ());
+                                       if (parameter.DefaultValue != System.DBNull.Value)
+                                               AddAttribute (paramNode, "defaultValue", (parameter.DefaultValue == null) ? "NULL" : parameter.DefaultValue.ToString ());
                                }
 
                                if (direction != "in")
@@ -813,6 +814,13 @@ namespace Mono.AssemblyInfo
                                if (!t.IsPublic && !t.Name.EndsWith ("TODOAttribute"))
                                        continue;
 
+                               // we ignore attributes that inherit from SecurityAttribute on purpose as they:
+                               // * aren't part of GetCustomAttributes in Fx 1.0/1.1;
+                               // * are encoded differently and in a different metadata table; and
+                               // * won't ever exactly match MS implementation (from a syntax pov)
+                               if (t.IsSubclassOf (typeof (SecurityAttribute)))
+                                       continue;
+
                                XmlNode node = document.CreateElement ("attribute");
                                AddAttribute (node, "name", t.FullName);