This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Performance Fixes #3942
Closed
Closed
Performance Fixes #3942
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d118448
fix conflicts
pakrym eb02a34
Fix bug with libraryexporter caching, add test for libraryexporter ca…
brthor 1b89e42
GetTypeBuildExclusionList Optimization.
brthor b6080bf
fix unused using
brthor 5f2dd29
Clear PatternGroup Cache, PR Feedback
brthor a8dc2b0
Slight tweak on project context cache
brthor 3871b9a
Fix Binding redirects!
brthor 55bddff
clean bin/obj in dependencycontextvalidator tests
brthor ec04a52
More performant and consistently ordered project dependency cache ref…
brthor 729b042
fix errors
brthor 874f512
fix library exporter
brthor 854824f
fix
brthor f1f7f11
changes
brthor 13a7c90
try again, this time do seen metadata right
brthor 36ca46d
tweak metadata
brthor 601c8f3
fix build warnings
brthor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
test/Microsoft.DotNet.ProjectModel.Tests/GivenAProjectContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using Microsoft.DotNet.ProjectModel; | ||
using Microsoft.DotNet.ProjectModel.Compilation; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Xunit; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using Microsoft.DotNet.Tools.Test.Utilities; | ||
using NuGet.Frameworks; | ||
|
||
namespace Microsoft.DotNet.ProjectModel.Tests | ||
{ | ||
public class GivenAProjectContext : TestBase | ||
{ | ||
[Fact] | ||
public void It_caches_library_exporter_when_configuration_and_buildBasePath_keep_value() | ||
{ | ||
var projectContext = GetProjectContext(); | ||
|
||
var configurations = new string[] { "TestConfig", "TestConfig", "TestConfig2", "TestConfig2" }; | ||
var buildBasePaths = new string[] { null, AppContext.BaseDirectory, null, AppContext.BaseDirectory }; | ||
|
||
for(int i=0; i<configurations.Length; ++i) | ||
{ | ||
var configuration = configurations[i]; | ||
var buildBasePath = buildBasePaths[i]; | ||
|
||
var exporter1 = projectContext.CreateExporter(configuration, buildBasePath); | ||
var exporter2 = projectContext.CreateExporter(configuration, buildBasePath); | ||
|
||
ReferenceEquals(exporter1, exporter2).Should().BeTrue(); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void It_does_not_cache_library_exporter_when_configuration_or_buildBasePath_changes() | ||
{ | ||
var projectContext = GetProjectContext(); | ||
|
||
var configurations = new string[] { "TestConfig", "TestConfig", "TestConfig2", "TestConfig2" }; | ||
var buildBasePaths = new string[] { null, AppContext.BaseDirectory, null, AppContext.BaseDirectory }; | ||
var previousExporters = new List<LibraryExporter>(); | ||
|
||
for(int i=0; i<configurations.Length; ++i) | ||
{ | ||
var configuration = configurations[i]; | ||
var buildBasePath = buildBasePaths[i]; | ||
var exporter = projectContext.CreateExporter(configuration, buildBasePath); | ||
|
||
foreach (var previousExporter in previousExporters) | ||
{ | ||
ReferenceEquals(exporter, previousExporter).Should().BeFalse(); | ||
} | ||
|
||
previousExporters.Add(exporter); | ||
} | ||
} | ||
|
||
private ProjectContext GetProjectContext() | ||
{ | ||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppSimple") | ||
.WithLockFiles(); | ||
|
||
return ProjectContext.Create(testInstance.TestRoot, FrameworkConstants.CommonFrameworks.NetCoreApp10); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong.