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

VS2015 FSLab journal template dll reference error. #98

Closed
simra opened this issue Nov 7, 2015 · 15 comments
Closed

VS2015 FSLab journal template dll reference error. #98

simra opened this issue Nov 7, 2015 · 15 comments

Comments

@simra
Copy link

simra commented Nov 7, 2015

This issue seems to be distinct from Issue #82.
build run from the VS2015 command line fails to successfully reference FSharp.CodeFormat:

System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.CodeFormat, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FSharp.CodeFormat, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
   at [email protected](Unit unitVar0)
   at [email protected](IEnumerable`1& next) in c:\Tomas\Public\fslaborg\FsLab\src\FsLab.Runner\Runner.fs:line 199
   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 FSI_0001.Build.generateJournals(ProcessingContext ctx)
   at [email protected](Unit _arg2)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

Here's the paket output from a clean unzip:

No version specified. Downloading latest stable.
Starting download from https://github.com/fsprojects/Paket/releases/download/2.22.5/paket.exe
Paket version 2.22.5.0
Resolving packages for group Main:
 - FAKE is pinned to 4.5.4
 - FsLab 0.3.8
 - FsLab.Runner 0.3.8
 - Suave 0.32.1
 - Newtonsoft.Json 7.0.1
 - MathNet.Numerics 3.8.0
 - MathNet.Numerics.FSharp 3.8.0
 - Google.DataTable.Net.Wrapper 3.1.2.0
 - FSharp.Formatting 2.10.0
 - FSharp.Data 2.2.5
 - FSharpVSPowerTools.Core 1.8.0
 - R.NET.Community 1.6.4
 - R.NET.Community.FSharp 1.6.4
 - FSharp.Compiler.Service 1.3.1.2
 - Deedle 1.2.4
 - Deedle.RPlugin 1.2.4
 - XPlot.GoogleCharts 1.2.1
 - XPlot.GoogleCharts.Deedle 1.2.1
 - XPlot.Plotly 1.2.1
 - RProvider 1.1.14
 - FSharp.Charting 0.90.12
 - Foogle.Charts 0.0.5
 - FSharp.Core 4.0.0.1
 - DynamicInterop 0.7.4
 - Zlib.Portable 1.11.0
 - TaskParallelLibrary 1.0.2856
 - Http.fs 1.5.1
@simra
Copy link
Author

simra commented Nov 8, 2015

Slightly different error building from the VS template (VS2015). Smells a lot like this issue, which is closed but maybe not fully resolved: fsprojects/FSharp.Formatting#337?

System.MethodAccessException: Attempt by method 'FSharpVSPowerTools.Lexer.|GenericTypeParameterPrefix|StaticallyResolvedTypeParameterPrefix|Other|@92(System.String, Microsoft.FSharp.Compiler.SourceCodeServices.FSharpTokenInfo)' to access method 'Microsoft.FSharp.Compiler.Parser.tokenTagToTokenId(Int32)' failed.
   at FSharp.CodeFormat.CodeFormatAgent.ParseSource(String file, String source, FSharpOption`1 options, FSharpOption`1 defines) in c:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.CodeFormat\CodeFormatAgent.fs:line 390
   at FSharp.Literate.ParseScript.parseScriptFile(String file, String content, CompilerContext ctx) in c:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.Literate\ParseScript.fs:line 198
   at FSharp.Literate.Literate.ParseScriptFile[d](String path, FSharpOption`1 formatAgent, FSharpOption`1 compilerOptions, FSharpOption`1 definedSymbols, FSharpOption`1 references, FSharpOption`1 fsiEvaluator) in c:\Tomas\Public\tpetricek\FSharp.Formatting\src\FSharp.Literate\Main.fs:line 67
   at [email protected](IEnumerable`1& next) in c:\Tomas\Public\fslaborg\FsLab\src\FsLab.Runner\Runner.fs:line 199
   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 FSI_0001.Build.generateJournals(ProcessingContext ctx) in c:\users\rsim\documents\visual studio 2015\Projects\Twitter\build.fsx:line 49
   at [email protected](Unit _arg3) in c:\users\rsim\documents\visual studio 2015\Projects\Twitter\build.fsx:line 103
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

@simra
Copy link
Author

simra commented Nov 9, 2015

Couple comments:
Issue repros in VS2013 as well.
Everything seems to be mired in some sort of paket/nuget DLL hell.
On the surface the issue is related to breaking changes in FSharp.Formatting but in general there seem to be a number of issues dealing with different assemblies referencing different/incorrect versions, and in some cases I see multiple versions of the same package pulled down.
Is there a minimum viable set of nuget packages I could grab and put in a local folder? I see this discussion pointing to avoiding specific builds but it's hard to see how to resolve this otherwise.

@tpetricek
Copy link
Member

Does it work if you use the latest version of F# formatting?

(Download the template from https://github.com/fslaborg/FsLab.Templates/archive/journal.zip and run build.cmd or build.sh...)

@tpetricek
Copy link
Member

No, it does not work for me either... let me investigate...

@tpetricek
Copy link
Member

I updated everything to the latest version (including new F# Formatting and new FAKE) and it seems to be happy again.

@simra
Copy link
Author

simra commented Nov 11, 2015

Thanks Tomas!
The vsix package is working great now, and I can build/use the journal zip archive from the FSLab repo without any issues. The journal zip archive hosted at fslab.org seems to have slightly different contents and it progresses a little further than it was before but build run but bumps into this exception:

System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.CodeFormat, Version=2.12.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'FSharp.CodeFormat, Version=2.12.0.0, Culture=neutral, PublicKeyToken=null'
   at [email protected](Unit unitVar0)
   at [email protected](IEnumerable`1& next) in c:\Tomas\Public\fslaborg\FsLab\src\FsLab.Runner\Runner.fs:line 199
   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 FSI_0001.Build.generateJournals(ProcessingContext ctx)
   at [email protected](Unit _arg2)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

