Rendering started (macro: Empty, type: 6, cacheRate: 0)
0.004624
0.000066
umbracoMacro
MacroEngine script added (empty.cshtml)
0.004649
0.000025
umbracoMacro
Loading IMacroEngine script
0.004664
0.000015
macro
Error loading MacroEngine script (file: empty.cshtml, Type: '' Object reference not set to an instance of an object. at umbraco.NodeFactory.Node.getCurrentNodeId() at umbraco.macro.loadMacroScript(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
call RenderMacroContent() from base error
I am using umbraco v 4.11.6 and try to create a base extension to return some html code to a ajax call.
However, I encounter the follow error
Object reference not set to an instance of an object.
at umbraco.NodeFactory.Node.getCurrentNodeId()
at umbraco.macro.loadMacroScript(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
This is the code trigger the error
empty.cshtml contains two statement only
If I change bodyText to some static text, the base extension work fine.
Is it a bug or somthing?
Thanks for help.
looks like you are hitting the current page/node issue
http://labs.vertic.com/2012/05/01/rendering-umbraco-4-content-in-a-service/
just make sure you set the page id first
calling
always comes back with an error until I added
Which seems a bit mad but totally works !
Thank you rob for providing this answer.
I agree, it seems mad, but it does the job.
is working on a reply...