tag:blogger.com,1999:blog-8596733192274108952.post2266721935831393327..comments2024-03-12T06:00:18.305+02:00Comments on Programming stuff: LINQ to Objects. VS2008 SP1 Bug!Sergey Teplyakovhttp://www.blogger.com/profile/14300835272589262297noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-8596733192274108952.post-43034018261058870222008-12-03T14:38:00.000+02:002008-12-03T14:38:00.000+02:00Как оказалось, это не ошибка, это фича. А ошибкой ...Как оказалось, это не ошибка, это фича. А ошибкой было то, что этот код работал в Visual Studio 2008 без SP1.<BR/>Более подробно здесь http://blogs.msdn.com/dinesh.kulkarni/archive/2008/08/10/net-fx-3-5-sp1-two-perf-improvements-linq-to-objects-and-linq-to-sql.aspx и здесь http://blogs.msdn.com/ed_maurer/archive/2008/02/16/breaking-change-in-linq-queries-using-explicitly-typed-range-variables.aspx.<BR/>Если кратко, то вот: <BR/>Cast<T> breaking change: This is a bug fix and a breaking change (see this post for background). The intended use of the NET FX 3.5 Cast<T> extension method is querying over non-generic collection types, whose elements require either a reference conversion or an unboxing step to be used in a generic query context. A late change VS 2008 cycle allowed the cast to succeed in more situations than intended, such as converting float values to int, where it should instead be throwing an InvalidCastException. The breaking change reverts the beta2 behavior and improves perf by simplifying the implementation of CastIterator<T>. Value conversions and explicitly-defined user conversions cause an InvalidCastException instead of being allowedSergey Teplyakovhttps://www.blogger.com/profile/14300835272589262297noreply@blogger.com