fsharp / fsharp-compiler-docs

Doc build for FSharp.Compiler.Service
https://fsharp.github.io/fsharp-compiler-docs
MIT License
279 stars 123 forks source link

GetProjectOptionsFromProjectFile needs to run on reactor thread #335

Closed 7sharp9 closed 8 years ago

7sharp9 commented 9 years ago

When running GetProjectOptionsFromProjectFile with the MonoDevelop.FSharp.mac-linux.fsproj I have experienced results where all of the assembly references are missing and only the projectreferences are present.

7sharp9 commented 9 years ago

Here is the project file options from GetProjectOptionsFromProjectFilewhen this happens

--simpleresolution
--noframework
--out:/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/../bin/mac-linux/Debug/FSharpBinding.dll
--fullpaths
--flaterrors
--target:library
--define:TRACE
--define:DEBUG
--define:MDVERSION_6_0
--debug+
--optimize+
--tailcalls+
--platform:anycpu
--warnon:1182
-r:/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/../bin/mac-linux/Debug/FSharp.CompilerBinding.dll
-r:/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/../bin/mac-linux/Debug/FSharpBinding.Gui.dll
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/Utils.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/OrderAssemblyReferences.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/Lexer.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/CodeGeneration.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/UntypedAst.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/TypedAstUtilities.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InterfaceStubGenerator.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/Parameters.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/CompilerArguments.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/TooltipHelpers.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/FileService.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/LanguageService.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/CompilerService.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/NRefactory.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/NRefactoryCodeActionSource.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/FSharpIndentationTracker.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSymbolHelper.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpInteractivePad.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpOptionsPanels.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpLanguageBinding.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpResourceIdBuilder.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFoldingParser.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpParser.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpTextEditorCompletion.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpPathExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpUnitTestTextEditorExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectServiceExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpTooltipProvider.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpResolverProvider.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/RefactoringOperationsHandler.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpReferenceFinderExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormattingPolicy.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormatter.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormattingPanelWidget.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpFormattingPolicyPanel.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpSyntaxMode.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpHighlightUsagesExtension.fs
/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharpBinding/UnformattedTextFileDescriptionTemplate.fs
7sharp9 commented 9 years ago

And here are the compiler options while running from msbuild:

