'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
I've just upgraded from 7.0.3 to 7.1.3 and am getting this error on the first partial that loads on my homepage:
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
Server Error in '/' Application.
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
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.DynamicPublishedContentList' does not contain a definition for 'Any'
Source Error:
Line 5: }
Line 6:
Line 7: @if (root.StoreFocus.Any())
Line 8: {
Line 9: foreach (var childPage in root.StoreFocus.Random(1))
Last changes to DynamicPublishedContentList dates back from long time ago and was merged in 7.0 already... so it must come from somewhere else... will try to find time to look into it.
and report the error you're seeing? DynamicPublishedContentList implements both IEnumerable<DynamicPublishedContent> and IEnumerable<IPublishedContent> and because of this, by default the compiler does not know if it should use Any<DynamicPublishedContent>() or Any<IPublishedContent>() and fails. Unless you're actually using a dynamic and then the runtime binder seems to be able to make the diff.
Also could you try
root.StoreFocus.Any<IPublishedContent>()
?
Though I don't see why it would change btw 7.0 and 7.1...
Thank-you for your patience, I've had computer issues.
Result from using
Enumerable.Any(root.StoreFocus)
The type arguments for method 'System.Linq.Enumerable.Any<TSource>(System.Collections.Generic.IEnumerable<TSource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. 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: The type arguments for method 'System.Linq.Enumerable.Any<TSource>(System.Collections.Generic.IEnumerable<TSource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Source Error:
Line 6: }
Line 7:
Line 8: @if (Enumerable.Any(root.StoreFocus)) Line 9: {
Result from using
root.StoreFocus.Any<IPublishedContent>()
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any' 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.DynamicPublishedContentList' does not contain a definition for 'Any'
Source Error:
Line 6: }
Line 7:
Line 8: @if (root.StoreFocus.Any<IPublishedContent>()) Line 9: {
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Random'
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.DynamicPublishedContentList' does not contain a definition for 'Random'
Source Error:
Line 8: @if (Enumerable.Any<IPublishedContent>(root.StoreFocus))
Line 9: {
Line 10: foreach (var childPage in root.StoreFocus.Random(1)) Line 11: {
Line 12: var retailer = Umbraco.Content(childPage.retailer);
I'm not sure where the best place is to post this, but I was able to "solve" an error tied to GetGridHtml() and "does not contain a definition for Any()" in 7.2.0. I realize it may not solve everyone's experience, but perhaps, it will move the community forward.
I am new to Umbraco (we're talking seriously new!). I've been playing with it a few days when suddenly, I was getting the errors it appears some are running into. One positive was that I was running two versions: one was pristine and one was the one I was messing with--and messed up. Note: since I was new, this was not an upgrade scenario
I did a full dependency comparison and hunted for clues based on the limited posts regarding these errors.
Ultimately, the answer lies in the /bin directory. When I ported over files, I brought over another EntityFramework dl: EntityFramework.SqlServer.dll. When that .dll is present in the bin directory, I get the errors above. When I remove it, all is well and things work perfectly.
I had introduced a new project to my solution that had Entity Framework in it, and was a different version, which caused this error for me. Once I removed the dll for the new project from the bin folder this problem went away.
EntityFramework.SqlServer.dll was also the cause of this issue on my 6.1.6 installation - I think it came from EF 6 which I had installed for a custom section, before rolling back to EF 5.
I have also encountered this error.
In my case it was after I have moved from SQL Server Compact to SQL Server 2008.
Not sure if these 2 are related in any way.
Before the change, everything worked normally.
I have also upgraded to the latest version hoping it will solve it. Now I am running 7.2.8. The back-end is ok but the front end is broken
Any ideea?
Have the same problem. whenever i add the Kendo.Mvc.dll i get the same error. i will try to find the older version of the Kendo.Mvc.dll because I'm thinking it might be a different MVC version.
by the way let me know if anyone has seen a nice guide how to implement Umbraco 7 with kendo controls
Update:
The problem solved with the right Kendo.Mvc version
Same here - started with a 7.2.6 installation with CE on local machine; moved it to Windows 2012 Server and SQL 2012. After copying back down to local machine, am now getting this when trying to run against local SQL 2012.
This is the Adrian Ursu kind of issue - appeared in front end after CE-to-SQL conversion.
Rest of the site works, but when trying to call partial view macros, i'm getting this.
Solved (in my case)! I had installed the Export SQL Server Compact package to export my local CE database to SQL Server on the production site.
Successfully uploaded to production and the production site worked just fine. Content was added to production for a month or so.
Local (CE) site continued to work fine, as well, on my local machine with very little content. The minute I backed up the production DB and restored it to full SQL Server on the local box and pointed my local Umbraco site to it, the errors started.
Only by UNINSTALLING the Export SQL Server Compact package did the errors go away.
Lesson learned: you'll need to uninstall Export SQL Server Compact package as soon as you stop using CE and want to use the SQL Server DB the package helps you create.
I just upgraded from 7.2 to 7.4.1 - big leap, I know. Everything was looking good until I received this error.
I had installed NEST 2.0.2. and it was causing the issue with Umbraco.Web.Models.DynamicPublishedContentList. Still not quite sure what the issue is but NEST 2 employs some of the c# 6 'goodness' and this might be causing the issue with 'dynamic'.
FWIW.. I came across this thread after trying out the CoreValueConverters project at https://our.umbraco.org/projects/developer-tools/umbraco-core-property-value-converters
It implemented fine but I wasn't interested in continuing with it so I used Nuget to uninstall the package. That's when I got the same error. I ended up doing the following to get back on track.
Deleted bin folder and rebuilt. (no luck)
Deleted asp.net temp
files--started getting new error ''using
Our.Umbraco.PropertyConverters.Models;''
did a search for
PropertyConverters and found a namespace reference still sitting in
the views/web.config. Deleted the namespace and site came back online.
I noticed also I still had a namespace reference to
I want to echo the resolution of Chuck Kirklen. I too had this problem after using Export SQL Server Compact package, and fixed by uninstalling the package per Chuck's tip.
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
I've just upgraded from 7.0.3 to 7.1.3 and am getting this error on the first partial that loads on my homepage:
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
Server Error in '/' Application.
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
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.DynamicPublishedContentList' does not contain a definition for 'Any'
Source Error:
Line 5: } Line 6: Line 7: @if (root.StoreFocus.Any()) Line 8: { Line 9: foreach (var childPage in root.StoreFocus.Random(1))
Source File: d:\Work\TFS\RegentArcade-branch\Stardust\Views\Partials\StoreFocusPartial.cshtml Line: 7
(StoreFocus is a DocumentType by the way).
The website worked fine before the upgrade. I followed the generic upgrade instructions and used NuGet, merging my web.config afterwards.
Any advice please? I'd rather not go thru the pain of a downgrade.
Cheers
This is the source. Not a lot to it!
Last changes to DynamicPublishedContentList dates back from long time ago and was merged in 7.0 already... so it must come from somewhere else... will try to find time to look into it.
Any ideas where i can look please? I'm unable to continue developing as it is now...
Following code runs fine on my 7.1.4 devt environment (with Test being a content type):
And content.Test is a dynamic, underlying type being DynamicPublishedContentList.
So... still trying to figure out what might be wrong. Sorry...
Note that the following code fails:
whereas the following code works:
Don't know if it helps...
Could help debugging...
Can you try to replace
by
and report the error you're seeing? DynamicPublishedContentList implements both IEnumerable<DynamicPublishedContent> and IEnumerable<IPublishedContent> and because of this, by default the compiler does not know if it should use Any<DynamicPublishedContent>() or Any<IPublishedContent>() and fails. Unless you're actually using a dynamic and then the runtime binder seems to be able to make the diff.
Also could you try
?
Though I don't see why it would change btw 7.0 and 7.1...
Could it be that the id being passed into Umbraco.Content is null or for a node that has been deleted or is unpublished?
Thank-you for your patience, I've had computer issues.
Result from using
Enumerable.Any(root.StoreFocus)
The type arguments for method 'System.Linq.Enumerable.Any<TSource>(System.Collections.Generic.IEnumerable<TSource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. 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: The type arguments for method 'System.Linq.Enumerable.Any<TSource>(System.Collections.Generic.IEnumerable<TSource>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Source Error:
Line 6: } Line 7: Line 8: @if (Enumerable.Any(root.StoreFocus)) Line 9: {
Result from using
root.StoreFocus.Any<IPublishedContent>()
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any' 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.DynamicPublishedContentList' does not contain a definition for 'Any'
Source Error:
Line 6: } Line 7: Line 8: @if (root.StoreFocus.Any<IPublishedContent>()) Line 9: {
Damn. Last one: Enumerable.Any<IPublishedContent>(root.StoreFocus)
?
slight progress!
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Random'
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.DynamicPublishedContentList' does not contain a definition for 'Random'
Source Error:
Line 8: @if (Enumerable.Any<IPublishedContent>(root.StoreFocus)) Line 9: { Line 10: foreach (var childPage in root.StoreFocus.Random(1)) Line 11: { Line 12: var retailer = Umbraco.Content(childPage.retailer);
Source File: d:\home\site\wwwroot\Views\Partials\StoreFocusPartial.cshtml Line: 10
FYI, i'm back on 7.0.2 now having rolled back my source control and still getting these issues...
Aha. So 7.0.2 also has the issue, so it's not a "new" issue with 7.1 - correct?
I think I'm starting to understand where it's coming from...
It first occured straight after my upgrade to 7.1.x, but seems it's showing same issue in 7.0.2 now...
confused.com!!!
It first occured straight after my upgrade to 7.1.x, but seems it's showing same issue in 7.0.2 now...
confused.com!!!
Stephen, where did you go?!
Still there, got caught into other things, will try to get back to you asap.
I'm really struggling here. got 2 sites down due to this. One is a fresh install which i've just deployed.
General issue with DynamicPublishedContentList extension methods.
To be discussed at: http://issues.umbraco.org/issue/U4-5084
I'm not sure where the best place is to post this, but I was able to "solve" an error tied to GetGridHtml() and "does not contain a definition for Any()" in 7.2.0. I realize it may not solve everyone's experience, but perhaps, it will move the community forward.
I am new to Umbraco (we're talking seriously new!). I've been playing with it a few days when suddenly, I was getting the errors it appears some are running into. One positive was that I was running two versions: one was pristine and one was the one I was messing with--and messed up. Note: since I was new, this was not an upgrade scenario
I did a full dependency comparison and hunted for clues based on the limited posts regarding these errors.
Ultimately, the answer lies in the /bin directory. When I ported over files, I brought over another EntityFramework dl: EntityFramework.SqlServer.dll. When that .dll is present in the bin directory, I get the errors above. When I remove it, all is well and things work perfectly.
Hope this helps!
Thanks for that.
I had introduced a new project to my solution that had Entity Framework in it, and was a different version, which caused this error for me. Once I removed the dll for the new project from the bin folder this problem went away.
EntityFramework.SqlServer.dll was also the cause of this issue on my 6.1.6 installation - I think it came from EF 6 which I had installed for a custom section, before rolling back to EF 5.
I've just upgraded a 7.1.8 build to 7.2.0 then 7.2.1 and now get this problem - looking into it but no entityframework dlls in my site
Si
have you guys figured out a solution to this? Im hitting the same
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Any'
on version 7.1.8 assembly: 1.0.5394.16131 install.Cant upgrade to later versions for quick testing and on the lookout for a quick-fix - if any...
The error being thrown at normally used-to-work ok code, cant figure how to fix it.
Line 7: @if (CurrentPage.Ancestors().Any())
any ideas? I have the entire site re-published and the ancestors of that currentpage re-published, yet no joy..
Hello guys,
I have also encountered this error. In my case it was after I have moved from SQL Server Compact to SQL Server 2008. Not sure if these 2 are related in any way. Before the change, everything worked normally. I have also upgraded to the latest version hoping it will solve it. Now I am running 7.2.8. The back-end is ok but the front end is broken Any ideea?
Thanks,
Adrian
Have the same problem. whenever i add the Kendo.Mvc.dll i get the same error. i will try to find the older version of the Kendo.Mvc.dll because I'm thinking it might be a different MVC version.
by the way let me know if anyone has seen a nice guide how to implement Umbraco 7 with kendo controls
Update: The problem solved with the right Kendo.Mvc version
Same here - started with a 7.2.6 installation with CE on local machine; moved it to Windows 2012 Server and SQL 2012. After copying back down to local machine, am now getting this when trying to run against local SQL 2012.
This is the Adrian Ursu kind of issue - appeared in front end after CE-to-SQL conversion.
Rest of the site works, but when trying to call partial view macros, i'm getting this.
Any insight appreciated.
Solved (in my case)! I had installed the Export SQL Server Compact package to export my local CE database to SQL Server on the production site.
Successfully uploaded to production and the production site worked just fine. Content was added to production for a month or so.
Local (CE) site continued to work fine, as well, on my local machine with very little content. The minute I backed up the production DB and restored it to full SQL Server on the local box and pointed my local Umbraco site to it, the errors started.
Only by UNINSTALLING the Export SQL Server Compact package did the errors go away.
Lesson learned: you'll need to uninstall Export SQL Server Compact package as soon as you stop using CE and want to use the SQL Server DB the package helps you create.
I had the same exact error running in version 7.3.7, and I solved it by creating a variable first thanks to this Stack Overflow suggestion.
Old Broken Code:
Updated Working Code:
Hopefully that helps anyone else that comes across this problem!
Hello guys,
I just upgraded from 7.2 to 7.4.1 - big leap, I know. Everything was looking good until I received this error.
I had installed NEST 2.0.2. and it was causing the issue with Umbraco.Web.Models.DynamicPublishedContentList. Still not quite sure what the issue is but NEST 2 employs some of the c# 6 'goodness' and this might be causing the issue with 'dynamic'.
If I find out anymore I'll post back.
Steve
FWIW.. I came across this thread after trying out the CoreValueConverters project at https://our.umbraco.org/projects/developer-tools/umbraco-core-property-value-converters It implemented fine but I wasn't interested in continuing with it so I used Nuget to uninstall the package. That's when I got the same error. I ended up doing the following to get back on track.
I noticed also I still had a namespace reference to
so I left that there.
I had the same problem, but for me this seemed to be something to do with conflicting versions of log4net.
For those running into the error after upgrading from SQL Server Compact to MSSQL, ensure you uninstall the Export SQL Server Compact package!
I want to echo the resolution of Chuck Kirklen. I too had this problem after using Export SQL Server Compact package, and fixed by uninstalling the package per Chuck's tip.
is working on a reply...