Author: jbevain
Date: 2007-06-06 07:23:22 -0400 (Wed, 06 Jun 2007)
New Revision: 78723
Modified:
trunk/cecil/linker/ChangeLog
trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs
Log:
2007-06-06 Jb Evain <[EMAIL PROTECTED]>
* Mono.Linker.Steps/MarkStep.cs:
Mark default constructor for serializable types.
Mark the special serialization constructor as well.
Modified: trunk/cecil/linker/ChangeLog
===================================================================
--- trunk/cecil/linker/ChangeLog 2007-06-06 11:20:07 UTC (rev 78722)
+++ trunk/cecil/linker/ChangeLog 2007-06-06 11:23:22 UTC (rev 78723)
@@ -2,6 +2,7 @@
* Mono.Linker.Steps/MarkStep.cs:
Mark default constructor for serializable types.
+ Mark the special serialization constructor as well.
* Mono.Linker/LinkContext.cs:
Mono.Linker.Steps/LoadReferences.cs:
Modified: trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs
===================================================================
--- trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs 2007-06-06 11:20:07 UTC
(rev 78722)
+++ trunk/cecil/linker/Mono.Linker.Steps/MarkStep.cs 2007-06-06 11:23:22 UTC
(rev 78723)
@@ -205,8 +205,10 @@
if (IsMulticastDelegate (td))
MarkMethodCollection (td.Constructors);
- if (IsSerializable (td))
+ if (IsSerializable(td)) {
MarkMethodsIf (td.Constructors, new
MethodPredicate (IsDefaultConstructor));
+ MarkMethodsIf (td.Constructors, new
MethodPredicate (IsSpecialSerializationConstructor));
+ }
MarkGenericParameters (td);
@@ -225,6 +227,19 @@
ApplyPreserveInfo (td);
}
+ static bool IsSpecialSerializationConstructor (MethodDefinition
method)
+ {
+ if (!IsConstructor (method))
+ return false;
+
+ ParameterDefinitionCollection parameters =
method.Parameters;
+ if (parameters.Count != 2)
+ return false;
+
+ return parameters [0].ParameterType.Name ==
"SerializationInfo" &&
+ parameters [1].ParameterType.Name ==
"StreamingContext";
+ }
+
delegate bool MethodPredicate (MethodDefinition method);
void MarkMethodsIf (ICollection methods, MethodPredicate
predicate)
@@ -236,8 +251,13 @@
static bool IsDefaultConstructor (MethodDefinition method)
{
+ return IsConstructor (method) &&
method.Parameters.Count == 0;
+ }
+
+ static bool IsConstructor (MethodDefinition method)
+ {
return method.Name == MethodDefinition.Ctor &&
method.IsSpecialName &&
- method.IsRuntimeSpecialName &&
method.Parameters.Count == 0;
+ method.IsRuntimeSpecialName;
}
static bool IsVirtual (MethodDefinition method)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches