Граф коммитов

7737 Коммитов

Автор SHA1 Сообщение Дата
Jan Krivanek fe79798bdb
Merge pull request #8763 from dotnet/locfiles/0e67b832-c67a-47b8-af21-5586aa599a48
Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7782330
2023-05-17 13:45:28 +02:00
dotnet bot a909356d73 Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7782330 2023-05-17 00:24:49 -07:00
dotnet bot 2d26c07db8 Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7782330 2023-05-17 00:24:42 -07:00
dotnet bot 141e51f32c Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7782330 2023-05-17 00:23:34 -07:00
Roman Konecny f3408b0c0d
Using immutable array here and there (#8753)
Related to #8673

Context
When analyzing traces from VS Orchard evaluation I have noticed few places which are easy to optimize by using ImmutableArray instead of ImmutableList.
ImmutableArray is almost always better in patters loop {mutate by builder}; ToImmutable since it is struct, allocates less, and have faster enumerator.

Changes Made
There are many places where using ImmutableArray instead of ImmutableList would render better performance. I however limit changes only on places which sticks out from memory traces as non-negligable.

Testing
Local. PR gate.

Notes
Overall gain will be small, in percent's of overall allocations, but given relatively simple and safe changes, I think it is good tradeoff.
2023-05-17 15:18:02 +08:00
dotnet bot f1bd6f2b08 Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7778149 2023-05-16 09:30:55 -07:00
dotnet bot 66e98c947c Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7778149 2023-05-16 09:30:48 -07:00
dotnet bot 3a3126f683 Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7778149 2023-05-16 09:29:40 -07:00
Jan Krivanek 6cfca54c1f
Merge pull request #8761 from dotnet/JanKrivanek-patch-2
[vs17.2] Update the build tools
2023-05-16 18:24:29 +02:00
dotnet bot a313969c55 Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7777270 2023-05-16 03:45:03 -07:00
Jenny Bai 8d8421c79a
Add Xml default resolver parameter for XslCompiledTransform.Transform (#8655)
Fixes #8570 part 1

Context
UseTrustedSettings parameter for XslTransformation task is ignored when using dotnet build since the resolver is not setting.

Changes Made
Use an XslCompiledTransform.Transform overload that takes an XmlResolver parameter.
Add the info log message when the UseTrustedSettings is opted-in on the Task

Testing
Enable the earlier disabled test XslDocumentFunctionWorks() on net7.0
2023-05-16 18:38:15 +08:00
dotnet bot 7c6807ef6e Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7777059 2023-05-16 02:33:45 -07:00
dotnet bot e8c975405a Localized file check-in by OneLocBuild Task: Build definition ID 9434: Build ID 7777059 2023-05-16 02:32:37 -07:00
Ladi Prosek 219f685962
Close API gap where ProjectInstance ignores ProjectOptions.DirectoryCacheFactory (#8746)
Context
When ProjectOptions.DirectoryCacheFactory was introduced only Project support was implemented. ProjectInstance ignores the field and while currently not a required functionality, it is a minor API gap.

Changes Made
Made ProjectInstance use DirectoryCacheFactory if passed in ProjectOptions.

Removed Project.GetDirectoryCacheForEvaluation and instead plumbed the factory all the way down to Evaluator.
Tweaked the unit test project to use Condition on Import rather than on ItemGroup to not expose differences between Project and ProjectInstance in the treatment of conditional items.
Testing
Existing updated unit test.
2023-05-16 17:30:37 +08:00
dotnet-maestro[bot] 256a9079e9
Update dependencies from https://github.com/nuget/nuget.client build 6.7.0.41 (#8759)
NuGet.Build.Tasks
 From Version 6.7.0-preview.2.33 -> To Version 6.7.0-preview.2.41

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-05-16 17:27:15 +08:00
Rainer Sigwald 16e00e350a Convert LiveLogger tests to use Verify
* Remove MockTerminal in favor of internal fields on Terminal itself.
* Reference Verify library for acceptance testing.
* Convert existing tests to Verify.
2023-05-15 15:24:01 -05:00
Rainer Sigwald 591ce821ab Manually pump messages in TerminalLogger tests
This way, even if the tests take a long time to run, we won't see
periodic messages with node status.
2023-05-15 15:23:29 -05:00
Rainer Sigwald 172c3e974b Default to large viewport when console redirected
This avoids an exception when `-tl:true` and output is redirected to a
file, which will be important for unit testing.
2023-05-15 15:06:23 -05:00
Jan Krivanek b18963d483
Bump version 2023-05-15 21:02:29 +02:00
Jan Krivanek 27393780ef
Update the build tools 2023-05-15 20:59:18 +02:00
Jan Krivanek ad63f95961
Merge pull request #8758 from dotnet/JanKrivanek-patch-2
[vs17.2] Expliciltly require matching version of VS for signing validation step
2023-05-15 18:14:43 +02:00
Jan Krivanek 80eb8b291e
Fix global.json 2023-05-15 09:58:58 +02:00
Jan Krivanek a34fb1bf85
Bump version 2023-05-15 09:54:18 +02:00
Jan Krivanek e2b2b2cc97
Expliciltly require matching version of VS for signing validation step 2023-05-15 09:48:43 +02:00
Roman Konecny fc28ffc971
Use CopyOnWritePropertyDictionary.ImportProperties for batching (#8747)
Fixes #8673

Context
High memory allocations in CopyOnWritePropertyDictionary ImmutableDictionary was reported by partners.

Changes Made
Use CopyOnWritePropertyDictionary.ImportProperties in obvious places as oppose to CopyOnWritePropertyDictionary.Set in loop.

Testing
Unit tests. Local. Perf measure.

Notes
2023-05-15 15:37:28 +08:00
Jan Krivanek 03946b7216
[vs17.2] Update vulnerable packages versions (#8740)
Fixes: 5 remaining CG issues on vs17.2 (https://devdiv.visualstudio.com/DevDiv/_componentGovernance/DotNet-msbuild-Trusted?_a=alerts&typeId=15231688&alerts-view-option=active)

Context
Couple packages were flagged by CG - updating those,
Plus taking inspiration from #7538 to override the transitive stale packages pull

Important
Those changes are NOT to be merged into 17.4 (as those are already managed by dependabot there https://github.com/dotnet/msbuild/blob/vs17.4/eng/dependabot/Packages.props)
2023-05-12 21:31:02 +08:00
Noah Gilson 9deb5b58fb
Detect .NET SDK & VSLANG Custom Language Settings & Apply To MSBuild (#8503)
Fixes #1596

Changes Made
SetConsoleUI now calls into a helper which sets the encoding to support non-en languages and checks if an environment variable exists to change the language to.

Testing
Setting DOTNET_CLI_UI_LANGUAGE=ja now changes msbuild correctly:
image

Doing a complicated build (aka building MSBuild) to use multiple threads shows other threads seem to use the same UI culture:

image

See that chcp remains the same after execution:
image

(Was set to 65001 temporarily but back to the original page before execution.)

Notes
Much of this code is a port of this code: dotnet/sdk#29755
There are some details about the code here.

[!] In addition, it will introduce a breaking change for msbuild just like the SDK.
The break is documented here for the sdk: dotnet/docs#34250
2023-05-12 10:58:37 +08:00
Mikhail Filippov 7f4bef8b46
Avoid MSBuild crash when DOTNET_SYSTEM_GLOBALIZATION_INVARIANT mode is enabled and console codepage, not ANSI. (#8738)
Context
If DOTNET_SYSTEM_GLOBALIZATION_INVARIANT is enabled and console codepage non-ANSI MSBuild will crash on an attempt to create CultureInfo:

Unhandled exception. System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
en-US is an invalid culture identifier.
Changes Made
Keep the current thread culture the same if CurrentUICulture is Invariant.
2023-05-10 15:52:44 +08:00
Forgind 37b52c8008
Dont ngen taskhost Fixes our lack of optprof data (#8737)
Don't ngen TaskHosts
2023-05-09 14:00:19 -07:00
Rainer Sigwald 2e62a015fa
Link from ChangeWaves-dev to ChangeWaves (#8744) 2023-05-09 13:49:34 -07:00
Ryan Rozario 8aa67f3f89
Fix logerror xslTransform task (#8734)
Fixes #8642
Fixes #8641

Context
Corrected the parameters in log error.

Changes Made
Fixed parameters in log message in xslTransform task
2023-05-09 13:49:23 -07:00
Ladi Prosek 7c5ff2cfc1
[Own build] Don't use AssemblyInformationCachePaths (#8739)
Now that #8688 is in, we no longer get value from the SDK pre-cache. The cost of reading the cache is >50 ms per project, which typically makes it the most expensive part of RAR.

Trace from MSBuild command line build:
2023-05-09 13:49:01 -07:00
Ladi Prosek 3fd7428081
Optimize locking in ProjectCollection (low risk) (#8742)
Fixes AB#1811627 (@davkean will likely file a GH issue)

Context
ProjectCollection uses a ReaderWriterLockSlim but it never takes it just for reading with EnterReadLock. Instead it uses EnterUpgradeableReadLock, which effectively provides mutual exclusion when reading data and results in unnecessary contention. The reason cited in comments revolves around reentrancy but calling EnterReadLock while already holding the write lock is perfectly legal with LockRecursionPolicy.SupportsRecursion so there's no need to mutually exclude readers.

Changes Made
Made ProjectCollection use plain read lock instead of the upgradeable one.
Simplified the IDisposable holder structs by removing the unneeded interlocked operation.
Testing
Existing unit tests.

Notes
This is a safer version of #8728, which attempts to optimize concurrency in this class even further at the expense of readability. In particular, many readers could be converted to volatile reads to eliminate the possibility of contention with writers, some of which may be long-running. Since the reader-writer contention should not happen in VS scenarios, that PR was closed due to unfavorable risk/benefit and left just for future reference.
2023-05-09 13:48:30 -07:00
dotnet-maestro[bot] 1dde6006e1
Update dependencies from https://github.com/nuget/nuget.client build 6.7.0.33 (#8736)
NuGet.Build.Tasks
 From Version 6.7.0-preview.1.20 -> To Version 6.7.0-preview.2.33

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-05-08 11:40:55 -07:00
Forgind 0809a23b75
Verify paths are not the same Fixes #8684 (#8685)
Fixes #8684
Fixes #8273

Context
After #8275, we delete any destination file as part of the Copy task if we determine that we really should copy onto it. Unfortunately, if we try to copy a file onto itself, we delete it before we can copy onto itself, which just means it's gone. Fortunately, we have a check earlier that ensures that we skip any copy operation from a location to the same location. Unfortunately, it's a direct string comparison that doesn't evaluate to full paths first, so it misses slightly more complicated examples.

Changes Made
Take into account full paths

Testing
Unit tests + manual test that it doesn't delete the file anymore

Notes
This implementation tries to remove now-unnecessary full path derivations downstream, hence some added complexity, but it still means extra computation on the happy path if we end up creating a hard/symbolic link. An alternate direction eliminating any full path derivations on the happy path would save about 4% of Copy's execution time, per a quick perf test. (With how many samples I used, "no change" is within a standard deviation.)
2023-05-05 14:49:10 -07:00
Ladi Prosek 280393a917
[RAR] Don't do I/O on SDK-provided references (#8688)
Fixes #8634

Context
For SDK/workload references, the SDK is currently already passing relevant metadata such as AssemblyVersion and PublicKeyToken, so there is no need for RAR to open these files and parse their .NET metadata tables to get this information. Also, barring corrupted installs, these files are guaranteed to exist on disk so there is no need for RAR to do any I/O on them (file-exists, get-time-stamp, ..)

Changes Made
Tweaked RAR to trust the item metadata passed by the SDK. The feature is gated on the presence of the FrameworkReferenceName metadatum which is not documented and is used only by the relevant SDK tasks, to my best knowledge.

SDK does not specify the Culture component of assembly names so it's assumed to be neutral. This has passed all relevant validation so far. If non-neutral assemblies are ever used as references, we'll need to define a metadatum for SDK to set.

Testing
Existing and new unit tests.
Experimental insertion with an assert that assembly names calculated from item metadata are equivalent to those extracted from assembly files (verifies that the Culture=neutral assumption is correct).
Checked all assemblies specified in all FrameworkList.xml files shipped in the SDK (+ workloads) and verified that all of them are culture neutral.
Perf results
RAR micro-benchmark where the task is invoked with parameters corresponding to building a simple AspNetCore app:

13.13 ms -> 3.27 ms per invocation without StateFile cache.
15.03 ms -> 5.13 ms per invocation with StateFile cache.
RAR task duration as reported with /clp:PerformanceSummary when building a simple AspNetCore app with MSBuild server enabled:

20 ms -> 10 ms.
Notes
The change is behind a 17.8 changewave.
No changes have been made to per-project caching (via the StateFile parameter) to reduce scope. Changes to the per-project cache file will be done in another PR.
2023-05-05 14:48:32 -07:00
Jan Krivanek b9a3f3cf68
[vs17.2] Update sdk version to bump pulled runtime (#8730)
Fixes - bunch of CVEs (up to 29): https://devdiv.visualstudio.com/DevDiv/_componentGovernance/DotNet-msbuild-Trusted?_a=alerts&typeId=15231688&alerts-view-option=active

Context
We need to update runtime from 6.0.2 to at least 6.0.12 (this is taking it to 6.0.16 - as part of SDK 6.0.311)
2023-05-05 11:28:53 -07:00
Rainer Sigwald 15ebad5f83 Bump Xunit version
The version pulled in by Arcade is currently slightly stale
and conflicts with Verify.
2023-05-05 08:38:46 -05:00
Rainer Sigwald 844fcc06ba
Avoid package dependencies on inbox libraries (#8669) (#8714)
System.Security.Principal.Windows is inbox since net6.0
System.Net.Http is inbox since netcoreapp2.0
System.Reflection.Metadata is inbox since netcoreapp2.0
System.Threading.Tasks.Dataflow is inbox since netcoreapp2.0
Leave System.Net.Http package references which aren't needed as they underlying assembly is inbox on both .NETFramework and .NETCoreApp, to avoid component governance alerts about downloading (but not using) an old version.

By avoiding the dependencies, we minimize the dependency graph and with that the attack surface.

cc @MichaelSimons (removes netstandard1.x dependencies)
2023-05-05 15:21:35 +08:00
Ladi Prosek ab6959506d
[LiveLogger] Fix error and warning message alignment (#8719)
Context
The error and warning symbols may be rendered with different width on some terminals, resulting in misaligned output.

Changes Made
To make sure that the message text is always aligned we

Print the symbol.
Move back to the start of the line.
Move forward to the desired column.
Print the message text.
Testing
Windows terminal:

image

Windows cmd:

image

Fedora terminal:

image

Notes
I've also tried saving & restoring cursor position (VT100 functions 7 and 8) but that didn't fully work on Windows. The red X was still off.
2023-05-05 11:24:28 +08:00
Jan Krivanek 90f4271f28
Proposal for secrets metadata feature (#8520)
Initial proposal for secrets metadata feature
2023-05-04 11:18:19 -07:00
Forgind 57c2833dbf
Clean up discarding implicit references from ProjectRootElementCache (#8576)
Simplify and correct logic when discarding implicit references from the ProjectRootElementCache
2023-05-04 11:16:46 -07:00
Roman Konecny b313662f92
Live logger properly report errors during restore. (#8707)
Fixes #8704

Context
Errors during restore was not reported when using /tl (live logger) leaving user without actionable information.

Changes Made
When restore success without error or warn - same as before
When restore success with warnings - report success with warnins and list warnings bellow that report
When restore fails - report errors and warnings THEN report Restore failed in 1.5s and do not report Build summary
2023-05-04 11:14:02 -07:00
dotnet-maestro[bot] 9995e28c3d
[vs17.2] Update dependencies from dotnet/arcade (#8721)
Update dependencies from https://github.com/dotnet/arcade build 20230421.7

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XUnitExtensions
 From Version 6.0.0-beta.23211.7 -> To Version 6.0.0-beta.23221.7
2023-05-03 14:18:04 -07:00
Rainer Sigwald 6882ab9de1
Remove stale PublishToBlob.proj (#8727)
This file is no longer required by arcade. Per JanKrivanek:
Based on dotnet/arcade#1561 and following changes it seems it was replaced with PushToAzureDevOpsArtifacts
Moreover - it's not defined/called/imported anywhere in current Arcade code.
2023-05-03 14:14:00 -07:00
Jonathan Dodds 768cad1671
Code cleanup in Microsoft.Common.tasks (#8657)
Context
Minor code cleanup in Microsoft.Common.tasks.

Changes Made
Removed duplicate UsingTask for the ResolveSDKReference task. The redundant ResolveSDKReference doesn't seem to create harm but is not useful.

Alphabetized the UsingTask elements. Retained the separate grouping of Roslyn tasks. Retained the blank lines around tasks that have different Runtimes and/or Conditions (i.e. GenerateResource, RegisterAssembly, and UnregisterAssembly). Ordering the UsingTask elements is intended to aid inspection and maintenance of tasks.

Testing
Tested on Windows 11 and macOS 12. Tested by running unit tests and by having this change in several development branches where msbuild has been run on project files.

Notes
This change is included in the implementation for #8613, which is PR #8614.
2023-05-01 13:40:40 -07:00
Ryan Rozario 322e417701
Add source generated files properties to project XSD (#8683)
Fixes #8471

Changes Made
Adds to Autocomplete

EmitCompilerGeneratedFiles
CompilerGeneratedFilesOutputPath
2023-05-01 13:40:17 -07:00
dotnet-maestro[bot] 59879b095e
[main] Update dependencies from nuget/nuget.client (#8694)
* Update dependencies from https://github.com/nuget/nuget.client build 6.7.0.19

NuGet.Build.Tasks
 From Version 6.7.0-preview.1.16 -> To Version 6.7.0-preview.1.19

* Update dependencies from https://github.com/nuget/nuget.client build 6.7.0.20

NuGet.Build.Tasks
 From Version 6.7.0-preview.1.16 -> To Version 6.7.0-preview.1.20

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-05-01 13:39:54 -07:00
Jan Krivanek 32ef3ee39f
[vs17.2] Customize opt-in for CG step (#8695)
Context
Explict call to ComponentGovernanceComponentDetection@0 task (via /eng/common/templates/steps/component-governance.yml template) based on the branch name (so that this can be invoked for 'vs*' branches as well)

Note
This will be breaking until we consume this arcade update: dotnet/arcade@b1a9b86, it's now flowing to MSBuild main in this PR: #8658

Testing the changes on: https://github.com/dotnet/msbuild/tree/vs-test-only
ADO run: (vs* branch, the CG step injected) https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7672204&view=logs&j=bb592630-4b9d-53ad-3960-d954a70a95cf&t=424211a8-7b86-5e93-500e-ae39b50be1a7
2023-05-01 13:39:42 -07:00
Jan Krivanek 956d69f41f
Reorganize docs (#8701)
Fixes #8671

Context
New layout as agreed offline

specs             (content remains same, we'll move here rar-core-scenarios from documentation/design folder)
 |-----proposed   (the secrets metadata and packages sourcing PRs would get routed here. In future - all in-progress work specs)
 |-----archive    (the rar-as-service.md from documentation/design will get moved here. In future - all not dismissed but not planned feature spec goes here)
Moving facilitated via git mv to preserve history and make diffs conscise
2023-05-01 13:38:58 -07:00