[Mono-bugs] [Bug 403371] New: Uncatched exception in CheckNewExceptionWithoutThrowingRule

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jun 24 14:28:30 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=403371


           Summary: Uncatched exception in
                    CheckNewExceptionWithoutThrowingRule
           Product: Mono: Tools
           Version: SVN
          Platform: i386
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: nestor.salceda at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Here is the stack trace for this rule:

An uncatched exception occured. Please fill a bug report @
https://bugzilla.novell.com/
Rule:   Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowingRule
Target: System.Boolean
System.Xml.Linq.XObject/<Annotations>c__Iterator16`1::MoveNext()
Stack trace: System.ArgumentOutOfRangeException: Index is less than 0 or more
than or equal to the list count.
Parameter name: index
0
  at System.Collections.ArrayList.get_Item (Int32 index) [0x00032] in
/home/nestor/devel/mono-project/mcs/class/corlib/System.Collections/ArrayList.cs:2652 
  at System.Collections.CollectionBase.System.Collections.IList.get_Item (Int32
index) [0x00000] in
/home/nestor/devel/mono-project/mcs/class/corlib/System.Collections/CollectionBase.cs:200 
  at Mono.Cecil.GenericParameterCollection.get_Item (Int32 index) [0x00000] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil/GenericParameterCollection.cs:44 
  at Mono.Cecil.ReflectionReader.GetTypeRefFromSig
(Mono.Cecil.Signatures.SigType t, Mono.Cecil.GenericContext context) [0x00359]
in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs:1099 
  at Mono.Cecil.ReflectionReader.GetTypeSpecAt (UInt32 rid,
Mono.Cecil.GenericContext context) [0x0004e] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil/ReflectionReader.cs:153 
  at Mono.Cecil.Cil.CodeReader.ReadCilBody (Mono.Cecil.Cil.MethodBody body,
System.IO.BinaryReader br) [0x003c7] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs:191 
  at Mono.Cecil.Cil.CodeReader.VisitMethodBody (Mono.Cecil.Cil.MethodBody body)
[0x000c5] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs:75 
  at Mono.Cecil.MethodDefinition.LoadBody () [0x00042] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil/MethodDefinition.cs:554 
  at Mono.Cecil.MethodDefinition.get_Body () [0x00000] in
/home/nestor/devel/mono-project/mcs/class/Mono.Cecil/Mono.Cecil/MethodDefinition.cs:104 
  at
Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowingRule.CheckMethod
(Mono.Cecil.MethodDefinition method) [0x0000f] in
/home/nestor/devel/mono-project/mono-tools/gendarme/rules/Gendarme.Rules.BadPractice/CheckNewExceptionWithoutThrowingRule.cs:53 
  at Gendarme.Framework.Runner.OnMethod (Gendarme.Framework.RunnerEventArgs e)
[0x000b7] in
/home/nestor/devel/mono-project/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs:251 
  at Gendarme.Framework.Runner.Run () [0x000cb] in
/home/nestor/devel/mono-project/mono-tools/gendarme/framework/Gendarme.Framework/Runner.cs:296 
  at Gendarme.ConsoleRunner.Run () [0x00006] in
/home/nestor/devel/mono-project/mono-tools/gendarme/console/ConsoleRunner.cs:197 
  at Gendarme.ConsoleRunner.Execute (System.String[] args) [0x00142] in
/home/nestor/devel/mono-project/mono-tools/gendarme/console/ConsoleRunner.cs:176 

I have been researching a little, and I'm not sure if is our bug or is a cecil
bug, because the exception is thrown at line 53:


if (!method.HasBody)
        return RuleResult.DoesNotApply;

StackEntryAnalysis sea = null;

--->    foreach (Instruction ins in method.Body.Instructions) {

The code checks if the method has body, but when access to the Instructions it
breaks.

In order to reproduce it, you have to run gendarme (with the BadPractice set)
against System.Xml.Linq.  (Or you can use the script in my mono-soc-2008
directory)


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list