Bug in using WebAPI and Tracking


I'm using episerver find and unified search, when I use tracking on Web API to search I get the following error:

Object reference not set to an instance of an object.

at EPiServer.Find.TrackContext..ctor()
at EPiServer.Find.SearchExtensions.GetProjectedResult[TResult](ISearch`1 search, SearchContext context)
at EPiServer.Find.SearchExtensions.GetResult(ITypeSearch`1 search, HitSpecification hitSpecification, Boolean filterForPublicSearch)
at Bendigo.Core.Services.SiteSearchService.Search(SearchResultsPage searchResultsPage, String keywords, Nullable`1 categoryId, Int32 page, Int32 pageSize, Boolean track).

as a note: I've seen the "https://world.episerver.com/forum/developer-forum/EPiServer-Search/Thread-Container/2018/3/unified-search---statistics-tracking-results-in-error/" and this is not my case.

This is related to use WebAPI and Tracking.

Hint: Look at HttpContext.Current.Session in TrackContext and remember HttpContext.Current.Session is null with WebAPI

Sep 09, 2019 7:33