SharePoint / Test-SPContentDatabase incorrectly reports missing features

Summary

It’s a best practice to test the compatibility of a migrated content database against the new target Farm before attaching the database and allowing users to access the migrated sites. This compatibly test is achieved by running Test-SPContentDatabase.

Sounds too easy, right?

Well, I recently worked on a case where “Test-SPContentDatabase” was reporting missing features even though the features were installed and working. The cause was not obvious and the ULS logs didn’t report the actual problem. So, I’m just publishing this quick blog to help the next Sharepoint Admin who encounters this scenario.

 

Problem Description

When executing “Test-SPContentDatabase” you may see reports of “Missing Features” even though the missing features are installed and working.

 

Example:

 

Category         :     MissingFeature

Error            :     True

UpgradeBlocking  :    False

Message         :     Database [SP_Content_DB] has reference(s)
to a missing feature: Id = [49aba86a-e141-455b-b560-4e30fa06be6d],
Name =[my.custom.feature], Description = [],
Install Location = [my.custom.feature].

Remedy         :     feature with Id 49aba86a-e141-455b-b560-

4e30fa06be6d is referenced in the database [SP_Content_DB]
but is not installed on the current farm. The missing
feature
may cause upgrade to fail. Please install any
solution
which contains the feature and
restart upgrade if necessary.


Locations        :     {bed017c8-f1fa-4f35-8606-0b45d202cfcb}

 

If you look ULS logs you will see a generic “Path not found” error.

 

Example:

11/12/2019 11:12:19.24    PowerShell.exe (0x5690)    0x2814    SharePoint Foundation    Object Cache    ai107    Medium    

Failed on try1 to load XML document at path
'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\Template\Features\ my.custom.feature\feature.xml':
System.IO.DirectoryNotFoundException: Could not find a part of the path
'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\Template\Features\ my.custom.feature\feature.xml'.


at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights,
FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy,
Boolean useLongPath, Boolean checkHost)

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, F
ileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path,
FileMode mode, FileAccess access, FileShare share) at System.IO.File.OpenRead(String path)

at Microsoft.SharePoint.SPXmlDocCache.<>c__DisplayClass2.<GetGlobalXmlDocumentFullPath>b__0()

6711b446-2538-4864-8953-dc057c0717e4

 

Cause

The issue is most likely occurring because you are not executing “Test-SPContentDatabase” from a SharePoint Server hosting the “Microsoft SharePoint Foundation Web Application” service, which is a required role by the feature reported a missing.

 

Note: Starting with SharePoint 2016, the “Microsoft SharePoint Foundation Web Application” service is started by default with all role types (Minrole). If the “Microsoft SharePoint Foundation Web Application” service is stopped, you probably have a configured custom role.

 

Solution

To resolve this issue simply run “Test-SPContentDatabase” from a SharePoint Server hosting the “Microsoft SharePoint Foundation Web Application” service.

If you are still seeing missing features, with the same errors reported in this blog and the feature is installed, there may be permissions issue or a problem with the XML formatting.

Leave a Reply