Hi,

I have found a bug in the class ImportContext (SVN).

There is following method in class TypeDefinition:

public TypeDefinition Clone ()
{
     return Clone (this, new ImportContext (null/
*IReferenceImporter*/, this));
}

This way the field m_importer/*IReferenceImporter*/ in class
ImportContext remains null.... no problem so far.

But now the following methods in the class ImportantContext creates an
exception:

public TypeReference Import (TypeReference type)
{
        return m_importer.ImportTypeReference (type, this);
}

public MethodReference Import (MethodReference meth)
{
        return m_importer.ImportMethodReference (meth, this);
}

public FieldReference Import (FieldReference field)
{
        return m_importer.ImportFieldReference (field, this);
}

If you can change the methods as follows(used in an older version) the
bug should be fixed :-)

public TypeReference Import (TypeReference type)
{
        return m_importer == null ? type :
m_importer.ImportTypeReference(type, this);
}

public MethodReference Import (MethodReference meth)
{
        return m_importer == null ? meth :
m_importer.ImportMethodReference(meth, this);
}

public FieldReference Import (FieldReference field)
{
        return m_importer == null ? field :
m_importer.ImportFieldReference(field, this);
}

Kind regards,

Ilóna


--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to