Skip to content

Commit 62f89a9

Browse files
committed
rename
1 parent f498798 commit 62f89a9

7 files changed

+205
-212
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,5 @@ paket-files/
210210

211211
output/
212212

213-
.fsdocs/
213+
.fsdocs/
214+
tmp/

Directory.Build.props

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
<PropertyGroup>
33
<Authors>FSharp.TypeProviders.SDK contributors</Authors>
44
<PackageLicenseExpression>MIT</PackageLicenseExpression>
5-
<PackageProjectUrl>https://github.com/fsprojects/FSharp.TypeProviders.SDK#the-f-type-provider-sdk</PackageProjectUrl>
5+
<PackageProjectUrl>https://fsprojects.github.io/FSharp.TypeProviders.SDK/</PackageProjectUrl>
66
<RepositoryUrl>https://github.com/fsprojects/FSharp.TypeProviders.SDK</RepositoryUrl>
7+
<FsDocsLogoSource>https://raw.githubusercontent.com/fsprojects/FSharp.TypeProviders.SDK/master/docs/files/img/logo.png</FsDocsLogoSource>
78
<RepositoryType>git</RepositoryType>
8-
<Copyright>Copyright 2020 FSharp.TypeProviders.SDK contributors</Copyright>
9+
<Copyright>Copyright 2021 FSharp.TypeProviders.SDK contributors</Copyright>
910
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1011
</PropertyGroup>
1112
</Project>

README.md

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
# The F# Type Provider SDK
22