If I get a chance this evening I'll poke a little further.

@tpetricek tpetricek reopened this Nov 11, 2015
@tpetricek
Copy link
Member

Hmm... I've seen this error and I'm not quite sure when it happens.

Just to make sure, are you saying that:

That would be quite curious, because the download link in the first one points to the contents of the repository! Perhaps this behaves in some non-deterministic way...

Can you see #r "FSharp.CodeFormat.dll" in the file packages\FSharp.Formatting\FSharp.Formatting.fsx?

Does deleting the line fix the issue (or does it cause some other issues)?

@simra
Copy link
Author

simra commented Nov 13, 2015

Hi Tomas,
This template does not work:
https://github.com/fslaborg/FsLab.Templates/archive/journal.zip
which is linked from "FSLab Journal Template" on the FSLab download page.
The template generated at "\FsLab\temp\template\FSLab Journal.zip" seems to be a different archive (it just packs the fsproj + assets without a build script) but it works fine.
There is also a template generated at "\FsLab\temp\journal.zip" which looks substantially the same as the one in the template folder.
I'm not sure exactly how to replicate the template that's posted to the web.
hth

@simra
Copy link
Author

simra commented Nov 13, 2015

Can you see #r "FSharp.CodeFormat.dll" in the file packages\FSharp.Formatting\FSharp.Formatting.fsx ?
Does deleting the line fix the issue (or does it cause some other issues)?

Yes! Deleting the line fixes the issue.

@tpetricek
Copy link
Member

This is really odd.

I just updated the template in VS gallery and it should now be exactly the same as the one on the web (the build.fsx file there is empty, but it is automatically copied from a package once you run the project).

Can you check if this still reproduces with the most recent version? (To make sure, it is probably best to uninstall the old one and do all experiments in a folder that you have not used before in case something somewhere gets cached!)

@tpetricek
Copy link
Member

Also, thanks for pointing out that the template in VS Gallery was different :-) I wanted to update it for ages!

@simra
Copy link
Author

simra commented Nov 14, 2015

Hi Tomas,
The fslab.org journal template seems to work fine. That's the archive hosted here:
https://github.com/fslaborg/FsLab.Templates/archive/journal.zip

However that archive is not the same as the one we get from the gallery or the one that's built from the FSLab repo. Specifically, build.cmd is missing in the gallery/repo builds, so while the template can be installed, launching runner fails to execute the build.cmd subprocess.

I'm a bit puzzled as to how build.cmd stopped being included in the zip archive- I can't find any evidence that it was ever packed in the first place. Does a different process generate the archive at the GitHub url above?

@tpetricek
Copy link
Member

I updated the template again and it should work now.

The idea is that the VS template only comes with minimal number of files (so that we do not have to change it often) and when you run it in VS, it actually copies the build scripts from a NuGet package - see the code here.

I messed things up in the last version, so it didn't do it. Now it should work again - so when you use the template, you'll get all the right build scripts after you run it once in VS (while the standalone download has everything included, because we expect more command line users getting that :-)).

I changed the project so that it now fetches everything from the FsLab templates repo, so that's the place where all changes can be made.

@tpetricek
Copy link
Member

Looks like I finally figured this out. This was the fix: fsprojects/FSharp.Formatting@5f1e1aa

@theimowski
Copy link

I had a similar problem (nondeterministic?) with my presentation in FsReveal.
It disappeared when I added explicit dep on FSharp.Formatting prerelease in paket.dependencies and invoked paket update:

source https://nuget.org/api/v2

nuget FsReveal
nuget FSharp.Formatting prerelease 
nuget FAKE
nuget Suave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants