[NET6] RibbonDesigner causes Visual Studio deadlock

Posted by: wknauf on 13 November 2023, 10:16 am EST

    • Post Options:
    • Link

    Posted 13 November 2023, 10:16 am EST - Updated 13 November 2023, 10:21 am EST

    Hi C1,

    today, I observed several deadlocks in WinForms designer, which forced me to kill Visual Studio and reopen it.

    It happens when I open a C1RibbonForm subclass and switch to another ribbon tab. I can do those steps for the first time without problems. But when I reopen the file another time and click in the ribbon, the lock occurs.

    Unfortunately, I cannot reproduce it with a simple sample. So, hopefully you have an idea.

    I attached another Visual Studio to “DesignToolsServer.exe” and found this stack trace where the ribbon designer seems to hang in a clipboard access:

     	[Managed to Native Transition]	
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.GetDataObject(int retryTimes, int retryDelay) Line 135	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.GetDataObject() Line 123	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.ContainsData(string format) Line 189	C#
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Floaties.RibbonBaseFloatieOwner.GetActionItems(bool deleteButtonOnly)	Unknown
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Floaties.TabFloatieOwner.GetItems()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieService.CreateFloatieForm(C1.Win.Design.Server.Floaties.IFloatieOwner floatieOwner)	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieFormsBehavior.ShowForm()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieGlyph.Paint(System.Windows.Forms.PaintEventArgs pe)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.PropagatePaint(System.Windows.Forms.PaintEventArgs pe)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.AdornerWindow.WndProc(ref System.Windows.Forms.Message m)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 2933	C#
     	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 356	C#
     	[Native to Managed Transition]	
     	[Managed to Native Transition]	
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.GetDataObject(int retryTimes, int retryDelay) Line 135	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.GetDataObject() Line 123	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Clipboard.ContainsData(string format) Line 189	C#
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Floaties.RibbonBaseFloatieOwner.GetActionItems(bool deleteButtonOnly)	Unknown
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Floaties.TabFloatieOwner.GetItems()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieService.CreateFloatieForm(C1.Win.Design.Server.Floaties.IFloatieOwner floatieOwner)	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieFormsBehavior.ShowForm()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieGlyph.Paint(System.Windows.Forms.PaintEventArgs pe)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.PropagatePaint(System.Windows.Forms.PaintEventArgs pe)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.AdornerWindow.WndProc(ref System.Windows.Forms.Message m)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 2933	C#
     	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 356	C#
     	[Native to Managed Transition]	
     	[Managed to Native Transition]	
     	System.Windows.Forms.Primitives.dll!Interop.User32.UpdateWindow(IHandle hWnd)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.Update() Line 13231	C#
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.AdornerWindow.InvalidateAdornerWindow(System.Drawing.Rectangle rectangle)	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieGlyph.InvalidateOwnerLocation()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieGlyph.IsVisible.set(bool value)	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieService.a()	Unknown
     	C1.Win.6.Design.Server.dll!C1.Win.Design.Server.Floaties.FloatieService.a(object A_0, System.EventArgs A_1)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Host.RemoteSelectionService.OnSelectionChanged()	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Host.RemoteSelectionService.UpdateSelection(System.Collections.Generic.IEnumerable<System.ComponentModel.IComponent> components, System.ComponentModel.Design.SelectionTypes selectionType)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Host.RemoteSelectionService.SetSelectedComponents(System.Collections.Generic.IEnumerable<System.ComponentModel.IComponent> components, System.ComponentModel.Design.SelectionTypes selectionType)	Unknown
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Designers.C1RibbonDesigner.dq.SelectComponent(System.ComponentModel.Component component)	Unknown
     	C1.Win.Ribbon.6.dll!bk.OnClick()	Unknown
     	C1.Win.6.dll!C1.Framework.ButtonElement.PerformClick()	Unknown
     	C1.Win.Ribbon.6.Design.Server.dll!C1.Win.Ribbon.Design.Server.Glyphs.SelectionBehavior.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.Behaviors.Glyph g, System.Windows.Forms.MouseButtons button, System.Drawing.Point mouseLoc)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.Microsoft.DotNet.DesignTools.Designers.IInputDispatcher.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.MouseDispatchEventArgs e)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.Behaviors.BehaviorService.AdornerWindow.ProxyDispatcher.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.MouseDispatchEventArgs e)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.InputDispatcher.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.MouseDispatchEventArgs e)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.ScrollableControlDispatcher.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.MouseDispatchEventArgs e)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Designers.DesignerFrame.Dispatcher.OnMouseDown(Microsoft.DotNet.DesignTools.Designers.MouseDispatchEventArgs e)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Protocol.Endpoints.Input.InputMessageHandler.HandleRequest(Microsoft.DotNet.DesignTools.Protocol.Endpoints.Input.InputMessageRequest request)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Protocol.Endpoints.RequestHandler<Microsoft.DotNet.DesignTools.Protocol.Endpoints.Input.InputMessageRequest, Microsoft.DotNet.DesignTools.Protocol.Endpoints.Input.InputMessageResponse>.Microsoft.DotNet.DesignTools.Protocol.Endpoints.IRequestHandler.HandleRequest(Microsoft.DotNet.DesignTools.Protocol.Endpoints.Request request)	Unknown
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Protocol.Endpoints.RequestManager.HandleRequestAsync(string name, Microsoft.DotNet.DesignTools.Protocol.Endpoints.Request request)	Unknown
     	[Resuming Async Method]	
     	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
     	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Microsoft.DotNet.DesignTools.Protocol.Endpoints.Response>.AsyncStateMachineBox<Microsoft.DotNet.DesignTools.Protocol.Endpoints.RequestManager.<HandleRequestAsync>d__10>.MoveNext(System.Threading.Thread threadPoolThread)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) Line 9656	C#
     	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks() Line 9733	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Line 14480	C#
     	System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) Line 1462	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc(ref System.Windows.Forms.Message m) Line 5617	C#
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Server.Window.ServerWindow.WndProc(ref System.Windows.Forms.Message m)	Unknown
     	System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Line 2933	C#
     	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, Interop.User32.WM msg, System.IntPtr wparam, System.IntPtr lparam) Line 356	C#
     	[Native to Managed Transition]	
     	[Managed to Native Transition]	
     	System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.Interop.Mso.IMsoComponentManager.FPushMessageLoop(System.UIntPtr dwComponentID, Interop.Mso.msoloop uReason, void* pvLoopData) Line 236	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 1318	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Interop.Mso.msoloop reason, System.Windows.Forms.ApplicationContext context) Line 1236	C#
     	System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context) Line 2744	C#
     	Microsoft.DotNet.DesignTools.Server.dll!Microsoft.DotNet.DesignTools.Server.DesignToolsServer.StartUIThreadAsync.AnonymousMethod__1()	Unknown
     	System.Private.CoreLib.dll!System.Threading.Thread.StartHelper.Callback(object state)	Unknown
     	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown
     	System.Private.CoreLib.dll!System.Threading.Thread.StartCallback()	Unknown
     	[Async Call Stack]	
     	[Async] StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.DispatchIncomingRequestAsync(StreamJsonRpc.Protocol.JsonRpcRequest request)	Unknown
     	[Async] StreamJsonRpc.dll!StreamJsonRpc.JsonRpc.HandleRpcAsync(StreamJsonRpc.Protocol.JsonRpcMessage rpc)	Unknown
    

    As you can see, the clipboard seems to be locked. Today, I work from home through a RDP session - maybe this is related. But Clipboard copy/paste works as usual, besides this lock.

    The clipboard access seems to do a retry internally and throw an exception. But maybe this delay causes a reentrant behavior, as the clipboard access happens in a “Paint” method? Probably, it is not a good idea to to something like this ;-).

    Best regards

    Wolfgang

  • Posted 14 November 2023, 8:40 am EST

    Hi Wolfgang,

    We followed the steps below in order to replicate the issue, but unfortunately, we could not. We request your confirmation on the steps and your build environment so that we can discuss the issue further with our developers.

    Here’s what we did:

    1. Created a WinForms application where main form is a sub class of C1RibbonForm.
    2. Placed a C1Ribbon control to the form.
    3. Added multiple tabs in the ribbon control.
    4. Switched between the tabs in the form designer. [No issue occurred]
    5. Closed the designer and reopened the file.
    6. Clicked on the ribbon and switched between the tabs in the form designer. [No issue occurred]

    We couldn’t replicate the problem on Win10 and Win11 machines (including via RDP). Could you provide a video demonstrating the issue on your end? Additionally, please provide us the following details:

    1. OS version
    2. VS version
    3. System Locale
    4. Display settings of the system

    Thanks & Regards,

    Aastha

  • Posted 15 November 2023, 3:08 am EST

    Hi Aastha,

    I already feared that you cannot reproduce it. I am in the office tomorrow and will test whether it is related to RDP sessions. More feedback tomorrow…

    My system: Win 11 23H2, Visual Studio 2022 17.7.6, locale = German, display settings: one screen at 1920x1280

    Best regards

    Wolfgang

  • Posted 16 November 2023, 2:01 am EST

    Hi Wolfgang,

    Thanks for the information.

    > I already feared that you cannot reproduce it. I am in the office tomorrow and will test whether it is related to RDP sessions. More feedback tomorrow…

    We understand your concerns. We will eagerly await your response before proceeding with any further steps. If you encounter any additional information or observations during your testing, please feel free to share them with us.

    Looking forward to hearing from you soon.

    Thanks & Regards,

    Aastha

  • Posted 16 November 2023, 4:27 am EST

    I cannot reproduce it today in the office. So, maybe it is related to HomeOffice and RDP session, or it was fixed by yesterdays Visual Studio update 17.7.7.

    If I have further information, I would come back. But for the moment, you can close this issue.

    Best regards

    Wolfgang

  • Posted 16 November 2023, 3:55 pm EST

    I just tested from home and cannot reproduce it either.

    A web search pointed me to the situation that a process could have forgotten to release a clipboard lock and thus block it. So maybe this happened here, and it broke C1Ribbon designer. But this seems to a rare condition. So close this issue.

    Best regards

    Wolfgang

  • Posted 16 November 2023, 4:59 pm EST

    Well, while experimenting with this and other issues, I could actually reproduce the error once. At this time, it was also not possible to copy/paste text from a Notepad in the RDP session to a Notepad on my client computer or vice versa. But I have no idea which process caused the clipboard lock, and I could not reproduce it afterwards.

    I don’t know whether it would be worth the effort to work around this error by doing the clipboard access async. More interesting would be the reason why the clipboard was locked, but I have no idea who caused this…

  • Posted 17 November 2023, 6:47 am EST

    Hi Wolfgang,

    Thanks for providing the further updates. We appreciate your cooperation in conducting these tests.

    We attempted to reproduce the reported issue on RDP in an environment similar to yours, testing both with Clipboard enabled and disabled multiple times. However, we were unable to identify any problems. For your reference, we have provided video links showcasing the testing scenarios:

    1. RDP with clipboard enabled: https://www.dropbox.com/scl/fi/srwgk7c5q7s56sx65nle5/ClipboardEnabled.mp4?rlkey=1xnhw7j4y1h2mf8ggfaraelbb&dl=0

    2. RDP with clipboard disabled: https://www.dropbox.com/scl/fi/uw36nsr6yqghaln3axi2t/ClipboardDisabled.mp4?rlkey=tzw8394lol045a2ffsq21edxy&dl=0

    Additionally, we are providing the application used for testing in the attached zip file: (See ClipboardRibbon.zip)

    We will await your confirmation/further observations regarding the cause of the reported issue or any additional details that may be helpful for replicating the problem for a better analysis.

    Thanks & Regards,

    Aastha

  • Posted 18 November 2023, 6:40 am EST

    Hi Aastha,

    thanks for the research effort that you invested. Yes, your steps are exactly what I do. But of course, I cannot reproduce it with your sample project :-(. And with our real application, it seems to happen only randomly.

    So, I tend to blame “something else” - probably not related to C1. You can close this ticket.

    Best regards

    Wolfgang

  • Posted 19 November 2023, 2:01 pm EST

    Hi Wolfgang,

    Thanks for the acknowledgement.

    As per your request we are closing this ticket now. You can reopen this case whenever you face an issue regarding this.

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels