Jump to content
Tuts 4 You
CodeExplorer

Dnlib cant find nested type!

Rate this topic

Recommended Posts

CodeExplorer

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?
 

Share this post


Link to post
Share on other sites
CodeExplorer

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!

 

Share this post


Link to post
Share on other sites
CodeExplorer

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

Share this post


Link to post
Share on other sites

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...