Error in Working with F# - by Mehdi Asgari

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 507202 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 10/31/2009 11:54:35 PM
Access Restriction Public


I've installed VS2010 Beta 2 Professional. I'd also installed VS2008 SP1 and F# CTP (
Now everything works as expected, except anything related to F#.

1-When I try to create a F# project a dialog box shows up with this error:

Microsoft Visual Studio
The operation could not be completed. Unspecified error 

but the empty solution directory is created in Documents/Visual Studio 2010/Projects

2- When I try to run the Fsi.exe, a FileNotFoundException raises.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, version=, Culture=neutral, PublicKeyToken=b03f5f711d50a3a' or one of its dependencies. The system cannot find the file specified. at <StartupCode$Fsi>.$Microsoft.FSharp.Compiler.Interactive.Shell$Main.main@()

3- When I try to open a .fs file with VS2010, this error raises (in a dialog box):

Microsoft Visual Studio
Object reference not set to an instance of an object.

sometimes I also get this error:

Microsoft Visual Studio
Visual Studio has encountered an exception. This may be caused by an extension. See the Activity Log for more details.

I've repaired VS 2010 beta2  but nothing changed (I also did: devenv /ResetSettings )
I can work with C# and everything is OK
Sign in to post a comment.
Posted by Mehdi Asgari on 11/7/2009 at 11:27 PM
>Could you run 'gacutil /l | findstr "FSharp"' from within a Visual Studio command prompt to see if it finds the 4.0 version of FSharp.Core.dll?
But it returns version 2.0 for me

> I would also suggest uninstalling and reinstalling the F# redist which you can get here:

Thank you. This fixed my problem. Now I can work with F# under .NET 4.0 (Please note that one must first uninstall the installed version and then install the new one)
Posted by Microsoft on 11/5/2009 at 3:50 PM

We were tracking issue #3 as bug 5918 and it has been fixed on our internal bits since Beta 2 was released. Until that fix goes public the most common causes of opening a .fs file raising an exception are:
- User sets config/platform to a set that is not defined in .fsproj file (will get helpful diagnostic if they just try to ‘build’ the project inside VS)
- User is trying to ‘upgrade’ by using some old .fsproj file that perhaps points to wrong location of Microsoft.FSharp.targets or has some other incompatibility with their new system

For issues #1 and #2 I am not sure of the exact cause. Could you run 'gacutil /l | findstr "FSharp"' from within a Visual Studio command prompt to see if it finds the 4.0 version of FSharp.Core.dll?

I would also suggest uninstalling and reinstalling the F# redist which you can get here:

Please try that and let us know if the issue persists.

Michael Hale
Visual Studio Languages Program Manager
Posted by Microsoft on 11/5/2009 at 2:06 AM
Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team
Posted by Microsoft on 11/2/2009 at 12:46 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted.
Posted by Dan Ruder [MSFT] on 11/1/2009 at 6:49 PM
Further note: I got the null reference exception when the project settings were set to an X64 build. When I changed ithe project to X86 and saved the solution, I was able to open .FS files without any problem. Hopefully, this helps anyone else who's seen this problem.

Posted by Dan Ruder [MSFT] on 11/1/2009 at 6:40 PM
I got the same bug as #3 reported by Medhi Asgari: opening a .fs file raises a null-reference exception. So, I ran devenv with /log and here is the relevant entry:

    <time>2009/11/02 02:30:01.785</time>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.FSharp.ProjectSystem.FSharpProjectNode.Microsoft-VisualStudio-FSharp-LanguageService-IProvideProjectSite-GetProjectSite()
at Microsoft.VisualStudio.FSharp.LanguageService.IProvideProjectSite.GetProjectSite()
at Microsoft.VisualStudio.FSharp.LanguageService.Artifacts.TryGetProjectSite(IVsHierarchy hierarchy)
at Microsoft.VisualStudio.FSharp.LanguageService.Artifacts.GetDefinesForFile(IVsRunningDocumentTable rdt, String filename, Boolean enableStandaloneFileIntellisense)
at <StartupCode$FSharp-LanguageService>.$Servicem.scanner@1157.Invoke(String source)
at Microsoft.VisualStudio.FSharp.LanguageService.FSharpScanner..ctor(FSharpFunc`2 makeTokenizer)
at Microsoft.VisualStudio.FSharp.LanguageService.LanguageServiceState.GetColorizer(IVsTextLines buffer)
at Microsoft.VisualStudio.FSharp.LanguageService.FSharpLanguageService.GetColorizer(IVsTextLines buffer)
at Microsoft.VisualStudio.FSharp.LanguageService.LanguageService.GetColorizer(IVsTextLines buffer, IVsColorizer& result)
at Microsoft.VisualStudio.Editor.Implementation.LanguageServiceClassifier.TryCreateClassifier(ITextBuffer textBuffer, IVsFontsAndColorsInformationService fontAndColorInformation, LanguageServiceClassifier& classifier)
at Microsoft.VisualStudio.Editor.Implementation.LanguageServiceClassifierProvider.GetClassifier(ITextBuffer buffer)
at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTaggerProvider.GatherClassifiers(ITextBuffer buffer)
at Microsoft.VisualStudio.Text.Classification.Implementation.ClassifierTaggerProvider.CreateTagger[T](ITextBuffer buffer)
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer textBuffer)</description>
Posted by Mehdi Asgari on 11/1/2009 at 3:56 AM
in Visual F# projects section in New Project dialog I have these items:


but it should be :

F# Library
F# Application
F# Tutorial

I uninstalled F#, but again the issue remains