These are chat archives for Microsoft/visualfsharp

14th
Dec 2016
Hosch250
@Hosch250
Dec 14 2016 16:55
Does anyone here have experience getting unit tests to work in an F# PCL? xUnit and NUnit won't install because it is a PCL, and MSTest appears to be unavailable as well.
My next attempt involved creating a normal library and writing my unit tests in that. However, it won't let me use the portable F# compiler in that project (or the normal F# compiler in the other project), so I'm getting a bunch of failures with FileIOError as soon as I use a certain type. Why I can use other types in my tests and have them work is beyond me...
Test Name:    BoardTests.Checker can jump forward
Test FullName:    BoardTests.Checker can jump forward
Test Source:    C:\Users\{}\Desktop\Checkers\CheckersTests\BoardTests.fs : line 103
Test Outcome:    Failed
Test Duration:    0:00:00.001

Result StackTrace:    at BoardTests.Checker can jump forward()
Result Message:    System.IO.FileLoadException : Could not load file or assembly 'FSharp.Core, Version=3.47.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Jared Hester
@cloudRoutine
Dec 14 2016 17:02
the test lib doesn't need to be a pcl library
Hosch250
@Hosch250
Dec 14 2016 17:03
I know. That's what I'm working with right now--a PCL for my code and a normal library with the InternalsVisibleTo attribute set.
But I'm getting the error shown above for most of my tests, and I'm not at all sure why.
I'm on VS 2015 Community with the latest updates, if that helps.
Jared Hester
@cloudRoutine
Dec 14 2016 17:05
you might need an app.config with assembly binding redirects
Hosch250
@Hosch250
Dec 14 2016 17:05
OK, I'll look into that.
Jared Hester
@cloudRoutine
Dec 14 2016 17:07
you can use paket to generate them
Hosch250
@Hosch250
Dec 14 2016 17:07
Yeah, another thing I need to look up.
Hosch250
@Hosch250
Dec 14 2016 17:09
Thanks.
Hosch250
@Hosch250
Dec 14 2016 17:44
So, I have paket installed, the paket.dependencies and paket.references files working, and all. I also created an App.config with this content:
<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="FSharp.Core"
                              publicKeyToken="b03f5f7f11d50a3a"
                              culture="neutral" />
            <bindingRedirect oldVersion="3.47.4.0"
                             newVersion="4.4.1.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>
