summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib
AgeCommit message (Collapse)AuthorFilesLines
2020-06-18Implement instantiating and unboxing through portable stublinker code… (#106)JUNG DONG-HEON1-11/+10
* Implement instantiating and unboxing through portable stublinker code - Handle only the cases with register to register moves - Shares abi processing logic with delegate shuffle thunk creation - Architecture specific logic is relatively simple - Do not permit use of HELPERREG in computed instantiating stubs - Fix GetArgLoc such that it works on all architectures and OS combinations Add a JIT stress test case for testing all of the various combinations - Use the same calling convention test architecture that was used as part of tail call work Rename secure delegates to wrapper delegates - Secure delegates are no longer a feature of the runtime - But the wrapper delegate lives on as a workaround for a weird detail of the ARM32 abi
2020-03-25Fix OverflowException from IntPtr casting (#14381)Swift Kim1-1/+1
2020-02-18Port dotnet/runtime#31946 to release/3.1 branch (#28014)Levi Broderick1-1/+5
When string.Replace is given a target string with zero collation weight, it would enter an infinite loop. It is now changed so that the call to Replace terminates when such a condition is encountered.
2020-02-18Fix AppDomain.SetPrincipalPolicy bug for new threads (#32104) (#28019)Eirik Tsarpalis1-3/+4
* fix principal policy for new threads Fixes #31717 Co-authored-by: Marco Rossignoli <marco.rossignoli@gmail.com>
2020-02-18Port dotnet/runtime#31904 to release/3.1 (#28013)Levi Broderick3-156/+92
Remove BMI2 from ASCII and UTF-16 processing hot paths, as not all processors have optimized implementations of pext/pdep
2020-01-15[release/3.1] Port fix to revert EncoderNLS and DecoderNLS Convert changes ↵Levi Broderick2-8/+33
(#27996)
2020-01-14Fix CancellationTokenRegistration.Unregister race condition (#27949)Stephen Toub1-1/+9
2020-01-14Fix EventSource to stop ignoring EventCommand.SendManifest (#27979)Sung Yoon Whang1-2/+0
2020-01-14Stop throwing exception in TimeZoneInfo POSIX parsing (#27969)Eric Erhardt2-33/+26
IsDaylightSavingTime_CasablancaMultiYearDaylightSavings fails on rhel.8 When parsing the tzdata POSIX string that contains an 'n' Julian date, we are currently throwing an exception, and then falling back to a TimeZoneInfo without DST enabled. However, this is a mistake because there are other DST transitions that were read from the tzdata file that are valid and usable. We shouldn't be throwing that information away. So instead, we now skip the POSIX string if we detect an unsupported 'n' Julian date, and just use the last transition as the AdjustmentRule for all the DateTimes in the future. This way we can still make DST determinations correctly for some DateTimes. Fix https://github.com/dotnet/corefx/issues/42192
2019-10-31Fix StreamReader to pass cancellation token into ReadBufferAsync (#27464) ↵Stephen Toub1-9/+9
(#27501) ReadAsyncInternal is correctly passing its token into the two call sites where it delegates directly to the underlying stream, but in one place it calls through ReadBufferAsync, which is currently not defined to take a token. Fix that, and pass the token through.
2019-10-30Support large EventSource filter args (#27522)Noah Falk1-11/+17
1. Fix NullReferenceException. When the filter args exceeded the hard-coded size limit GetDataFromController would return data = null. The code previously asserted that data was not null and triggered NRE when it was. The fix correctly null checks the value instead of asserting and uses an empty args dictionary in this case, the same as if filter args had been empty to begin with. 2. ETW has always limited filter args to 1024 bytes but EventPipe has no such restriction. When using DiagnosticSourceEventSource it can be useful to specify a larger filter arg blob. I can't do anything about ETW's restriction but there is no need for the runtime to force EventPipe to be equally limited. The larger size also reduces the chance that we need to hit the fallback path above causing filter args to be ignored.
2019-10-17Fix DecoderNLS.Convert to out the correct value for 'completed' (#27229)Levi Broderick1-3/+7
Port https://github.com/dotnet/coreclr/pull/27210 to release/3.1
2019-10-17Enable ETW/EventSource logging of task IDs for boxed state machines (#27115) ↵Stephen Toub1-1/+3
(#27217) * Wrap MoveNext Action for TPL event tracing Wraps the MoveNext action of the AsyncStateMachineBox in a continuation wrapper when async causality tracing is on so that the TPL event source can find the task that is associated with a continuation. Does not wrap otherwise. * Clarifying comment * removing trailing whitespace * code review feedback. Makes AsyncMethodBuilderCore.TryFindContinuationTask check to whether the target of a continuation is itself a task, as a fall-back to checking to see if the continuation is a ContinuationWrapper * Got rid of unnecessary null checks
2019-10-15Improve the performance of Environment.WorkingSet in Windows (#26522) (#27212)Sung Yoon Whang5-24/+65
* Use win32 api directly for workingset counter * Fix build warnings * Removing useless code * more cleanup * remove size annotation * remove useless comment * Move all the changes to Environment.WorkingSet and remove it from RuntimeEventSourceHelper * removing useless usings * Use kernel32.dll instead of psapi.dll * Code review feedback * Remove newline change * More code review nits
2019-10-04Improve TimeSpan precision (#26992) (#27010)Jan Kotas1-13/+8
Change multiplying by (x * (1.0 / BigValue)) on (x / BigValue). Fix #41380
2019-09-21Port The Fix When Enabling Windows Compatibilty Mode (#26805)Tarek Mahmoud Sayed3-24/+31
2019-08-27Fix Abbreviated Genitive Month Names Parsing (#26384)Tarek Mahmoud Sayed3-10/+24
In 3.0 we have fixed the formatting to use the abbreviated genitive month names when having "d" format specifier followed by "MMM". This fix is good as original formatting specs required but we needed to support the parsing when we have such genitive names.
2019-08-26Do not use `AllocateUninitializedArray` in private array pools. (#26338) ↵Stephen Toub1-3/+3
(#26366) User may have extra expectations for the privatly owned array pools. For example there could be an expectation that array never contains negative numbers (since user never puts them there). Uninitialized allocations can break such expectations.
2019-08-26[release/3.0] Fix BinaryReader.ReadChars for fragmented Streams (#26324) ↵Jan Kotas2-1/+23
(#26356) BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks. Fixes https://github.com/dotnet/corefx/issues/40455
2019-08-16Allow for interface implementations in EventSource.WriteEventVarArgs ↵Sung Yoon Whang1-5/+6
(#25844) (#26056) * Allow for interface implementations in EventSource.WriteEventVarArgs * Also account null ref types and nullable types * fix error in comment and simplify first part of boolean logic * Update src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs Co-Authored-By: Noah Falk <noahfalk@users.noreply.github.com>
2019-08-07[release/3.0] Updating Math.Round and MathF.Round to be IEEE compliant so ↵Tanner Gooding4-22/+179
that the intrinsic and managed form are deterministic. (#26017) * Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic. (#25901) * Updating Math.Round and MathF.Round to be IEEE compliant so that the intrinsic and managed form are deterministic. * Fixing the Math.Round and MathF.Round handling for values greater than 0.5 and less than 1.0 * Applying formatting patch. * Adding a comment about only having the roundToNearestTiesToEven code path
2019-08-07Make counters use dedicated thread instead of timer (#25864) (#25978)Sung Yoon Whang2-73/+89
* Make a dedicated polling thread for EventCounters * Cleanup * remove debug prints * nit * Fix comment * addressing issues from code review * Fix an assertion from getting fired when we have multiple listeners * Fix a test issue * code review feedback * Fix a potential deadlock * Fix another deadlock * Allow s_sleepDurationInMilliseconds to be reset to a larger value * More issues fix * Let thread wake up from sleep if needed * Some suggestions for the counters fix. The resulting behavior should be the same as what is there now (assuming I didn't mess anything up), these are all just code simplifications that hopefully make it easier to review and maintain going forward. In total I think this reduces the change size in CounterGroup.cs by ~30%. - With the addition of the AutoResetEvent the ManualResetEvent is no longer needed, removed it. - Removed the various if foo != null checks for the shared state, it is all initialized once when then thread is created and then assumed to be non-null elsewhere. - Removed a 2nd lock acquisition inside OnTimer - Replaced an if with Math.Min in PollForValues * fix test
2019-07-28Fix use of AddTo/RemoveFromActiveTasks in async methods (#25915)Stephen Toub1-20/+15
When we rewrote the async methods implementation with AsyncStateMachineBox, we neglected to call AddToActiveTasks if the debugger is paying attention to tasks. This hasn't mattered as the debugger's support for Tasks hasn't worked for other reasons in .NET Core, but there is now a renewed focus on it, and this is preventing some of that support from working. This change is a minimal fix to ensure that we're adding the state machine box task when it's created and removing it when it completes. Post-3.0, we should look at overhauling this, e.g. to clean up a lot of this logging and tracking that's done, to use a weak table in order to avoid keeping task objects alive artificially if they're dropped without completing by the developer code, etc. This only affects when the debugger is attached, as the s_asyncDebuggingEnabled field is only ever set by the debugger.
2019-07-28Fix nullability annotations for static (#25914)Stephen Toub21-29/+30
The compiler is now analyzing statics. Get compliant.
2019-07-22[3.0 port] Fix first value of counter payload being skewed (#25799)Sung Yoon Whang4-5/+35
* Fix issue 25709 * rename * Fix regression test * cleanup * Code review feedback * set maxincrement to 3 * test fix
2019-07-18Make all event types nullable (#25752)Stephen Toub13-67/+74
Late-breaking design change: all events should be declared with nullable delegate types.
2019-07-18Remove now unnecessary !s / TODO-NULLABLE comments (#25749)Stephen Toub60-312/+312
* Remove !s and TODO-NULLABLE comments for [DoesNotReturn] * Remove !s and TODO-NULLABLE comments for [NotNullIfNotNull] * Remove !s and TODO-NULLABLE comments for writes via Interlocked.CompareExchange * Remove !s and TODO-NULLABLE comments for Debug.Assert on fields * Update/add several TODO-NULLABLE comments
2019-07-18Fix nullability warnings from compiler updateSantiago Fernandez Madero4-8/+8
2019-07-16Disable debugger evaluation of ValueTask<T>.Result (#25727)Stephen Toub1-0/+3
If the debugger evaluates a `ValueTask<T>`'s `Result`, that counts as the "you should only consume a `ValueTask<T>`" once, and ends up breaking / hanging / throwing exceptions and other bad stuff while stepping through code in the debugger. This commit addresses that in two ways: 1. Adds `[DebuggerBrowsable(Never)]` to `Result` to prevent it from showing up in debugger views. 2. Adds a NotifyOfCrossThreadDependency call to its ToString. This prevents the debugger from using ToString to show an implicit representation of the instance, and it forces the developer explicitly trying to access ToString (e.g. in the watch window) to click a button acknowleding the impact. (Post 3.0, we should consider removing the `ValueTask<T>.ToString()` override altogether.)
2019-07-15Merge pull request dotnet/corert#7397 from dotnet-bot/from-tfsMichal Strehovský2-0/+12
Merge changes from TFS Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-07-13Fix use of uninitialized variables in managed decimal implementation (#25674)Jan Kotas1-20/+30
2019-07-12Handle nullable attributes on platforms that lack themStephen Toub1-9/+54
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-07-11Fix build break in TimerQueue.Portable.csJan Kotas1-5/+5
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-07-11Remove stale nullable !s and pragmas (#25640)Stephen Toub29-45/+37
Also update TODO-NULLABLE comments to be more specific where appropriate.
2019-07-10Add AggressiveInlining to Single.GetHashCode (#25633)Stephen Toub1-0/+1
2019-07-09Let EventPipe threads sleep when no events are available (#25601)David Mason2-0/+27
Don't spin forever in EventListener when listening for EventPipe data
2019-07-09Fix Timer argument exception parameter names (#25617)Stephen Toub1-5/+5
2019-07-09Fix regression in Timers with long timeouts (#25604)Stephen Toub3-25/+20
* Fix regression in Timers with long timeouts Early in .NET Core 3.0, we added an important optimization to significantly reduce lock contention and CPU overheads in situations where lots of timers were firing. The optimization worked by splitting the set of timers into those expected to fire in the very near future and then everything else. However, for really long timers (e.g. > 24 days), due to integer overflows we can accidentally put a long timer onto the short list and cause a timer that shouldn’t fire for days to instead fire in milliseconds. This is not the first such bug we’ve had in Timer, and there is a fair amount of complicated casting (that we sometimes get wrong, obviously) in order to keep the tick count usage within the Int32 domain. This PR addresses the problem (and hopefully others in the future) by switching over to using Int64. We’re already paying to get 64-bit tick counts on both Windows and Unix, so this just removes truncation that was being performed, does a little more addition/comparison with 64-bit values instead of with 32-bit, and stores an Int64 instead of Int32 in each TimerQueueTimer. On 64-bit, this has a 0 increase in memory consumption, as it simply ends up utilizing padding space that was previously in TimerQueueTimer. On 32-bit, it increases memory allocation when creating a Timer by 4 bytes from 80 to 84 (still 3 allocations), but I believe it’s the right trade-off for reduced complexity and bug likelihood. * Address PR feedback
2019-07-08Adding DisplayUnits property to all the runtime counters (#25598)Sung Yoon Whang1-9/+9
2019-07-08Return HardLimitBytes from GCMemoryInfo.TotalAvailableMemoryBytes (#25437)Andy Hanson2-19/+27
* Add property HardLimitBytes to GCMemoryInfo This adds a new property HardLimitBytes. Unlike TotalAvailableMemoryBytes, this will reflect an explicitly set COMPLUS_GCHeapHardLimit. It will also reflect the fraction of a container's size that we use, where TotalAvailableMemoryBytes is the total container size. Normally, though, it is equal to TotalAvailableMemoryBytes. Fix #38821 * Remove HardLimitBytes; have TotalAvailableMemoryBytes take on its behavior * Fix typos * Separate total_physical_mem and heap_hard_limit so we can compute highMemoryLoadThresholdBytes and memoryLoadBytes * Do more work in gc.cpp instead of Gc.cs * Consistently end names in "Bytes"
2019-07-03Cleanup IL linker heuristic usage (#25547)Jan Kotas7-52/+20
Prep-work for using mainstream IL linker
2019-07-03Delete some dead code (#25546)Jan Kotas4-47/+6
2019-07-02Use Array.MaxArrayLength in ArrayList (#25530)Michal Strehovský1-4/+1
Now that `ArrayList` is in CoreLib, we don't need the copy.
2019-07-02Reduce allocations in GetLocale() (#25531)Ilya1-1/+1
2019-07-01Decrease EventListener buffer size (#25526)Sung Yoon Whang1-1/+3
* Reduce the default EventPipe circularBufferSize to 10MB for EventListener sessions * make it a static var instead of random # in the code
2019-07-01Use AssemblyLoadContext from shared partition (dotnet/corert#7570)Michal Strehovský2-1/+3
We were missing methods that got added for 3.0. The only LoadContext that works is the default one though. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
2019-07-01Delete dead code (#25513)Jan Kotas1-11/+0
2019-06-28Fix an assertion failure in the thread pool's QueueUserWorkItemCallbackBase ↵Koundinya Veluri1-1/+2
(#25482) Fixes https://github.com/dotnet/coreclr/issues/25242 - The issue could be that there is no memory barrier (or in the wrong place) on the thread reading the value, and an old value could be cached and read
2019-06-27React to new compiler nullability warningsSantiago Fernandez Madero2-6/+8
2019-06-26Fix typo & make the code leaner (#25442)Jan Kotas1-2/+2
Enum.HasFlag generates bigger IL and depends on complex JIT optimization for a good code. The classic bit check is strongly preferred accross CoreCLR and CoreFX.