1

每当我尝试在 sharepoint 2007 中编辑自定义 Web 部件的共享属性时,都会收到以下错误:

Exception has been thrown by the target of an invocation.
  at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  at Microsoft.SharePoint.WebPartPages.ExtendedPropertyInfo.GetValue(Object target, Object[] indexValues)
  at Microsoft.SharePoint.WebPartPages.PropertySheetProperty.get_Value()
  at Microsoft.SharePoint.WebPartPages.PropertySheetProperty.get_IsNull()
  at Microsoft.SharePoint.WebPartPages.PropertySheetProperty..ctor(WebPart targetWebPart, SPWebPartManager webPartManager, PropertyInfo pi)
  at Microsoft.SharePoint.WebPartPages.PropertySheetProperties.GetProperties(WebPart targetWebPart, SPWebPartManager manager, Boolean inPersonalizationMode, IPropertySheetPropertiesFilter filter)
  at Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart.CreatePropertyGrid()
  at Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart.CreateChildControls()
  at System.Web.UI.Control.EnsureChildControls()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Control.PreRenderRecursiveInternal()
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

我的 Web 部件中确实有一些自定义属性,用于设置表单生成的通知电子邮件的电子邮件地址。这方面的一个例子是:

    [WebBrowsable(true),
    Personalizable(true),
    DefaultValue("myemail@company.com"),
    Category("Email Properties"),
    Microsoft.SharePoint.WebPartPages.WebPartStorage(Microsoft.SharePoint.WebPartPages.Storage.Shared),
    Microsoft.SharePoint.WebPartPages.FriendlyName("Email Addresses (separate multiple emails with a comma):"),
    Description("Please enter the email addresses for those that should be notified when an incident takes place at a Corporate location.")]
    public string CorpMessageEmailAddresses { get; set; }

但是,即使注释掉了这些属性,我在尝试修改 Web 部件时仍然会收到错误消息。

有没有其他人处理过这样的问题?如果需要,我可以提供更多信息或代码片段。

4

1 回答 1

1

好的,我昨晚很晚才发现这个……这是一个隐藏在异常中的典型 MS 异常。显示的异常不是原因,而是最后发生的异常。真正的例外是与我的 ViewState 变量有关的问题。我在获取和设置周围进行了尝试/捕捉,现在一切正常!

直到今天早上我才看到您的评论 kbrimington...感谢您的帮助!

于 2010-07-30T17:22:05.140 回答