3-
The F# Type Provider SDK is two things:
4-
5-
1. The ``ProvidedTypes.fs`` API files you need to author type providers
6-
7-
2. [Documentation and samples on type provider creation](https://fsprojects.github.io/FSharp.TypeProviders.SDK)
8-
9-
[![Build Status](https://github.com/fsprojects/FSharp.TypeProviders.SDK/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions?query=branch%3Amaster)
3+
The F# Type Provider SDK contains the ``ProvidedTypes.fs`` API files you need to author type providers
104

115
## Getting Started
126

13-
See [the documentation](https://fsprojects.github.io/FSharp.TypeProviders.SDK).
7+
See [Documentation and samples on type provider creation](https://fsprojects.github.io/FSharp.TypeProviders.SDK)
148

15-
## Support and community
16-
17-
- If you have a question about `FSharp`, ask at StackOverflow and [mark your question with the `f#` tag](https://stackoverflow.com/questions/tagged/f%23).
18-
- If you want to submit a bug, a feature request or help with fixing bugs then look at [issues](https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues).
19-
209
## Building
2110

11+
[![Build and Test and Publish](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/workflows/push.yml/badge.svg)](https://github.com/fsprojects/FSharp.TypeProviders.SDK/actions/workflows/push.yml)
12+
2213
Use
2314

2415
```shell
@@ -31,13 +22,6 @@ or
3122
build.cmd RunTests
3223
```
3324

34-
## Library license
35-
36-
The library is available under the MIT License. For more information see the [License file][1] in the GitHub repository.
37-
38-
[1]: https://github.com/fsprojects/FSharp.TypeProviders.SDK/blob/master/LICENSE.md
39-
40-
4125
## Maintainer(s)
4226

4327
- [@dsyme](https://github.com/dsyme)

docs/debugging.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Debugging a Type Provider
2+
3+
Debugging a type provider can be difficult because it is a program run at compile-time and editing-time in host compilation tools including
4+
`fsc.exe`, `devenv.exe` and `FsAutoComplete.exe`.
5+
6+
This articule discusses some techniques you can use to debug a type provider when it is run inside these different tools.
7+
8+
## How do I debug execution of a type provider when using .NET SDK tools?
9+
10+
To debug a use of a type provider inside the `dotnet` toolchain, you should first isolate a precise invocation of the `dotnet` tool used in compilation.
11+
12+
1. Capture output of `dotnet build -v:n` in `args.txt` and trim out the rubbish leaving just the command line arguments to the F# compiler, usually starting with `-o:...`
13+
14+
2. Run an explicit invocation of the compiler, checking that your failures still happen, then debug that invocation.
15+
16+
For example, on Windows:
17+
18+
```text
19+
"c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
20+
21+
devenv /debugexe "c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
22+
```
23+
24+
Be careful to make sure Visual Studio debugging type is set to ".NET Core" (right click properties on dotnet and set debug type). Set first-catch exception handling (Ctrl-Alt-E, select all CLR exceptions) and set Just My Code off.
25+
26+
## How do I debug execution of a type provider hosted in F# Interactive?
27+
28+
If your failures only happen in F# Interactive then use `devenv /debugexe fsi.exe MyProj.fsproj`, or a simialr .NET SDK invocation.
29+
30+
## How do I debug execution of a type provider inside an IDE?
31+
32+
This can be quite tricky. First try to unit-test the type-provider and debug command-line invocations thoroughly. If your failures only happen
33+
in Visual Studio, then use `devenv /debugexe devenv.exe MyProj.fsproj`, set debug type to ".NET Framework 4.0"
34+
and launch F5.
35+
36+
## How do I debug execution of a type provider when using .NET Framework tools?
37+
38+
To debug a use of a type provider inside the `msbuild` toolchain (.NET Framework), you should first isolate a precise invocation of the `dotnet` tool used in compilation.
39+
40+
1. Capture output of `msbuild -v:n` in `args.txt` and trim to leave the command line arguments to the F# compiler, usually starting with `-o:...`
41+
42+
2. Run an explicit invocation of the compiler using this, checking that your failures still happen, then debug that invocation.
43+
44+
For example, on Windows:
45+
46+
```text
47+
fsc.exe @args.txt
48+
49+
devenv /debugexe fsc.exe @args.txt
50+
```
51+
52+
Set first-catch exception handling (Ctrl-Alt-E, select all CLR exceptions) and set Just My Code off.
53+
54+
## A dependency of my type provider is not loading, what do I do?
55+
56+
For example, let's say you have this error in your test project:
57+
58+
```text
59+
2>E:\GitHub\admin\joe-provider\test\Joe.Test\ProviderTests.fs(8,10): error FS3033: The type provider 'Joe.Provider.JoeProvider' reported an error: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified. [E:\GitHub\dsyme\joe-provider\test\Joe.Test\Joe.Test.fsproj]
60+
```
61+
62+
Here your test project is referencing your provider project, and your type provider has a dependency on `Newtonsoft.Json.dll`. To see what's going on, run
63+
64+
```text
65+
dotnet build -v:n
66+
```
67+
68+
In the compilation of your test project you will see something like this:
69+
70+
```text
71+
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\3.1.401\FSharp\fsc.exe"
72+
-o:obj\Debug\net5.0\Joe.Test.dll
73+
...
74+
-r:E:\GitHub\admin\joe-provider\src\Joe.Provider\bin\Debug\netstandard2.0\Joe.Provider.dll
75+
...
76+
```
77+
78+
1. The tool `fsc.exe` is trying to load the type provider but a dependency is not found. As mentioned above, all dependencies must be packaged
79+
alongside your design time component. For example, adding
80+
81+
```text
82+
<Content Include="..\..\packages\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll" CopyToOutputDirectory="PreserveNewest" />
83+
```
84+
85+
will include the component and unblock you. However, you will need to be careful to make sure this component is laid down in the right place in your nuget
86+
package, see the instructions above for what the final layout of the nuget package should be.
87+
88+
2. When making type providers whose design-time components have dependencies, you should always use a "split" type provider that separates the design-time and runtime components.
89+
90+
TODO: give exact .fsproj/nuget instructions to get the dependency into the `typeproviders\fsharp41\netstandard2.0` directory alongside the design-time component.
91+

docs/faq.md

-138
This file was deleted.

docs/index.md

+16-36
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,39 @@
44

55
To create a type provider use:
66

7-
dotnet new -i FSharp.TypeProviders.Templates
8-
dotnet new typeprovider -n LemonadeProvider -lang F#
7+
```text
8+
dotnet new -i FSharp.TypeProviders.Templates
9+
dotnet new typeprovider -n LemonadeProvider -lang F#
10+
```
911

1012
The template uses paket to acquire the files of the latest published type provider SDK.
1113

12-
cd LemonadeProvider
14+
```text
15+
cd LemonadeProvider
1316
14-
dotnet tool restore
15-
dotnet paket update
16-
dotnet build -c release
17+
dotnet tool restore
18+
dotnet paket update
19+
dotnet build -c release
1720
18-
dotnet test -c release
21+
dotnet test -c release
22+
```
1923

2024
The type provider also contains the logic necessary to package the type provider:
2125

22-
dotnet paket pack nuget --version 0.0.1
26+
```text
27+
dotnet paket pack nuget --version 0.0.1
28+
```
2329

2430
## Examples
2531

2632
See examples the [`examples`](https://github.com/fsprojects/FSharp.TypeProviders.SDK/tree/master/examples) directory.
2733

28-
## Type Provider Naming Conventions
29-
30-
A type provider is simultaneously a tool and a library. The existing guidance is as follows, from https://fsharp.github.io/2014/09/19/fsharp-libraries.html.
31-
32-
> Likewise, a type provider for a data source or schema format XYZ should normally be placed in “FSharp.Data”, e.g. “FSharp.Data.XYZ”.
33-
34-
Good type provider naming examples:
35-
36-
* `FSharp.Text.RegexProvider`
37-
* `FSharp.Azure.StorageTypeProvider`
38-
39-
Existing type providers that don't quite follow the guidelines but which are ok:
40-
41-
* `FSharp.Data`
42-
43-
Here are some examples of existing type providers that aren't too bad (they are clear) but could be renamed to follow the guidelines:
44-
45-
* `ExcelProvider` (better would be `FSharp.Interop.ExcelProvider`)
46-
* `RProvider` (better would be `FSharp.Interop.RProvider`)
47-
* `ApiaryProvider` (better would be `FSharp.Data.ApiaryProvider`)
48-
* `SQLProvider` (better would be `FSharp.Data.SQLProvider`)
49-
* `DynamicsNAVProvider` (better would be `FSharp.Interop.DynamicsNAVProvider`)
50-
* `DynamicsCRMProvider` (better would be `FSharp.Interop.DynamicsCRMProvider`)
51-
5234
## Resources
5335

5436
For advice on how to get started building a type provider, check out:
5537

38+
- [Debugging Type Providers](debugging.html)
5639
- [Tehcnical Notes](technical-notes.html)
57-
- [FAQ](faq.html)
58-
- [Type Providers from the ground up](https://blog.mavnn.co.uk/type-providers-from-the-ground-up/)
59-
- (and the [follow up posts](https://blog.mavnn.co.uk/blog/categories/typeprovider/))
60-
- [The MSDN Tutorial](https://msdn.microsoft.com/en-us/library/hh361034.aspx). The code in this package replaces the code from the sample pack it mentions.
40+
- [Type Providers from the ground up](https://blog.mavnn.co.uk/type-providers-from-the-ground-up/) and the [follow up posts](https://blog.mavnn.co.uk/blog/categories/typeprovider/)
6141

6242

0 commit comments

Comments
 (0)