使用生成类型提供程序创建多个根类型

时间:2014-06-12 13:13:37

标签: f# type-providers

生成类型提供程序似乎存在多个根类型的问题。 完整的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.

1 个答案:

答案 0 :(得分:3)

事实证明,有必要为每个根类型创建单独的临时程​​序集。我修改了Gist以反映解决方案:https://gist.github.com/dsevastianov/46d1a8495c4af46a9875