Xamarin Studio无法打开F#文件。

6

我刚刚在OSX上安装了Xamarin Studio,以尝试F#编程。安装过程很顺利,我能够创建F#教程项目,但是当我尝试打开Tutorial.fs文件时,出现以下消息:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Mono.TextEditor.Highlighting.ResourceXmlProvider.Open'.
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at Mono.Addins.TypeExtensionNode.CreateInstance () [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/external/mono-addins/Mono.Addins/Mono.Addins/TypeExtensionNode.cs:93 
  at MonoDevelop.SourceEditor.SyntaxModeCodon.get_SyntaxMode () [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SyntaxModeCodon.cs:42 
  at MonoDevelop.SourceEditor.SyntaxModeService+<SyntaxModeService>c__AnonStorey17.<>m__61 (Mono.TextEditor.TextDocument d) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SyntaxModeService.cs:45 
  at Mono.TextEditor.Highlighting.SyntaxModeProvider.Create (Mono.TextEditor.TextDocument doc) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs:839 
  at Mono.TextEditor.Highlighting.SyntaxModeService.GetSyntaxMode (Mono.TextEditor.TextDocument doc, System.String mimeType) [0x00036] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs:157 
  at MonoDevelop.SourceEditor.SourceEditorView.UpdateMimeType (System.String fileName) [0x00042] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:926 
  at MonoDevelop.SourceEditor.SourceEditorView.Load (System.String fileName, System.Text.Encoding loadEncoding) [0x00040] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:792 
  at MonoDevelop.SourceEditor.SourceEditorView.Load (System.String fileName) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:729 
  at MonoDevelop.Ide.Gui.LoadFileWrapper.Invoke (System.String fileName) [0x00107] in /Users/builder/data/lanes/monodevelop-lion-evolve_fixed/a8bf58d3/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs:1181 

双击该文件也会导致上述消息。该文件在 Xamarin studio 中可见。如果我使用 mono 3.0.10,我可以运行教程项目并打开终端并执行该文件。我正在使用 Xamarin studio 版本4.0.4,并安装了 mono 3.0.10 和 2.10.12。
还有一件事情我不太明白,可能与此有关,在引用中有一个警告:FSharp.Core 在 Mono/.NET 4.0 上不可用(在 mono 3.0.10 中)。我认为这会阻止我运行文件,但事实并非如此,所以我不确定它是否相关。

1
您可以在 http://fsharp.org/use/ios/ 找到最新的 F# + Xamarin Studio 安装说明。(此说明也适用于安卓系统) - James Moore
2个回答

11

我认为您需要使用最新版本的F#绑定,因为该错误是Xamarin Studio 4.0.1和4.0.3版本之间的重大更改。

您没有指定当前使用的版本,但如果您使用插件渠道或手动从以下链接安装最新版本:F#绑定3.2.15,则一切都应该正常工作。

您提到的FSharp.Core问题也是已知问题


今天我安装了所有东西,包括我添加为插件的绑定,所以我认为我有最新版本的绑定。 - Tomas Jansson
那么您是否正在使用 F# 绑定的 3.2.15 版本呢?在 Xamarin Studio 的“Addin 管理器”中,“语言绑定”将显示已安装的版本。 - 7sharp9
好的,我稍后会回来处理这个问题。现在我在工作,没有带着我的MacBook,但我今天稍后会尝试一下。如果我没有安装最新版本,我该如何安装它呢?我今天使用了插件管理器来安装它,并认为它会给我最新版本,如果不是最新版本,有其他方法可以安装绑定吗? - Tomas Jansson
我猜你会使用3.2.14版本。我认为Xamarin的插件管理器可能存在一个问题,无法从渠道中获取到3.2.15版本。你可以通过点击上面的链接手动更新,下载mpack文件。在插件管理器中有一个“从文件安装”的选项。 - 7sharp9

0

我最近遇到了这个问题,在升级到带有最新升级的 alpha 版本 3.3 后才解决了它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接