GetCurrentActualNode returns null

Posted by Community Admin on 04-Aug-2018 19:41

GetCurrentActualNode returns null

All Replies

Posted by Community Admin on 20-Jan-2014 00:00
VERSION: 6.1
I am trying to get my custom inbound pipe to search the branch of the tree that the user is currently in. 
My Code is filtering the information thanks to some other threads on here. 
But now i want to get it to use the current node as a reference point. 
the problem is however that the getActualCurrentNode() returns null, actually i have tested getCurrentNode(), getActualCurrentNode.SiteMap, CurrentNode, SiteMapBase.CurrentNode. Nothing is bringing back any results for me. 

Am i coding this wrong? 
This is from my custom_search class  which inherits pageInBound, and the Global.Asax file runs this on application_start. 
PageNode node = null;
SiteMapNode currentNode = SiteMap.CurrentNode;
 
var pageNode = currentNode as PageSiteNode;
 
 
while (pageNode == null) //Debug test by entering an infinite loop
      pageNode = SiteMapBase.GetActualCurrentNode();
 
//if currentNode is found, the rest of the code should function as per normal.
 if (item.Item is WrapperObject && ((WrapperObject)item.Item).WrappedObject != null)
 
      node = (PageNode)((WrapperObject)item.Item).WrappedObject;
else
      node = ((PageNode)item.Item);
if (node.Page != null && node.Page.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
       while (true)
        
             node = node.Parent; //gets the nodes parent information.
                         
              //if criteria is met the page will be filtered out towards it's specifications.
              if(node.Title.Equals(pageNode.Title,StringComparison.InvariantCultureIgnoreCase))
              
                  //filtered results

and when i put in the code for the infinite loop the re-indexing will never find the actual current node. 
The error it gives me when i run says "Object Reference with no Instance of Object"
And here is the Error Log
----------------------------------------
Timestamp: 1/20/2014 8:53:25 PM
 
Message: HandlingInstanceID: 596bf716-1ac6-4d9f-a4cc-82de7421b81a
An exception of type 'System.NullReferenceException' occurred and was caught.
-----------------------------------------------------------------------------
01/20/2014 15:53:25
Type : System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Object reference not set to an instance of an object.
Source : SitefinityWebApp
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void PushData(System.Collections.Generic.IList`1[Telerik.Sitefinity.Publishing.PublishingSystemEventInfo])
HResult : -2147467261
Stack Trace :    at SitefinityWebApp.Search_Delimiter_Test.PushData(IList`1 items) in c:\inetpub\sitefinity61\Search_Delimiter_Test.cs:line 131
   at Telerik.Sitefinity.Publishing.Pipes.PageInboundPipe.ToPublishingPoint()
   at Telerik.Sitefinity.Publishing.PublishingManager.InvokeInboundPushPipes(PublishingPoint point, String providerName)
   at Telerik.Sitefinity.Publishing.Web.Services.PublishingAdminService.ReindexSearchContent(String providerName, String pointId)
   at SyncInvokeReindexSearchContent(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
 
Additional Info:
 
MachineName : SITEFINITY61
TimeStamp : 1/20/2014 8:53:25 PM
FullName : Telerik.Sitefinity.Utilities, Version=6.2.4910.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
AppDomainName : /LM/W3SVC/2/ROOT-7-130347245681907483
ThreadIdentity :
WindowsIdentity : SiteFinity61\iap_apps_user
 
 
Category: ErrorLog
Priority: 0
EventId: 90000
Severity: Error
Title:Enterprise Library Exception Handling
Machine: SITEFINITY61
App Domain: /LM/W3SVC/2/ROOT-7-130347245681907483
ProcessId: 1212
Process Name: c:\windows\system32\inetsrv\w3wp.exe
Thread Name:
Win32 ThreadId:3208
Extended Properties:
----------------------------------------

The Error log says the error is on line 131, that is a comment line before the following line:
if(node.Title.Equals(pageNode.Title,StringComparrison.InvariantCultureIgnoreCase))
Posted by Community Admin on 21-Jan-2014 00:00
Hello,

First, let me explain some basics about the search functionality.
The publishing system, that uses so called pipes, only gathers the information and stores it in the search index (for example). Then when the user searches for this information (using the SearchResults widget for example), the results are extracted and shown (the information is already stored - all of it, not just the results).
When you click reindex, or you publish a page, it is absolutely normal that the current node is null. After all you are not even in the frontend.
I believe you are trying to see if the page that the user is on is a parent of the page that will be shown in the results. I think you have another ticket oppened with the same problem.
Lets move the discussion there, or do you think this thread should still be oppened for some reason?

Regards,
Bonny
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
This thread is closed