Macro in PublishedSearchResult Content throw ArgumentNullException
Hello,
I work with Umbraco version 8.9.1.
I have a simple macro video to add local video (in Umbraco Media) in place of public url video.
I also use a Search (IPublishedContentQuery) that return me a IEnumerable of PublishedSearchResult.
It works well except when I use my macro video in a field, then the field (here body) throw an error : System.ArgumentNullException.
Apparently it's the mapping that cannot be done. The property is in the item.Content.Property and the item.Content.HasValue(property) return true.
public List<IPublishedProperty> CheckTheValues(PublishedSearchResult item, string searchValue)
{
foreach (var property in item.Content.Properties) // return me "body"
{
if (!item.Content.HasValue(property.Alias)) // HasValue return true
continue;
var contentValue = item.Content.Value(property.Alias); // throw System.ArgumentNullException
...
}
}
I suppose that's because the mapping cannot translate the macro in something known but it's awkward because I have the html code in my cache like <?UMBRACO_MACRO ... />.
Is there a way to add an alternative content to the macro (not on the video tag), I think about alt property that exists on html img to write an alternative text if the image doesn't exists ?
If not, is there a way to force to get the html code ? (to get the tag umbraco_macro in place of an error)
If not, is there a way to ignore the "not understand" part tags of the content "body" ? so return all except this macro tag.
If not, except with a try catch continue, is there a proper way to ignore this result from my search ?
Macro in PublishedSearchResult Content throw ArgumentNullException
Hello,
I work with Umbraco version 8.9.1. I have a simple macro video to add local video (in Umbraco Media) in place of public url video. I also use a Search (IPublishedContentQuery) that return me a IEnumerable of PublishedSearchResult. It works well except when I use my macro video in a field, then the field (here body) throw an error : System.ArgumentNullException.
Apparently it's the mapping that cannot be done. The property is in the item.Content.Property and the item.Content.HasValue(property) return true.
I suppose that's because the mapping cannot translate the macro in something known but it's awkward because I have the html code in my cache like
<?UMBRACO_MACRO ... />
.Thanks a lot !
Hello, no one have any idea, please. It's really blocking for me.
is working on a reply...