我有一些生成异常的代码,second time
它在 FSI 中执行。顺序如下:
1)选择above
它的所有行,继续FSI
使用Alt+Enter
.
2)选择代码,FSI
使用Alt+Enter
. 到目前为止没有错误。
3) 通过点击再次运行选定的代码Alt+Enter
。错误(见下文)。
以下是生成此行为的代码行:
let assetsMap =
assetInfo.Rows
|> Seq.filter (fun (rw: AssetsInfo.Row) -> Set.contains rw.Ticker assetsTickerSet)
|> List.ofSeq
|> List.map (fun rw -> rw.Ticker, Asset.constructor rw) // Frame.ReadCSV called here
|> Map.ofSeq
相关资料:
type AssetsInfo = FSharp.Data.CsvProvider<...>
错误信息:
System.InvalidOperationException: tried to skip The input sequence has an insufficient number of elements. 1 past the end of the seq
at Microsoft.FSharp.Collections.SeqModule.Skip@1316.GenerateNext(IEnumerable`1& next)
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
at FSharp.Data.Runtime.CsvHelpers.parseIntoTypedRows@176.GenerateNext(IEnumerable`1& next) in C:\Git\FSharp.Data\src\Csv\CsvRuntime.fs:line 176
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@187[T](FSharpFunc`2 f, IEnumerator`1 e, FSharpRef`1 started, Unit unitVar0)
at Microsoft.FSharp.Collections.Internal.IEnumerator.filter@182.System-Collections-IEnumerator-MoveNext()
at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
at <StartupCode$FSI_0035>.$FSI_0035.main@() in H:\Dropbox\BitBucket\VSProjects\Fractal10\Fractal10\Program.fs:line 139
Stopped due to error
关于这种奇怪行为的原因有什么想法吗?