[Mono-dev] Problem with Linq in Mono

Chakotey STME chakoteystme at gmail.com
Wed Oct 20 08:51:29 EDT 2010


Thanks for your answer

I produced the error. It's no bug!

I had no elements in the list or the list wasn't initialized when I
make the .Max-Operation.

Sorry

2010/10/20 Jb Evain <jb at nurv.fr>:
> Hi,
>
> On Wed, Oct 20, 2010 at 1:58 PM, Chakotey STME <chakoteystme at gmail.com> wrote:
>> 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
>
> Sorry but it's not exactly clear what you're doing that is triggering
> the exception. Could you please write a small standalone repro?
>
> Thanks,
>
> --
> Jb Evain  <jb at nurv.fr>
>


More information about the Mono-devel-list mailing list