Friday, November 26, 2010

SharePoint: Diagnose “Error loading and running event receiver” problem

We developer gain experience as we work more and spend more time on learning and applying. Mostly, we only care about the how expertise developers are, in implementing things. But I also emphasis on another dimension of experience: “How expertise developers are in fixing or diagnosing problem”. This diagnosing expertise can mainly be gained with more and more real life working experience. Maybe everyday or every week or every moth, you face a problem and find out the solution by debugging or writing logs or finding solution on the internet. That’s how a problem  is resolved but this may lead you to an experienced person in solving similar problems or at least helping you diagnosing similar problems.


Ok, I’m beating around the bush, let me come to the real problem that the post is all about. If you have come around the problem that your event receiver is not running and you found that in log file the error message is something like “Error loading and running event receiver…” then you need to find out what’s wrong with the receiver. As the error message says, the problem might be with loading the event receiver or running the event receiver. You need to find out first if the problem is in loading event receiver. If the problem is in loading event receiver the fix the problem first.  To find out the issue, you can use the following steps:

Step 1: Event Receiver Loading Problem?

You need to find out first if your event receiver is executing or being invoked. The simplest way might be to use logging. If you already have logging capability in your code, you can use the logging. But make sure logging doesn’t have any permission related problem. The easiest way to resolve the issue is to allow user ‘everyone’ to have full control in the file/folder where the log file will be saved. However, revert the permission once you are done with diagnosis.

If your logging works from event receiver, then clearly, the problem is not loading receiver.


Step 2: Event Receiver Running Problem?

From step 1 if you find the problem is not loading problem then surely the problem is in running the event receiver. So put proper logs in the event receiver in tracking the problem.

No comments:

Post a Comment