在MonoDevelop中添加事件时出错

时间:2012-06-08 10:54:49

标签: c# windows monodevelop gtk#

当我双击Clicked信号添加新的Clicked事件时,它不会自动添加代码。它显示错误

error monodevelop

我使用最新版本的Monodevelop和Gtk#Toolkit和Window7平台 如何解决?

2 个答案:

答案 0 :(得分:0)

尝试手动添加。 进入窗口类的构造函数写:

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

其中 EventHandler Clicked 事件的委托类型, Method 是一个与 EventHandler 相同的方法em>签名。

答案 1 :(得分:0)

这是MonoDevelop 3.0.1中仍然存在的错误。查看下面的完整堆栈跟踪。手动添加偶数就像Arman Stepanyan描述的那样。

  

System.Reflection.TargetInvocationException:调用目标抛出了异常。 ---> System.NotImplementedException:未实现所请求的功能。     在/build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide中的MonoDevelop.Ide.TypeSystem.CodeGenerationService.GetSuitableInsertionPoint(IEnumerable`1 points,IUnresolvedTypeDefinition cls,IUnresolvedMember成员)[0x0003e] .TypeSystem / CodeGenerationService.cs:335     在/build/buildd/monodevelop-3.0.1/main/src/core/MonoDevelop.Ide/MonoDevelop中的MonoDevelop.Ide.TypeSystem.CodeGenerationService.AddNewMember(ITypeDefinition类型,IUnresolvedTypeDefinition部分,IUnresolvedMember newMember,Boolean implementExplicit)[0x00043]。 Ide.TypeSystem / CodeGenerationService.cs:91     在/build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs中的MonoDevelop.GtkCore.GuiBuilder.CodeBinder.BindSignal(Stetic.Signal signal)[0x000de] :182     在/build/buildd/monodevelop-3.0.1/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore中的MonoDevelop.GtkCore.GuiBuilder.GuiBuilderView.OnSignalAdded(System.Object sender,Stetic.ComponentSignalEventArgs args)[0x00000]。 GuiBuilder / GuiBuilderView.cs:316     在Stetic.WidgetDesigner.OnSignalAdded(System.Object sender,Stetic.ComponentSignalEventArgs args)[0x00000] in:0     在Stetic.Project + c_ AnonStoreyD。<> m _17(System.Object,System.EventArgs)[0x00000] in:0     在Stetic.GuiDispatch.InvokeSync(System.EventHandler h)[0x00000] in:0     在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)     在Stetic.ProjectBackend.Stetic.IProject.NotifySignalAdded(Stetic.SignalEventArgs args)[0x00000] in:0     在Stetic.ObjectWrapper.OnSignalAdded(Stetic.SignalEventArgs args)[0x00000] in:0     at Stetic.SignalCollection.OnInsertComplete(Int32 index,System.Object value)[0x00000] in:0     在System.Collections.CollectionBase.System.Collections.IList.Add(System.Object value)[0x00000] in:0     ---内部异常堆栈跟踪结束---     在System.Reflection.MonoMethod.Invoke(System.Object obj,BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object [] parameters,System.Globalization.CultureInfo culture)[0x00000] in:0     在System.Reflection.MethodBase.Invoke(System.Object obj,System.Object [] parameters)[0x00000] in:0     在System.Delegate.DynamicInvokeImpl(System.Object [] args)[0x00000] in:0     在System.MulticastDelegate.DynamicInvokeImpl(System.Object [] args)[0x00000] in:0     在System.Delegate.DynamicInvoke(System.Object [] args)[0x00000] in:0     在GLib.Signal.ClosureInvokedCB(System.Object o,GLib.ClosureInvokedArgs args)[0x00000] in:0     at GLib.SignalClosure.Invoke(GLib.ClosureInvokedArgs args)[0x00000] in:0     在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