I’m suddenly unable to debug one project (AvaloniaUI,C#,.NET 8.0.302) in Rider (2024.1.3 / Build #RD-241.17011.166, built on June 7, 2024) on Windows 11 and I’m struggling to figure out the issue.
If I just run the project, it builds and starts without issue. I have other solutions on the same machine using all the same tech stack and they debug without any issues at all in Rider. So it seems limited to Rider and this one specific solution.
Opening this problematic solution in VS2022 also debugs just fine. All very confusing as I was working on this project all day yesterday (in Rider) without any issues at all.
The error is:
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.))
Don’t you just love these cryptic Windows errors? It seems 0x80004005 is brilliantly described here as “E_FAIL Unspecified failure 0x80004005” And here it’s described more generally as:
Most generally speaking, error code 0x80004005 occurs when Windows cannot access a file or
folder. It is usually displayed as "Error 0x80004005: Unspecified Error."
I’ve uninstalled and reinstalled Rider which hasn’t had any impact.
I’ve tried running Rider as administrator which didn’t help and I’ve tried removing all the DotSettings files and the .idea directory and relaunching. Nothing seems to help.
Looking at the Rider log file the exception seems to be the Rider Debugger having COM issues. But how I’d solve that is a mystery at this point. And why would it only effect this solution? The debugger works just fine with other solutions.
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
”
UPDATE:
This has been raised with JetBrains here and here.
Summary seems to be that publishing as single file is the issue.
<PublishSingleFile>true</PublishSingleFile> <!-- breaks debugger -->
Like you wrote in your edit. The SingleFilePublish breaks the debugger.
I fixed it in my project file by wrapping the SingleFilePublish in a separate PropertyGroup-block with a condition which disables SingleFilePublish only on Debug:
<PropertyGroup Condition="'$(Configuration)' != 'Debug'">
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With