[Mono-bugs] [Bug 80246][Nor] New - monocov does not encode generic type names in output code coverage xml
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Dec 12 20:48:37 EST 2006
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 matt.ward.bugs at googlemail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=80246
--- shadow/80246 2006-12-12 20:48:37.000000000 -0500
+++ shadow/80246.tmp.27263 2006-12-12 20:48:37.000000000 -0500
@@ -0,0 +1,81 @@
+Bug#: 80246
+Product: Mono: Tools
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: tools
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: matt.ward.bugs at googlemail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: monocov does not encode generic type names in output code coverage xml
+
+Description of Problem:
+
+monocov does not encode class names for generic types (.NET 2.0) in output
+code coverage xml. The resulting xml cannot be loaded by monocov since some
+of the attributes contain <element> tags.
+
+Steps to reproduce the problem:
+
+Using Mono 1.2.2 and monocov 0.2
+
+1. Create a console app with the following code.
+
+using System;
+using System.Collections.Generic;
+
+namespace GenericListApp
+{
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ List<string> l = new List<string>();
+ l.Add("Test");
+ }
+ }
+}
+
+2. Compile with gmcs. Something like:
+
+gmcs -target:exe -out:GenericListApp.exe -debug Main.cs
+
+3. Run mono with monocov to generate code coverage:
+
+mono --debug --profile=monocov GenericListApp.exe
+
+4) Open the code coverage output file GenericListApp.exe.cov. You will find
+lines like:
+
+<method assembly="mscorlib"
+class="System.Collections.Generic.List<System.String>" name="Add (string)"
+token="100679232">
+<method assembly="mscorlib"
+class="System.Collections.Generic.List<System.String>" name=".ctor ()"
+token="100679206">
+
+Which monocov cannot load since the xml is not well formed.
+
+To fix:
+
+The type name is not being encoded so coverage.c needs to be modified.
+
+Index: coverage.c
+===================================================================
+--- coverage.c (revision 69432)
++++ coverage.c (working copy)
+@@ -289,6 +289,7 @@
+
+ klass = mono_method_get_class (method);
+ classname = mono_type_get_name (mono_class_get_type (klass));
++ classname = g_markup_escape_text (classname, strlen (classname));
+ image = mono_class_get_image (klass);
+
+ tmpname = mono_method_get_name (method);
More information about the mono-bugs
mailing list