简体   繁体   English

在MonoDevelop中添加事件时出错

[英]error when add event in MonoDevelop

when i double click on Clicked signals to add new Clicked event, it not automatic add code. 当我双击Clicked信号以添加新的Clicked事件时,它不是自动添加代码。 it show error 它显示错误

错误单显影

i use newest version of Monodevelop and Gtk# Toolkit and Window7 platform how to fix it ?? 我使用Monodevelop和Gtk#工具包的最新版本以及Window7平台如何修复它?

Try to add it manually. 尝试手动添加它。 Into constructor of your window class write: 在您的窗口类的构造函数中写入:

yourElement.Clicked += new EventHandler(Method);
void Method(~)
{
//logic
}

Where EventHandler is a delegate type of Clicked event, and Method is a method, which have same with EventHandler signature. 其中EventHandlerClicked事件的委托类型,而Method是方法,与EventHandler签名相同。

This is a bug still present in MonoDevelop 3.0.1. 这是MonoDevelop 3.0.1中仍然存在的错误。 Look below for the full stacktrace. 在下面查找完整的堆栈跟踪。 Adding an even manually is like Arman Stepanyan described it. 手动添加偶数就像Arman Stepanyan所描述的那样。

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.TargetInvocationException:调用的目标引发了异常。 ---> System.NotImplementedException: The requested feature is not implemented. ---> System.NotImplementedException:所请求的功能未实现。 at MonoDevelop.Ide.TypeSystem.CodeGenerationService.GetSuitableInsertionPoint (IEnumerable`1 points, IUnresolvedTypeDefinition cls, IUnresolvedMember member) [0x0003e] in /build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerationService.cs:335 at MonoDevelop.Ide.TypeSystem.CodeGenerationService.AddNewMember (ITypeDefinition type, IUnresolvedTypeDefinition part, IUnresolvedMember newMember, Boolean implementExplicit) [0x00043] in /build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerationService.cs:91 at MonoDevelop.GtkCore.GuiBuilder.CodeBinder.BindSignal (Stetic.Signal signal) [0x000de] in /build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs:182 at MonoDevelop.GtkCore.GuiBuilder.GuiBuilderView.OnSignalAdded (System.Object sender, Stetic.ComponentSignalEventArgs args) [0x00000] in /build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop 在/build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide中的MonoDevelop.Ide.TypeSystem.CodeGenerationService.GetSuitableInsertionPoint(IEnumerable`1分,IUnresolvedTypeDefinition cls,IUnresolvedMember成员)[0x0003e]中.build / Ide.TypeSystem.CodeGenerationService.AddNewMember中的.TypeSystem / CodeGenerationService.cs:335(ITypeDefinition类型,IUnresolvedTypeDefinition部分,IUnresolvedMember newMember,布尔实现显式)[0x00043]在/build/buildd/monodevelop-3.0.1/main/src/ /build/buildd/monodevelop-3.0.1/main/中的MonoDevelop.GtkCore.GuiBuilder.CodeBinder.BindSignal(Stetic.Signal signal)[0x000de]处的core / MonoDevelop.Ide / MonoDevelop.Ide.TypeSystem / CodeGenerationService.cs:91 src / addins / MonoDevelop.GtkCore / MonoDevelop.GtkCore.GuiBuilder / CodeBinder.cs:182在MonoDevelop.GtkCore.GuiBuilder.GuiBuilderView.OnSignalAdded(System.Object发送者,Stetic.ComponentSignalEventArgs args)[0x00000]在/ build / buildd / monodevelop中-3.0.1 / main / src / addins / MonoDevelop .GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs:316 at Stetic.WidgetDesigner.OnSignalAdded (System.Object sender, Stetic.ComponentSignalEventArgs args) [0x00000] in :0 at Stetic.Project+c_ AnonStoreyD.<>m _17 (System.Object , System.EventArgs ) [0x00000] in :0 at Stetic.GuiDispatch.InvokeSync (System.EventHandler h) [0x00000] in :0 at Stetic.Project.NotifySignalAdded (System.Object obj, System.String name, Stetic.Signal signal) [0x00000] in :0 at (wrapper remoting-invoke-with-check) Stetic.Project:NotifySignalAdded (object,string,Stetic.Signal) at Stetic.ProjectBackend.Stetic.IProject.NotifySignalAdded (Stetic.SignalEventArgs args) [0x00000] in :0 at Stetic.ObjectWrapper.OnSignalAdded (Stetic.SignalEventArgs args) [0x00000] in :0 at Stetic.SignalCollection.OnInsertComplete (Int32 index, System.Object value) [0x00000] in :0 at System.Collections.CollectionBase.System.Collections.IList.Add (System.Object value) [0x00000] in :0 --- End of inner exception stack trace --- at Syste .GtkCore / MonoDevelop.GtkCore.GuiBuilder / GuiBuilderView.cs:316在Stetic.WidgetDesigner.OnSignalAdded(System.Object发送者,Stetic.ComponentSignalEventArgs args)[0x00000]在0处在Stetic.Project + c_ AnonStoreyD。<> m _17( Stetic.GuiDispatch.InvokeSync(System.EventHandler h)中0处的System.Object,System.EventArgs)[0x00000]在Stetic.Project.NotifySignalAdded中0处的[0x00000](System.Object obj,System.String名称,Stetic .Signal.Project:NotifySignalAdded(object,string,Stetic.Signal)在Stetic.ProjectBackend.Stetic.IProject.NotifySignalAdded(Stetic.SignalEventArgs args)处的信号信号[0x00000]在:0处)[0x00000]在0处在Stetic.ObjectWrapper.OnSignalAdded(Stetic.SignalEventArgs args)[0x00000]在0处在Stetic.SignalCollection.OnInsertComplete(Int32索引,System.Object值)[0x00000]在0处在System.Collections .CollectionBase.System.Collections.IList.Add(0中的System.Object值)[0x00000] ---内部异常堆栈跟踪的结尾---在Syste m.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in :0 at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in :0 at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in :0 at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in :0 m.Reflection.MonoMethod.Invoke(System.Reflection.MethodBase上为0的[0x00000](System.Object obj,BindingFlags invokeAttr,System.Reflection.Binder活页夹,System.Object []参数,System.Globalization.CultureInfo文化)。在System.Delegate.DynamicInvokeImpl上以0调用(System.Object obj,System.Object []参数)[0x00000]在System.MulticastDelegate.DynamicInvokeImpl(System.Object上以:0调用[0x00000] [0x00000]在GLib.Signal.ClosureInvokedCB(在System.Object o,GLib.ClosureInvokedArgs args)处,在:0处位于System.Delegate.DynamicInvoke的[[args] [0x00000] [System.Object [] args)[0x00000]在[0x00000]在GLib.SignalClosure.Invoke处为:0(GLib.ClosureInvokedArgs args)[0x00000]在GLib.SignalClosure.MarshalCallback处为:0处(IntPtr raw_closure,IntPtr return_val,UInt32 n_param_vals,IntPtr IntPtr int_0,IntPttrtr_m_values, 0:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM