Windows 调试器上的 Rider - CLR 加载回调已处于错误状态 E_FAIL - 0x80004005

问题描述 投票:0回答:1

我突然无法在 Windows 11 上的 Rider(2024.1.3 / Build #RD-241.17011.166,构建于 2024 年 6 月 7 日)中调试一个项目(AvaloniaUI、C#、.NET 8.0.302),我正在努力解决这个问题。

如果我只是运行该项目,它会毫无问题地构建和启动。我在同一台机器上有其他解决方案,使用所有相同的技术堆栈,并且它们在 Rider 中调试时没有任何问题。所以它似乎仅限于 Rider 和这一特定解决方案。

在 VS2022 中打开这个有问题的解决方案也可以正常调试。一切都非常令人困惑,因为我昨天一整天都在处理这个项目(在 Rider 中),没有任何问题。

错误是:

One or more errors occurred. (One or more errors occurred. (CLR load callback is already in
 error state. Error HRESULT E_FAIL has been returned from a call to a COM component. The 
error code is E_FAIL, or EFail, or 0x80004005.))

您难道不喜欢这些神秘的 Windows 错误吗?似乎 0x80004005 在这里被精彩地描述为“E_FAIL 未指定的故障 0x80004005” 这里更一般地描述为:

Most generally speaking, error code 0x80004005 occurs when Windows cannot access a file or
 folder. It is usually displayed as "Error 0x80004005: Unspecified Error."

我已经卸载并重新安装了 Rider,没有任何影响。

我尝试以管理员身份运行 Rider,但这没有帮助,我尝试删除所有 DotSettings 文件和 .idea 目录并重新启动。似乎没有什么帮助。

查看 Rider 日志文件,异常似乎是 Rider 调试器存在 COM 问题。但目前我如何解决这个问题还是个谜。为什么它只会影响这个解决方案?调试器与其他解决方案配合得很好。

09:11:56.998 |V| InvokeChildProcess_Totyb      | Debugger worker MTA main thread:9 | Created process with pid 23036, main thread 23044, suspended.
09:11:56.998 |V| InvokeChildProcess_Totyb      | Debugger worker MTA main thread:9 | Calling user callback on process startup.
09:11:56.999 |V| CoreClrDebuggerUtil_Lixur     | Debugger worker MTA main thread:9 | The process 23,036 has been started and suspended, registering a debugger callback for when CLR gets loaded (RegisterForRuntimeStartup).
09:11:57.000 |V| InvokeChildProcess_Totyb      | Debugger worker MTA main thread:9 | Done calling user callback on process startup.
09:11:57.000 |V| InvokeChildProcess_Totyb      | Debugger worker MTA main thread:9 | The process has been resumed.
09:11:57.000 |V| CoreClrDebuggerUtil_Lixur     | Debugger worker MTA main thread:9 | Process resumed.
09:11:57.000 |V| CoreClrDebuggerUtil_Lixur     | Debugger worker MTA main thread:9 | Awaiting CLR load callback.
09:11:57.121 |V| CoreClrDebuggerUtil_Lixur     | :37                | Got CLR load callback from the debugger. Error HRESULT E_FAIL has been returned from a call to a COM component. The error code is E_FAIL, or EFail, or 0x80004005.
09:11:57.121 |V| CoreClrDebuggerUtil_Lixur     | .NET TP Worker:33  | Done awaiting. Got CLR Callback? True! Process exited? False! Timeout expired? False!
09:11:57.121 |V| CoreClrDebuggerUtil_Lixur     | :37                | Unregistering from debugger callback for when CLR gets loaded (UnregisterForRuntimeStartup).
09:11:57.125 |V| RiderDebuggerSessionFrontend  | Debugger worker MTA main thread:9 | Event from debugger: type TargetExited
09:11:57.127 |W| RiderDebuggerSessionFrontend  | Debugger worker MTA main thread:9 | Can't cast target event args of type TargetEventArgs to TargetExitedEventArgs
09:11:57.170 |W| RiderDebuggerWorker           | Debugger worker MTA main thread:9 | Failed to startup debugger. Fire terminating One or more errors occurred. (One or more errors occurred. (CLR load callback is already in error state. Error HRESULT E_FAIL has been returned from a call to a COM component. The error code is E_FAIL, or EFail, or 0x80004005.))

--- EXCEPTION #1/5 [COMException]
Message = “CLR load callback is already in error state. Error HRESULT E_FAIL has been returned from a call to a COM component. The error code is E_FAIL, or EFail, or 0x80004005.”
ExceptionPath = Root.InnerException.InnerException.InnerException.InnerException
ClassName = System.Runtime.InteropServices.COMException
HResult = E_FAIL=EFail=80004005
Source = JetBrains.Platform.Interop
StackTraceString = “
  at JetBrains.UI.Interop.HResultsEx.AssertSucceeded(Int32 hresult, String comment) in AssertSucceeded.il:line IL_0000 mvid 9209
     at JetBrains.Debugger.CorApi.Pinvoke.CoreClrDebuggerUtil.RuntimeLoadCallback(Int32 hr, Void* pCordb, TaskCompletionSource`1 taskWaitForStartup, Action`1 corDebugLoadhandler, UInt32 procId, ILogger logger) in RuntimeLoadCallback.il:line IL_0014 mvid 3078
”

更新:

此问题已通过 JetBrains herehere 提出。

总结似乎是作为单个文件发布是问题所在。

<PublishSingleFile>true</PublishSingleFile>     <!-- breaks debugger -->
.net debugging rider
1个回答
0
投票

就像您在编辑中所写的那样。

SingleFilePublish
会破坏调试器。

我通过将 SingleFilePublish 包装在单独的 PropertyGroup 块中来修复它在我的项目文件中,并设置一个仅在调试时禁用 SingleFilePublish 的条件:

<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
   <PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
© www.soinside.com 2019 - 2024. All rights reserved.