dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.37k stars 968 forks source link

MenuStrip "broken" #12091

Closed RandyPJ closed 2 weeks ago

RandyPJ commented 2 weeks ago

Environment

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.11.2

.NET version

.NET 8

Did this work in a previous version of Visual Studio and/or previous .NET release?

Yes.

Issue description

MenuStrip broken in designer when i click on a ToolStripMenuItem. image

Steps to reproduce

The steps: 1 - Create a .net 8 Winforms app. 2 - Add MenuStrip to a Window. 3 - Add some ToolStripMenuItems and try to add childrens and siblings.

Diagnostics

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Microsoft.DotNet.DesignTools.Client.DesignToolsServerException: Failed to set Win32 parent window of the Control.
   at Microsoft.DotNet.DesignTools.Client.DesignToolsClient.<SendRequestAsync>d__49`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.DotNet.DesignTools.Protocol.Endpoints.Input.InputMessageEndpoint.Sender.SendRequest(SessionId sessionId, UInt32 messageType, UIntPtr wParam, IntPtr lParam, Point location, Keys modifierKeys, IntPtr controlHandle, Nullable`1 toolboxItemSelected)
   at Microsoft.DotNet.DesignTools.Protocol.Endpoints.DesignToolsEndpoints.InputImpl.InputMessage(SessionId sessionId, UInt32 messageType, UIntPtr wParam, IntPtr lParam, Point location, Keys modifierKeys, IntPtr controlHandle, Nullable`1 toolboxItemSelected)
   at Microsoft.DotNet.DesignTools.Client.Designers.InputShield.ProcessMessage(WindowMessage message, Point screenLocation, UIntPtr wParam, IntPtr lParam, Boolean isHookMessage)
   at Microsoft.DotNet.DesignTools.Client.Designers.InputShield.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
elachlan commented 2 weeks ago

@Olina-Zhang can your team please test this?

Olina-Zhang commented 2 weeks ago

We cannot repro this issue. @RandyPJ can you please attach a video of the issue you describe or a sample application? Thanks!

RandyPJ commented 2 weeks ago

Hello, I apologize. After a while I realized that it is a bug in Visual Studio Community 2022 Preview. Sorry for the inconvenience.

JeremyKuhne commented 2 weeks ago

Thanks for the report @RandyPJ