0

We are using Azure B2C for Login into Our website, but in CM server we are getting below error . The Same code is working in CD server. I don't remember what i have missed in CM server (any config entry or any setting).

Object reference not set to an instance of an object.

Description: An unhandled exception occurred. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 10:      
Line 11: Claim _B2CEmailAuthenticationClaim = cookieAuthenticationTicket.Identity.Claims.Where(x => x.Type.Equals(UserProfileDetails.Email)).Single();
Line 12: Sitecore.Analytics.Tracker.Current.Session.Identify("shailesh.kumar.sahu@e.com");

In Log File

9048 07:11:07 ERROR Exception when executing agent aggregation/contactProcessing
Exception: System.Collections.Generic.KeyNotFoundException
Message: The given key was not present in the dictionary.
Source: mscorlib
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Sitecore.Analytics.Aggregation.Data.Contact.ContactWorkDispatcher.TryGetNext(ContactWorkItem& workItem)
   at Sitecore.Analytics.Aggregation.Data.Contact.ContactProcessingAgent.Execute()
   at Sitecore.Analytics.Core.BackgroundService.Run()
  • I'm not sure but can you just do a comparison of the different config file between your CM and CD? You can use winmerge – Hishaam Namooya May 22 '17 at 8:01
2

Tracker.Current really is only meant to be run on the Content Delivery servers and not the Content Management server. It would seem to me, you are executing code at a time where Tracker isn't available, without checking to see if Tracker is enabled.

When Tracker isn't available, calls like Sitecore.Analytics.Tracker.Current.Session... will generate an object not found error because of Tracker.Current = null.

I advise, anywhere where you are executing Tracker.Current, that you check to see if Tracker.Current is equal to null.

If so, you may need to reconfigure how you are obtaining contact/interaction data by using the ContactManager, ContactRepository, or SharedSessionManager classes.

  • reconfigure :- Compare the Config files from CD ?????? – Shailesh May 23 '17 at 6:20
  • No, code differently. Your use case isn't fully thought out enough for me to provide a more quality answer. If you'd like, add some additional detail about what exactly is occurring on the CM server that is not working. – Pete Navarra May 23 '17 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.