Winforms 将DocumentWindow添加到DocumentTabStrip会导致应用程序无限期挂起

Winforms 将DocumentWindow添加到DocumentTabStrip会导致应用程序无限期挂起,winforms,telerik,cefsharp,Winforms,Telerik,Cefsharp,我有一个Winforms应用程序,它的主窗体包含(除其他外)一个TelerikDocumentTabStrip。这些选项卡用于保存用户控件或网页(通过web浏览器控件)。它已经运行了很长一段时间,但我现在遇到了一个问题 我最近将web浏览器控件从基于IE的内置.NET web浏览器切换到了CefSharp。这样做之后,我注意到,在尝试将DocumentWindow添加到DocumentTabStrip时,调用会无限期挂起(在调试中)或完全崩溃(正常运行应用程序)。这仅在打开包含浏览器控件的文档窗

我有一个
Winforms
应用程序,它的主窗体包含(除其他外)一个Telerik
DocumentTabStrip
。这些选项卡用于保存用户控件或网页(通过web浏览器控件)。它已经运行了很长一段时间,但我现在遇到了一个问题

我最近将web浏览器控件从基于IE的内置.NET web浏览器切换到了
CefSharp
。这样做之后,我注意到,在尝试将DocumentWindow添加到DocumentTabStrip时,调用会无限期挂起(在调试中)或完全崩溃(正常运行应用程序)。这仅在打开包含浏览器控件的文档窗口时出现,而不是在打开任何其他用户控件时出现。实际调用本身如下所示

我甚至不知道如何开始调试它,因为没有收到任何错误-它只是无限期地挂在
控件中。Add()
方法中。如有任何建议,将不胜感激

Private dts As New Telerik.WinControls.UI.Docking.DocumentTabStrip


Try


    dts.InvokeIfRequired(Sub()
        Dim docWindow As Telerik.WinControls.UI.Docking.DocumentWindow = Nothing
        Dim ctrl As ucBaseControl = Nothing
        Dim browser As ucBrowser = Nothing
        Dim isBrowser As Boolean = False

        docWindow = New Telerik.WinControls.UI.Docking.DocumentWindow
        docWindow.BackColor = Color.FromArgb(89, 89, 89)

        'Do various stuff to determine the type of control to load (ctrl or browser), then setup the applicable control

        If isBrowser Then
            'Place the browser into the Document Window.
            If Not IsNothing(browser) Then
                browser.Dock = DockStyle.Fill
                docWindow.Controls.Add(browser)
            End If
        Else
            'Place the ctrl into the Document Window.
            ctrl.Dock = DockStyle.Fill
            docWindow.Controls.Add(ctrl)
        End If

        'Add the DocumentWindow to the DocumentTabStrip
        ' Ensure DockWindow not disposed due to lag in bringing up
        If IsNothing(docWindow) OrElse docWindow.IsDisposed Then
            Exit Sub
        End If
        Try
            docWindow.Padding = New Padding(0)
            dts.TabStripElement.Children(0).Children(1).Padding = New Padding(0)
            dts.Controls.Add(docWindow)  'This is where the issue is. It only happens sporadically here.
        Catch ex As Exception
            'Code to log any exceptions here. In the problem described here, no exception is ever generated, though.
        End Try

        'Bring the control to the front and focus it, here...
    End Sub)
Catch ex As Exception
    'Error handling code here'
End Try

我假设
invokeFrequered
是您为
Control
s创建的扩展方法。请注意,如果它依赖于
Invoke
,这是一个同步调用,请改用
BeginInvoke
(请参阅:)


因为您患有

而从未抛出异常。是否有任何异常被抛出?如果是这样,请发布堆栈跟踪。@TEK不,没有任何异常。当单步执行时,它只进入Controls.Add方法,永远不会返回。在VisualStudio之外,它将添加DocumentWindow并在没有任何错误的情况下崩溃。您的
invokeIfrequered
方法的逻辑是什么?我假设这是您为
Control
s创建的扩展方法。请注意,如果它依赖于
Invoke
,这是一个同步调用,请改用
BeginInvoke
(请参阅:)。另一个起点是在调用
dts.Controls.Add(docWindow)
之后尝试调用
dts.CreateControl()
。请注意,这些只是一些调试步骤供您使用,因此是一个注释而不是答案。只是补充一下,听起来您好像遇到了死锁。如果是硬崩溃,则应该有一个事件查看器条目和/或崩溃转储