My F# code doesn't run, how can I investigate further?

I downloaded Visual Studio Community 2015 to try and lean F#. My F# projects compiles without any issues but when I try to launch the console project (even the default console project) Visual Studio just hangs and then freezes. The only way I have to shut it down is to go to the task manager.

Same thing if I try to directly launch the generated .exe file: explorer freezes and I have to go to the task manager to restart it.

All my C# projects work fine...

Upvotes: 2

Views: 650

Answers (1)

Tomas Petricek
Tomas Petricek

Reputation: 243041

I have seen a similar behavior before on a machine that had an anti-virus installed. The anti-virus was blocking Visual Studio from running F# code with debugger and disabling the anti-virus resolved the issue.

In general, there are a few ways to run F# code in Visual Studio:

  • Using F5 to start the program with a debugger (this is the one that the anti-virus was blocking); F11 which steps into the debugger was also not working

  • Using Ctrl+F5 which starts the program without a debugger - this should work!

  • By creating an F# script file (Script.fsx), selecting code and using Alt+Enter to run code using F# interactive - this should work too.

Many people do quite a lot of work with F# using F# Interactive, so learning how to use that is a good skill, but to use the debugger, disabling anti-virus should do the trick.

Upvotes: 3

Related Questions