生成类型提供程序似乎存在多个根类型的问题。 完整的repro可在此处获取:https://gist.github.com/dsevastianov/46d1a8495c4af46a9875。以下示例
#r @"SampleProvider.dll"
type Birch = Sample.Sample<"birch">
type Elm = Sample.Sample<"elm">
let birch = Birch.birch()
let elm = Elm.elm()
elm.Branches <- ([|Elm.elm()|])
在编译时失败(不是在设计时):
FSC: error FS2014: A problem occurred writing the binary 'obj\Debug\Tests.dll':
Error in pass3 for type Schema, error: Error in GetMethodRefAsMethodDefIdx for
mref = (".ctor", "ZipLookup"), error: Exception of type Microsoft.FSharp.Compiler.AbstractIL.ILBinaryWriter+MethodDefNotFound' was thrown.
答案 0 :(得分:3)
事实证明,有必要为每个根类型创建单独的临时程序集。我修改了Gist以反映解决方案:https://gist.github.com/dsevastianov/46d1a8495c4af46a9875