You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WcfEnabledSubProcess - OnBrowserDestroyed add null checks and log msg if WCF was null
It's likely the WCF host didn't start and some break points should be added in ManagedCefBrowserAdapter::InitializeBrowserProcessServiceHost
to catch the actual exception. We're not logging as it causes too many false positives as it's expected there will be errors
when browser is created then rapidly Disposed.
Resolves#2839
Copy file name to clipboardExpand all lines: CefSharp.BrowserSubprocess.Core/WcfEnabledSubProcess.cpp
+29-17Lines changed: 29 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -58,34 +58,46 @@ namespace CefSharp
58
58
{
59
59
auto channelFactory = browser->ChannelFactory;
60
60
61
-
try
61
+
//Add null check for issue https://github.com/cefsharp/CefSharp/issues/2839
62
+
if (channelFactory == nullptr)
62
63
{
63
-
if (channelFactory->State == CommunicationState::Opened)
64
-
{
65
-
channelFactory->Close();
66
-
}
64
+
LOG(ERROR) << "WcfEnabledSubProcess::OnBrowserDestroyed - browser->ChannelFactory was unexpectedly null, see https://github.com/cefsharp/CefSharp/issues/2839 for some debugging tips.";
67
65
}
68
-
catch (Exception^)
66
+
else
69
67
{
70
-
channelFactory->Abort();
68
+
try
69
+
{
70
+
if (channelFactory->State == CommunicationState::Opened)
71
+
{
72
+
channelFactory->Close();
73
+
}
74
+
}
75
+
catch (Exception^)
76
+
{
77
+
channelFactory->Abort();
78
+
}
71
79
}
72
80
73
-
auto clientChannel = ((IClientChannel^)browser->BrowserProcess);
74
-
75
-
try
81
+
//Add null check for issue https://github.com/cefsharp/CefSharp/issues/2839
82
+
if (browser->BrowserProcess != nullptr)
76
83
{
77
-
if (clientChannel->State == CommunicationState::Opened)
84
+
auto clientChannel = ((IClientChannel^)browser->BrowserProcess);
85
+
86
+
try
78
87
{
79
-
clientChannel->Close();
88
+
if (clientChannel->State == CommunicationState::Opened)
0 commit comments