Sitecore 8.1 rev. 160302.
Looking into my logfiles, there are lots of errors such as:
Job Started: Index_Update_IndexName=RSearch ... Exception: System.NullReferenceException Message: Object reference not set to an instance of an object. Source: System.Web at System.Web.Security.Roles.IsUserInRole(string username, string roleName) at Sitecore.Security.Accounts.RolesInRoleProvider.IsUserInRole(User user, Role targetRole, Boolean includeIndirectMemberships) ...
This is just about everytime an index rebuild is triggered. Its almost identical to this: https://community.sitecore.net/developers/f/8/t/549 that seems to remain unresolved.
I've been over the security/roles with a fine-tooth comb and come up with nothing.
Any help will be massively appreciated. ty
UPDATE
Fixed with the help of Sitecore support. It turned out to be a conflict with .net 4.5.2 and IIS tracing. In brief, the Sitecore crawler ends up in System.Web.Security.Roles.IsUserInRole where there are these lines of code:
public static bool IsUserInRole(string username, string roleName)
{
bool flag3;
if (HostingEnvironment.IsHosted && EtwTrace.IsTraceEnabled(4, 8))
{
EtwTrace.Trace(EtwTraceType.ETW_TYPE_ROLE_BEGIN, HttpContext.Current.WorkerRequest);
}
...
}
Basically, there's no null guard on HttpContext.Current which turns out to be null for the crawler. With IIS Failed Request Tracing enabled, the code ventured into the if branch and choked.
The fixes are:
- Turn IIS tracing off OR
- Turn down the verbosity of IIS tracing from VERBOSE to WARNING OR
- Upgrade to .Net Framework 4.6.1 onwards (this contains a null guard check on HttpContext.Current in the System.Web DLL)