SharepointLoggger not marked as Serializable - Workflow Activities Fail

Dec 18, 2009 at 1:58 PM

I'm starting to see this error with more frequency in my workflow activities. I suspect that as more of the activities are dehydrated and become subject to dehydration/rehydration the workflows activities will fail due to the lack of serialization. This solution is being delivered to a customer and I'd like to be able to make sure that CM is maintained across code base; therefore I am hesitant to apply a fix to this myself.

 

My option is to remove ULS logging from the workflow activities or break the CM.

 

Coordinator
Dec 18, 2009 at 2:03 PM

I'm not 100% sure I fully understand the issue.  I would think this should only be a problem if you are including the logger as member of your activity.  Can you explain why you think the workflow trying to serialize the logger?

Thanks,

Chris

Dec 18, 2009 at 3:13 PM

I am not explicitly serializing the logger. The logger is being used to log activities and exceptions being raised within the activities, most specifically in some of the assemblies that are being used by the activities.  I realize that there is an exception management/logging capability intrinsic to WWF. It looks like I may have to break CM or remove Moss Logger from the entire call stack.

 

Coordinator
Dec 18, 2009 at 5:47 PM

I don't believe that the runtime will try to serialize the logger unless you are holding a reference to the logger on one of your objects.  If you use a pattern when logging of fetching the logger from the service locator and use it rather than retaining a reference you should avoid this problem.  Are you holding onto an instance in the logger in your classes?

Coordinator
Dec 18, 2009 at 7:43 PM

Are saying that you are not retaining the sharepoint logger as a member of any of your classes? If you are not retaining a reference as a member of one of your classes and the problem occurs then this doesn't make a lot of sense to me because it would mean you can't use any non-serializable class in any class used by a SharePoint workflow without encountering this issue.

The pattern we encourage is to get the logger from service locator and use it when you need it rather than retain a reference to it as a member.  If you are not doing this and still encountering the problem, can you give us more specific information and minimimally we will make sure it gets addressed in our next release for 2010.

Thanks,
Chris

Dec 22, 2009 at 1:39 PM

Here's what I've done that is probably causing the problem - it was a misinterpretation of the the examples under the Key Scenarios..


I have a class instance variable ( ILogger logger);

the class constructor performs a GetInstance and an assignment to the logger)

logger = SharepointServiceLocator.Current.GetInstance<ILogger>("INLRm");


I re-read the guidance and the only explicit prohibition was against directly calling the logger without going through the service locator.

Looks like I have some work to do.


Guy




From: [email removed]
To: [email removed]
Date: Fri, 18 Dec 2009 12:43:58 -0800
Subject: Re: SharepointLoggger not marked as Serializable - Workflow Activities Fail [spg:78556]

From: ckeyser
Are saying that you are not retaining the sharepoint logger as a member of any of your classes? If you are not retaining a reference as a member of one of your classes and the problem occurs then this doesn't make a lot of sense to me because it would mean you can't use any non-serializable class in any class used by a SharePoint workflow without encountering this issue.
The pattern we encourage is to get the logger from service locator and use it when you need it rather than retain a reference to it as a member. If you are not doing this and still encountering the problem, can you give us more specific information and minimimally we will make sure it gets addressed in our next release for 2010.
Thanks,
Chris
Read the full discussion online.
To add a post to this discussion, reply to this email (spg@discussions.codeplex.com)
To start a new discussion for this project, email spg@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Dec 22, 2009 at 1:47 PM

Thanks for feedback Guy.  We will take a look at this for our next release and make sure we are explicit on usage pattern.

From: ReleaseTheHounds [mailto:notifications@codeplex.com]
Sent: Tuesday, December 22, 2009 9:39 AM
To: Chris Keyser
Subject: Re: SharepointLoggger not marked as Serializable - Workflow Activities Fail [spg:78556]

From: ReleaseTheHounds


Here's what I've done that is probably causing the problem - it was a misinterpretation of the the examples under the Key Scenarios..


I have a class instance variable ( ILogger logger);

the class constructor performs a GetInstance and an assignment to the logger)

logger = SharepointServiceLocator.Current.GetInstance<ILogger>("INLRm");


I re-read the guidance and the only explicit prohibition was against directly calling the logger without going through the service locator.

Looks like I have some work to do.


Guy



From: [email removed]
To: [email removed]
Date: Fri, 18 Dec 2009 12:43:58 -0800
Subject: Re: SharepointLoggger not marked as Serializable - Workflow Activities Fail [spg:78556]

From: ckeyser

Are saying that you are not retaining the sharepoint logger as a member of any of your classes? If you are not retaining a reference as a member of one of your classes and the problem occurs then this doesn't make a lot of sense to me because it would mean you can't use any non-serializable class in any class used by a SharePoint workflow without encountering this issue.
The pattern we encourage is to get the logger from service locator and use it when you need it rather than retain a reference to it as a member. If you are not doing this and still encountering the problem, can you give us more specific information and minimimally we will make sure it gets addressed in our next release for 2010.
Thanks,
Chris

Read the full discussion online.
To add a post to this discussion, reply to this email (spg@discussions.codeplex.com)
To start a new discussion for this project, email spg@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Read the full discussion online.

To add a post to this discussion, reply to this email (spg@discussions.codeplex.com)

To start a new discussion for this project, email spg@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com