Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

[release-8.4] [Ide] Consider MSBuild item conditions in Solution pad #9408

Closed
wants to merge 3 commits into from

Commits on Dec 2, 2019

  1. [Ide] Consider MSBuild item conditions in Solution pad

    Creating an ASP.NET Core project when .NET Core 3.1 SDK was installed
    would result in .json files being displayed twice in the Solution pad.
    .NET Core 3.1 SDK defines .json files twice.
    
        <Content Include="**\*.json" ... Condition="'$(ExcludeConfigFilesFromBuildOutput)'!='true'" />
    
        <Content Include="**\*.json" ... Condition="'$(ExcludeConfigFilesFromBuildOutput)'=='true'" />
    
    Older .NET Core SDKs did not define the Content items more than once.
    The Condition was not considered when showing files in the Solution
    pad.
    
    To support conditional files the Solution pad asks the project for
    its visible files. The project uses the MSBuildEvaluationContext
    to evaluate the condition to see if the file is visible or not.
    
    Note that conditions on parent ItemGroups are currently not taken into
    account. Also that visible files are not updated if the active config
    is changed.
    
    Fixes VSTS #1005277 Create ASP.NET Core project, open Properties
    folder, there are two launchSettings.json files.
    mrward authored and monojenkins committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    5824b8c View commit details
    Browse the repository at this point in the history
  2. [Core] Make MSBuildPropertyGroupEvaluated thread safe

    Adding a new .json file to a ASP.NET Core 3.1 project resulted in the
    files not being displayed in the Properties folder due to the project
    configuration's Properties being updated on a background thread on
    saving and the UI thread reading these properties to determine if a
    file is visible in the Solution pad. Switch to using a concurrent
    dictionary in MSBuildPropertyGroupEvaluated.
    
    System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
      at System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator[TKey,TValue].MoveNext () [0x00085] in mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:1628
      at MonoDevelop.Projects.MSBuild.MSBuildEvaluatedPropertyCollection+<MonoDevelop-Projects-IPropertySet-GetProperties>d__11.MoveNext () [0x0008e] in monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildPropertyGroupEvaluated.cs:207
      at MonoDevelop.Projects.Project+<GetVisibleFiles>d__143.MoveNext () [0x0017d] in monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:1231
      at MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderNodeBuilder.GetFolderContent (MonoDevelop.Projects.Project project, System.String folder, System.Collections.Generic.List`1[MonoDevelop.Projects.ProjectFile]& files, System.Collections.Generic.List`1[System.String]& folders) [0x00149] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs:87
      at MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderNodeBuilder.BuildChildNodes (MonoDevelop.Ide.Gui.Components.ITreeBuilder builder, System.Object dataObject) [0x00048] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs:74
      at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView+TransactedTreeBuilder.FillNode () [0x00082] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/TransactedTreeBuilder.cs:522
    mrward authored and monojenkins committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    636e5f6 View commit details
    Browse the repository at this point in the history
  3. [Core] Use lock in MSBuildPropertyGroupEvaluated

    Using a ConcurrentDictionary broke the tests that rely on the items
    being ordered in the Dictionary. The item definition test
    ItemDefinitionGroup_AddFilesWithoutMetadata_MetadataUsesEmptyElements
    failed due to the item definition properties being re-ordered. For
    now using a lock around the Dictionary instead of a
    ConcurrentDictionary.
    mrward authored and monojenkins committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    c84dcc8 View commit details
    Browse the repository at this point in the history