score:2
You will normally get this sort of error when a ModuleBuilder has already been 'compiled', or a TypeBuilder has already been 'compiled'.
I would check where such things happen. Also, a stack trace may be handy in this case.
score:-1
There is a bug report here, not sure though if it is the same issue that you experience. Apparently this has been fixed in .NET 3.5 SP1.
Source: stackoverflow.com
Related Articles
- Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery`1[]' using linq lambda expression
- Linq cast conversion Xelement error: Unable to cast object of type 'System.Xml.Linq.XElement' to type 'System.IConvertible'
- Unable to cast object of type 'WhereSelectListIterator` in LINQ
- LINQ Issue: Unable to cast object of type 'System.Reflection.Module' to type 'System.Reflection.Emit.ModuleBuilder
- Removing duplicates using LINQ returns "Error removing duplicates: Unable to cast object of type 'System.Int32' to type 'System.String'."
- LINQ with String.Join() error: "System.InvalidCastException: Unable to cast object of type '<DistinctIterator>
- linq query getting Unable to cast object of type 'System.Boolean' to type 'System.String'
- Unable to cast object of type 'System.Double' to type 'System.String' linq query
- Unable to cast object of type 'System.Int32' to type 'System.String' in LINQ query
- Assigning LINQ Results to child Property - InvalidCastException: Unable to cast object of type
- LINQ Error unable to cast object of type 'system.datetime' to type 'system.string'
- Unable to cast object of type in below Linq method
- Unable to cast object of type grouping to datarow after i grouped datatable with linq
- Linq query error - Unable to cast object of type 'V1.Controllers.Loan' to type 'System.IConvertible
- Unable to cast object of type 'System.Linq.Expressions.UnaryExpression' to type 'System.Linq.Expressions.MemberExpression'
- Unable to cast object of type WhereSelectListIterator 2 System.Collections.Generic.List
- Unable to cast object of type 'System.Data.Linq.DataQuery`1[System.Int32]' to type 'System.IConvertible'
- Unable to cast object of type 'WhereEnumerableIterator`1' to type 'System.Collections.Generic.ICollection`1
- Unable to cast object of type 'System.Collections.Generic.List`1[System.Decimal]' to type 'System.IConvertible'
- Unable to cast object of type 'System.Int32' to type 'System.String'
- Unable to cast a object of type 'SZArrayEnumerator' to type 'System.Collections.Generic.IEnumerator' 1[System.String]'
- Unable to cast object of type WhereSelectListIterator
- Unable to cast object of type 'System.Linq.EnumerableQuery to type 'Microsoft.Azure.Documents.Linq.IDocumentQuery
- Linq Unable To Cast Issue
- Unable to cast object of type System.Func`2 with Int64
- Unable to cast object of type '<>f__AnonymousType5`6
- Unable to cast object of type 'System.Data.Common.DataRecordInternal' to type 'System.Data.IDataReader'
- Unable to cast object of type 'System.Int16' to type 'System.String'
- Unable to cast object of type 'System.Data.Objects.ObjectQuery`1 [Manager.Data.Channel]' to type 'Manager.Data.Channel'
- Unable to cast the type X to type Y. LINQ to Entities only supports casting EDM primitive or enumeration types
- LINQ reusing Select statement with anonymous grouping types
- linq query for no match rows
- Using linq to combine objects
- Perform Calculations Within List Using Linq and Lambda Expressions
- How to get isolation level in EF for MSSQL?
- How to assign SortableBindingList to LINQ query
- Pass LINQ query to VIewBag to create DropDownList
- iterating over columns in a list of tuples with Linq
- Percent of Yes in Yes/No column in Linq
- Which book is good to start with LINQ?
- Object reference updating, update all collections property?
- C# - Convert delimited string array w/ duplicates to dictionary using LINQ
- Linq extended set operations
- Prevent Duplicates From Being Saved In Database
- WPF TreeView Binding
- Access to the return value from the database by linq
- Get values from list that match BOTH attributes using c# LINQ
- Dynamic Lambda Expression For Filtering
- Delete item from inner collection
- LIKE in "where" LINQ statement causes error