In SharePoint 2007 you can make features dependent on each other so that FeatureB can only be activated if FeatureA is. If this isn't the case it will prompt you with a message to activate FeatureA first:
Now, when you mark FeatureA as HIDDEN the Feature Dependency will automagically active it when FeatureB is activated ! How cool is that !? This means you can have FeatureA with all your content types and columns and FeatureB with some code to manipulate those items with the guarantee that they have been created.
This voids the following question: "What if you have a feature with Site Columns and Content Types in XML, but also code in the Feature Receiver that manipulates those items ? Will the code run before or after the XML ?"
Problem
I was receiving multiple complaints from clients with the above errors in the machine's Event Log:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Besides the errors it was no longer possible to manage the Web Sites using IIS Manager which gave "The path specified cannot be used at this time."
Approach
Searching on the Web had led me to believe this would all be fixed when SharePoint 2007 Service Pack 1 released, so I upgraded all (problematic and non problematic) servers to
- .NET 2.0 SP1
- .NET 3.0 SP1
- WSS 3.0 SP1
- MOSS 2007 SP1
The problems remained however...
I found out that an iisreset would solve the issue but this really wasn't feasible to do every day.
Next I found that just restarting the Windows SharePoint Services Timer Service (SPTimerV3) also did the trick and was less intrusive:
C:\>net stop sptimerv3
The Windows SharePoint Services Timer service is stopping.
The Windows SharePoint Services Timer service was stopped successfully.
C:\>net start sptimerv3
The Windows SharePoint Services Timer service is starting.
The Windows SharePoint Services Timer service was started successfully.
Other suggested solutions include:
- recreating the SSP
- reset the service account credentials
- Timer Job Shocker
But none of the above solutions seem to be the definite answer.
Solution
Microsoft recently released the following KB with hotfix:
FIX: You may be unable to manage IIS 6.0 by using Server Manager if two threads access IIS 6.0 at the same time
References
http://blogs.neudesic.com/blogs/grant_earl/archive/2007/04/05/5465.aspx
http://glorix.blogspot.com/2007/09/attempted-to-read-or-write-protected.html
http://forums.asp.net/t/675515.aspx
http://sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/Post.aspx?ID=47
If you declare your Site Columns and Content Types in XML to deploy them as a Site Collection feature, you must make sure to ALWAYS include the node. If you leave it out then your Content Type will not have any of the inherited fields of the parent Content Type !!!
<ContentType
ID="0xAAA943C84244BF338428AA48DA19"
Name="Proposal"
Group="Custom Content Types">
<FieldRefs />
ContentType>