Skip to content

Commit eae578c

Browse files
committed
WcfEnabledSubProcess - Add better error handling when closing the WCF channel/factory
Resolves #2074
1 parent fb18122 commit eae578c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

CefSharp.BrowserSubprocess.Core/WcfEnabledSubProcess.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,31 @@ namespace CefSharp
5656
{
5757
auto channelFactory = browser->ChannelFactory;
5858

59-
if (channelFactory->State == CommunicationState::Opened)
59+
try
60+
{
61+
if (channelFactory->State == CommunicationState::Opened)
62+
{
63+
channelFactory->Close();
64+
}
65+
}
66+
catch (Exception^)
6067
{
61-
channelFactory->Close();
68+
69+
channelFactory->Abort();
6270
}
6371

6472
auto clientChannel = ((IClientChannel^)browser->BrowserProcess);
6573

66-
if (clientChannel->State == CommunicationState::Opened)
74+
try
75+
{
76+
if (clientChannel->State == CommunicationState::Opened)
77+
{
78+
clientChannel->Close();
79+
}
80+
}
81+
catch (Exception^)
6782
{
68-
clientChannel->Close();
83+
clientChannel->Abort();
6984
}
7085

7186
browser->ChannelFactory = nullptr;

0 commit comments

Comments
 (0)