Skip to content

Graph Based Builds encounter InvalidProjectException #245

@TheAngryByrd

Description

@TheAngryByrd

Describe the bug

[10:10:28.735 ERR] [Ionide.ProjInfo.WorkspaceLoaderViaProjectGraph] InvalidProjectException error while building projects via graph build
Microsoft.Build.Exceptions.InvalidProjectFileException: The project file could not be loaded. The process cannot access the file 'c:\Users\jimmy\Repositories\public\demystifyfp\FsToolkit.ErrorHandling\src\FsToolkit.ErrorHandling\FsToolkit.ErrorHandling.fsproj' because it is being used by another process.  c:\Users\jimmy\Repositories\public\demystifyfp\FsToolkit.ErrorHandling\src\FsToolkit.ErrorHandling\FsToolkit.ErrorHandling.fsproj
 ---> System.IO.IOException: The process cannot access the file 'c:\Users\jimmy\Repositories\public\demystifyfp\FsToolkit.ErrorHandling\src\FsToolkit.ErrorHandling\FsToolkit.ErrorHandling.fsproj' because it is being used by another process.
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at Microsoft.Build.Internal.XmlReaderExtension..ctor(String file, Boolean loadAsReadOnly)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting, Boolean loadAsReadOnly)
   --- End of inner exception stack trace ---
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.ThrowInvalidProjectFile(BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.Construction.ProjectRootElement.LoadDocument(String fullPath, Boolean preserveFormatting, Boolean loadAsReadOnly)
   at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.CreateProjectFromPath(String projectFile, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting)
   at Microsoft.Build.Evaluation.ProjectRootElementCache.GetOrLoad(String projectFile, OpenProjectRootElement loadProjectRootElement, Boolean isExplicitlyLoaded, Nullable`1 preserveFormatting)
   at Microsoft.Build.Construction.ProjectRootElement.OpenProjectOrSolution(String fullPath, IDictionary`2 globalProperties, String toolsVersion, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded)
   at Microsoft.Build.Evaluation.Project.ProjectImpl..ctor(Project owner, String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext, IDirectoryCacheFactory directoryCacheFactory, Boolean interactive)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   at Ionide.ProjInfo.ProjectLoader.createNewProject@469.Invoke(IDictionary`2 properties) in C:\Users\jimmy\Repositories\public\TheAngryByrd\proj-info\src\Ionide.ProjInfo\Library.fs:line 470
   at Ionide.ProjInfo.ProjectLoader.findOrCreateMatchingProject@497.Invoke(Unit _arg3) in C:\Users\jimmy\Repositories\public\TheAngryByrd\proj-info\src\Ionide.ProjInfo\Library.fs:line 500
   at Ionide.ProjInfo.ProjectLoader.findOrCreateMatchingProject(String path, ProjectCollection collection, IDictionary`2 globalProps) in C:\Users\jimmy\Repositories\public\TheAngryByrd\proj-info\src\Ionide.ProjInfo\Library.fs:line 495
   at Ionide.ProjInfo.WorkspaceLoaderViaProjectGraph.projectInstanceFactory(String projectPath, IDictionary`2 globalProperties, ProjectCollection projectCollection) in C:\Users\jimmy\Repositories\public\TheAngryByrd\proj-info\src\Ionide.ProjInfo\Library.fs:line 1216
   at <StartupCode$Ionide-ProjInfo>.$Library.g@1250.Invoke(String delegateArg0, Dictionary`2 delegateArg1, ProjectCollection delegateArg2)
   at Microsoft.Build.Graph.GraphBuilder.ParseProject(ConfigurationMetadata configurationMetadata)
   at Microsoft.Build.Graph.GraphBuilder.<>c__DisplayClass40_0.<SubmitProjectForParsing>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Microsoft.Build.Graph.ParallelWorkSet`2.ExecuteWorkItem()

To Reproduce
Steps to reproduce the behaviour:

  1. Editing a project file and letting it reload multiple times in FsAutocomplete

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS:
  • Ionide version:
  • VSCode version:
  • dotnet SDK version:
  • mono / .Net Framework version:

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions