gpt4 book ai didi

c# - 当 dotpeek 仅使用 "//Stub method (' ret 指令填充方法时,这意味着什么)”

转载 作者:太空宇宙 更新时间:2023-11-03 15:26:19 54 4
gpt4 key购买 nike

我偶然发现了这个 question询问linq的聚合算法,认为这种问题最好用逆向工程来回答,所以我去Visual Studio写了下面的代码(这段代码是为了在Compact framework项目中使用Combine函数的)只有两个参数):

    public static string Combine(string path1, params string[] paths)
{
return paths.Aggregate(path1, System.IO.Path.Combine);
}

然后我将光标设置到 Aggregate 方法上,按 F12 键(我安装了 Resharper),然后被引导到以下代码:

// Decompiled with JetBrains decompiler
// Type: System.Linq.Enumerable
// Assembly: System.Core, Version=3.9.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes
// MVID: 77D23A6E-E19D-435B-9CBB-733D74F92072
// Assembly location: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsEmbeddedCompact\v3.9\System.Core.dll

Lots of stuff...

public static TAccumulate Aggregate<TSource, TAccumulate>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func)
{
// Stub method ('ret' instruction only)
}

很明显,这不是我调用 Aggregate 时运行的代码,因为... Aggregate 做了一些事情。问题是反编译器的结果到底是什么意思?什么是对“聚合”方法进行逆向工程的合适方法?

--编辑--

我刚刚意识到我上面所说的只有在 Compact Framework 项目中完成时才是正确的,当我反编译标准框架的 Aggregate 时,我得到了正确的源代码。

最佳答案

如果您想反编译 CF 程序集,您必须使用实际的 BCL,而不是通常在 Studio 中用作引用的 stub (不,我不知道他们为什么这样做)。我看到您使用的是 3.9,所以我不确定您需要查看的路径,但是对于 3.5,您可以在这里找到它们:

C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL

关于c# - 当 dotpeek 仅使用 "//Stub method (' ret 指令填充方法时,这意味着什么)”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35185881/

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com