Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generated Types Provider working example [closed]

Can somebody point me to working example of generated types F# TypeProvider? Ideally, based on F# sample pack "ProvidedTypes-*.fs" library.

I tried "GeneratedTypeProvider" from F# 3.0 Sample Pack but it doesn't work for me. I received "...'FSharpLib.T' does not contain a definition for 'F1' and no extension method 'F1' accepting a first argument of type 'FSharpLib.T' could be found (are you missing a using directive or an assembly reference?)" for C# project. I don't care much about C# project (ConsoleApplication1) but when I changed ConsoleApplication2 to run as console application that invokes T.F1 I received scary "Error in pass3 for type FSharpLib.Program, error: Error in GetMethodRefAsMethodDefIdx for mref = "F1", error: Exception of type 'Microsoft.FSharp.Compiler.AbstractIL.ILBinaryWriter+MethodDefNotFound' was thrown." And honestly, it's suspicious that source code out of sync with http://apollo13cn.blogspot.com/2013/01/generated-type-provider-and-code.html

I also looked at http://code.google.com/p/froto/source/browse/Gen/ProtoTypeProvider.fs. I didn't compile/ran the project but it doesn't use Sample Pack which is certainly sub-optimal.

Not sure about "Playground" project by colinbull on GitHub because it seems just to copy types from other assembly.

like image 359
Dmitry Morozov Avatar asked Nov 02 '22 22:11

Dmitry Morozov


1 Answers

In general Tests project in sample pack contains tests for both erased and generated type providers. However when I run tests I saw the same error that you have - seems that 'provided types' API was partially broken recently - now fixed (at least for the tests project, have not tried GeneratedTypeProvider sample)

like image 145
desco Avatar answered Nov 19 '22 21:11

desco