Jump to content
Tuts 4 You

Dnlib cant find nested type!


CodeExplorer

Recommended Posts

Dnlib cant find nested type!
Nested type name:
Confuser_Methods_Decryptor.MetadataReader/TableSize

        public TypeDef FindTypeFullName(string typeFullName)
        {
        if (assemblies==null||assemblies.Count<=0)
        return null;
        
        for (int i=0;i<assemblies.Count;i++)
        {
            TypeDef foundtype = assemblies.Find(typeFullName, false);  // is a slah '/'
            if (foundtype!=null)
            return foundtype;
        }
        
        
        return null;
        }

So I've used AssemblyDef Find method,
anyway this doesn't find nested types!
What I do wrong? How to fix it?
 

Link to comment

Seems the string is malformed:
        string toFindType = "Confuser_Methods_Decryptor.MetadataReader";
        string WrongStr   = "Confuser_Met hods_Decryptor.MetadataRead e r";
        
        int Len1 = toFindType.Length;  // 41
        int Len2 = WrongStr.Length;    // 44 WTF???

toFindType - when I enter that all is ok.

Confuser_Methods_Decryptor.MetadataReader
"Confuser_Met hods_Decryptor.MetadataRead e r"

This board really helps for seeing the malformed string!

 

Link to comment

The solution was to trim spaces and NewLines like this:
        operand_str = operand_str.TrimEnd(' ');
        operand_str = operand_str.TrimEnd( '\r', '\n' );
 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...