Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a weird question... there is a site that has been running for 2 or 3 years without any problem. It is implemented in 7.6.5, but suddenly some pages started to show the null reference exception.
I have this code:
@Model.Content.GetVortoValue("salaPrensaImagenEncabezado")
it returns this: Umbraco.Core.Udi[]
It doesn't show any exception.
But when I change to this:
@Model.Content.GetVortoValue<IPublishedContent>("salaPrensaImagenEncabezado")
or
@Model.Content.GetVortoValue<IPublishedContent>("salaPrensaImagenEncabezado").Url
note: spaces before and after IPulblishedContent are intentionally to be shown. If I remove those spaces the post question hides the casting.
it shows the null reference exception.
It was working prefectly. This property "salaPrensaImagenEncabezado" actually has value.
These make no difference:
<EnablePropertyValueConverters>true</EnablePropertyValueConverters>
or <EnablePropertyValueConverters>false</EnablePropertyValueConverters>
<EnablePropertyValueConverters>false</EnablePropertyValueConverters>
Error seems to be adding the IPublishedContent . Do I need an "using" or something on the top of the file? I have this heading the file:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Our.Umbraco.Vorto.Extensions; @using ContentModels = Umbraco.Web.PublishedContentModels; @{ Layout = "Master.cshtml"; }
Thank you very much in advance.
I found the way to fix this:
@((Model.Content.GetVortoValue<IEnumerable<IPublishedContent>>("salaPrensaImagenEncabezado").ElementAt(0)).Url)
Can somebody explain to me why the previous code worked since 2017 and suddenly now, it is not working anymore?
Old code, working until few days ago:
Please!!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
IPublishedContent showing null object reference error using Vorto
I have a weird question... there is a site that has been running for 2 or 3 years without any problem. It is implemented in 7.6.5, but suddenly some pages started to show the null reference exception.
I have this code:
it returns this: Umbraco.Core.Udi[]
It doesn't show any exception.
But when I change to this:
or
note: spaces before and after IPulblishedContent are intentionally to be shown. If I remove those spaces the post question hides the casting.
it shows the null reference exception.
It was working prefectly. This property "salaPrensaImagenEncabezado" actually has value.
These make no difference:
or
<EnablePropertyValueConverters>false</EnablePropertyValueConverters>
Error seems to be adding the IPublishedContent . Do I need an "using" or something on the top of the file? I have this heading the file:
Thank you very much in advance.
I found the way to fix this:
Can somebody explain to me why the previous code worked since 2017 and suddenly now, it is not working anymore?
Old code, working until few days ago:
Please!!
is working on a reply...