platform/upstream/dotnet/runtime.git
2 years ago[PERF][MAUI] Update Podcast app repo (#66843)
Parker Bibus [Mon, 21 Mar 2022 16:02:33 +0000 (11:02 -0500)]
[PERF][MAUI] Update Podcast app repo (#66843)

* Update the repo and branch we get dotnet-podcasts from.

2 years ago[mono] Fix typo in detecting sys/auxv.h (#66894)
Alexander Köplinger [Mon, 21 Mar 2022 15:48:06 +0000 (16:48 +0100)]
[mono] Fix typo in detecting sys/auxv.h (#66894)

We were checking `sts/auxv.h` instead of `sys/auxv.h` so we were never defining `HAVE_SYS_AUXV_H`.

Instead of fixing the typo let's switch to checking for `HAVE_GETAUXVAL` which is what coreclr/libs.native are using.

2 years agoFix up DiagnosticName of RuntimeDetermined types (#66937)
Michal Strehovský [Mon, 21 Mar 2022 15:04:45 +0000 (00:04 +0900)]
Fix up DiagnosticName of RuntimeDetermined types (#66937)

Name/Namespace of these already includes the details type name. Bring this over to DiagnosticName too.

This is so that we can distinguish between `List<__Canon>` and List<T___Canon>`.

2 years ago[mono][interp] Fix a few local store warnings (#66766)
Vlad Brezae [Mon, 21 Mar 2022 14:18:33 +0000 (16:18 +0200)]
[mono][interp] Fix a few local store warnings (#66766)

* [mono][interp] Fix warning when storing function pointers

* [mono][interp] Fix storing of R4 or R8 into local of different size

The IL execution stack operates on generic floating type F, which can be stored in local of both float32 or float64. We however operate on the real types and need to add implicit conversions if necessary.

* [mono][interp] Fix ckfinite

It was previously handling only R8 correctly.

* [mono][interp] Add implicit conversion between nint and int32

* [mono][interp] Change warning to error

2 years agoMake it possible to log scanner progress (#66935)
Michal Strehovský [Mon, 21 Mar 2022 13:28:14 +0000 (22:28 +0900)]
Make it possible to log scanner progress (#66935)

We were using a null logger.

2 years agoAdd executable bit to tizen sh files (#66931)
Gleb Balykov [Mon, 21 Mar 2022 13:14:45 +0000 (16:14 +0300)]
Add executable bit to tizen sh files (#66931)

2 years agoFix ReplaceModuleMapping for 32bit binary on 64bit kernel (#66640)
Hyungju Lee [Mon, 21 Mar 2022 04:58:35 +0000 (13:58 +0900)]
Fix ReplaceModuleMapping for 32bit binary on 64bit kernel (#66640)

2 years agoUse ValueStringBuilder in CodeIdentifier.MakeValid (#66915)
Stephen Toub [Mon, 21 Mar 2022 03:41:21 +0000 (23:41 -0400)]
Use ValueStringBuilder in CodeIdentifier.MakeValid (#66915)

2 years agoReplace XmlSchema ContentValidator Hashtables that are boxing lots of ints (#66908)
Stephen Toub [Mon, 21 Mar 2022 03:20:48 +0000 (23:20 -0400)]
Replace XmlSchema ContentValidator Hashtables that are boxing lots of ints (#66908)

2 years agoDelete IL verifier support in the VM (#66616)
Jan Kotas [Sun, 20 Mar 2022 21:41:47 +0000 (14:41 -0700)]
Delete IL verifier support in the VM (#66616)

Contributes to #32648

2 years agoAdd flags checks to BMI1 intrinsic lowering (#66736)
Wraith [Sun, 20 Mar 2022 10:41:02 +0000 (10:41 +0000)]
Add flags checks to BMI1 intrinsic lowering (#66736)

* add flags checks to BMI1 intrinsic lowering to prevent decomposed longs in x84 from being altered

* update bmji1intrinsics tests

2 years agoUpdate coredistools from 1.0.1-prerelease-00006 to 1.1.0 (#66861)
Bruce Forstall [Sun, 20 Mar 2022 00:44:50 +0000 (17:44 -0700)]
Update coredistools from 1.0.1-prerelease-00006 to 1.1.0 (#66861)

Updates include:
- Use LLVM 13.0.1
- Use Visual Studio 2022 for building on Windows
- Use Ubuntu 18.04 containers for building on Linux

Binaries built from: https://github.com/dotnet/jitutils/pull/351

2 years agoFix too narrow loads while unspilling (#66675)
Jakob Botsch Nielsen [Sat, 19 Mar 2022 20:55:47 +0000 (21:55 +0100)]
Fix too narrow loads while unspilling (#66675)

Unspilling could produce too narrow loads for normalize-on-load
variables when encountering a narrowly typed LCL_VAR node. This could
result in subsequent uses of the same local using a truncated value.

Fix #66624

2 years agoMerged wrapper support for test exclusion lists (#66680)
Tomáš Rylek [Sat, 19 Mar 2022 20:20:36 +0000 (21:20 +0100)]
Merged wrapper support for test exclusion lists (#66680)

According to our design discussions we have decided to keep
the 'issues.targets' file for disabling tests before the
test refactoring has been completed as otherwise we would
have a subset of issue exclusions in 'issues.targets' and
the rest in 'ActiveIssue' test annotations making it very
hard to understand for developers and test monitors.

Moreover today implementation of ActiveIssue is not rich enough
to express all conditional test disabling clauses in issues.targets
so the bug migration will require a bit of additional design work
and we don't want to block the migration on that. This simple change
uses the existing infrastructure to emit a "test exclusion list"
under CORE_ROOT for the particular targeting OS, architecture and
build mode that gets subsequently consumed by the merged test
wrapper in Helix and used to skip the blocked tests.

Thanks

Tomas

2 years agoJIT: handle large OSR funclet frame initial SP delta for arm64 type 5… (#66124)
Andy Ayers [Sat, 19 Mar 2022 15:25:00 +0000 (08:25 -0700)]
JIT: handle large OSR funclet frame initial SP delta for arm64 type 5… (#66124)

Because OSR funclet frames must pad with Tier0 frame size, initial SP delta
may exceed 240 bytes.

Fixes #65996.

2 years agoInclude sys/auxv.h in getexepath (#66874)
Adeel Mujahid [Sat, 19 Mar 2022 13:14:13 +0000 (15:14 +0200)]
Include sys/auxv.h in getexepath (#66874)

2 years agoFixed TlsHandshakeType enum label (#66786)
J. Ritchie Carroll [Sat, 19 Mar 2022 12:22:06 +0000 (07:22 -0500)]
Fixed TlsHandshakeType enum label (#66786)

Fixes #66781

2 years agoFix Character Spelling (#66857)
Stefan [Sat, 19 Mar 2022 12:21:23 +0000 (13:21 +0100)]
Fix Character Spelling (#66857)

2 years agoAdd tests for RegexGenerator on interface and virtual members (#66850)
Stephen Toub [Sat, 19 Mar 2022 12:20:21 +0000 (08:20 -0400)]
Add tests for RegexGenerator on interface and virtual members (#66850)

2 years agoAvoid boxing array enumerator in StackTrace.TryResolveStateMachineMethod (#66836)
Stephen Toub [Sat, 19 Mar 2022 12:19:58 +0000 (08:19 -0400)]
Avoid boxing array enumerator in StackTrace.TryResolveStateMachineMethod (#66836)

2 years agoAvoid IntPtr[] allocation in Associates.AssignAssociates (#66825)
Stephen Toub [Sat, 19 Mar 2022 12:19:11 +0000 (08:19 -0400)]
Avoid IntPtr[] allocation in Associates.AssignAssociates (#66825)

* Avoid IntPtr[] allocation in Associates.AssignAssociates

* Address PR feedback (and as a result use stack space in a few more related places)

2 years ago[mono] Make the --llvmonly mode the same as --llvmonly-interp. (#66811)
Zoltan Varga [Sat, 19 Mar 2022 07:14:11 +0000 (03:14 -0400)]
[mono] Make the --llvmonly mode the same as --llvmonly-interp. (#66811)

The --llvmonly mode is not used in production, it also doesn't
have correct EH semantics.

2 years agoDisabled System.Security.Cryptography.Tests for Android x64 and x86 (#66833)
Ilona Tomkowicz [Sat, 19 Mar 2022 06:58:21 +0000 (07:58 +0100)]
Disabled System.Security.Cryptography.Tests for Android x64 and x86 (#66833)

* Disabled System.Security.Cryptography.Tests.

* Applied @mdh1418 suggestion.

* Removed empty line.

2 years agoDo not include redist files in runtime packs (#66805)
Vladimir Sadov [Sat, 19 Mar 2022 06:44:02 +0000 (23:44 -0700)]
Do not include redist files in runtime packs (#66805)

* do not copy redist files to artefacts

* do not copy redist files to tests

* Do not include Redist files in runtime packs

2 years agoFix cancel in PipeReader.ReadAtLeastAsync (#66752)
Brennan [Sat, 19 Mar 2022 02:38:40 +0000 (19:38 -0700)]
Fix cancel in PipeReader.ReadAtLeastAsync (#66752)

2 years agoReplace AsArgument/AsParameter with less P/Invoke-centric concepts (#66784)
Jeremy Koritzinsky [Fri, 18 Mar 2022 22:41:43 +0000 (15:41 -0700)]
Replace AsArgument/AsParameter with less P/Invoke-centric concepts (#66784)

2 years ago[mono] Remove a few set but unused variables (#66839)
Alexander Köplinger [Fri, 18 Mar 2022 19:00:29 +0000 (20:00 +0100)]
[mono] Remove a few set but unused variables (#66839)

These triggered a warning in the new clang included with Xcode 13.3

2 years agoDedup patterm/options/timeout in Regex source generator (#66747)
Stephen Toub [Fri, 18 Mar 2022 17:56:28 +0000 (13:56 -0400)]
Dedup patterm/options/timeout in Regex source generator (#66747)

* Dedup patterm/options/timeout in Regex source generator

If we end up with multiple identical pattern/options/timeout tuples in the same assembly, we don't need to emit unique code for each.  We can still emit the partial implementation for each, but emit a single implementation of the Regex they all share.

* Make the cached Regex members be static readonly fields

No reason we need a property here wrapping a compiler-generated backing field.

2 years agoReduce string allocations in XmlWriterTraceListener (#66762)
Stephen Toub [Fri, 18 Mar 2022 17:25:31 +0000 (13:25 -0400)]
Reduce string allocations in XmlWriterTraceListener (#66762)

Rather than ToString'ing everything, most of the header data can be formatted into a span and then written out to the writer.

2 years ago[mono] Move basic w32file* and w32process* functions to eventpipe (#66731)
Alexander Köplinger [Fri, 18 Mar 2022 15:36:38 +0000 (16:36 +0100)]
[mono] Move basic w32file* and w32process* functions to eventpipe (#66731)

They are not used by the rest of the runtime and we only need a bare minimum of w32process and w32file in eventpipe (e.g. no file share/access logic).

Fix ep-test build and warnings, it was missing linking against libz and monoapi.

Fix host vs. target confusion in ep-rt-mono.c

Move initialization of num_main_args after setting main_args in object.c so we can use it as a cheap guard value (not totally thread-safe but good enough for our purposes).

Co-authored-by: Johan Lorensson <lateralusx.github@gmail.com>
2 years ago[mono] Remove unused MONO_DEBUG=dont-free-domains option. (#66817)
Zoltan Varga [Fri, 18 Mar 2022 15:30:44 +0000 (11:30 -0400)]
[mono] Remove unused MONO_DEBUG=dont-free-domains option. (#66817)

2 years ago[Group 3] Enable nullable annotations for `Microsoft.Extensions.Logging` (#65262)
Maksym Koshovyi [Fri, 18 Mar 2022 15:04:03 +0000 (17:04 +0200)]
[Group 3] Enable nullable annotations for `Microsoft.Extensions.Logging` (#65262)

* First pass

* Second pass

* Pass three

* Missed few things

* ref

* Update ProviderAliasUtilities.cs

* Update ActivityTrackingOptions.cs

* Update Microsoft.Extensions.Logging.cs

* GetRequiredService

* Update Logger.Scope

* Create CompatibilitySuppressions.xml

* Add comment to CompatibilitySuppressions.xml

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
* Delete CompatibilitySuppressions.xml

* AsyncLocal<Scope?> _currentScope

* Add assert

Co-authored-by: Jose Perez Rodriguez <joperezr@microsoft.com>
2 years ago[mono][jit] Pass generic context when ldftn of generic method (#66350)
Vlad Brezae [Fri, 18 Mar 2022 14:15:20 +0000 (16:15 +0200)]
[mono][jit] Pass generic context when ldftn of generic method (#66350)

2 years agoMake the `EventSource` generator incremental et.al. (#64579)
Theodore Tsirpanis [Fri, 18 Mar 2022 12:53:14 +0000 (14:53 +0200)]
Make the `EventSource` generator incremental et.al. (#64579)

2 years ago[mono] Hot Reload: support for reloadable types (#66749)
Aleksey Kliger (λgeek) [Fri, 18 Mar 2022 12:38:58 +0000 (08:38 -0400)]
[mono] Hot Reload: support for reloadable types (#66749)

Fully implement support for the `NewTypeDefinition` EnC capability: a hot reload edit can add a new type definition (class, struct, interface, enum) that contains new fields, methods, properties, events, and nested classes, and can have generic params.  Also add reflection support for all of the above.

This is sufficient to support hot reload of types tagged with [`CreateNewOnMetadataUpdateAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.createnewonmetadataupdateattribute?view=net-6.0).

Contributes to https://github.com/dotnet/runtime/issues/63643 and https://github.com/dotnet/runtime/issues/57365

---

The implementation introduces `MonoAddedDefSkeleton` which is a bookkeeping structure that records the metadata indexes of where to find methods, fields, properties and events for a newly-added class.  The issue is that normally `mono_class_create_from_typedef` expects to find all that stuff in a contiguous block starting at the row pointed by the `MONO_TYPEDEF_FIELD_LIST` or `MONO_TYPEDEF_METHOD_LIST` columns of the new typedef.  But in EnC deltas, those columns are zeroed out, and instead the EnCLog functions like `ENC_FUNC_ADD_METHOD` and `ENC_FUNC_ADD_FIELD` explicitly record when a new row is added that is relevant to a particular type definition.

So during the pass over the EnCLog, we start creating skeletons when we see a new row added to the typedef table.  Then when we see the add functions, we record the row indices of the field, method, etc tables.  As far as I can tell, the rows for a particular type definition are contiguous, so we just record the first index and the count.

At the end of the pass, we save the skeletons on the metadata delta, and when code finally creates the `MonoClass` for a particular freshly-added type definition, we check the skeleton and use the recorded rows to populate the fields and methods.  Event and property data is created on-demand (the demand being reflection) in basically the same way.

One important note: we try very hard not to accidentally materialize a newly-added class as a `MonoClass` during the update itself - we need to at least get through the entire EnCLog - otherwise we might not see every field/method/etc and set up the class incorrectly.

The upshot is that the newly-added `MonoClass` behaves like any other "normal" class - all its fields are laid out normally (they're stored in the object, not in a separate hash table).  It can be generic.  It can have base types, interfaces, etc.

This is different from how added fields, props and events will be implemented on existing classes - we won't modify `MonoClass:fields` or the `MonoClassPropertyInfo:properties` arrays - once they have been allocated, we don't want to mess with them.  Instead additions to existing classes with create `MonoClassMetadataUpdateField` (`MonoClassMetadataUpdateProperty` and `MonoClassMetadataUpdateEvent`) structs that are going to be stored on the `MonoClassMetadataUpdateInfo` that's associated with each `MonoClass`.  The various iterators like `mono_class_get_fields` and `mono_class_get_props` will be modified to return the added fields/props/etc after the existing ones.

This is already implemented for fields.  Props and Events will be part of a separate effort to implement reflection support for them.

---

* Checkpoint. Infrastructure for added types

* register member->parent lookups for newly-added classes and members

* fix off by one error creating class from skeleton

* AddNestedClass test works with mono now; also make it generic

* checkpoint: adding properties

   it "works" but only because we don't look very hard for the new properties anywhere.  reflection is probably pretty broken.

* Add a property to AddNestedClass test

* remove allow class/field/method/property ifdefs

   keep the instance field ifdef for now

* add event to AddNestedClass

* add DISALLOW_BROKEN_PARENT ifdef

   allow CustomAttribute row modifications to change Parent, while https://github.com/dotnet/roslyn/issues/60125 is being sorted out

* checkpoint: adding events

* Add new test ReflectionAddNewType

* Add new types to the image name cache

* Assembly.GetTypes and additional tests

* Make nested types work

* GetInterfaces on new types; also Activator.CreateInstance

* Mark mono_class_get_nested_classes_property as a component API

   also mono_class_set_nested_classes_property

* Add GetMethods, GetFields, GetMethod, GetField test

* [class] Implement added method iteration

   Change the iterator from storing MonoMethod** values to storing an iteration count. For added methods, when the iteration count is more than mono_class_get_method_count, run through the hot reload added_members list and
iterate over any relevant methods

* Implement added field iteration

* Add a GetField(BindingFlags.Static) test case

* Add Enum.GetNames and GetProperties tests - not working yet

* Mark mono_class_get_method_count as a component API

   also mono_class_get_field_count

* Enum values work

* Use GSList for added_fields (and props, events); add from_update bit

   Use GSList to simplify the concurrency story for accessing added_fields (and added_props and added_events, eventually): unlike a GPtrArray it won't resize, so we don't need to lock readers.

   Add a from_update bit to MonoProperty and MonoEvent - when props or events are added to existing classes, they will have the bit set.  That means that pointer arithmetic to figure out the prop (or event) tokens won't be usable (since
they're not allocated in one big block).

* Reflection on props in new classes works

* events on new classes work

* Add CustomAttribute reflection test

* remove test for props on existing type - it's not part of this PR

* instance field additions to existing types aren't supported yet

* rm TODO and FIXME

* store prop and event from_update bit in attrs

   The upper 16 bits aren't used for ECMA flags, so grab a bit for metadata-update

* remove instance fields from reflection test

   since Mono doesn't support them yet

* make the Browser EAT lanes happy

   Add some fields to the baseline versions of some test assemblies to keep some types that are used in the deltas from getting trimmed away

2 years agoRemove superfluous string[] and string from System.IO.Packaging.ContentType (#66764)
Stephen Toub [Fri, 18 Mar 2022 11:49:52 +0000 (07:49 -0400)]
Remove superfluous string[] and string from System.IO.Packaging.ContentType (#66764)

2 years agoUse guint64 in UCONTEXT_REG_SET_PC (arm64) (#66812)
Adeel Mujahid [Fri, 18 Mar 2022 09:29:53 +0000 (11:29 +0200)]
Use guint64 in UCONTEXT_REG_SET_PC (arm64) (#66812)

In this scope, `__uint64_t` is not available on musl based systems. Switched to `guint64`, which nearby code is using.

2 years agoDisable Windows arm32 pinvoke stress tests (#66790)
Jakob Botsch Nielsen [Fri, 18 Mar 2022 07:38:50 +0000 (08:38 +0100)]
Disable Windows arm32 pinvoke stress tests (#66790)

2 years agoReenable 4611 and 4703 (#66792)
Aaron Robinson [Fri, 18 Mar 2022 01:59:24 +0000 (21:59 -0400)]
Reenable 4611 and 4703 (#66792)

2 years agoLoad C++/CLI DLLs built against .NET 7.0+ in default ALC (#66486)
Elinor Fung [Fri, 18 Mar 2022 00:14:33 +0000 (17:14 -0700)]
Load C++/CLI DLLs built against .NET 7.0+ in default ALC (#66486)

2 years ago[main] Update dependencies from 8 repositories (#66539)
dotnet-maestro[bot] [Thu, 17 Mar 2022 23:24:40 +0000 (00:24 +0100)]
[main] Update dependencies from 8 repositories (#66539)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years agoFix emscripten-version.txt link (#66778)
Layomi Akinrinade [Thu, 17 Mar 2022 23:20:19 +0000 (16:20 -0700)]
Fix emscripten-version.txt link (#66778)

2 years agoImplement missing SymUnmanaged* interfaces (#66650)
Steve [Thu, 17 Mar 2022 22:34:22 +0000 (06:34 +0800)]
Implement missing SymUnmanaged* interfaces (#66650)

* Implement missing SymUnmanaged* interfaces

* Add try-finally around GCHandle

* Marshal interface argument to pinned pointer

* Minor fixes

* Address feedbacks from review

2 years agoReimplement stubs to improve performance (#65738)
Jan Vorlicek [Thu, 17 Mar 2022 22:19:15 +0000 (23:19 +0100)]
Reimplement stubs to improve performance (#65738)

* Reimplement stubs to improve performance

This change implements `FixupPrecodeStub`, `PrecodeStub`
and `CallCountingStub` using a new mechanism with fixed code and separate RW
data. The `LoaderHeap` was updated to support a new kind of allocation
using interleaved code and data pages to support this new mechanism.
The JIT now generates code that uses indirection slot to jump to the
methods using `FixupPrecode`, improving performance of the ASPNet
plaintext benchmark by 3-4% depending on the target platform (measured
on x64 Windows / Linux and arm64 Linux).

I have also removed the Holders, as the stubs are naturally properly
aligned due to the way they are allocated.

There is now only a single variant of each stub, there are no long /
short ones anymore as they are not needed - the indirect jumps we use
now are not range limited.

Most of the stubs stuff is now target agnostic and the originally split
implementation is now in single place for all targets. Only a few
constants are defined as target specific in these.

The code for the stubs is no longer generated as bytes by C++ code, but
rather written in asm and compiled. These precompiled templates are then
used as a source to copy the code from. The x86 is a bit more complex
than that due to the fact that it doesn't support PC relative indirect
addressing, so we need to relocate all access to the data slots when
generating the code pages.

As a further improvement, we could generate just a single page of the
code and then just map it many times. This is left for future work.

ARM64 Unix differs from the other targets / platforms - there are
various page sizes being used. So the asm templates are generated for
4k..64k page sizes and the variant is then picked at runtime based on
the page size extracted from the OS.

This also removes a lot of writeable mappings created for modifications
of the stub code when W^X is enabled, in the plaintext benchmark they
were reduced by 75%. That results in a significant reducing of the .NET
application startup time with W^X enabled.

I think the `LoaderHeap` would benefit from some refactoring, but I'd
prefer leaving it for a follow up. It seems that for the sake of the
review, it is better to keep it as is.

The change also implements logging of number of mappings and their exact
locations. This helped me to drive the work and I am planning to use it
for further changes. It can be removed in the future once we reach a
final state.

There are still opportunities for improvement, but these stubs allowed
me to scrape off the most significant portion of the mappings.

2 years agoAlways append the "dll" extension for native libraries loads on Windows (#66666)
Aaron Robinson [Thu, 17 Mar 2022 21:41:40 +0000 (17:41 -0400)]
Always append the "dll" extension for native libraries loads on Windows (#66666)

* Always append the "dll" extension for native libraries loads on Windows

Due to case-sensitive file systems on Windows the runtime will now
  always append the ".dll" extension unless the name contains a trailing
  "." or a known loadable extensions. This is an attempt to mitigate
  the default Windows behavior that appends a ".DLL" which is rarely the
  casing used for Windows shared libraries.

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoEnsure the generic math interfaces are implemented implicitly where possible (#66748)
Tanner Gooding [Thu, 17 Mar 2022 21:39:57 +0000 (14:39 -0700)]
Ensure the generic math interfaces are implemented implicitly where possible (#66748)

* Updating generic math interfaces to be implicitly implemented where possible

* Resolve a build error in OdbcConnection caused by new Parse APIs

* Revert "Resolve a build error in OdbcConnection caused by new Parse APIs"

This reverts commit 6fd7ec7797cad7b28d381a695e84430c8d1081ae.

* Suppress CA1846 for System.Data.Odbc

* Updating the xml doc comments for exposed constants

2 years ago[wasm][debugger] Fix incompatibility between runtime and nuget package (#66295)
Thays Grazia [Thu, 17 Mar 2022 18:54:53 +0000 (15:54 -0300)]
[wasm][debugger] Fix incompatibility between runtime and nuget package (#66295)

* Fix incompatibility between runtime and nuget package

* Update debug.ts

2 years ago[wasm][debugger] Don't show the wasm functions on callstack when debugging managed...
Thays Grazia [Thu, 17 Mar 2022 18:54:26 +0000 (15:54 -0300)]
[wasm][debugger] Don't show the wasm functions on callstack when debugging managed code (#64223)

* Show the callstack as it's shown on net5.

* Addressing @lewing and @radical comments.

* addressing @lewing comment.

2 years agoAdd additional trace to HttpConnectionPool (#66605)
Natalia Kondratyeva [Thu, 17 Mar 2022 18:09:14 +0000 (19:09 +0100)]
Add additional trace to HttpConnectionPool (#66605)

The additional trace should help troubleshoot hanged "pending" connection issues (i.e. the reasons why new connections were not created) in HttpConnectionPool.

The issue manifests as growing number of timeouted requests. It is not easy to link a timeouted request (esp. with a small timeout) to a connection that was created 3 minutes ago but still is not connected. There are no traces of the state of HttpConnectionPool, e.g. number of pending connections, so it is unclear from existing traces why the pool decided not to create a connection.

Related to #66297

2 years agoSurface native sourcelink on CoreCLR native PDBs for easier dump debugging (#66677)
Juan Hoyos [Thu, 17 Mar 2022 18:05:31 +0000 (11:05 -0700)]
Surface native sourcelink on CoreCLR native PDBs for easier dump debugging (#66677)

* Use managed sourcelink infrastructure to allow for win native sourcelink

2 years agoTemporarily disable HttpClientTest.GetContentAsync_WhenCanNotConnect_ExceptionContain...
Radek Zikmund [Thu, 17 Mar 2022 17:49:03 +0000 (18:49 +0100)]
Temporarily disable HttpClientTest.GetContentAsync_WhenCanNotConnect_ExceptionContainsHostInfo on OSX (#66761)

2 years agoUpdate area owners to add 2 triagers (#66767)
Dan Moseley [Thu, 17 Mar 2022 17:02:19 +0000 (11:02 -0600)]
Update area owners to add 2 triagers (#66767)

2 years agoFixes Binding to non-null IEnumerable doesn't work #36390 (#66131)
Steve Dunn [Thu, 17 Mar 2022 16:15:18 +0000 (16:15 +0000)]
Fixes Binding to non-null IEnumerable doesn't work #36390 (#66131)

2 years agoStructs: Do not mark "Hidden buffer pointer" as address-exposed (#64130)
Kunal Pathak [Thu, 17 Mar 2022 15:08:05 +0000 (08:08 -0700)]
Structs: Do not mark "Hidden buffer pointer" as address-exposed (#64130)

* Preliminary changes

* Add the missing push of ssadef

* Fix an issue for call tree cloning

* formatting

* minor review comments incorporation

* Make GT_CALL as full-def

* Merge RenameCall into RenameDef

* Fix DefinesLocalAddr and lateuse arg

* Minor comments

* fix the recently added code to account that GT_CALL can also have defintion:

* clone the return buffer arg

* Another round of review comments

* Handle return buffer calls in optIsVarAssgCB

* Update locals defined by calls in NodeInfo

* Fix a case where arg can be putarg

* Restructure the cases in GetLclRetBufArgNode()

* move ivaMaskCall outside the condition

* Add back to call for DoNotEnregister which was missed for Release builds

* Retrieve the appropriate node in case of copyReload

* Added an assert

* remove assert and add comment

2 years agoReplace StringBuilder with ValueStringBuilder in AssemblyName.FullName (#66750)
Stephen Toub [Thu, 17 Mar 2022 11:30:59 +0000 (07:30 -0400)]
Replace StringBuilder with ValueStringBuilder in AssemblyName.FullName (#66750)

2 years ago[mono] Merge icall-def-netcore.h back into icall-def.h (#66730)
Alexander Köplinger [Thu, 17 Mar 2022 09:01:32 +0000 (10:01 +0100)]
[mono] Merge icall-def-netcore.h back into icall-def.h (#66730)

This was originally done in mono/mono to allow building both legacy and netcore, but we don't need this split anymore in dotnet/runtime.

2 years agoRemove dotnet6 feeds (#66447)
Viktor Hofer [Thu, 17 Mar 2022 07:42:48 +0000 (08:42 +0100)]
Remove dotnet6 feeds (#66447)

* Remove dotnet6 feeds

dotnet7 feeds are currently the target feeds for the main branch. The dotnet6 feeds shouldn't be used anymore.

* Update targetingpacks.targets

* Update prebuilt package versions

* Update NativeExports.csproj

2 years agoRemove test coverage of FeatureSIMD=0 (#66670)
Kunal Pathak [Thu, 17 Mar 2022 06:01:08 +0000 (23:01 -0700)]
Remove test coverage of FeatureSIMD=0 (#66670)

* Remove coverge of FeatureSIMD=0

* Remove COMPlus_FeatureSIMD flag

* Remove isSacalarIsa() condition

* Remove the flag from other places of VM

2 years agoReenable CA 4701 (#66676)
Aaron Robinson [Thu, 17 Mar 2022 02:30:39 +0000 (22:30 -0400)]
Reenable CA 4701 (#66676)

* Reenable 4701

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoBump next from 11.1.3 to 12.1.0 in /src/mono/sample/wasm/browser-nextjs (#65534)
dependabot[bot] [Thu, 17 Mar 2022 00:08:34 +0000 (01:08 +0100)]
Bump next from 11.1.3 to 12.1.0 in /src/mono/sample/wasm/browser-nextjs (#65534)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoAdd tracing to the Linux X509Chain implementation
Jeremy Barton [Wed, 16 Mar 2022 23:53:50 +0000 (16:53 -0700)]
Add tracing to the Linux X509Chain implementation

The tracing is heavily focused on transient behaviors, like AIA/CRL/OCSP downloads and cache interactions.

Things like applying ApplicationPolicy aren't really traced because that can be "easily" evaluated by looking at the certificates in isolation.

2 years agoFix automatic adding to all projects for issue boards as well. (#66740)
Jose Perez Rodriguez [Wed, 16 Mar 2022 23:39:00 +0000 (16:39 -0700)]
Fix automatic adding to all projects for issue boards as well. (#66740)

2 years agoRevisit PatternContext<TFrame>.PushDataFrame nullable annotation (#65598)
Maksym Koshovyi [Wed, 16 Mar 2022 22:57:58 +0000 (00:57 +0200)]
Revisit PatternContext<TFrame>.PushDataFrame nullable annotation (#65598)

TFrame non null

2 years ago[Group 3] Enable nullable annotations for `Microsoft.Extensions.Hosting.Abstractions...
Maksym Koshovyi [Wed, 16 Mar 2022 22:54:16 +0000 (00:54 +0200)]
[Group 3] Enable nullable annotations for `Microsoft.Extensions.Hosting.Abstractions` (#65403)

* First pass (src)

* Update Microsoft.Extensions.Hosting.Abstractions.cs

* Update HostBuilderContext

* Values of Properties cannot be null

2 years agoUpdate Roslyn Testing SDK (#66681)
Jeremy Koritzinsky [Wed, 16 Mar 2022 22:37:59 +0000 (15:37 -0700)]
Update Roslyn Testing SDK (#66681)

2 years agoInject existing object into MEF2 (#66364)
Huo Yaoyuan [Wed, 16 Mar 2022 22:03:41 +0000 (06:03 +0800)]
Inject existing object into MEF2 (#66364)

2 years agoMoving "Generic Math" in box and making it no longer experimental (#65731)
Tanner Gooding [Wed, 16 Mar 2022 22:01:01 +0000 (15:01 -0700)]
Moving "Generic Math" in box and making it no longer experimental (#65731)

* Moving "Generic Math" in box and making it no longer experimental

* Removing an unused using from the generic math interfaces

* Updating the ordering of the checked keyword for the commented out checked operators

2 years agoImprove NamedPipeClientStream.Connect edge cases handling (#65553)
Adam Sitnik [Wed, 16 Mar 2022 21:46:30 +0000 (22:46 +0100)]
Improve NamedPipeClientStream.Connect edge cases handling (#65553)

* don't try to call WaitNamedPipeW if we know that no instances exist and the sys-call will quit immediately

* remove code duplication

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoOnly move PRs to Done column on projects that already contain the PR when they are...
Jose Perez Rodriguez [Wed, 16 Mar 2022 21:40:55 +0000 (14:40 -0700)]
Only move PRs to Done column on projects that already contain the PR when they are moved to a different area. (#66737)

2 years agoFix beginning fixups of captures after Regex span support (#66713)
Stephen Toub [Wed, 16 Mar 2022 21:18:38 +0000 (17:18 -0400)]
Fix beginning fixups of captures after Regex span support (#66713)

The Regex span support changed the scanning infrastructure to always be based on spans.  That means that when a string is passed in by the caller, internally we still operate on it as a span.  That also means we can take advantage of slicing, and if the caller has specified via a beginning/length set of arguments that we should only process a substring, we can just slice to that substring.  That, however, then means that all offsets computed by the scanning implementation are 0-based rather than beginning-based.  The span change included a fixup for the overall match position, but not for the position of each individual capture, and that then meant that captures were providing the wrong values.  We unfortunately didn't have any tests for validating groups that also involved non-0 beginnings with string inputs.

2 years agofix pal test (#66636)
Dan Moseley [Wed, 16 Mar 2022 20:56:01 +0000 (14:56 -0600)]
fix pal test (#66636)

2 years agoFix incorrect conversion from int to size_t due to PR 66552. (#66721)
Johan Lorensson [Wed, 16 Mar 2022 20:42:36 +0000 (21:42 +0100)]
Fix incorrect conversion from int to size_t due to PR 66552. (#66721)

https://github.com/dotnet/runtime/pull/66552 did incorrect switch
to size_t from int in a sections that expects variable to go negative.

2 years agoFix mono warnings on linux arm64 (#65256)
Adeel Mujahid [Wed, 16 Mar 2022 20:20:21 +0000 (22:20 +0200)]
Fix mono warnings on linux arm64 (#65256)

2 years agoDedup SymbolicRegexMatcher construction (#66617)
Stephen Toub [Wed, 16 Mar 2022 19:02:21 +0000 (15:02 -0400)]
Dedup SymbolicRegexMatcher construction (#66617)

2 years agoneed to clear mark array bits for regions completely outside the marked range in...
Maoni Stephens [Wed, 16 Mar 2022 18:33:19 +0000 (11:33 -0700)]
need to clear mark array bits for regions completely outside the marked range in FGCs (#66696)

we are missing a case where the mark array bits need to be cleared for a region is completely outside the marked range (ie, slow/shigh) in Workstation GC.

also added verification when we return a region to free.

2 years agoUpdate fabricbot config for Libraries area pods. Scripts moved to dotnet/fabricbot...
Jeff Handley [Wed, 16 Mar 2022 18:30:09 +0000 (11:30 -0700)]
Update fabricbot config for Libraries area pods. Scripts moved to dotnet/fabricbot-config repo. (#66691)

* Update fabricbot config for Libraries area pods. Scripts moved to
dotnet/fabricbot-config repo.

* Apply the taskSource property to the generated tasks

2 years agoConsole.ReadKey should print a char, not an integer (#66609)
Adam Sitnik [Wed, 16 Mar 2022 17:02:20 +0000 (18:02 +0100)]
Console.ReadKey should print a char, not an integer (#66609)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoClose helix tag. (#66717)
Parker Bibus [Wed, 16 Mar 2022 16:23:14 +0000 (11:23 -0500)]
Close helix tag. (#66717)

Close helix work item tag in android_scenarios.proj file that is missing it.

2 years agoFix System.Text.Json tests affected by DST (#66559)
Stephen A. Imhoff [Wed, 16 Mar 2022 12:48:00 +0000 (05:48 -0700)]
Fix System.Text.Json tests affected by DST (#66559)

* Correct whitespace

* Switch DateTime.Now -> DateTime.UtcNow

* Tweak formatting

* Change references to UtcNow to a fixed date/time value.

* Add missing common file reference

2 years agoDisabled in wasm. (#66698)
Ilona Tomkowicz [Wed, 16 Mar 2022 11:01:47 +0000 (12:01 +0100)]
Disabled in wasm. (#66698)

2 years agoFix outerloop NonBacktracking test throwing argument exception (#66693)
Stephen Toub [Wed, 16 Mar 2022 10:21:09 +0000 (06:21 -0400)]
Fix outerloop NonBacktracking test throwing argument exception (#66693)

2 years ago[mono] Optimize and clean-up `System.Reflection.Emit.ILGenerator`. (#65251)
Theodore Tsirpanis [Wed, 16 Mar 2022 10:06:11 +0000 (12:06 +0200)]
[mono] Optimize and clean-up `System.Reflection.Emit.ILGenerator`. (#65251)

2 years agoEnable some ARM32 tests (#66553)
Jakob Botsch Nielsen [Wed, 16 Mar 2022 09:51:28 +0000 (10:51 +0100)]
Enable some ARM32 tests (#66553)

- Enable tests relying on implicit tailcalls
- Enable all ABI stress tests

2 years agoCondition Windows SslCertificateTrust test on Registry value (#65848)
Radek Zikmund [Wed, 16 Mar 2022 09:34:52 +0000 (10:34 +0100)]
Condition Windows SslCertificateTrust test on Registry value (#65848)

Sending trusted issuers list on Windows is problematic (depends on registry settings), so there were no tests. This PR conditionally enables existing tests on Windows if the relevant registry setting is set.

2 years agoAwait pending client authentication task before disposing (#66682)
Radek Zikmund [Wed, 16 Mar 2022 07:30:14 +0000 (08:30 +0100)]
Await pending client authentication task before disposing (#66682)

Fixes #65455.

The assert was hit due to the SslStream being disposed during handshake, while `AuthenticateAsClientAsync` was still running. This removes a rare crash in test runs with debug libraries configuration.

2 years agoAddress a few TODOs on S.S.C.Cose. (#66641)
David Cantú [Wed, 16 Mar 2022 06:48:29 +0000 (23:48 -0700)]
Address a few TODOs on S.S.C.Cose.  (#66641)

* Make HeaderMaps optionals

* Improve handling of integers larger/smaller than int32 in Alg header

2 years agoExpose `LibraryImportAttribute` (#66434)
Elinor Fung [Wed, 16 Mar 2022 03:05:50 +0000 (20:05 -0700)]
Expose `LibraryImportAttribute` (#66434)

2 years agoRemove 4267 suppression from mono (#66552)
Adeel Mujahid [Tue, 15 Mar 2022 23:00:34 +0000 (01:00 +0200)]
Remove 4267 suppression from mono (#66552)

* Remove 4267 suppression from mono

* Fix a mono warning on linux arm64

* Remove trailing whitespaces from changeset

2 years agoFix check for IsTrimmable metadata (#66658)
Jan Kotas [Tue, 15 Mar 2022 22:52:49 +0000 (15:52 -0700)]
Fix check for IsTrimmable metadata (#66658)

Fixes #66593

2 years agoAdd withAssert flag in getTierName method (#66662)
Kunal Pathak [Tue, 15 Mar 2022 22:50:02 +0000 (15:50 -0700)]
Add withAssert flag in getTierName method (#66662)

* review feedback

* Remove the DEBUG condition

2 years agoFix stepping issues with ReadyToRun and TieredCompilation (#66491)
Aaron Robinson [Tue, 15 Mar 2022 21:49:05 +0000 (17:49 -0400)]
Fix stepping issues with ReadyToRun and TieredCompilation (#66491)

* Fix stepping with ReadyToRun and TieredCompilation assemblies

Get the correct PCODE version for ReadyToRun methods when the StubManager
  is computing the address to step to.

* Update logging
Update GetJitInfoWorker to respect code versioning

2 years agoFix register conflict between freeing large stack frames and fast tailcalls on arm32...
Jakob Botsch Nielsen [Tue, 15 Mar 2022 20:40:27 +0000 (21:40 +0100)]
Fix register conflict between freeing large stack frames and fast tailcalls on arm32 (#66588)

Fix #66585

2 years agoReenable SslStreamNetworkStreamTests on OSX #46837 (#66393)
Radek Zikmund [Tue, 15 Mar 2022 20:36:10 +0000 (21:36 +0100)]
Reenable SslStreamNetworkStreamTests on OSX  #46837 (#66393)

The underlying issue has been likely fixed by other changes

2 years agoUpdate maui SDK to 6.0.3xx (#66671)
Parker Bibus [Tue, 15 Mar 2022 19:21:49 +0000 (14:21 -0500)]
Update maui SDK to 6.0.3xx (#66671)

* Update downloaded SDK for maui to 6.0.3xx

2 years agosupport WindowsPrincipal in HttpListenerWebSocketContext (#65746)
Badre BSAILA [Tue, 15 Mar 2022 19:16:41 +0000 (20:16 +0100)]
support WindowsPrincipal in HttpListenerWebSocketContext (#65746)

* support WindowsPrincipal in HttpListenerWebSocketContext

* user Identity is known as instance of WindowsIdentity

* use TARGET_WINDOWS preprocessor

2 years agoEnsure serializer reflection-dependency sentinel is accurate (#66522)
Layomi Akinrinade [Tue, 15 Mar 2022 19:14:58 +0000 (12:14 -0700)]
Ensure serializer reflection-dependency sentinel is accurate (#66522)

* Ensure serializer reflection-dependency sentinel is accurate

* Address feedback

2 years agoFix assert for ARM shuffle thunk (#66642)
Bruce Forstall [Tue, 15 Mar 2022 18:41:22 +0000 (11:41 -0700)]
Fix assert for ARM shuffle thunk (#66642)

Handle case where gap exists at the beginning of the stack
range.

Fix #13241

2 years ago[wasm] Add vector measurements to the bench Sample (#66655)
Radek Doulik [Tue, 15 Mar 2022 18:26:29 +0000 (19:26 +0100)]
[wasm] Add vector measurements to the bench Sample (#66655)

Example output, chrome:

    | measurement | time |
    |-:|-:|
    |               Vector, Create Vector128 |     0.1340us |
    |              Vector, Add 2 Vector128's |     0.6261us |
    |         Vector, Multiply 2 Vector128's |     0.6257us |

v8:

    | measurement | time |
    |-:|-:|
    |               Vector, Create Vector128 |     0.3990us |
    |              Vector, Add 2 Vector128's |     0.9154us |
    |         Vector, Multiply 2 Vector128's |     0.9127us |

2 years agoFix for assert failure in distribute free regions (#66657)
Peter Sollich [Tue, 15 Mar 2022 18:15:50 +0000 (19:15 +0100)]
Fix for assert failure in distribute free regions (#66657)

* Fix the case where a region that was decommitted due to age is also among the highest free regions, and so gets moved to the decommit list again by region_allocator::move_highest_free_regions.

The fix is simply to check whether the region is already on the to_free_list and not move it or count it if it is.

* Fix typo.

* Fix logic in move_highest_free_regions.

2 years agoBring back unused implementation of type conversions (#66597)
Simon Rozsival [Tue, 15 Mar 2022 18:13:24 +0000 (19:13 +0100)]
Bring back unused implementation of type conversions (#66597)