Windbg 和查看 AppDomain 内容

发布于 2024-12-15 21:27:47 字数 1078 浏览 2 评论 0原文

我知道我们可以在 winbbg 中使用 !dumpdomain 命令来查看给定托管进程(例如 w3wp)中存在的各种应用程序域。

我在 LinqPad 中编写了一个小程序(来自 Visual C# 2010 Recipes A 问题解决方法的食谱 3-1),以创建自定义 AppDomain。这就是我面临问题的地方。我无法使用 Windbg 查看此应用程序域。换句话说,这个应用程序域是在哪里创建的?它是否托管在 LinqPad 进程内?如果不是,那么哪个进程正在托管此自定义应用程序域?

我尝试将 LinqPad.exe 附加到 Windbg 并发出 !dumpdomain 命令,但出现以下错误:

找不到运行时 DLL (clr.dll),0x80004005 扩展命令 需要 clr.dll 才能有事可做。

代码:

void Main()
{
    AppDomainSetup setUpInfo = new AppDomainSetup();

    setUpInfo.ApplicationBase = @"C:\MyRootDirectory";
    setUpInfo.ConfigurationFile = "MyApp.config";
    setUpInfo.PrivateBinPath = "bin;plugins;external";

    AppDomain newDomain = AppDomain.CreateDomain("My New Domain",null,setUpInfo);

    Console.WriteLine("Main method complete.Press Enter");
    Console.ReadLine();
}

步骤如下:

  • 运行程序。它等待用户按 Enter 键。
  • 启动windbg。附加 LinqPad.exe。
  • 发出命令:.load sos.dll 和 .load sosex.dll
  • 发出命令 .reload
  • 最后调用 !dumpdomain。此时 LinqPad 冻结。如果我关闭windbg,那么LinqPad也会关闭。

I know we can use !dumpdomain command in winbbg to view the various app domains present in a given managed process(e.g. w3wp).

I wrote a small program(Recipe 3-1 from Visual C# 2010 Recipes A problem solution approach) in LinqPad, to create a custom AppDomain. This is where I am facing issues. I am not able to view this appdomain using windbg. In other words, where is this app domain created ? Is it hosted inside LinqPad process ? If not, then which process is hosting this custom appdomain ?

I tried attaching LinqPad.exe to windbg and issues !dumpdomain command but I got the following error :

Failed to find runtime DLL (clr.dll), 0x80004005 Extension commands
need clr.dll in order to have something to do.

Code :

void Main()
{
    AppDomainSetup setUpInfo = new AppDomainSetup();

    setUpInfo.ApplicationBase = @"C:\MyRootDirectory";
    setUpInfo.ConfigurationFile = "MyApp.config";
    setUpInfo.PrivateBinPath = "bin;plugins;external";

    AppDomain newDomain = AppDomain.CreateDomain("My New Domain",null,setUpInfo);

    Console.WriteLine("Main method complete.Press Enter");
    Console.ReadLine();
}

Steps Followed :

  • Run the program. It waits for the user to press Enter.
  • Start windbg. Attach LinqPad.exe.
  • issue commands : .load sos.dll and .load sosex.dll
  • Issue command .reload
  • Finally call !dumpdomain. At this point the LinqPad freezes. If I close the windbg, then LinqPad is also closed.

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

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

发布评论

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

评论(1

彩虹直至黑白 2024-12-22 21:27:47

它是在 LINQPad 进程内创建的。您的查询本身在 LINQPad 创建的单独 AppDomain 中运行。该错误消息是否与 CLR 版本不匹配有关?您运行的是 LINQPad 2.x 还是 4.x?

It's created inside the LINQPad process. Your query itself runs in separate AppDomain created by LINQPad. Could the error message be related to a CLR version mismatch? Are you running LINQPad 2.x or 4.x?

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