Skip to content

Commit 384570e

Browse files
authored
Update faq.md
1 parent 6c5e456 commit 384570e

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/faq.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,44 @@
1414

1515
If your failures only happen in the IDE then use `devenv /debugexe devenv.exe MyProj.fsproj`, set debug type to ".NET Framework 4.0" and launch F5. Likewise if your failures only happen in F# Interactive then use `devenv /debugexe fsi.exe MyProj.fsproj`.
1616

17-
Set first-catch exception handling (Ctrl-Alt-E, select all CLR exceptions) and set Just My Code off
17+
Set first-catch exception handling (Ctrl-Alt-E, select all CLR exceptions) and set Just My Code off
1818

1919
## A dependency of my type provider is not loading, what do I do?
2020

2121
For example, let's say you have this error in your test project:
2222

23-
```
23+
```text
2424
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]
2525
```
2626

2727
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
2828

29-
dotnet build -v:n
30-
29+
```text
30+
dotnet build -v:n
31+
```
32+
3133
In the compilation of your test project you will see something like this:
3234

33-
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\3.1.401\FSharp\fsc.exe"
34-
-o:obj\Debug\net5.0\Joe.Test.dll
35-
...
36-
-r:E:\GitHub\admin\joe-provider\src\Joe.Provider\bin\Debug\netstandard2.0\Joe.Provider.dll
37-
...
35+
```text
36+
C:\Program Files\dotnet\dotnet.exe "C:\Program Files\dotnet\sdk\3.1.401\FSharp\fsc.exe"
37+
-o:obj\Debug\net5.0\Joe.Test.dll
38+
...
39+
-r:E:\GitHub\admin\joe-provider\src\Joe.Provider\bin\Debug\netstandard2.0\Joe.Provider.dll
40+
...
41+
```
3842

3943
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
4044
alongside your design time component. For example, adding
4145

42-
<Content Include="..\..\packages\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll" CopyToOutputDirectory="PreserveNewest" />
46+
```text
47+
<Content Include="..\..\packages\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll" CopyToOutputDirectory="PreserveNewest" />
48+
```
4349

4450
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
4551
package, see the instructions above for what the final layout of the nuget package should be.
4652

4753
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.
4854

49-
TODO: give exact .fsproj/nuget instructions to get the dependency into the `typeproviders\fsharp41\netstandard2.0` directory alongside the design-time component.
50-
5155
## How do I debug execution of a type provider when using .NET Core tools on Windows?
5256

5357
One approach:
@@ -56,11 +60,15 @@ One approach:
5660

5761
2. Run an explicit invocation of the compiler using:
5862

59-
"c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
63+
```text
64+
"c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
65+
```
6066

6167
Then debug that invocation using
6268

63-
devenv /debugexe "c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
69+
```text
70+
devenv /debugexe "c:\Program Files\dotnet\dotnet.exe" "C:\Program Files\dotnet\sdk\2.1.403\FSharp\fsc.exe" @args.txt
71+
```
6472

6573
Be careful to make sure Visual Studio debugging type is set to ".NET Core" (right click properties on dotnet and set debug type)
6674

0 commit comments

Comments
 (0)