This is a migrated thread and some comments may be shown as answers.

JustDecompile - Converted char to number why?

1 Answer 30 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sumith Damodaran
Top achievements
Rank 1
Sumith Damodaran asked on 28 Apr 2011, 03:54 PM
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; }





1 Answer, 1 is accepted

Sort by
0
Tsviatko Yovtchev
Telerik team
answered on 04 May 2011, 09:39 AM
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 >>

Tags
General Discussions
Asked by
Sumith Damodaran
Top achievements
Rank 1
Answers by
Tsviatko Yovtchev
Telerik team
Share this question
or