149333 (5) [Avatar] Offline
#1
Re: pages 20 - 29 of MEAP v1

(1) With 64 bit AMD CPU, win10, VS 2015 community edition. Followed all instructions.

I can't get same o/p running 1st program. I ONLY get:
------------------------------
press any key to continue ...
------------------------------

Do not see either of:
------------------------------
[||]
press any key to continue ...
------------------------------

nor:
------------------------------
[|"HELLO"; "WORLD"|]
press any key to continue ...
------------------------------

(2) Googling F# interactive options, I can find no mention of 'readline' command line option in any docs (for f# or c#!)
Isaac Abraham (68) [Avatar] Offline
#2
Hi!

149333 wrote:

I can't get same o/p running 1st program. I ONLY get:
------------------------------
press any key to continue ...
------------------------------

Do not see either of:
------------------------------
[||]
press any key to continue ...
------------------------------

nor:
------------------------------
[|"HELLO"; "WORLD"|]
press any key to continue ...
------------------------------


Hmmm. You should definitely get the [||] stuff from a standard F# console application - File -> New Project -> F# Console, then hit CTRL + F5.

149333 wrote:
(2) Googling F# interactive options, I can find no mention of 'readline' command line option in any docs (for f# or c#!)


As I recall, this is to help enable allowing Diagnostics trace messages that are sent to the Console Trace Listeners to show in FSI.
148888 (1) [Avatar] Offline
#3
It worked for me, I tried uploading the 'PrintScreens' but this 'forums.manning.com/posts/reply/0/39223.page' would not let me load it for size too big for screen shots.

Try closing vs2015 and starting again, it worked for me second time.
149333 (5) [Avatar] Offline
#4
1) No debug for me! When I run the console application with F5, it executes in debug mode but does not pickup the arguments set for debug (HELLO WORLD), nor does it debug. It ignores breakpoints.

2) At first I thought it was because I had a couple of entries in my PATH pointing to other fsc executables at:

C:\Programs\scala\bin;
C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\;

The first is a batch file!. I removed these from the PATH, but the debug still didn't work

3) I also noticed I have files in my PREFETCH folder, 4 of them!

Directory of C:\Windows\Prefetch

30-Sep-16 10:23 AM ---- 28,870 bytes ---- FSC.EXE-BD42E756.pf
29-Sep-16 10:34 PM ---- 32,853 bytes ---- FSI.EXE-31454674.pf
29-Sep-16 10:54 PM ---- 32,519 bytes ---- FSI.EXE-F6EFA044.pf
30-Sep-16 10:05 AM ---- 90,492 bytes ---- FSIANYCPU.EXE-4ABD7B54.pf

Are these OK to leave there?

4) I can live without debug anyway. I have the REPL and can write tests. Debug can be a big waste of time if you get used to using it a lot.
149333 (5) [Avatar] Offline
#5
Baffled now. I executed it from the command line:
f:\> F:\code\FSharp\LearnFsharp-1\LearnFsharp-1\bin\Debug\learnfsharp_1.exe HELLO WORLD

It gave no output. As if it compiled a different program. Shouldn't printfn behave as Console.WriteLn() ?

So I changed the program to:
[<EntryPoint>]
let main argv =
    let hw = [|"HELLO"; "WORLD"|]
    let items = hw.Length
    printfn "Passed in %d items: %A" items hw
    0


Cleaned it (and checked that the debug folder contents were deleted). Ran the new program from the command line:
f:\> F:\code\FSharp\LearnFsharp-1\LearnFsharp-1\bin\Debug\learnfsharp_1.exe

Still no output from it. It does not fail because it always returns zero. It looks like it's compiling another program!

Replaced it with:
open System

[<EntryPoint>]
let main argv =
    let hw = [|"HELLO"; "WORLD"|]
    let items = hw.Length
    Console.WriteLine("Passed in {0} items: {1}", items, hw)
    Console.ReadKey |> ignore
    0

Cleaned. It did not debug with F5. Ran it from the command line. Still giving no o/p, nor did it ask for a wait for a key!!
149333 (5) [Avatar] Offline
#6
I will remove VS2015 community edition and reinstall.
Isaac Abraham (68) [Avatar] Offline
#7
I'm completely baffled by this. You evidently have the F# tools installed, yet the console application doesn't output anything.

Can you replace the call to printfn with Console.WriteLine and see if that works?

Cheers
149333 (5) [Avatar] Offline
#8
Apologies. All my fault.

Somehow Visual Studio became mis-configured. I don't know how that happened. The Build -> Configuration Manager settings were wrong. It was not actually building the program I wrote.

This is not a book issue.