[Mono-dev] Problem with Linq in Mono

Chakotey STME chakoteystme at gmail.com
Wed Oct 20 07:58:02 EDT 2010

Hi Community,

I have a vb.net project (.net 3.5).
I use this Linq-Statement:

Dim minPosition = myIndexing.Where(Function(x) x.Key <
beginTime).SelectMany(Function(x) x.Value).ToList

It works perfect under .net and mono 2.6

But I get an exception if I use this operation (i get the exception
only under mono - with .net it works perfect):

Dim MaxValue = minPosition.Max

The exception:
Unhandled Exception: System.InvalidOperationException: Operation is
not valid due to the current state of the object
  at System.Linq.Enumerable.Iterate[Int64,Int64] (IEnumerable`1
source, Int64 initValue, System.Func`3 selector) [0x00000] in
<filename unknown>:0
  at System.Linq.Enumerable.Max (IEnumerable`1 source) [0x00000] in
<filename unknown>:0
  at FileReader.Module1.getObenUndUnten
(System.Collections.Generic.Dictionary`2& myIndexing, Int32 beginTime,
Int32 endTime) [0x00000] in <filename unknown>:0
  at FileReader.Module1.Main () [0x00000] in <filename unknown>:0

I get the same exception if I use minPosition.Max()

could you tell me please why the .Max-Operation throws an exception?
MoMA for Mono 2.6 tells me all Operations are accepted by Mono 2.6

So where is the problem?


More information about the Mono-devel-list mailing list