Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating reference documentation fails for PCL Profile259 and System.IO #346

Closed
adamchester opened this issue Oct 6, 2015 · 5 comments
Labels

Comments

@adamchester
Copy link

Originally raised here: fsprojects/ProjectScaffold#211

I created a new blank ProjectScaffold, added an F# PCL (Profile259) Library (VS 2015), added member x.TestMe = new System.IO.StringWriter(), then executed build. It fails to build.

projectscaffoldpcldocfailure

I don't fully understand why, but it seems that F# Formatting doesn't know what to do with the PCL types... Do I need to add some references somewhere?

The relevant build error follows:

Generating 'C:\My\repo\TestPclScaffold\docs\tools\..\content/release-notes.html'
Help generated
Finished Target: GenerateHelp
Starting Target: GenerateReferenceDocs (==> RunTests, GenerateHelp)
FSharp.Formatting Information: 0 : FSharp.Formatting Logging setup!
Yaaf.FSharp.Scriping Information: 0 : Yaaf.FSharp.Scripting Logging setup!
Copying file: C:\My\repo\TestPclScaffold\docs\output\img\logo-template.pdn
Copying file: C:\My\repo\TestPclScaffold\docs\output\img\logo.png
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\style.css
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\style.css.bak
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\style_light.css
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\tips.js
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\img\github-blue.png
Copying styles and scripts: C:\My\repo\TestPclScaffold\docs\output\content\img\github.png
Creating C:\My\repo\TestPclScaffold\docs\output\reference
System.InvalidOperationException: The entity or value 'System.IO.StringWriter' does not exist or is in an unresolved assembly. You may need to add a reference to assembly 'System.IO'
   at Microsoft.FSharp.Compiler.SourceCodeServices.Impl.dflt@76[a](String asmName, String path) in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\vs\Symbols.fs:line 37
   at Microsoft.FSharp.Compiler.SourceCodeServices.Impl.protect[a](FSharpFunc`2 f) in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\vs\Symbols.fs:line 36
   at Microsoft.FSharp.Compiler.SourceCodeServices.FSharpEntity.get_MembersFunctionsAndValues() in C:\GitHub\fsharp\FSharp.Compiler.Service\src\fsharp\vs\Symbols.fs:line 416
   at [email protected](IEnumerable`1& next) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 0
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at [email protected](String cat, IDictionary`2 cmds, Comment comment) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 900
   at FSharp.MetadataFormat.Reader.readCommentsInto[a](ReadingContext ctx, String xmlDoc, FSharpFunc`2 f) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 790
   at FSharp.MetadataFormat.Reader.readType(ReadingContext ctx, FSharpEntity typ) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 885
   at [email protected](ReadingContext ctx, FSharpEntity typ) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 878
   at Microsoft.FSharp.Collections.IEnumerator.choose@202.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at FSharp.MetadataFormat.Reader.readModulesAndTypes(ReadingContext ctx, IEnumerable`1 entities) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 879
   at FSharp.MetadataFormat.Reader.readNamespace(ReadingContext ctx, String ns, IEnumerable`1 entities) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 957
   at [email protected](Tuple`2 tupledArg) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 997
   at [email protected](b& )
   at Microsoft.FSharp.Collections.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at FSharp.MetadataFormat.Reader.readAssembly(FSharpAssembly assembly, Boolean publicOnly, String xmlFile, FSharpOption`1 sourceFolderRepo, FSharpFunc`2 urlRangeHighlight, Boolean markDownComments, IUrlHolder urlMap, String codeFormatCompilerArgs) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 1000
   at <StartupCode$FSharp-MetadataFormat>[email protected](Tuple`2 _arg2) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 1123
   at Microsoft.FSharp.Collections.ListModule.chooseAllAcc[a,b](FSharpFunc`2 f, FSharpList`1 xs, FSharpList`1 acc)
   at FSharp.MetadataFormat.MetadataFormat.Generate(FSharpList`1 dllFiles, String outDir, FSharpList`1 layoutRoots, FSharpOption`1 parameters, FSharpOption`1 namespaceTemplate, FSharpOption`1 moduleTemplate, FSharpOption`1 typeTemplate, FSharpOption`1 xmlFile, FSharpOption`1 sourceRepo, FSharpOption`1 sourceFolder, FSharpOption`1 publicOnly, FSharpOption`1 libDirs, FSharpOption`1 otherFlags, FSharpOption`1 markDownComments, FSharpOption`1 urlRangeHighlight, FSharpOption`1 assemblyReferences) in C:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.MetadataFormat\Main.fs:line 1118
   at <StartupCode$FSI_0003>.$FSI_0003.main@() in C:\My\repo\TestPclScaffold\docs\tools\generate.fsx:line 140
Stopped due to error
Running build failed.
Error:
System.Exception: generating reference documentation failed
   at [email protected](Unit _arg11)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target         Duration
------         --------
Clean          00:00:00.0067298
AssemblyInfo   00:00:00.0190892
Build          00:00:01.5366830
CopyBinaries   00:00:00.0193597
RunTests       00:00:01.2451498
CleanDocs      00:00:00.0105662
GenerateHelp   00:00:05.8688994
Total:         00:00:13.2202441
Status:        Failure
---------------------------------------------------------------------
  1) System.Exception: generating reference documentation failed
   at [email protected](Unit _arg11)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483
---------------------------------------------------------------------

C:\My\repo\TestPclScaffold>
@ReedCopsey
Copy link
Member

I'm hitting this same issue in my libraries - types completely "self contained" work fine, but if a type uses or exposes anything out of the framework, you get these errors.

@matthid
Copy link
Member

matthid commented Jan 14, 2016

Current workaround is to build the library again against net45 and use the result for FSharp.Formatting as we currently have not found a good way to detect the required Framework.

@ReedCopsey
Copy link
Member

@matthid Is there a way to have the engine add a reference? I think if you were to add the reference to the PCL proxy libs, it'd probably fix it (that's frequently required for testing and other projects), as the types would then exist there.

@matthid
Copy link
Member

matthid commented Jan 14, 2016

Yes but we need to detect the framework of the given dlls to add the correct framework references. We obviously cannot just Assembly.Load the dll as it might be imcompatible with what we are running. And I want to avoid an additional reference like Mono.Ceceil for various reasons. Besides that FCS should be able to provide the information, as it already contains an IL-Reader (however I couldn't find a way jet).

We cannot just add the PCL proxy libs additionally to the regular framework assemblies as that doesn't work (Edit: I think I actually tried that already :( ).

@dsyme
Copy link
Contributor

dsyme commented Apr 12, 2019

Closing this old issue (spring cleaning)

@dsyme dsyme closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants