[Mono-bugs] [Bug 582203] New: gendarme/cecil NullReferenceException when scanning C++ Assembly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Feb 23 10:03:24 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=582203

http://bugzilla.novell.com/show_bug.cgi?id=582203#c0


           Summary: gendarme/cecil NullReferenceException when scanning
                    C++ Assembly
    Classification: Mono
           Product: Mono: Tools
           Version: 2.6.x
          Platform: x86-64
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Gendarme
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: david at dasz.at
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=344106)
 --> (http://bugzilla.novell.com/attachment.cgi?id=344106)
assembly causing the error

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2)
Gecko/20100115 Firefox/3.6

When scanning a managed C++ DLL which does some COM work, gendarme dies with
this stacktrace:

Stack trace: System.NullReferenceException: Object reference not set to an
instance of an object.
   at Mono.Cecil.Pdb.PdbCciReader.ReadScopeAndLocals(PdbScope scope, Scope
parent, MethodBody body, IDictionary instructions) in
P:\tempmono-complete\cecil\pdb\Mono.Cecil.Pdb\Mono.Cecil.Pdb\PdbCciReader.cs:line
117
   at Mono.Cecil.Pdb.PdbCciReader.ReadScopeAndLocals(PdbScope[] scopes, Scope
parent, MethodBody body, IDictionary instructions) in
P:\tempmono-complete\cecil\pdb\Mono.Cecil.Pdb\Mono.Cecil.Pdb\PdbCciReader.cs:line
103
   at Mono.Cecil.Pdb.PdbCciReader.Read(MethodBody body, IDictionary
instructions) in
P:\tempmono-complete\cecil\pdb\Mono.Cecil.Pdb\Mono.Cecil.Pdb\PdbCciReader.cs:line
88
   at Mono.Cecil.Cil.CodeReader.ReadCilBody(MethodBody body, BinaryReader br)
in P:\tempmono-complete\mcs\class\Mono.Cecil\Mono.Cecil.Cil\CodeReader.cs:line
242
   at Mono.Cecil.Cil.CodeReader.VisitMethodBody(MethodBody body) in
P:\tempmono-complete\mcs\class\Mono.Cecil\Mono.Cecil.Cil\CodeReader.cs:line 76
   at Mono.Cecil.MethodDefinition.LoadBody() in
P:\tempmono-complete\mcs\class\Mono.Cecil\Mono.Cecil\MethodDefinition.cs:line
572
   at Mono.Cecil.MethodDefinition.get_Body() in
P:\tempmono-complete\mcs\class\Mono.Cecil\Mono.Cecil\MethodDefinition.cs:line
100
   at Gendarme.Framework.EngineController.Build(MethodDefinition method,
EngineEventArgs e) in
P:\tempmono-complete\mono-tools\gendarme\framework\Gendarme.Framework\EngineController.cs:line
132
   at Gendarme.Framework.EngineController.Build(IList`1 list) in
P:\tempmono-complete\mono-tools\gendarme\framework\Gendarme.Framework\EngineController.cs:line
102
   at Gendarme.Framework.Runner.Initialize() in
P:\tempmono-complete\mono-tools\gendarme\framework\Gendarme.Framework\Runner.cs:line
163
   at Gendarme.ConsoleRunner.Initialize() in
P:\tempmono-complete\mono-tools\gendarme\console\ConsoleRunner.cs:line 374
   at Gendarme.ConsoleRunner.Execute(String[] args) in
P:\tempmono-complete\mono-tools\gendarme\console\ConsoleRunner.cs:line 321

The line numbers reference a current SVN checkout (local rebuild), but the
stacktrace seems to be the same as gendarme 2.6 shows on the same assembly.

Looking at the code, this seems to happen because
Mono.Cecil.Pdb.PdbCciReader.Read(MethodBody,IDictionary) receives a PdbFunction
whose .scopes member contains nulls. Here is the output from the immediate
window:

function
{Microsoft.Cci.Pdb.PdbFunction}
    address: 4946
    flags: 1
    iteratorClass: null
    iteratorScopes: null
    length: 57
    lines: null
    module:
"f:\\dd\\vctools\\crt_bld\\SELF_X86\\crt\\src\\build\\INTEL\\xdll_obj\\clr_obj\\mstartup.obj"
    name: "<CrtImplementationDetails>::LanguageSupport::Cleanup"
    namespaceScopes: null
    scopes: {Microsoft.Cci.Pdb.PdbScope[3]}
    segment: 1
    slotToken: 285212716
    token: 100663326
    usingCounts: null

function.scopes
{Microsoft.Cci.Pdb.PdbScope[3]}
    [0]: {Microsoft.Cci.Pdb.PdbScope}
    [1]: null
    [2]: null

The C++ assembly is compiled with Visual Studio 2008 Professional Edition

Reproducible: Always

Steps to Reproduce:
1. Compile managed C++ Assembly with VS2008 Professional
2. Run gendarme on it

Actual Results:  
Null Reference Exception as described above

Expected Results:  
normal gendarme run or error message refusing to run on unsupported assembly
type

-- 
Configure bugmail: http://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