Error while evaluating expression: CurrentAliasPath

hadi tag asked on September 6, 2015 09:38

hi,

i create multi site in my kentico(8.1) application.and everything works properly

But sometimes I get this error:


Source: MacroResolver Event code: RESOLVEDATAMACRO User ID: 53 User name: administrator IP address: 1 Description: Error while evaluating expression: CurrentAliasPath

Object reference not set to an instance of an object.

at CMS.DataEngine.AbstractInfo1.RegisterProperties()at CMS.DocumentEngine.TreeNode.RegisterProperties()at CMS.Base.RegisteredProperties1.GetRegisteredProperties()at CMS.DocumentEngine.TreeNode.TryGetProperty(String columnName, Object& value)at CMS.DataEngine.BaseInfo.TryGetProperty(String columnName, Object& value, Boolean notNull)at CMS.MacroEngine.MacroResolver.GetObjectValue(Object objectToCheck, String columnName, EvaluationContext context)at CMS.MacroEngine.MacroResolver.CheckDataSourcesInternal(String expression, EvaluationContext context)at CMS.MacroEngine.MacroResolver.CheckDataSourcesInternal(String expression, EvaluationContext context)at CMS.MacroEngine.MacroResolver.CheckDataSourcesInternal(String expression, EvaluationContext context)at CMS.MacroEngine.MacroResolver.CheckDataSources(String expression, EvaluationContext context)at CMS.MacroEngine.ExpressionEvaluator.EvaluateDataMember(Boolean& match, Boolean& securityPassed)at CMS.MacroEngine.ExpressionEvaluator.EvaluateInternal(Boolean& match, Boolean& securityPassed)at CMS.MacroEngine.ExpressionEvaluator.Evaluate()at CMS.MacroEngine.MacroResolver.ResolveMacroExpression(ResolveExpressionSettings settings)

How can I fix this problem?

Recent Answers


Lukas Martinak answered on September 6, 2015 13:56

Hi, there should be an Event URL in the event details as well. I'd recommend going to the detailed Macro debug and refreshing the page mentioned in the Event log details, so you can figure out which component causes the issue. Then, you will figure out the location of the failing macro and proceed further. Maybe, there is no Document context available (e.g. you are using CurrentAliasPath of a document that doesn't exist in the current context), so the macro doesn't make sense in that location.

If you could give us a URL and the failing macro, we would help you more...

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on September 7, 2015 11:05

Hi,

since the eventlog reports the error for the user 'administrator' I assume this error occurs while viewing the design tab of a page template in the page templates module where, as Lukas mentioned, their is no current document context. You could (should) program defensibly and first check if current document != null!

Cheers,

David

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.