Archive for the ‘Uncategorized’ Category
Body Moving
Your body is not a thing separate from your Self, it is the physical manifestation of who you are. You are much more vast than your body can hold at this time—but your body is a manifestation of the aspect of yourself that you are concerned with at this time and place. Take a moment and breathe into your feet, feel the seat beneath you, feel your eyes focus as you read the words on this page (yes you can feel your eyes focus, if you take notice).
The other misunderstanding is about unconditional love. Unconditional love it not forced love. There is nothing forceful about it. It is love allowed, it is acceptance. Unconditional love of your body is loving acceptance for your body, no matter what your body looks like or feels like.
Sharepoint Workflow – When you just can’t create a task.
I’ve been writing sharepoint applications for quite some time. In fact, I consider myself pretty damn good at it. Somehow though, I’ve been able to avoid writing much workflow all this time. Event Handlers have been all I needed to this point.
I’ve never wanted to beat my head into a wall so much as this last weeks adventure into workflow. The infamous Julie kremer, who i hold in the highest of esteem as a friend and teacher, wrote a workflow for the OfficeLive app that Ive been working on for the last 5 or so months ( I think we’re on version 5 at this point, we iterate fast ) that takes a solution submitted by a small business owner and kicks off a workflow to have it approved before it shows up in the small business portal search – http://www.officelivepartnerdirectory.com.
My task is to create a workflow that the company object will pass through for approval. The goal is to catch any offensive company names or logos from showing up in the portal. This seems pretty easy, logistical, shouldn’t be a problem right?
Well, right off the bat I was getting an exception in mscorlib
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.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature 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 System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Workflow.Activities.CallExternalMethodActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()
I added a fault handler to the workflow and bubbled up the inner exception to see what the deal was:
private void code_HandleAllExceptions_ExecuteCode(object sender, EventArgs e) { WriteException(faultHandlerActivity1_Fault1, "An error was handled by fault hander. " + faultHandlerActivity1_Fault1.InnerException); } private static void WriteException(Exception e, string message) { WriteTrace("CompanyWF ERROR: " + message + " " + e.Message + "\n" + e.StackTrace, "ERROR"); } private static void WriteInfo(string message) { WriteTrace("CompanyWF: " + message, "INFO"); } private static void WriteTrace( string message, string level ) { Trace.WriteLine("["+DateTime.Now+"] " + message, level); }
which then reported a null reference exception:
[4120] ERROR: [7/25/2008 10:36:46 AM] CompanyWF ERROR: An error was handled by fault hander. System.NullReferenceException: Object reference not set to an instance of an object. [4120] at Microsoft.SharePoint.Workflow.SPWorkflowTask.SetWorkflowData(SPListItem task, Hashtable newValues, Boolean ignoreReadOnly) [4120] at Microsoft.SharePoint.Workflow.SPWinOETaskService.UpdateTaskInternal(Guid taskId, SPWorkflowTaskProperties properties, Boolean fSetWorkflowFinalize, Boolean fCreating, HybridDictionary specialPermissions) [4120] at Microsoft.SharePoint.Workflow.SPWinOETaskService.CreateTaskWithContentTypeInternal(Guid taskId, SPWorkflowTaskProperties properties, Boolean useDefaultContentType, SPContentTypeId ctid, HybridDictionary specialPermissions) [4120] at Microsoft.SharePoint.Workflow.SPWinOETaskService.CreateTask(Guid taskId, SPWorkflowTaskProperties properties, HybridDictionary specialPermissions) Exception has been thrown by the target of an invocation. [4120] at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) [4120] at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) [4120] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) [4120] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [4120] at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) [4120] at System.Workflow.Activities.CallExternalMethodActivity.Execute(ActivityExecutionContext executionContext) [4120] at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) [4120] at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) [4120] at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) [4120] at System.Workflow.Runtime.Scheduler.Run()
One of the properties I was trying to push into the ExtendedProperties propertybag was null, I changed that and we were past this exception. The lesson here is to grab the InnerException of your fault handler and hope that it returns something descriptive, i guess :-)
In case you are wondering, the trace viewer i use is called DebugView, brought to my attention by the industrious Eric Jobin.
Another issue I was having with the InfoPath form though, was quite a bit harder to track down, but a stupid mistake in the long run. I was creating a link to the infopath form with an item id in the query string, but it was the wrong item, wrong list :-) The error I was getting was something extremely vague and Sharepointy, but what helped me figure it out was enabling (in a google friendly fashion) – verbose sharepoint exception reporting – verbose sharepoint error handling – full Moss exception handling – good enough.
This is a lot easier than you might think, and you’ve probably done this before with other web applications you’ve needed to debug. Open the Web.Config for your spsite and find:
<SharePoint> <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
and change it to:
<SharePoint> <SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="true">
then find the node:
<system.web> <customErrors mode="On" />
and set it to “Off”
you may have to recycle your app pool before changes take effect, but you should now see a stack trace when you cause an error – hopefully more helpful than the generic Unknown Exception that we had all come to love.
peace, and happy coding…
trinity
Chris O’Brien’s blog
Chris O’Brien’s blog. – Great SharePoint resource.
