I was wondering if I found a bug or are just using it wrong.
If I use
from obj in ctx.SomeChild select obj.AncestorOrDefault<AnotherType>()
I get the error below (The given key was not present in the dictionary) when SomeChild doesn't have a parent of type AnotherType.Is this error avoidable?
Thanks
Teus
The given key was not present in the dictionary.
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: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Linq to Umbraco AncestorOrDefault bug ?
Hello,
I was wondering if I found a bug or are just using it wrong.
If I use
from obj in ctx.SomeChild
select obj.AncestorOrDefault<AnotherType>()
I get the error below (The given key was not present in the dictionary) when SomeChild doesn't have a parent of type AnotherType.Is this error avoidable?
Thanks
Teus
The given key was not present in the dictionary.
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: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Which Umbraco version?
umbraco v 4.5.2 (Assembly version: 1.0.3891.20719)
See if there's a bug on codeplex already and if not can you lodge one.
I haven't used it since I wrote that though.
logged as item 29217
http://umbraco.codeplex.com/workitem/29217
regards
Teus
Hi There,
Is there any solution for this ?
I try to get all child nodes of particular type which give me the same error.
The given key was not present in the dictionary
For example get all news item in news category
newsCat.NewsItems.ToList();
How do you get the child node of particular type in umbraco ?
Thanks
Did you find any resolution for this issue?
is working on a reply...