-o:obj/Debug/FSharpBinding.dll
-g
--noframework
--define:TRACE
--define:DEBUG
--define:MDVERSION_6_0
--optimize+
--resource:obj/Debug/FSharpSyntaxMode.xml
--resource:obj/Debug/FSharpFormattingPolicy.xml
--resource:obj/Debug/FSharpStylePolicy.xml
--resource:obj/Debug/FSharpBinding.addin.xml
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/gtk-sharp-2.0/pango-sharp.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/gtk-sharp-2.0/atk-sharp.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/gtk-sharp-2.0/gdk-sharp.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/gtk-sharp-2.0/gtk-sharp.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/gtk-sharp-2.0/glib-sharp.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/System.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/System.Xml.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/System.Xml.Linq.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/mscorlib.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Mono.Cairo.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Mono.Posix.dll
-r:../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll
-r:../../../build/bin/Mono.Addins.dll
-r:../../../build/bin/Xwt.dll
-r:../../../build/bin/Xwt.Gtk.dll
-r:../../../build/bin/Mono.TextEditor.dll
-r:../../../build/bin/MonoDevelop.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/monodoc/monodoc.dll
-r:../../../build/bin/MonoDevelop.Ide.dll
-r:../../../build/bin/ICSharpCode.NRefactory.dll
-r:../../../build/AddIns/MonoDevelop.Refactoring/MonoDevelop.Refactoring.dll
-r:../../../build/AddIns/MonoDevelop.Debugger/MonoDevelop.Debugger.dll
-r:../../../build/AddIns/NUnit/MonoDevelop.NUnit.dll
-r:../packages/FSharp.Compiler.Service.0.0.89/lib/net45/FSharp.Compiler.Service.dll
-r:../packages/Mono.Cecil.0.9.5.4/lib/net40/Mono.Cecil.dll
-r:../packages/Mono.Cecil.0.9.5.4/lib/net40/Mono.Cecil.Mdb.dll
-r:../packages/Mono.Cecil.0.9.5.4/lib/net40/Mono.Cecil.Pdb.dll
-r:../packages/Mono.Cecil.0.9.5.4/lib/net40/Mono.Cecil.Rocks.dll
-r:../packages/Fantomas.1.6.0/lib/FantomasLib.dll
-r:../packages/FSharp.Compiler.CodeDom.0.9.1/lib/net40/FSharp.Compiler.CodeDom.dll
-r:../packages/ExtCore.0.8.45/lib/net40/ExtCore.dll
-r:../packages/System.Collections.Immutable.1.1.32-beta/lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll
-r:../packages/System.Reflection.Metadata.1.0.17-beta/lib/portable-net45+win8/System.Reflection.Metadata.dll
-r:../packages/Microsoft.CodeAnalysis.Common.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.dll
-r:../packages/Microsoft.CodeAnalysis.Common.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.Desktop.dll
-r:../packages/Microsoft.CodeAnalysis.CSharp.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.CSharp.dll
-r:../packages/Microsoft.CodeAnalysis.CSharp.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.CSharp.Desktop.dll
-r:../packages/Microsoft.CodeAnalysis.Workspaces.Common.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.Workspaces.dll
-r:../packages/Microsoft.CodeAnalysis.Workspaces.Common.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.Workspaces.Desktop.dll
-r:../packages/Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
-r:../packages/Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll
-r:../packages/Microsoft.CodeAnalysis.VisualBasic.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.VisualBasic.dll
-r:../packages/Microsoft.CodeAnalysis.VisualBasic.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.VisualBasic.Desktop.dll
-r:../packages/Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
-r:../packages/Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0.0-beta2/lib/net45/Microsoft.CodeAnalysis.VisualBasic.Workspaces.Desktop.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/xbuild/../4.5/Facades/System.Runtime.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/xbuild/../4.5/Facades/System.IO.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/xbuild/../4.5/Facades/System.GLobalization.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/xbuild/../4.5/Facades/System.Threading.Tasks.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/FSharp.Core.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/System.Core.dll
-r:/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/FSharp.CompilerBinding/bin/Debug//FSharp.CompilerBinding.dll
-r:/Users/dave/code/xamarin/monodevelop/main/external/fsharpbinding/MonoDevelop.FSharp.Gui/bin/Debug//FSharpBinding.Gui.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Collections.Concurrent.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Collections.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ComponentModel.Annotations.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ComponentModel.EventBasedAsync.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ComponentModel.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Diagnostics.Contracts.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Diagnostics.Debug.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Diagnostics.Tools.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Diagnostics.Tracing.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Dynamic.Runtime.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Globalization.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.IO.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Linq.Expressions.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Linq.Parallel.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Linq.Queryable.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Linq.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Net.NetworkInformation.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Net.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Net.Requests.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ObjectModel.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.Emit.ILGeneration.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.Emit.Lightweight.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.Emit.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Reflection.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Resources.ResourceManager.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.InteropServices.WindowsRuntime.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.InteropServices.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.Numerics.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.Serialization.Json.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.Serialization.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.Serialization.Xml.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Runtime.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Security.Principal.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ServiceModel.Http.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ServiceModel.Primitives.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.ServiceModel.Security.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Text.Encoding.Extensions.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Text.Encoding.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Text.RegularExpressions.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Threading.Tasks.Parallel.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Threading.Tasks.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Threading.Timer.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Threading.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Xml.ReaderWriter.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Xml.XDocument.dll
-r:/Library/Frameworks/Mono.framework/Versions/4.0.0/lib/mono/4.5/Facades/System.Xml.XmlSerializer.dll
--target:library
--warn:3
--warnaserror:76
--fullpaths
--flaterrors
--highentropyva-
--warnon:1182
Services/Utils.fs
Services/OrderAssemblyReferences.fs
Services/Lexer.fs
Services/CodeGeneration.fs
Services/UntypedAst.fs
Services/TypedAstUtilities.fs
Services/InterfaceStubGenerator.fs
Services/Parameters.fs
Services/CompilerArguments.fs
Services/TooltipHelpers.fs
Services/FileService.fs
Services/LanguageService.fs
Services/CompilerService.fs
Services/InteractiveSession.fs
Services/NRefactory.fs
Services/NRefactoryCodeActionSource.fs
Services/FSharpIndentationTracker.fs
FSharpSymbolHelper.fs
FSharpInteractivePad.fs
FSharpOptionsPanels.fs
FSharpLanguageBinding.fs
FSharpResourceIdBuilder.fs
FSharpFoldingParser.fs
FSharpParser.fs
FSharpTextEditorCompletion.fs
FSharpPathExtension.fs
FSharpUnitTestTextEditorExtension.fs
FSharpProjectServiceExtension.fs
FSharpProjectFileNodeExtension.fs
FSharpTooltipProvider.fs
FSharpResolverProvider.fs
RefactoringOperationsHandler.fs
FSharpReferenceFinderExtension.fs
FSharpFormattingPolicy.fs
FSharpFormatter.fs
FSharpFormattingPanelWidget.fs
FSharpFormattingPolicyPanel.fs
FSharpSyntaxMode.fs
FSharpHighlightUsagesExtension.fs
UnformattedTextFileDescriptionTemplate.fs
7sharp9 commented 9 years ago

