了解 Reflector 重建的 C# 字符串

发布于 2024-08-24 03:03:54 字数 402 浏览 3 评论 0原文

我被要求帮助一个 C# 项目,该项目的源代码不再可用。幸运的是,可以使用该项目的非混淆调试版本,因此我通过 Reflector 运行它,重构的源代码看起来基本没问题。

我有一个奇怪的问题。一些显然应该是字符串的对象如下所示:

string str7 = new string();
str7.Value = strArray3[k];

现在,字符串没有无参数构造函数,也没有 Value 属性。我想我可以删除实例化并删除 .Value 属性,事情可能会按预期工作,但我想了解是否可能存在比 Reflector bug 更多的事情。

另一件有趣的事情是,几乎所有变量都是用听起来原始的名称来重建的,但是这个变量(以及其他一些变量)似乎被分配了随机名称。

任何见解都非常受欢迎。

I have been asked to help with a C# project where the source code is no longer available. Fortunately a non-obfuscated debug build of the project is available, so I ran it through Reflector and the reconstructed source code looks largely fine.

There is one oddity that I have a question about. Some objects that pretty clearly should be a string are coming out like this:

string str7 = new string();
str7.Value = strArray3[k];

Now, string does not have a parameterless constructor nor does it have a Value property. I think I can just remove the instantiation and remove the .Value property and things will probably work as expected, but I would like to understand if there might be something more going on than a Reflector bug.

One other interesting piece is that almost all of the variables were reconstructed with original-sounding names, but this one (and a few others) seem to have been assigned random names.

Any insight is very welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潜移默化 2024-08-31 03:03:54

您能否针对发生这种情况的同一方法同时发布 IL 和反编译的 C#?

该程序集中不会偶然出现“类字符串 { ... }”,不是吗?

Can you post both the IL and decompiled C# for the same method where this happens?

There isn't by chance a "class string { ... }" in that assembly, is there?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文