http://bugzilla.novell.com/show_bug.cgi?id=598992

http://bugzilla.novell.com/show_bug.cgi?id=598992#c6


--- Comment #6 from Andreas Berglund <[email protected]> 2010-04-26 08:36:15 
UTC ---
I've looked into the problem further.

It works fine to loop through and print all the parent elements of the
IEnumerable<T>, but as soon as i query the IEnumerable in its turn, and print
the results, i get the Invalid IL code.

- theModel.Count() returns the correct number of parent elements, 3.

- allCategories.Count() returns the correct number of total elements, including
children, which is 9 in my case.

- Querying for the children of the first parent element works fine, but when
outputting the number of children we found, i get "Invalid IL Code". This line:
<%= children.Count().ToString() %> 

Here's a little code snippet:
----------
<%@ Control Language="C#"
Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<WebshopCategory>>" %>
<%@ Import Namespace="webshop.Models"%>

<% var theModel = ViewData.Model; %>
<%= theModel.Count().ToString() %>

<% var allCategories = (IEnumerable<WebshopCategory>)ViewData["AllCategories"];
%>
<%= allCategories.Count().ToString() %>

<% foreach(var item in ViewData.Model) %>
<%{%>
<li>
    <%= item.Name %>

    <% var children = allCategories.Where(o => o.ParentId == item.Id); %>    
    <%= children.Count().ToString() %>
</li>    
<%}%>
----------

Let me know if there's anything i can do to simplify things for you.

/Andreas

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to