Commit Graph
1164 Commits
Author SHA1 Message Date
Viktor Hofer 0964be0ae9 Update slngen and solution files (#60871)
Update slngen tooling to latest stable version and solution files since
a lot changed since the last time they were updated:
- NET7 (removal of older TFMs)
- Source Generators
2021-10-26 21:23:54 +02:00
Adeel Mujahid 80e843ff5b Fix license header in a few new files (#59910) 2021-10-12 22:39:55 -04:00
John Call d4e4d33e18 Improve SortedSet DeepCopy performance (#56561)
* SortedSet recursive deep copy

* Make DeepCopy iterative

* Undo accidental delete
2021-10-12 17:51:39 +01:00
Andrii Kurdiumov 5588f94924 Remove usused rd.xml files (#59201)
Closes #51112
2021-09-16 16:53:54 -06:00
f88633994b Enable more iOS/tvOS device tests (#58846)
Add a few more suites to help validate the device infrastructure

Enable soft trimming and skip failing tests

Co-authored-by: Steve Pfister <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
2021-09-10 11:30:59 -04:00
Theodore Tsirpanis 00f37bc13b Use BitOperations.Log2 in SortedSet. (#58793) 2021-09-08 15:42:56 +01:00
Viktor Hofer 36b6247cc7 Update solution files for correct ordering of elements (#58655)
With the newest udpate of slngen, the order of elements (configuration, folders, etc.) is in sync with how Visual Studio arranges them.
Also the order is now deterministic.

Based on that, updating all solution files to have the correct ordering of elements. This change also unblocks adding CI protection for
making sure that solution files are up-to-date in regards to their dependencies as slngen is now generating the files deterministically.
2021-09-04 00:16:15 +02:00
Eirik Tsarpalis 30793a265a add missing documentation in new EnsureCapacity methods (#58007) 2021-08-25 18:07:10 +01:00
John Call bb7e7f9251 Add equality override for KeyValuePairComparer (#56634) 2021-08-02 17:29:53 +01:00
Viktor Hofer a6b9a63f35 Update libraries solution and NuGet.config files (#56430)
* Update slngen and invocation

* Update NuGet.config files

* Update solution files with slngen
2021-07-28 18:44:17 +02:00
naminodarie 26f5cc54f3 Add VersionCheck (#55763) 2021-07-18 06:31:10 -04:00
Sergio Pedri bbcb6b7707 Add CollectionsMarshal.GetValueRefOrAddDefault (#54611) 2021-07-14 17:02:16 -07:00
Eirik Tsarpalis 0a42d49532 remove superfluous comment (#55634)
Fix #55389
2021-07-14 08:32:27 -04:00
Günther Foidl 738b09bee3 Use inline Vector{128|256}.Create for constants (#54827)
* Used VectorXYZ.Create for constants in Base64

* Used VectorXYZ.Create for constants in BitArray

* Remove conditional compilation

It's only built for NetCoreAppCurrent, so no need to special case older runtimes.
2021-07-12 16:53:50 +00:00
petrogavriluk 784ddf83e7 Fix incorrect comparison (#54834) (#55094)
Add test to check fix.

Checking comparison result against 1 or -1 causes problems when custom comparer is used.
As a result Min and Max properties return incorrect values.
2021-07-09 10:24:27 -04:00
xtqqczze 99f7bae2a2 Use Span<T>.Fill implementation for Array.Fill (#52590) 2021-06-29 21:05:04 -07:00
Adam Sitnik 44f050acc0 Fold System.IO.FileSystem into CoreLib (#53231)
* move Queue<T> to System.Private.CoreLib

* fold System.IO.FileSystem into System.Private.CoreLib
2021-05-27 12:56:30 +02:00
hrrrrustic ebba451551 System.Collections.* missed Equals nullable annotations (#52164)
* add NotNullWhen attribute

* add usings
2021-05-24 11:55:05 +03:00
6ca3d9105d Shift Most of Wasm AOT test build to helix (#48226)
Since AOT'ing each test suite takes between 3-9 min, we need to shift the burden over to helix.

## This is done by:
1. building the test assemblies on the build machine
   - the wasm part of the build is not executed on the build machine,
      because it has the AOT build part
2. Zip up the test assembly+friends, *and* any bits required to run the wasm
    app build for that on helix (eg. emsdk, wasm app targets, cross compiler etc)
3. Send all this to helix, and use a custom `aot-build.proj`
     - which recreates all the build inputs for the `WasmBuildApp` target
        using the paths for the assets on helix
     - then we can run `WasmBuildApp` for the build, resulting in a wasm app
       bundle.
4. Run the tests!

- We already have the bits required for building wasm apps on helix, supported
for `Wasm.Build.Tests`, which we can use here too.

## Trimming:

- Since, AOT can be so expensive, we use `EnableAggressiveTrimming=true`(EAT), but
   that means that we could have issues due to trimming.
- And it can sometimes be unclear whether the build/test failures are due to trimming
     or AOT.

- Because these builds+test runs are different from other builds, owing to the
   "build partially on helix" step, a normal EAT build would not be the same as 
- to help with testing this, we add two lanes to `runtime-staging`:
   - `*_Mono_AOT`: builds AOT+EAT on helix
   - `*_Mono_EAT`: builds EAT, on helix
      - this is required because we want to run almost the same kinda
         build: 1. build test assembly; *2. send to helix; 3. build wasm app;* 4. run tests

- This should effectively mean that we can see which errors might be due to EAT, and
   which are clearly because of EAT+AOT.

Co-authored-by: Steve Pfister <[email protected]>
Co-authored-by: Marek Safar <[email protected]>
Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
2021-04-21 20:58:25 -04:00
df6da13870 Add Array.GetMaxLength<T> (#43301)
* Add Array.GetMaxLength<T> implementation.

* Implement Array.MaxLength and fix all remaining references

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>

* Update src/libraries/System.Collections/tests/Generic/Stack/Stack.Generic.Tests.cs

Co-authored-by: Jan Kotas <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2021-04-17 08:08:56 -04:00
Eirik TsarpalisandStephen Toub 6f6bbb8c6a Use IGenericSharedAPI test harness in PriorityQueue (#50291)
* Use IGenericSharedAPI test harness in PriorityQueue

* remove dead code

* remove index check from IEnumerator.Current

* Update src/libraries/System.Collections/tests/Generic/PriorityQueue/PriorityQueue.Generic.cs

Co-authored-by: Stephen Toub <[email protected]>

* Update src/libraries/System.Collections/tests/Generic/PriorityQueue/PriorityQueue.Generic.cs

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2021-03-27 00:31:05 +00:00
kronicandkronic 62170c1147 remove repetitions ';' (#50236)
Co-authored-by: kronic <[email protected]>
2021-03-25 20:59:08 -04:00
Eirik Tsarpalis 4645ecf69b Fix PriorityQueue not deleting references to dequeued elements (#50182)
* Fix #50114

* add debug assertions to MoveUp/Down methods
2021-03-24 21:13:15 +00:00
Eirik Tsarpalis f000c7db83 avoid unnecessary allocations in PriorityQueue.EnqueueRange (#50065) 2021-03-23 10:32:07 +00:00
Stephen Toub 062ae9697d Add Task.WaitAsync methods (#48842) 2021-03-11 12:11:15 -05:00
Eirik Tsarpalis 21c739706c improve PriorityQueue documentation (#49392) 2021-03-10 15:54:32 +00:00
Eirik Tsarpalis 3d2ecd0589 Apply feedback to grow methods of generic collections (#49167)
* Apply feedback to Grow methods of generic collections

* add assertion
2021-03-07 19:56:02 -05:00
Stephen Toub 87f2561417 Add debugger attributes for PriorityQueue (#49188) 2021-03-05 10:55:56 -05:00
Eirik TsarpalisandStephen Toub dc73562d3d Misc PriorityQueue fixes (#48539)
* PriorityQueue fixes

* add missing enumerator invalidations

* Update src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs

Co-authored-by: Stephen Toub <[email protected]>

* add Debug assertion for heap arity

* presize buffer if EnqueueRange input is ICollection

* move capacity check outside of the core Grow method

* remove ICollection detection from EnumerableHelpers

* address feedback

Co-authored-by: Stephen Toub <[email protected]>
2021-03-05 14:13:37 +00:00
LateApexEarlySpeedandEirik Tsarpalis 28be25735f issue-44801 EnsureCapacity Apis For List Stack Queue (#47149)
* issue-44801 Initial commit: public List.EnsureCapacity.

* Create Stack.EnsureCapacity().

* issue-44801 Fix comment for Stack.

* issue-44801 Fix comment: Move temp MaxArrayLength into near usage scope for Stack.

* issue-44801 Fix comment for List.

* issue-44801 Create EnsureCapacity for Queue.

* issue-44801 Create tests for List.EnsureCapacity.

* issue-44801 Create tests for Stack.EnsureCapacity.

* issue-44801 Create tests for Queue.EnsureCapacity.

* issue-44801 Update version if updating internal buffer.

* issue-44801 Update test cases to verify invalidating enumeration (List, Stack, Queue).

* issue-44801 Improve code change for List:

1. Avoid incrementing version number twice in one Insert (or Add) method call;
2. Avoid more capacity check for Insert (or Add) method.

* issue-44801 Fix comments: consider integer overflow; refactor methods.

* Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs

Fix comment: update xml doc.

Co-authored-by: Eirik Tsarpalis <[email protected]>

* ensure same algorithm is used for all resize operations

* revert array length check in List.EnsureCapacityCore

* remove GrowFactor constant

* skip large capacity tests on mono.

* Fix overflow handling when capacity < MaxArrayLength; add clarifying comments

Co-authored-by: Eirik Tsarpalis <[email protected]>
2021-02-23 14:03:35 +00:00
Eirik Tsarpalis adc73fb548 Expand PriorityQueue test coverage (#48420)
* make comparer field readonly

* abstract IComparer in PriorityQueue generic tests

does minor refactorings and adds new tests

* add PriorityQueue property tests

* address feedback

* add seed for deterministic runs

* apply var fixes in property tests

* replace FsCheck properties with theories
2021-02-19 10:02:52 +00:00
Eirik TsarpalisandStephen Toub 9a3f001b87 PriorityQueue: Apply Comparer<T>.Default optimization (#48346)
* PriorityQueue: inline Comparer<T>.Default.Compare calls

* address feedback

* Update src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs

Co-authored-by: Stephen Toub <[email protected]>

* address feedback

* Update src/libraries/System.Collections/src/System/Collections/Generic/PriorityQueue.cs

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2021-02-16 23:37:10 -05:00
Stephen Toub d273590219 Fix IndexOutOfRangeException in PriorityQueue.EnqueueDequeue (#48323) 2021-02-16 11:51:30 +00:00
Stephen Toub e951a0e0c8 Avoid nulling out in PriorityQueue.Remove if it's not needed (#48324) 2021-02-16 11:48:03 +00:00
Stephen Toub 83143a4a88 Add missing XML comments on PriorityQueue public API (#48316) 2021-02-15 21:03:30 -05:00
Stephen Toub fb67c325c3 Simplify PriorityQueue enumerator, and fix tuple element names (#48315)
- Rewritten to match `List<T>.Enumerator` line for line
- Tuples, according to our guidelines, use PascalCased element names
2021-02-15 19:52:32 -05:00
Patryk Golebiowski 826aa4f784 Add PriorityQueue to System.Collections.Generic (#43957) (#46009)
* Add PriorityQueue to System.Collections.Generic (#43957)

This commit adds a new data structure, priority queue.

Fixes #43957

* (draft step, to squash) Modify API reference

In this commit, I modified the API reference using [these guidelines](https://github.com/dotnet/runtime/blob/4d784693ebc5f91c7eede32170046355ef3969b2/docs/coding-guidelines/updating-ref-source.md), following the advice from @danmosemsft.

The automatically generated code (with `dotnet msbuild /t:GenerateReferenceAssemblySource`) didn't build out of the box and I tweaked it manually.

* (draft step, to squash) Add tests for PriorityQueue

Added generic tests for <int, int> and <string, string>. Removed non-generic tests.

* (draft step, to squash) Add initial implementation

This commit adds the core of the heap implementation for the priority queue.

It doesn't implement the method `EnqueueDequeue`, as I'm not convinced by it. It also doesn't implement the method `CopyTo(Array array, int index)`, leaving this one for later.

* (draft step, to squash) Rename parameters

* (draft step, to squash) Replace `this.nodes` with `_nodes`

* (draft step, to squash) Use an array and handle sizing ourselves

* (draft step, to squash) Create UnorderedItemsCollection lazily

* (draft step, to squash) Deduplicate constructors

* (draft step, to squash) Replace excessive `var` with explicit types

* (draft step, to squash) Remove `this.` in front of methods

* (draft step, to squash) Improve out-of-range-argument exceptions

* (draft step, to squash) Use error messages from .resx

* (draft step, to squash) Use positive case first in try methods

* (draft step, to squash) Implement UnorderedItemsCollection.CopyTo

* (draft step, to squash) Optimize expressions involving Arity

* (draft step, to squash) Adjust implementation to be consistent with reference

* (draft step, to squash) Implement method `EnqueueDequeue`

* (draft step, to squash) Make EnsureCapacity return int

* (draft step, to squash) Simplify lazy initialization of _unorderedItems

* (draft step, to squash) Use `out _` discard for unused properties

* (draft step, to squash) Relax null checks on elements and priorities

* (draft step, to squash) Simplify method SetCapacity

* (draft step, to squash) Remove MethodImplOptions.AggressiveInlining attributed

* (draft step, to squash) Use Array.Empty if the initial capacity is zero

* (draft step, to squash) Simplify UnorderedItemsCollection.Enumerator declaration

* (draft step, to squash) Simplify GetEnumerator methods

* (draft step, to squash) Optimize EnqueueRange methods

* (draft step, to squash) Capitalize members of (TElement, TPriority)[]

* (draft step, to squash) Improve resize constants

* (draft step, to squash) Remove redundant `.this`

* (draft step, to squash) Optimize EnqueueDequeue

* (draft step, to squash) Reduce indentation

* (draft step, to squash) Simplify math expressions

* (draft step, to squash) Remove the PutAt helper method

* (draft step, to squash) Make the UnorderedItemsCollection constructor internal

* (draft step, to squash) Clear last node slot on removal

* (draft step, to squash) Improve next growth capacity computation

* (draft step, to squash) Optimize Enqueue method

* (draft step, to squash) Make UnorderedItemsCollection.CopyTo implemented explicitly on ICollection

* (draft step, to squash) Improve priority queue tests

* (draft step, to squash) Drop redundant casting

* (draft step, to squash) Cosmetic improvements

* (draft step, to squash) Change signature of UnorderedItemsCollection

* (draft step, to squash) Add test PriorityQueue_Generic_EnqueueDequeue_EqualToMin

* (draft step, to squash) Add tests of enqueue null functionality

* (draft step, to squash) Add test PriorityQueue_Generic_EnsureCapacity_Negative

* (draft step, to squash) Check underlying buffer length in tests with reflection

* (draft step, to squash) Check enumeration invalidation

* (draft step, to squash) Simplify code and improve documentation
2021-02-15 19:54:37 +00:00
Shreyas Jejurkar dfc70d174f Minor refactoring to collections (#46506)
* Minor refactoring to collections
1. Removed unwanted casting.
2. Added condition for Clear() method for SortedDictionary.

* Addressed PR feedback.
Removed unwated Clear condition.

* Addressed PR feedback.
1. Fixed spacing.
2021-01-11 13:10:38 +00:00
John CallandJan Kotas b01c8e1247 SortedDictionary Copy optimization (#45659)
* Sorted Dictionary Copy optimization

* Update src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs

Co-authored-by: Jan Kotas <[email protected]>

* Feedback

Co-authored-by: Jan Kotas <[email protected]>
2020-12-14 12:56:01 +02:00
Jan Kotas 10381a2cdc Find&Replace coreclr/src -> coreclr (#45761) 2020-12-08 10:40:17 -08:00
Eirik Tsarpalis 17f5167d75 Ensure BitArray fill operations do not set bits out of range (#45223)
* ensure BitArray fill operation does not produce dirty bits

* Update BitArray BinaryFormatter expected blob
2020-11-27 05:47:45 -05:00
Egor BogatovandLevi Broderick eb5df0da7a Handle non-ASCII strings in GetNonRandomizedHashCodeOrdinalIgnoreCase (#44688)
* Fix GetNonRandomizedHashCodeOrdinalIgnoreCase

* Add a test

Co-authored-by: Levi Broderick <[email protected]>
2020-11-21 15:01:32 -08:00
Viktor Hofer ed295782bf Add workflow to update solution files with SlnGen and update them initially (#44703)
* Add slngen infra

* Update all solution files
2020-11-17 18:23:30 +01:00
Eric StJohn 8ebd0d46e5 Validate ref/src parameter names (#43838)
Ensure our reference assembly parameter names match implementation.  Align all current mismatches.
2020-11-12 08:00:18 -08:00
Charles Stoner c1a21a0319 Resolve warnings for assignment or explicit cast of possibly null type parameter value (#43925) 2020-11-09 20:11:57 -08:00
Stephen Toub cf276ce537 Change Task.FromResult to use same task cache as async methods (#43894)
* Change Task.FromResult to use same task cache as async methods

Task.FromResult today always creates a new task.  This leads developers that are aware of this to then create their own caches for common values, typically 0, true, and false, to avoid task allocations for those common values.  But we already have such values cached internally, used for async method return values.  We can just use the same cache for Task.FromResult.

* Address PR feedback
2020-10-28 06:50:00 -04:00
Stephen ToubandEirik Tsarpalis c5b97a6a50 Add IDictionary_Generic_Tests test for multiple values with hash collisions (#43836)
* Add IDictionary_Generic_Tests test for multiple values with hash collisions

* Update src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs

Co-authored-by: Eirik Tsarpalis <[email protected]>

* Update src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs

Co-authored-by: Eirik Tsarpalis <[email protected]>
2020-10-26 22:24:54 -04:00
Stephen Toub e7204f5d6f Use T? for unconstrained nullable types (#40197)
* Temporarily upgrade compiler version for T? support

* Use T? for unconstrained nullable types
2020-08-07 11:25:42 -04:00
Levi Broderick 189e1aa8f9 Improve dictionary & hashset lookup perf for OrdinalIgnoreCase (#36252) 2020-08-05 21:16:21 -07:00
Viktor Hofer 809a06f451 Remove depprojs in favor of PackageReferences (#35606)
- Remove depprojs which currently binplace external references into the RefPath folders in favor of PackageReference and PackageDownload items.
- Build all configurations by default when building an individual project (either on the CLI or inside VS) same as with the official SDK. This enables .NETFramework Test Explorer support.
- Centrally define libraries that compose the shared framework instead of in each Directory.Build.props file to be able to build the targeting pack first and consume it in the OOB libraries.
- Use ProjectReferences to reference OOB projects. Compile against the reference assembly but use the implementation assembly app-local during runtime.
- Remove OOBs from the testhost and remove the testhost folder for .NETFramework as it isn't required anymore.
- Only binplace for $(NetCoreAppCurrent) to compose a) the targeting pack, b) the runtime pack, c) the testhost, d) a full closure for the shims.
- Use Targeting Packs for OOB projects (with their implicit assembly references) but still explicitly define granular references for .NETCoreApp configurations (DisableImplicitAssemblyReferences switch). Use the implicit targeting pack references in some Microsoft.Extensions.* cases.
- Remove placeholder configurations as they aren't needed anymore with explicit P2Ps vs Targeting Pack references.
- Remove implicit assembly references (ie for .NETFramework, mscorlib)
- Remove AssemblySearchPath hacks that were introduced with b7c4cb7 as the targeting pack is now used by default.
- Reduce unnecessary .NETFramework configurations that were added to run tests in favor of the already existing ref&src configurations.
- Stop hardcoding the paths for wasm assemblies and use the returned TargetPath of the ProjectReferences.
- Addressed formatting (ItemGroups, References at the bottom of the project file, ordering of references, use LibrariesProjectRoot instead of a relative path, unnecessary AssemblyName and RootNamespace properties which are identical to the project name, ordering of tfms)
- Revert "fix clean (#33758)"
2020-07-23 17:20:26 +02:00