Umbraco Content/Media/Member Service Failing Due to Examine
Hi All!
Hope everyone is doing well! We've come across a very strange issue with the new Umbraco Content Service (also applies to Member and Media Services) and we wanted to detail and see if others have encountered this and suggestions for best fixes:
Basically, if we do something like:
var myNode = Umbraco.TypedMedia(myNodeId)
And then do something like:
if (myNode.HasProperty("myProperty"))
...
This throws a YSOD "
'Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'HasProperty'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'HasProperty'
Looking further at this, it turns out something has happened with Examines index (needs rebuilding / has no or out of date data). Rebuilding resolved this.
But the problem this leaves is the end developer then has no safe way to test the data coming back (so far as I can see!) .... (i.e. the whole point of doing if (myNode.HasProperty && myNode.HasValue ... ) is to prevent exactly this scenario.
So firstly, has anyone else experienced this? We do not yet know the exact cause of Examines data no longer being valid (website has not been restored/rebuilt/recycled or anything like this) and second, can anyone suggest the best way around this?
It is great that Examine and the dashboard tools come into the core Umbraco application, just not entirely sure how we would resolve an issue like this?
Umbraco Content/Media/Member Service Failing Due to Examine
Hi All!
Hope everyone is doing well! We've come across a very strange issue with the new Umbraco Content Service (also applies to Member and Media Services) and we wanted to detail and see if others have encountered this and suggestions for best fixes:
Basically, if we do something like:
var myNode = Umbraco.TypedMedia(myNodeId)
And then do something like:
if (myNode.HasProperty("myProperty"))
...
This throws a YSOD "
'Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'HasProperty'
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'Umbraco.Web.Models.PublishedContentBase' does not contain a definition for 'HasProperty'
Looking further at this, it turns out something has happened with Examines index (needs rebuilding / has no or out of date data). Rebuilding resolved this.
But the problem this leaves is the end developer then has no safe way to test the data coming back (so far as I can see!) .... (i.e. the whole point of doing if (myNode.HasProperty && myNode.HasValue ... ) is to prevent exactly this scenario.
So firstly, has anyone else experienced this? We do not yet know the exact cause of Examines data no longer being valid (website has not been restored/rebuilt/recycled or anything like this) and second, can anyone suggest the best way around this?
It is great that Examine and the dashboard tools come into the core Umbraco application, just not entirely sure how we would resolve an issue like this?
Many thanks for any input!
Kind Regards,
Roger Davies
is working on a reply...