Also notice that one produced by GetProjectOptionsFromProjectFile has the option --simpleresolution set, is that correct?

ping @rneatherway @dsyme

rneatherway commented 9 years ago

I suggest using the optional log parameter to see if anything strange is going on. You get a string back. On 17 Apr 2015 15:50, "Dave Thomas" notifications@github.com wrote:

Also notice that the produced by GetProjectOptionsFromProjectFile has the option --simpleresolution set, is that correct?

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Compiler.Service/issues/335#issuecomment-94001251 .

7sharp9 commented 9 years ago

It's quite strange, it doesn't happen all the time. It's as if an error is occurring and the dll references are missed.

On 17 Apr 2015, at 23:43, Robin Neatherway notifications@github.com wrote:

I suggest using the optional log parameter to see if anything strange is going on. You get a string back. On 17 Apr 2015 15:50, "Dave Thomas" notifications@github.com wrote:

Also notice that the produced by GetProjectOptionsFromProjectFile has the option --simpleresolution set, is that correct?

— Reply to this email directly or view it on GitHub https://github.com/fsharp/FSharp.Compiler.Service/issues/335#issuecomment-94001251 .

— Reply to this email directly or view it on GitHub.

dsyme commented 9 years ago

We'll need a reliable repro for this - can you isolate it Dave?

7sharp9 commented 9 years ago

@rneatherway GetProjectOptionsFromProjectFile doesn't have an option for logging only FSharpProjectFileInfo.Parse has that option.

@dsyme Its a strange one, I didn't get it yesterday, but I get it each time I need it today, the problem is I memoize it so once its incorrect Im stuck with it.

What Im assuming is happening is there is an exception while processing references and there is an empty list returning, all project references are there just no file references.

7sharp9 commented 9 years ago

Actually I just managed to capture this exception:

