简体   繁体   English

优先机会异常:RPC服务器不可用

[英]First-chance exception: The RPC server is unavailable

At some point while developing my C# application, the following started to appear in the VS Output pane whenever I create an OpenFileDialog: 在开发C#应用程序的某个时候,每当我创建OpenFileDialog时,以下内容就会开始出现在VS Output窗格中:

First-chance exception at 0x75A6C42D (KernelBase.dll) in (myapp).exe: 0x000006BA: The RPC server is unavailable.

I've been maintaining this application for years, and definitely never saw this before, so I started rolling back in SVN to determine when it began. 我一直在维护该应用程序多年,而且绝对以前从未见过,因此我开始回滚SVN以确定它何时开始。

Bafflingly, revisions in which it occurs & doesn't occur seem to be inconsistent; 令人困惑的是,发生和未发生的修订版本似乎不一致。 if I go back sufficiently far it never happens, but there's an "area" when I can check a revision, it won't happen, I'll check another revision, it will, then I'll return to the first, and this time it suddenly will. 如果我走得足够远,它永远不会发生,但是当我可以检查修订时,会有一个“区域”,它不会发生,我将检查另一个修订,它将,然后,我将返回第一个,时间突然就会过去。 In other words, I can't seem to reliably pinpoint when it started happening. 换句话说,我似乎无法确切地确定它何时开始发生。

To illustrate this, here's an excerpt of my tests, indented for clarity. 为了说明这一点,以下是我的测试节选,为清楚起见,本文进行了缩进。 Numbers are revisions. 数字是修订。 For each test, I "update to revision" and do a full rebuild. 对于每个测试,我都会“更新至修订版”并进行完全重建。

      3977: Exception. This is the most-recent revision.
 3839: OK.  Since it didn't happen, I'll start working my way back up to see when it starts
   3843: OK
    3852: OK
     3890: Exception. So it started between 3852 & 3890.
    3852: Exception. Huh?? I JUST tried 3852, and last time it didn't happen!
3778: OK. Going back this far, I've never seen it happen.
    3852: Exception. I guess I'll start working my way BACK to see when it stops.
   3828: Exception
  3810: OK
   3828: Exception.  Just making sure.
  3810: OK. Just making sure again.
   3828: OK.  What?? 3828 showed the exception last time I tried!
    3852: OK. (but previously it showed the exception)
     3890: Exception

I'm aware that I can just tell VS not to break on these types of exceptions, and ignore them. 我知道我可以告诉VS不要破坏这些类型的异常,而忽略它们。 But as mentioned, after years of working on this software, I've never seen it once - so I'd like to determine exactly when and why they started, rather than just turning a blind eye. 但是如前所述,在使用该软件多年之后,我从未见过它-因此,我想确切确定它们启动的时间原因 ,而不是视而不见。

This has nothing to do with your project. 这与您的项目无关。 When you use the shell dialogs, like OpenFileDialog, you load Explorer into your process. 当使用诸如OpenFileDialog之类的外壳对话框时,会将Explorer加载到您的进程中。 Which comes with a lot of baggage, you also get all of the shell extensions loaded. 这带来了很多负担,您可以加载所有的Shell扩展。 The kind that customize Explorer, they work just as well in the dialog. 自定义资源管理器的类型,它们在对话框中的效果也一样。

Misbehaving ones are quite common. 行为不端的情况很常见。 Programmers tend to use the quirkier kind. 程序员倾向于使用更奇怪的类型。 Any mishap in such a shell extension is now visible to you, the debugger tells you about it. 调试器会告诉您有关此类shell扩展的任何意外信息。

So, nothing actually went wrong, the exception was caught and handled. 因此,实际上没有任何错误,可以捕获并处理异常。 Explorer implements counter-measures against bad shell extensions destabilizing it and automatically disables them. 资源管理器实施了针对措施,以防止不良的外壳扩展破坏其稳定性并自动禁用它们。 So you just have a lame-duck shell extension that doesn't work, low odds you'd notice since it probably hasn't worked for a while. 因此,您只有一个me脚的鸭壳扩展程序不起作用,由于它可能有一段时间没有起作用,您注意到的几率很低。

The debugger can tell you which one is bad. 调试器可以告诉您哪一个不好。 Enable unmanaged debugging and tick the Thrown checkboxes in the Debug + Exception dialog. 启用非托管调试,然后在“调试+异常”对话框中选中“抛出”复选框。 The debugger will now stop when the exception is thrown. 现在,当引发异常时,调试器将停止。 You won't see any source code but you can look at the Call Stack debugger window for hints. 您不会看到任何源代码,但是可以在“调用堆栈”调试器窗口中找到提示。 It displays the name of the DLL that contain the bad code somewhere on the stack, below the Windows DLL functions. 它在Windows DLL函数下方的堆栈中某处显示包含错误代码的DLL名称。 The name ought to give you a hint which one is the troublemaker. 这个名字应该给你一个提示,那就是麻烦制造者。 SysInternals' AutoRuns utility is excellent to disable them. SysInternals的AutoRuns实用程序非常适合禁用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取第一次机会异常的行号 - Get line number of first-chance exception GetFileInfo导致优先机会异常 - GetFileInfo resulting in First-chance exception 数据库连接错误-优先机会异常 - Database connection error - first-chance exception xxx.exe中0x782260ec处的首次机会异常:0xC0000005:访问冲突 - First-chance exception at 0x782260ec in xxx.exe: 0xC0000005: Access violation RPC服务器在BackgroundMediaPlayer.SendMessageToBackground上不可用 - The RPC server is unavailable exception on BackgroundMediaPlayer.SendMessageToBackground RPC服务器不可用 - RPC server is unavailable 在非托管C ++项目中使用C#COM - > 0x7697C41F的第一次机会异常(KernelBase.dll) - Using C# COM in unmanaged C++ project -> First-chance exception at 0x7697C41F (KernelBase.dll) 第一次机会例外 - A first chance exception 在应用程序启动时抛出的第一次机会COMException但无法中断以找出它发生的位置/原因 - First-chance COMException thrown at application startup but cannot break to find out where/why it's happening 第一次机会SocketException被抛出但我的捕获不起作用 - First-chance SocketException getting thrown but my catch isn't working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM