Unfortunately there is no fix for the legacy DynamicNode/Razor Macro however it seems that the also affected MVC templates/Partial View Macros might be fixed in the v7.1.5 nightlies.
I have an unproven theory, this error seems either occur to .Any() or .Count() and happens to the now legacy DynamicNode and also to the DynamicPublishedContnt (CurrentPage) but not to IPublishedContent (Model.Content). So I think that these are extension methods and of course dynamics doesn't have extension methods, so there is a clever mechanism in Umbraco to support extension methods with dynamics (FindAndExecuteExtensionMethod). I think what happens is that some third party assemblies also have extension methods for .Count() or .Any() and for some reason the FindAndExecuteExtensionMethod finds these first but as they don't match the type we end up with this exception.
However, as I said, it seems that DynamicPublishedContent may now not have this issue in v7.1.5....
Would surely need further testing to be sure, but that could be an explanation. Methods such as .Any() or .Count() "disappear" when the extension methods cannot be inferred either by the default runtime C# binder or by our own extended finder (which tries to find extension methods for dynamics). I think that our finder is not as smart as the C# binder, because infering the right method based upon parameters, etc. is a complex task (see the C# specs...) -- and potentially an expensive one.
So to some extend... our dynamic support of extension methods prob. has flaws that would be complex & expensive to solve.
Exactly, I have been trying to prove it. I can replicate easily on v7.1.4 but when I tried to do it with current v7.1.5 source I cannot replicate. I will have another attempt :-)
Just wanted to chime in, even though I am not using ServiceStack. It's the SolisSearch package that's causing my problem.
I get the error: "Umbraco.Web.Models.DynamicPublishedContentList does not contain a definition for 'Any'" I tried upgrading to 7.15 but the error persists.
This also happens to me when adding the ImageResizer.Plugins.SimpleFilters.dll lose the ability to use Count() 'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Count'
I'm running a fresh install of 7.1.6 assembly: 1.0.5350.25714
I have confirmed that ServiceStack.dll will break the .Any() and .Count();
We have a project utilized some components of ServiceStack but did not require the base ServiceStack.dll to be in the references or the bin. So I took it out and the .Count() and .Any() in our navigation now works.
Adding ServiceStack reference breaks extension methods
Whenever we install ServiceStack 3.9.x on a new v7 install we get the error message:
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Any'
Removing ServiceStack.dll resolves the issue.
Does anyone know why or how we can work around it?
Hi Tim,
Unfortunately there is no fix for the legacy DynamicNode/Razor Macro however it seems that the also affected MVC templates/Partial View Macros might be fixed in the v7.1.5 nightlies.
Jeavon
Ok thanks Jeavon, any idea what's causing it? Happy to write a fix if someone is?
Hi Tim,
I have an unproven theory, this error seems either occur to .Any() or .Count() and happens to the now legacy DynamicNode and also to the DynamicPublishedContnt (CurrentPage) but not to IPublishedContent (Model.Content). So I think that these are extension methods and of course dynamics doesn't have extension methods, so there is a clever mechanism in Umbraco to support extension methods with dynamics (FindAndExecuteExtensionMethod). I think what happens is that some third party assemblies also have extension methods for .Count() or .Any() and for some reason the FindAndExecuteExtensionMethod finds these first but as they don't match the type we end up with this exception.
However, as I said, it seems that DynamicPublishedContent may now not have this issue in v7.1.5....
Jeavon
Would surely need further testing to be sure, but that could be an explanation. Methods such as .Any() or .Count() "disappear" when the extension methods cannot be inferred either by the default runtime C# binder or by our own extended finder (which tries to find extension methods for dynamics). I think that our finder is not as smart as the C# binder, because infering the right method based upon parameters, etc. is a complex task (see the C# specs...) -- and potentially an expensive one.
So to some extend... our dynamic support of extension methods prob. has flaws that would be complex & expensive to solve.
Exactly, I have been trying to prove it. I can replicate easily on v7.1.4 but when I tried to do it with current v7.1.5 source I cannot replicate. I will have another attempt :-)
Cool, sounds like it's fixed which can only be a good thing
Hi,
Just wanted to chime in, even though I am not using ServiceStack. It's the SolisSearch package that's causing my problem.
I get the error: "Umbraco.Web.Models.DynamicPublishedContentList does not contain a definition for 'Any'" I tried upgrading to 7.15 but the error persists.
Cheers
Bjørn
This also happens to me when adding the ImageResizer.Plugins.SimpleFilters.dll
lose the ability to use Count()
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Count'
I'm running a fresh install of 7.1.6 assembly: 1.0.5350.25714
I have a Umbraco 7.1.6 installation, assembly: 1.0.5350.25714 where I use the .Any() method on a dynamic expression, where I get an exeption like:
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any' ... and a similar error if I use Count method.
The code was working before, but after installing the Analytics package for Umbraco 7, it seems to conflict with the methods.
/Bjarne
I have confirmed that ServiceStack.dll will break the .Any() and .Count();
We have a project utilized some components of ServiceStack but did not require the base ServiceStack.dll to be in the references or the bin. So I took it out and the .Count() and .Any() in our navigation now works.
See http://issues.umbraco.org/issue/U4-6438
is working on a reply...