Is that right? I'm still getting the same error, so I suspect not.
Jared Hester
@cloudRoutine
Dec 14 2016 17:49
<bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"/>
F# 4.1 doesn't work in VS2015
are you using the fsharp.core nupkg?
Hosch250
@Hosch250
Dec 14 2016 17:54
I'm using the one that was just on my disk.
So, if I want to use F# 4.1, I have to go to VS 2017 RC?
I'm willing to do that--I'd like to work with F# 4.1 anyway.
Jared Hester
@cloudRoutine
Dec 14 2016 17:56
4.1 isn't released, and there are still bugs
you don't want to use it
Hosch250
@Hosch250
Dec 14 2016 17:56
Oh, OK.
Jared Hester
@cloudRoutine
Dec 14 2016 17:57
the F# support in vs2017 is WIP, the only people who are really using it are people working on either the compiler or the vs tooling
Hosch250
@Hosch250
Dec 14 2016 17:57
OK. I'll be watching for it to be released.
Right now, I just want to get my portable library under test. It has to be portable so I can use it in a Universal app.
I have a normal library working, but...
Jared Hester
@cloudRoutine
Dec 14 2016 17:58
oh yea that mess :(
Hosch250
@Hosch250
Dec 14 2016 17:58
Yeah. I like the concept, but :/
Jared Hester
@cloudRoutine
Dec 14 2016 17:59
eventually F# will have UWP support
Hosch250
@Hosch250
Dec 14 2016 17:59
Cool. BTW, are you guys working on any common refactorings?
Jared Hester
@cloudRoutine
Dec 14 2016 17:59
iirc they need to support tailcalls on the runtime and a few other things before it will work
like what?
Hosch250
@Hosch250
Dec 14 2016 18:00
I notice F# is lacking ones a bunch of ones C# has, and I have experience with writing them, so I'd be willing to help once I know F# better.
Remove Parameters, Extract Method.
Jared Hester
@cloudRoutine
Dec 14 2016 18:01
i rarely find myself wanting the refactorings i'd want in C#
Hosch250
@Hosch250
Dec 14 2016 18:01
OK, maybe I just have the C# mindset still--that's my main language.
I actually wrote all but the Rename and Extract Method refactorings in Rubberduck VBA. It was quite a learning experience.
Jared Hester
@cloudRoutine
Dec 14 2016 18:04
if the fsharp.compiler.service makes it easier to work with the typed AST someone might try to make some funky refactorings
vfpt has rename
Hosch250
@Hosch250
Dec 14 2016 18:04
Yep, I'm using that.
Jared Hester
@cloudRoutine
Dec 14 2016 18:04
vs2017 will have the roslyn inline refactorings and all the preview stuff
Hosch250
@Hosch250
Dec 14 2016 18:05
:thumb-up:
I guess that doesn't work on gitter.
Hosch250
@Hosch250
Dec 14 2016 18:07
Well, I still can't get it to work. Maybe I didn't link up my App.config file properly--I didn't have one, and I just created it in the root directory.
Jared Hester
@cloudRoutine
Dec 14 2016 18:08
it needs to be part of the test project
Hosch250
@Hosch250
Dec 14 2016 18:08
Do you know any reason why it doesn't complain for Piece, but does for Board? Those are both in the main project...
Jared Hester
@cloudRoutine
Dec 14 2016 18:09
it's kinda supported in vscode w/ ionide
Hosch250
@Hosch250
Dec 14 2016 18:10
Oh, I just got 18 passing, instead of 5!
And I'm getting different exceptions now, too.
Thanks for the help :)
Jared Hester
@cloudRoutine
Dec 14 2016 18:11
np
Hosch250
@Hosch250
Dec 14 2016 18:12
Well, this is insane, the new exception says it can't find a static member of the Piece type.
Intellisense found it :/
Johan Larsson
@JohanLarsson
Dec 14 2016 18:15
@Hosch250 are you aware of the slack fp team?
It is pretty active and very friendly
Hosch250
@Hosch250
Dec 14 2016 18:15
No, I'm not.
I'm sorry if I've been a nuisance here.
Johan Larsson
@JohanLarsson
Dec 14 2016 18:16
not at all, just thought maybe you'd be interested in a nice chat
Hosch250
@Hosch250
Dec 14 2016 18:17
OK.
I don't have slack. How can I create an account?
Johan Larsson
@JohanLarsson
Dec 14 2016 18:17
there is a web thing
Johan Larsson
@JohanLarsson
Dec 14 2016 18:29
wrong room :)
Hosch250
@Hosch250
Dec 14 2016 18:29
Uh, whoops.
Jared Hester
@cloudRoutine
Dec 14 2016 18:32
@Hosch250 also sign up at http://foundation.fsharp.org/join for an invite to the FSSF slack
Hosch250
@Hosch250
Dec 14 2016 19:06
I got it working by changing the App.config rebinding to 4.4.1.0 instead of 4.4.0.0 :) :)
Jared Hester
@cloudRoutine
Dec 14 2016 19:53
you have 4.1 installed on your machine?
Hosch250
@Hosch250
Dec 14 2016 19:56
I don't know.
Hosch250
@Hosch250
Dec 14 2016 19:57
Yeah, I have 4.0 and 4.1.
How'd that happen, I wonder?
Jared Hester
@cloudRoutine
Dec 14 2016 20:00
did you install any of the vs2017 previews?
Hosch250
@Hosch250
Dec 14 2016 20:01
VS 15 Preview 4.
I suppose I should uninstall that and get the RC version.
Jared Hester
@cloudRoutine
Dec 14 2016 20:10
RC2 F# tooling is at least usable, RC1 was actually a downgrade from preview4 :laughing:
Hosch250
@Hosch250
Dec 14 2016 20:14
So, RC2 is better than preview 4?
Or should I just stick with preview 4 for now?
Do you know when it will be stable?
Jared Hester
@cloudRoutine
Dec 14 2016 20:18
probably "stableish" rc3
Hosch250
@Hosch250
Dec 14 2016 20:18
OK. Is there a timeline on that?