Target ResolveAssemblyReferences started.
Task started.
Using task CreateItem from Microsoft.Build.Tasks.CreateItem, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Task finished.
Task started.
Using task CreateItem from Microsoft.Build.Tasks.CreateItem, Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Task finished.
Task started.
Error initializing task ResolveAssemblyReference: Exception has been thrown by the target of an invocation.
Error initializing task ResolveAssemblyReference: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: An item with the same key has already been added.
  at System.ThrowHelper.ThrowArgumentException (ExceptionResource resource) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/throwhelper.cs:74 
  at System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.Version,System.String]].Insert (System.String key, System.Collections.Generic.Dictionary`2 value, Boolean add) [0x0008e] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:329 
  at System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Dictionary`2[System.Version,System.String]].Add (System.String key, System.Collections.Generic.Dictionary`2 value) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:185 
  at Microsoft.Build.Tasks.AssemblyResolver.GatherGacAssemblies () [0x000c4] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs:104 
  at Microsoft.Build.Tasks.AssemblyResolver..ctor () [0x00024] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs:58 
  at Microsoft.Build.Tasks.ResolveAssemblyReference..ctor () [0x00006] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ResolveAssemblyReference.cs:89 
  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) [0x00002] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:535 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00013] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Reflection/MonoMethod.cs:541 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x000af] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System/Activator.cs:321 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System/Activator.cs:214 
  at Microsoft.Build.BuildEngine.BuildTask.InitializeTask () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:204 
  at Microsoft.Build.BuildEngine.BuildTask.Execute () [0x00006] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:90 
Target ResolveAssemblyReferences finished.
7sharp9 commented 9 years ago

And another:

Error executing task ResolveAssemblyReference: Object reference not set to an instance of an object
Error executing task ResolveAssemblyReference: System.NullReferenceException: Object reference not set to an instance of an object
  at System.Collections.Generic.Dictionary`2[System.String,Microsoft.Build.Tasks.TargetFrameworkAssemblies].Insert (System.String key, Microsoft.Build.Tasks.TargetFrameworkAssemblies value, Boolean add) [0x0010c] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:347 
  at System.Collections.Generic.Dictionary`2[System.String,Microsoft.Build.Tasks.TargetFrameworkAssemblies].set_Item (System.String key, Microsoft.Build.Tasks.TargetFrameworkAssemblies value) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/collections/generic/dictionary.cs:180 
  at Microsoft.Build.Tasks.AssemblyResolver.FindInTargetFramework (ITaskItem reference, System.String framework_dir, Boolean specific_version) [0x00034] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssemblyResolver.cs:131 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.ResolveReference (ITaskItem item, IEnumerable`1 search_paths, Boolean set_copy_local) [0x000a4] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ResolveAssemblyReference.cs:220 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.ResolveAssemblies () [0x0007f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ResolveAssemblyReference.cs:157 
  at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute () [0x00087] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ResolveAssemblyReference.cs:112 
  at Microsoft.Build.BuildEngine.TaskEngine.Execute () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskEngine.cs:134 
  at Microsoft.Build.BuildEngine.BuildTask.Execute () [0x0008f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:101 
Target ResolveAssemblyReferences finished.
7sharp9 commented 9 years ago

Looks like its not thread safe to call GetProjectOptionsFromProjectFile because msbuild is not threadsafe during the access.

7sharp9 commented 9 years ago

If I add a lock to my usage then I don't get any errors:

lock projectInfoCache 
    (fun () ->Debug.WriteLine (sprintf "LanguageService: GetProjectCheckerOptions: Generating ProjectOptions for %s" <| Path.GetFileName(projFilename) )
              let opts = checker.GetProjectOptionsFromProjectFile(projFilename, properties)
7sharp9 commented 9 years ago

Maybe there is some state within the msbuild task thats invoked or something that not disposed properly?

dsyme commented 9 years ago

If the operation is not thread safe then it should really be run through the Reactor thread in FCS. This is a relatively easy fix to make.

7sharp9 commented 9 years ago

Running this function out of process would fix this issue and also #342

dsyme commented 8 years ago

@rneatherway Note this will be fixed by #470 :)

dsyme commented 8 years ago

Closed via #470