From f6761743aac701186b22978b6dbb84fd85fcbe84 Mon Sep 17 00:00:00 2001 From: Ulysses Date: Thu, 27 Apr 2023 02:31:00 +0800 Subject: [PATCH] prevent `AggregateException` when connecting to unity process (#190) --- .../dnSpy.Debugger.DotNet.Mono/Impl/DbgEngineImpl.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/Impl/DbgEngineImpl.cs b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/Impl/DbgEngineImpl.cs index 6a53695a45..2b707fdcd0 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/Impl/DbgEngineImpl.cs +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.Mono/Impl/DbgEngineImpl.cs @@ -431,6 +431,9 @@ void StartCore(DebugProgramOptions options) { catch (SocketException sex) when (sex.SocketErrorCode == SocketError.ConnectionRefused) { // Retry it in case it takes a while for mono.exe to initialize or if it hasn't started yet } + catch (AggregateException aex) when (aex.InnerExceptions.Count == 1 && aex.InnerExceptions[0] is SocketException {SocketErrorCode: SocketError.ConnectionRefused}) { + // Retry it in case it takes a while + } Thread.Sleep(100); }