작업 흐름에서 SharePoint 2010을 사용하기위한 사용자 지정 활동을 빌드하려고합니다. 디자이너에서는 "사용자 정의 활동"아래의 리본에있는 활동 드롭 다운 메뉴에서 활동을 볼 수 있습니다. 그러나 요소는 디자이너에서 결코 구체화되지 않으며이 문제를 디버그하는 방법을 알아 내려고 노력하고 있습니다.SharePoint 2010 사용자 지정 활동 디버깅
내가 이벤트 핸들러로 Debugger.Break()를 넣어 시도했지만 그 어떤 브레이크 포인트에서 정지하지 않는 w3wp.exe
프로세스에 디버거를 연결, 또한 An unhandled exception ('Launch for user') occurred in w3wp.exe [xxxx]. Just-In-Time debugging this exception failed with the following error: Not enough storage is available to complete this operation.
을 말한다 응용 프로그램 이벤트 로그에 항목을 초래한다.
SharePoint 2010 내부에서 자세한 로깅을 설정했는데 로깅이 매우 복잡하지만 구성 요소에 대한 정보가 없거나 디자이너가 구성 요소를로드하지 않는 이유가 없습니다.
다음은 매우 기본적인 활동에 대한 관련 스 니펫입니다. 여기서 내가 뭘 잘못하고 있니? 내장 추적, 내가 디자이너에서 워크 플로우에 활동을 추가하려고 어떤 시간
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Workflow.ComponentModel;
using System.Workflow.Activities;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WorkflowActions;
namespace SharePoint.Activities.IO
{
public partial class CopyFile : SequenceActivity
{
public CopyFile()
{
InitializeComponent();
}
public static DependencyProperty SourceDirectoryProperty = DependencyProperty.Register("SourceDirectory", typeof(string), typeof(CopyFile));
public static DependencyProperty TargetDirectoryProperty = DependencyProperty.Register("TargetDirectory", typeof(string), typeof(CopyFile));
public static DependencyProperty ResultProperty = DependencyProperty.Register("Result", typeof(string), typeof(CopyFile));
public static DependencyProperty CreateDateProperty = DependencyProperty.Register("CreateDate", typeof(DateTime), typeof(CopyFile));
public static DependencyProperty CompletionDateProperty = DependencyProperty.Register("CompletionDate", typeof(DateTime), typeof(CopyFile));
public static DependencyProperty WFContextProperty = DependencyProperty.Register("WFContext", typeof(WorkflowContext), typeof(CopyFile));
[Description("Path the files to perform the operation on")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string SourceDirectory
{
get { return (string)GetValue(SourceDirectoryProperty); }
set { SetValue(SourceDirectoryProperty, value); }
}
[Description("Path the files are copied to")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string TargetDirectory
{
get { return (string)GetValue(TargetDirectoryProperty); }
set { SetValue(TargetDirectoryProperty, value); }
}
[Description("Once the the operation completes, this is set to OK or the exception information")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public string Result
{
get { return (string)GetValue(ResultProperty); }
set { SetValue(ResultProperty, value); }
}
[Description("When the request was created")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public DateTime CreateDate
{
get { return (DateTime)GetValue(CreateDateProperty); }
set { SetValue(CreateDateProperty, value); }
}
[Description("When execution stoped")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public DateTime CompletionDateDate
{
get { return (DateTime)GetValue(CompletionDateProperty); }
set { SetValue(CompletionDateProperty, value); }
}
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public WorkflowContext WFContext { get { return (WorkflowContext)GetValue(WFContextProperty); } set { SetValue(WFContextProperty, value); } }
protected override void Initialize(IServiceProvider provider)
{
TraceIn();
base.Initialize(provider);
TraceOut();
}
protected override void Uninitialize(IServiceProvider provider)
{
TraceIn();
base.Uninitialize(provider);
TraceOut();
}
public override string ToString()
{
TraceIn();
var result = base.ToString();
TraceOut();
return result;
}
public override int GetHashCode()
{
TraceIn();
// ReSharper disable BaseObjectGetHashCodeCallInGetHashCode
var result = base.GetHashCode();
// ReSharper restore BaseObjectGetHashCodeCallInGetHashCode
TraceOut();
return result;
}
public override bool Equals(object obj)
{
TraceIn();
// ReSharper disable BaseObjectEqualsIsObjectEquals
var result = base.Equals(obj);
// ReSharper restore BaseObjectEqualsIsObjectEquals
TraceOut();
return result;
}
//This code causes the compiler to blow up! :)
//protected override void Dispose(bool disposing)
//{
// TraceIn();
// base.Dispose(disposing);
//}
protected override void SetBoundValue(ActivityBind bind, object value)
{
TraceIn();
base.SetBoundValue(bind, value);
TraceOut();
}
protected override void OnWorkflowChangesCompleted(ActivityExecutionContext executionContext)
{
TraceIn();
base.OnWorkflowChangesCompleted(executionContext);
TraceOut();
}
protected override void OnSequenceComplete(ActivityExecutionContext executionContext)
{
TraceIn();
base.OnSequenceComplete(executionContext);
TraceOut();
}
protected override void OnListChanging(ActivityCollectionChangeEventArgs e)
{
TraceIn();
base.OnListChanging(e);
TraceOut();
}
protected override void OnListChanged(ActivityCollectionChangeEventArgs e)
{
TraceIn();
base.OnListChanged(e);
TraceOut();
}
protected override void OnClosed(IServiceProvider provider)
{
TraceIn();
base.OnClosed(provider);
TraceOut();
}
protected override void OnActivityExecutionContextUnload(IServiceProvider provider)
{
TraceIn();
base.OnActivityExecutionContextUnload(provider);
TraceOut();
}
protected override void OnActivityExecutionContextLoad(IServiceProvider provider)
{
TraceIn();
base.OnActivityExecutionContextLoad(provider);
TraceOut();
}
protected override void OnActivityChangeRemove(ActivityExecutionContext executionContext, Activity removedActivity)
{
TraceIn();
base.OnActivityChangeRemove(executionContext, removedActivity);
TraceOut();
}
protected override void OnActivityChangeAdd(ActivityExecutionContext executionContext, Activity addedActivity)
{
TraceIn();
base.OnActivityChangeAdd(executionContext, addedActivity);
TraceOut();
}
protected override ActivityExecutionStatus HandleFault(ActivityExecutionContext executionContext, Exception exception)
{
TraceIn();
var result = base.HandleFault(executionContext, exception);
TraceOut();
return result;
}
protected override object GetBoundValue(ActivityBind bind, Type targetType)
{
TraceIn();
var result = base.GetBoundValue(bind, targetType);
TraceOut();
return result;
}
protected override ActivityExecutionStatus Cancel(ActivityExecutionContext executionContext)
{
TraceIn();
var result = base.Cancel(executionContext);
TraceOut();
return result;
}
protected override void InitializeProperties()
{
TraceIn();
base.InitializeProperties();
TraceOut();
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
TraceIn();
var isSiteAdmin = false;
CreateDate = DateTime.Now;
try
{
// Needs administrative credentials to get the web application properties ino
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (var site = new SPSite(WFContext.Site.ID))
{
using (var web = site.AllWebs[WFContext.Web.ID])
{
isSiteAdmin = web.CurrentUser.IsSiteAdmin;
if (string.IsNullOrEmpty(SourceDirectory)) throw new ArgumentException("SourceDirectory cannot be null or empty");
if (!Directory.Exists(SourceDirectory)) throw new DirectoryNotFoundException("Could not find source directory: \"" + SourceDirectory + "\"");
if (string.IsNullOrEmpty(TargetDirectory)) throw new ArgumentException("TargetDirectory cannot be null or empty");
if (!Directory.Exists(TargetDirectory)) throw new DirectoryNotFoundException("Could not find target directory: \"" + TargetDirectory + "\"");
// Do something
}
}
});
Result = "OK";
}
catch (Exception ex)
{
Result = isSiteAdmin ? ex.ToString() : ex.Message;
}
CompletionDateDate = DateTime.Now;
var result = base.Execute(executionContext);
TraceOut();
return result;
}
private static void TraceIn()
{
Trace("Entering");
}
private static void TraceOut()
{
Trace("Exiting");
}
private static void Trace(string direction)
{
Debugger.Launch();
var stackTrace = new StackTrace(2, false);
var frame = stackTrace.GetFrame(0);
Debug.WriteLine(direction + " " + frame.GetMethod().Name);
}
}
}
, 나는 GetHashCode()와 같음()와 아무것도에 대한 호출을 참조하십시오.
여기에 대한 .actions 파일이 있습니다.
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions
Sequential="then"
Parallel="and">
<Action
Name="IO Activities"
ClassName="SharePoint.Activities.IO"
Assembly="SharePoint.Activities.IO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=abfb622251cf6982"
Category="Custom Actions"
AppliesTo="all">
<RuleDesigner
Sentence="CopyFile %1">
<FieldBind
Field="SourceDirectory,TargetDirectory,Result,CreateDate,CompletionDate"
Text="Copy the files"
DesignerType="CopyFile"
Id="1"/>
</RuleDesigner>
<Parameters>
<Parameter
Name="SourceDirectory"
Type="System.String, mscorlib"
Direction="In"
DesignerType="StringBuilder"
Description="Directory where the source files are to move" />
<Parameter
Name="TargetDirectory"
Type="System.String, mscorlib"
Direction="In"
DesignerType="StringBuilder"
Description="Directory where the files will be placed" />
<Parameter
Name="Result"
Type="System.String, mscorlib"
Direction="Out" />
<Parameter
Name="CreateDate"
Type="System.DateTime, mscorlib"
Direction="Out" />
<Parameter
Name="CompletionDate"
Type="System.DateTime, mscorlib"
Direction="Out" />
<Parameter
Name="WFContext"
Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions"
Direction="In"
DesignerType="Hide" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
제공 할 수있는 도움이 크게 도움이 될 것입니다.