microsoft / winforms-designer-extensibility

MIT License
56 stars 13 forks source link

VS Crashes when right clicking on designer surface #35

Open valiahmetovv opened 5 months ago

valiahmetovv commented 5 months ago

Hi @KlausLoeffelmann

I'm trying to implement simple context menus, but any right click causes the following error:

System.InvalidOperationException HResult=0x80131509 Message=The service 'Microsoft.DotNet.DesignTools.Client.Designers.IEventHandlerService' must be installed for this feature to work. Ensure that this service is available. Source=Microsoft.WinForms.Utilities.Shared StackTrace: at System.ServiceExtensions.GetRequiredService[TService,TInterface](IServiceProvider provider) at System.ServiceExtensions.GetCachedService[T](IServiceProvider serviceProvider, T& location) at Microsoft.DotNet.DesignTools.Client.Designers.InputShield.OnContextMenu(Point screenLocation) at Microsoft.DotNet.DesignTools.Client.Designers.InputShield.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at Microsoft.DotNet.DesignTools.Client.Designers.InputShield.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

RightClickError

RightClickErrorCallStack

IEventHandlerService is internal, so I'm not sure how to "install" it.

Please assist in how to resolve this error and open a simple context menu when right clicking on designer surface

Regards Tim

cc @merriemcgaw