I am having a strange issue with a macro not rendering in the backoffice. It used to work and it stopped suddenly and with a strange error message.
An exception of type 'System.InvalidOperationException' occurred in umbraco.dll but was not handled in user code
Additional information: Cannot return the IPublishedContent because the UmbracoHelper was constructed with an UmbracoContext and the current request is not a front-end request.
It looks like the offending code is retrieving the Macro Paramaters but I do that with other macros and it works fine.
The macro has one parameter defined projectNo which is used to drive some Javascript further down in the view.
The workaround for now is to not render the macro in the backoffice and I think we can live with that; maybe there is something I misunderstand here about how this works so anything would help really.
Macro not rendering in the backoffice
Hi all,
I am having a strange issue with a macro not rendering in the backoffice. It used to work and it stopped suddenly and with a strange error message.
It looks like the offending code is retrieving the Macro Paramaters but I do that with other macros and it works fine.
Any ideas what might be causing this?
Thanks!
Hi Matei
What version of Umbraco are you using?
Can you show the macro code?
Thanks,
Alex
Hi Alex,
Umbraco version is 7.6.1. Here are the offending lines in the partial view:
The macro has one parameter defined
projectNo
which is used to drive some Javascript further down in the view.The workaround for now is to not render the macro in the backoffice and I think we can live with that; maybe there is something I misunderstand here about how this works so anything would help really.
Cheers!
Hi Matei
If you macro contains javascript - definitely do not render it in the backend. It can cause the unpredictable problems.
Thanks,
Alex
is working on a reply...