[Mono-bugs] [Bug 624050] New: Cecil ignores NonSerialized attribute
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Jul 20 16:11:57 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=624050
http://bugzilla.novell.com/show_bug.cgi?id=624050#c0
Summary: Cecil ignores NonSerialized attribute
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Cecil
AssignedTo: jbevain at novell.com
ReportedBy: knocte at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2
SUSE/5.0.350.0-2.1 (KHTML, like Gecko) Chrome/5.0.350.0 Safari/533.2
Repro:
public class MainClass
{
int someFieldWithNoAttrs;
[ThreadStatic]
int someFieldWithThreadStatic;
[NonSerialized]
int someFieldWithNonSerialized;
public static void Main (string[] args)
{
Console.WriteLine (CsharpLib.MyClass.GetString ());
}
}
Cecil-based tool:
public static void Main (string[] args)
{
if (args.Length != 1)
throw new Exception ("Coloca un arg");
if (!System.IO.File.Exists (args [0]))
throw new Exception ("No existe");
var ass = AssemblyFactory.GetAssembly (args [0]);
foreach (TypeDefinition type in ass.MainModule.Types)
{
Console.WriteLine ("Inspecting type:" + type.Name);
foreach (FieldDefinition field in type.Fields) {
Console.WriteLine ("Field:" + field.Name +
" (attrs:" +
field.CustomAttributes.Count);
}
}
}
Reproducible: Always
Steps to Reproduce:
1. Compile the above codes.
2. Run the main method against MainClass.
Actual Results:
Inspecting type:<Module>
Inspecting type:MainClass
Field:someFieldWithNoAttrs (attrs:0
Field:someFieldWithThreadStatic (attrs:1
Field:someFieldWithNonSerialized (attrs:0
Expected Results:
Inspecting type:<Module>
Inspecting type:MainClass
Field:someFieldWithNoAttrs (attrs:0
Field:someFieldWithThreadStatic (attrs:1
Field:someFieldWithNonSerialized (attrs:1
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list