JustDecompile - Converted char to number why?

2 posts, 0 answers
  1. Sumith Damodaran
    Sumith Damodaran avatar
    3 posts
    Member since:
    Jan 2010

    Posted 28 Apr 2011 Link to this post

    Justdecompile output
    ----------------------------
    protected string GetPath(string basePath, string path, SiteContext context)
    {
    string virtualFolder = context.VirtualFolder;
    if ((virtualFolder.Length <= 0 || virtualFolder == "/") || path.Length == (virtualFolder.Length - 1))
    {
    path = string.Empty;
    }
    if (basePath.Length > 0 && basePath != "/")
    {
    path = FileUtil.MakePath(basePath, path, 47);
    }
    if (path.Length > 0 && path.get_Chars(0) != 47)
    {
    path = string.Concat(47, path);
    }
    return path;
    }

    Reflector Output:
    ---------------------
    protected string GetPath(string basePath, string path, SiteContext context) { string virtualFolder = context.VirtualFolder; if ((virtualFolder.Length > 0) && (virtualFolder != "/")) { if (path.Length == (virtualFolder.Length - 1)) { path = string.Empty; } else { path = path.Substring(virtualFolder.Length); } } if ((basePath.Length > 0) && (basePath != "/")) { path = FileUtil.MakePath(basePath, path, '/'); } if ((path.Length > 0) && (path[0] != '/')) { path = '/' + path; } return path; }





  2. Tsviatko Yovtchev
    Admin
    Tsviatko Yovtchev avatar
    408 posts

    Posted 04 May 2011 Link to this post

    Hello Sumith Damodaran,

     Thanks for letting us know about this problem.

    It'd be great if we could have a look at the assembly you are decompiling. If that's not possible could you send over the declaration of FileUtil.MakePath method as well as  the MSIL code for the GetPath method.

    I have some idea why that might happen even now but I need that stuff to confirm that I am right. Pretty much what happens is that in MSIL type information gets lost, i.e. the '/' constant is represented by its integer value. Normally we'd infer the type in such cases depending on the constant usages. The information I am asking for is gonna help us determine why that inference fails in your case. 

    Greetings,
    Tsviatko Yovtchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
Back to Top