platform/upstream/dotnet/runtime.git
23 months agoPrevent exceptions with a 'Success' message when there is a problem with permissions...
Simon Rozsival [Wed, 30 Nov 2022 14:20:38 +0000 (15:20 +0100)]
Prevent exceptions with a 'Success' message when there is a problem with permissions (#78555)

23 months agoDisable APICompat assembly validation in source build (#79027)
Viktor Hofer [Wed, 30 Nov 2022 14:01:48 +0000 (15:01 +0100)]
Disable APICompat assembly validation in source build (#79027)

The APICompat tooling was recently updated and the CoreLib projects and ApiCompat.proj depend on the new features. As source-build in main builds with a 7.0.100 toolchain instead of live built components, disable APICompat for now in source-build.

23 months agoInternal.Console.Write uses unicode encoding for iOS (#78974)
Milos Kotlar [Wed, 30 Nov 2022 12:53:26 +0000 (13:53 +0100)]
Internal.Console.Write uses unicode encoding for iOS (#78974)

* Internal.Console.Write uses UTF16 encoding for IsiOSLike

23 months agoTransform `STRUCT`-typed uses of primitives in local morph (#78131)
SingleAccretion [Wed, 30 Nov 2022 12:23:56 +0000 (15:23 +0300)]
Transform `STRUCT`-typed uses of primitives in local morph (#78131)

* Add fwd-sub workaround

* Fold STRUCT-based access to primitives in local morph

* Solve a tiny regression

* Adapt args morhing

* Adapt block morphing

* Adapt return morphing

* Delete dead code

23 months agoAdd .NET 7 source gen regression tests (#78857)
Eirik Tsarpalis [Wed, 30 Nov 2022 11:57:30 +0000 (11:57 +0000)]
Add .NET 7 source gen regression tests (#78857)

23 months agoUpdate to the stable 7.0.100 SDK (#78034)
Viktor Hofer [Wed, 30 Nov 2022 11:52:48 +0000 (12:52 +0100)]
Update to the stable 7.0.100 SDK (#78034)

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
23 months agoAdd simple Else conditions to If Conversion (#77728)
Alan Hayward [Wed, 30 Nov 2022 10:53:28 +0000 (10:53 +0000)]
Add simple Else conditions to If Conversion (#77728)

* Add simple Else conditions to If Conversion

For example:
if (x < 7) { a = 5; } else { a = 9; }
a = (cond) ? b : c;

The else condition must write to the same variable as the then
statement.

* Move phase and stop updating ssa

* Wrap JitConfig access

* Add GT_RETURN else cases

* Add test cases with verification checks

* Ensure single only operation condition checks are used

* Remove empty line

* Use DOTNET_ instead of COMPlus_

* Move JitDoIfConversion check

* Move if conversion into it's own file

* Always invert condition

* Rename IfConvertMergeBlocks

* Use gtGetOp1()

* Expand tests

* Add operation type assert

* Allow nested SELECT nodes

* Fix condition directions

23 months agoJIT: Fix initblk/cpblk and STORE_DYN_BLK size mismatch (#78930)
Jakob Botsch Nielsen [Wed, 30 Nov 2022 09:59:21 +0000 (10:59 +0100)]
JIT: Fix initblk/cpblk and STORE_DYN_BLK size mismatch (#78930)

STORE_DYN_BLK turns into a call to JIT_MemSet/JIT_MemCpy that go quite
directly to memset/memcpy, so the size is actually a native uint. This
can cause problems since the JIT does not make any normalization
guarantees above 32 bits.

Fix #78912

23 months agoMove AT_EXECFN to fallback for /proc/self/exe (#78958)
Adeel Mujahid [Wed, 30 Nov 2022 09:40:17 +0000 (11:40 +0200)]
Move AT_EXECFN to fallback for /proc/self/exe (#78958)

* Move AT_EXECFN to fallback for /proc/self/exe

* Update src/native/minipal/getexepath.h

23 months agoConsolidate approach for conditional tests that check for privileged processes (...
Jeff Handley [Wed, 30 Nov 2022 09:32:35 +0000 (01:32 -0800)]
Consolidate approach for conditional tests that check for privileged processes (#78793)

* Consolidate approach for conditional tests that check for privileged processes

* Simpler privileged process helpers

* Revert SLN file changes

* Remove platform-specific helpers for privileged process conditions

* Fix System.IO tests for unix-specific privileged process scenarios

* Browser does not support privileged processes

* Fix System.IO tests for unix-specific privileged process scenarios

* Enable the Environment.IsPrivilegedProcess test for browser

* PR feedback

Omit [PlatformSpecific] in modified tests that are in platform-specific test files.

Remove [Outerloop] attributes from privileged process tests.

Better multithreaded handling in PlatformDetection.IsPrivilegedProcess

23 months ago[Android] Remove repeated calls to beginHandshake (#78849)
Simon Rozsival [Wed, 30 Nov 2022 08:28:19 +0000 (09:28 +0100)]
[Android] Remove repeated calls to beginHandshake (#78849)

Cleanup

Revert some changes

23 months agodisable failing test - active issue (#78976)
Pavel Savara [Wed, 30 Nov 2022 08:18:14 +0000 (09:18 +0100)]
disable failing test - active issue (#78976)

23 months agoDon't gitignore linker (#79002)
Sven Boemer [Wed, 30 Nov 2022 07:59:14 +0000 (23:59 -0800)]
Don't gitignore linker (#79002)

23 months agoPlace non-GC statics in the dehydratable section (#78795)
Michal Strehovský [Wed, 30 Nov 2022 05:56:41 +0000 (14:56 +0900)]
Place non-GC statics in the dehydratable section (#78795)

There can be a pointer reloc that points to the class constructor. We need this to stay as a full pointer since non-Gc statics can be allocated at runtime and we don't have guarantees they would be within +-2 GB of the cctor.

23 months agoPlace frozen objects into dehydrated section (#78688)
Michal Strehovský [Wed, 30 Nov 2022 05:49:04 +0000 (14:49 +0900)]
Place frozen objects into dehydrated section (#78688)

Saves 1% in size on a Hello World on Windows, more on Linux because we're getting rid of full pointers.

* Instead of using `ArrayOfEmbeddedDataNode` as the base for the frozen object region, derive from `DehydratableObjectNode` directly. The base class wasn't really saving us much work over `ObjectNode` anyway.
* Move the "align object to minimum size" code to the central location while I'm touching it.
* Keep track of all frozen objects in the `MetadataManager`. This is the general pattern we follow elsewhere. The old pattern where the frozen object adds itself from the callback also works, but this matches the approach we use for other summarized node kinds.

23 months agoPlace dispatch cells in dehydrated section (#78748)
Michal Strehovský [Wed, 30 Nov 2022 05:48:03 +0000 (14:48 +0900)]
Place dispatch cells in dehydrated section (#78748)

23 months agoAdd IndexOfAnyValues.Contains (#78996)
Miha Zupan [Wed, 30 Nov 2022 04:37:09 +0000 (04:37 +0000)]
Add IndexOfAnyValues.Contains (#78996)

* Add IndexOfAnyValues.Contains

* Unsafe => unsafe

23 months agoFix compiling EXE modules as native libraries (#78949)
Michal Strehovský [Wed, 30 Nov 2022 02:05:04 +0000 (11:05 +0900)]
Fix compiling EXE modules as native libraries (#78949)

When `--nativelib` is used together with a module that defines an entrypoint, we would incorrectly run some of the logic meant for EXEs. This is failure is only reachable when one constructs inputs to `ilc.exe` manually. The SDK doesn't allow constructing such inputs.

23 months agoFix configuration binding with types implementing IDictionary<,> (#78946)
Tarek Mahmoud Sayed [Wed, 30 Nov 2022 00:50:07 +0000 (16:50 -0800)]
Fix configuration binding with types implementing IDictionary<,> (#78946)

Co-authored-by: Steve Dunn <steve@dunnhq.com>
23 months agoImplement DateTimeOffset.TotalOffsetMinutes (#78943)
Tarek Mahmoud Sayed [Tue, 29 Nov 2022 23:48:02 +0000 (15:48 -0800)]
Implement DateTimeOffset.TotalOffsetMinutes (#78943)

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Fixes https://github.com/dotnet/runtime/issues/52081

23 months agoRemove single-stage-pipeline-with-resources.yml, use only pipeline-with-resources...
Alexander Köplinger [Tue, 29 Nov 2022 23:26:36 +0000 (00:26 +0100)]
Remove single-stage-pipeline-with-resources.yml, use only pipeline-with-resources.yml (#78968)

* Remove single-stage-pipeline-with-resources.yml, use only pipeline-with-resources.yml

This reduces nesting of the pipeline templates.

* Remove file

23 months agoImprove fgGetStaticFieldSeqAndAddress (#78961)
Egor Bogatov [Tue, 29 Nov 2022 21:51:22 +0000 (22:51 +0100)]
Improve fgGetStaticFieldSeqAndAddress (#78961)

23 months ago[PERF] Make mono dotnet pathing dynamic with proj file (#78787)
Parker Bibus [Tue, 29 Nov 2022 21:31:27 +0000 (13:31 -0800)]
[PERF] Make mono dotnet pathing dynamic with proj file (#78787)

* Added the proj file that prints the variables we need in the azure pipeline.

* Added the steps to run the new properties pipeline.proj file and properly use the env variables where necessary.

23 months ago[wasm][debugger] Fix justMyCode behavior (#78066)
Thays Grazia [Tue, 29 Nov 2022 19:47:47 +0000 (16:47 -0300)]
[wasm][debugger] Fix justMyCode behavior (#78066)

* DotnetDebugger.setDebuggerProperty does not depend of having a session.

* addressing @radical comments

23 months ago[wasm][debugger] Improvements in debugging in async methods (#78651)
Thays Grazia [Tue, 29 Nov 2022 19:47:17 +0000 (16:47 -0300)]
[wasm][debugger] Improvements in debugging in async methods (#78651)

* Fixing 2 variables with same names in different scopes in a async method.

* Implementing support to see local variables in async methods in VB code, and also fixing 2 variables with same name in differente scopes, and also fixing method name for async methods in VB.

* Adding Test case as suggested by @radical

* Refactor Scope class

* slight test changes

* Split the tests, to be more readable in code, and in test results

* cleanup

* addressing radical comments

* addressing radical comments, fix test case

* addressing radical comments

* addressing @radical comments

Co-authored-by: Ankit Jain <radical@gmail.com>
23 months agoRevert "Handle zero value RSA modulus for OpenSSL 1.1" (#78986)
Kevin Jones [Tue, 29 Nov 2022 19:21:16 +0000 (14:21 -0500)]
Revert "Handle zero value RSA modulus for OpenSSL 1.1" (#78986)

23 months agoUse `FIELD_ADDR` for all `ldflda`s (#78226)
SingleAccretion [Tue, 29 Nov 2022 18:02:30 +0000 (21:02 +0300)]
Use `FIELD_ADDR` for all `ldflda`s (#78226)

23 months agoMake DAC logging opt-in (#77923)
Andrew Au [Tue, 29 Nov 2022 17:46:56 +0000 (09:46 -0800)]
Make DAC logging opt-in (#77923)

23 months agoHandle zero value RSA modulus for OpenSSL 1.1
Kevin Jones [Tue, 29 Nov 2022 17:40:43 +0000 (12:40 -0500)]
Handle zero value RSA modulus for OpenSSL 1.1

23 months ago[wasm] Catch error from loading "node:crypto" module (#78916)
Marek Fišera [Tue, 29 Nov 2022 16:58:04 +0000 (17:58 +0100)]
[wasm] Catch error from loading "node:crypto" module (#78916)

* Catch error from loading node:crypto module.

* Throw error with explanation when crypto module is not available.

* Fix providing error throwing polyfill.

23 months agoUse string interpolation in more places (#78920)
Stephen Toub [Tue, 29 Nov 2022 16:51:41 +0000 (11:51 -0500)]
Use string interpolation in more places (#78920)

Mostly tests, but a few src fixes as well.

23 months agoFix handling of conv_i in the interpreter (#78948)
Michal Strehovský [Tue, 29 Nov 2022 14:55:01 +0000 (23:55 +0900)]
Fix handling of conv_i in the interpreter (#78948)

The missing `default` case was causing a stack imbalance (that we later detect so it doesn't actually harm anything). But better to `Status.Fail` than throw and catch.

23 months agoDelete .NET Native leftovers from type loader (part 1 of X) (#78960)
Michal Strehovský [Tue, 29 Nov 2022 14:54:27 +0000 (23:54 +0900)]
Delete .NET Native leftovers from type loader (part 1 of X) (#78960)

Main themes:
* Floating generic dictionaries
* Universal shared code
* Metadata type loading

I went through EETypeCreator.cs and deleted everything that didn't look necessary. Some of that had entrails in other files that I deleted as well, but the other files were not my focus.

23 months agoRemoved extra 'Build' from build display name
Nathan Ricci [Tue, 29 Nov 2022 14:00:10 +0000 (09:00 -0500)]
Removed extra 'Build' from build display name

23 months agoExtend regex [x, x+64) char class optimization to [x, x+32) (#78900)
Stephen Toub [Tue, 29 Nov 2022 11:47:49 +0000 (06:47 -0500)]
Extend regex [x, x+64) char class optimization to [x, x+32) (#78900)

* Extend regex [x, x+64) char class optimization to [x, x+32)

Regex currently optimizes set lookups when all of the characters in the range-based character class are within 64 of each other; in that case, it builds a 64-bit bitmap in a ulong and does bit manipulation to compute in a branchless manner whether the target character is in the set. However, because this manipulates 64-bit values, RegexCompiler avoids this optimization when in a 32-bit process, and the source generator generates the code anyway, with a 32-bit process suffering slightly. This PR adds a 32-bit variation of the scheme, such that if all of the characters fall within 32 of each other, it's used.

* Update src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Emitter.cs

Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
23 months agoReplace more Unsafe.As usage with pointers (#78919)
Stephen Toub [Tue, 29 Nov 2022 11:38:56 +0000 (06:38 -0500)]
Replace more Unsafe.As usage with pointers (#78919)

23 months agoFix nullable annotation on Path.EndsInDirectorySeparator(string) (#78922)
Stephen Toub [Tue, 29 Nov 2022 04:49:06 +0000 (23:49 -0500)]
Fix nullable annotation on Path.EndsInDirectorySeparator(string) (#78922)

23 months agoChange the default SuperPMI collection location (#78513)
Bruce Forstall [Tue, 29 Nov 2022 01:43:29 +0000 (17:43 -0800)]
Change the default SuperPMI collection location (#78513)

When using `superpmi.py collect`, change the default output MCH
file to be located in the current directory, not the "spmi" location.
Also, add logic so multiple concurrent collections using a default
file name don't overwrite each other.

23 months agoJIT: Fold const RVA access (via const index) (#78783)
Egor Bogatov [Tue, 29 Nov 2022 01:31:07 +0000 (02:31 +0100)]
JIT: Fold const RVA access (via const index) (#78783)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoFix typos: entires -> entries (#78928)
Julien Couvreur [Mon, 28 Nov 2022 23:36:52 +0000 (15:36 -0800)]
Fix typos: entires -> entries (#78928)

23 months agoMake sure s_currentGenerationTable is safe for profiler attach (#78841)
Andrew Au [Mon, 28 Nov 2022 23:17:20 +0000 (15:17 -0800)]
Make sure s_currentGenerationTable is safe for profiler attach (#78841)

23 months agoAdd compiler-generated code tests for NativeAot (#77457)
Sven Boemer [Mon, 28 Nov 2022 22:43:55 +0000 (14:43 -0800)]
Add compiler-generated code tests for NativeAot (#77457)

This adds the compiler-generated code tests from illink and enables them for NativeAot.

Includes fixes in the test infrastructure required to make some of the tests pass.

23 months agoDisable ClientConnectAsync_Cancel_With_InfiniteTimeout test frequently failing in...
Stephen Toub [Mon, 28 Nov 2022 22:43:05 +0000 (17:43 -0500)]
Disable ClientConnectAsync_Cancel_With_InfiniteTimeout test frequently failing in CI (#78923)

23 months agoGenerate diagnosable failfast in GVM resolution (#78904)
Michal Strehovský [Mon, 28 Nov 2022 22:23:06 +0000 (07:23 +0900)]
Generate diagnosable failfast in GVM resolution (#78904)

If the program hits the conditions in #77070, generate a failfast message that makes it possible to create a workaround.

Instead of:

```
Process terminated. Generic virtual method pointer lookup failure.

Declaring type handle: MethodTable:0x00007FF66E8587B8
Target type handle: MethodTable:0x00007FF66E858810
Method name: Serialize
Instantiation:
  Argument 00000000: MethodTable:0x00007FF66E85DA08
```

Generate:

```
Process terminated. Generic virtual method pointer lookup failure.

Declaring type handle: EETypeRva:0x005438B8(MemoryPackFormatter2`1[MemPackObject])
Target type handle: EETypeRva:0x00543910(MemoryPackableFormatter2`1[MemPackObject])
Method name: Serialize
Instantiation:
  Argument 00000000: EETypeRva:0x00529B38(System.Buffers.ArrayBufferWriter`1[System.Byte])
```

The workaround is then:

```xml
<Directives>
  <Application>
    <Assembly Name="repro">
      <Type Name="MemoryPackableFormatter2`1[[MemPackObject]]">
        <Method Name="Serialize" Dynamic="Required All">
          <GenericArgument Name="System.Buffers.ArrayBufferWriter`1[[System.Byte, mscorlib]],System.Memory" />
        </Method>
      </Type>
    </Assembly>
  </Application>
</Directives>
```

23 months agoadd README files for Microsoft.Win32.* (#78248)
Akhil Indurti [Mon, 28 Nov 2022 20:58:58 +0000 (12:58 -0800)]
add README files for Microsoft.Win32.* (#78248)

* Microsoft.Win32.Primitives: add README

* Microsoft.Win32.Registry: add README

* Microsoft.Win32.Registry.AccessControl: add README

* Microsoft.Win32.SystemEvents: add README

23 months agoCorrectly handle false on Add/Take from underlying collection in BlockingCollection...
hrrrrustic [Mon, 28 Nov 2022 16:59:38 +0000 (19:59 +0300)]
Correctly handle false on Add/Take from underlying collection in BlockingCollection (#77936)

* add failing tests

* fix false handling

* wrong push

* remove empty line

* remove random assert

* fix interlocked

* simplify if

* add few more assertions

* try to simplify double try-finally

* apply review comments

23 months agoDisable mark phase prefetching for segments.
Peter Sollich [Mon, 28 Nov 2022 16:57:05 +0000 (17:57 +0100)]
Disable mark phase prefetching for segments.

Idea is to have clrgc.dll using segments as a fallback for customers hitting issues with regions - one thing that changed for segments with 7.0 is prefetching in the mark phase, so this PR disables this functionality.

23 months agoUse IndexOfAnyValues in Cookie DomainCharsTest (#78896)
Miha Zupan [Mon, 28 Nov 2022 15:59:38 +0000 (15:59 +0000)]
Use IndexOfAnyValues in Cookie DomainCharsTest (#78896)

23 months agoJIT: Set GTF_ORDER_SIDEEFF for some nodes with invisible dependencies (#78698)
Jakob Botsch Nielsen [Mon, 28 Nov 2022 13:52:59 +0000 (14:52 +0100)]
JIT: Set GTF_ORDER_SIDEEFF for some nodes with invisible dependencies (#78698)

We have a few places where we create the pattern "COMMA(some check, some value)". In some of these cases there may not be any visible dependency (e.g. use of a defined value) which makes the dependency invisible to the JIT.

If the value is safe to compute only because of the check (for example, a bounds check + indexing operation), and if the value otherwise has no side effects, then nothing prevented the backend or optimizations from reordering these nodes.

A particular problem we may have is around array indexing and bounds checks. Creating an arbitrary illegal byref is not allowed, but to the JIT this node is just a normal node that is completely free of any side effects. Before this change nothing was preventing us from reordering the bounds checks with the computation of the array element.

Fix #78554

Co-authored-by: Alan Hayward <alan.hayward@arm.com>
23 months agoUpdate JsonSerializer.Write.Stream.cs (#78902)
Ivan Maximov [Mon, 28 Nov 2022 11:53:37 +0000 (14:53 +0300)]
Update JsonSerializer.Write.Stream.cs (#78902)

23 months ago[main] Update dependencies from dotnet/cecil (#78768)
dotnet-maestro[bot] [Mon, 28 Nov 2022 08:15:19 +0000 (09:15 +0100)]
[main] Update dependencies from dotnet/cecil (#78768)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
23 months agoReplace loop with LastIndexOfAny in DeveloperExperience.cs (#78895)
Miha Zupan [Mon, 28 Nov 2022 08:11:34 +0000 (08:11 +0000)]
Replace loop with LastIndexOfAny in DeveloperExperience.cs (#78895)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoConvert pointers in a couple tables to relative (#78801)
Michal Strehovský [Mon, 28 Nov 2022 04:36:31 +0000 (13:36 +0900)]
Convert pointers in a couple tables to relative (#78801)

`EmbeddedPointerIndirection` is used in:

* Array of pointers to dispatch maps
* Array of pointers to GC static infos
* Array of pointers to eager constructors

I'm also updating array of module initializers emission since the code to interpret this table at runtime is the same as eager constructors.

23 months agoAlign version option in System.CommandLine usages (#78886)
Adeel Mujahid [Mon, 28 Nov 2022 04:21:11 +0000 (06:21 +0200)]
Align version option in System.CommandLine usages (#78886)

23 months agoChange MetricSpec.TryParse to be Parse (#78729)
Stephen Toub [Sun, 27 Nov 2022 16:37:47 +0000 (11:37 -0500)]
Change MetricSpec.TryParse to be Parse (#78729)

* Change MetricSpec.TryParse to be Parse

It was always creating a MetricSpec and returning true.

* Update src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/MetricsEventSource.cs

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
23 months ago[wasm] Fix chrome downloads to unbreak CI (#78884)
Ankit Jain [Sun, 27 Nov 2022 09:36:08 +0000 (04:36 -0500)]
[wasm] Fix chrome downloads to unbreak CI (#78884)

23 months agoFix malformed XML documentation (#78868)
Martin Costello [Sat, 26 Nov 2022 22:41:09 +0000 (22:41 +0000)]
Fix malformed XML documentation (#78868)

23 months agoFix asserts in Vector<> (#78765)
Egor Bogatov [Fri, 25 Nov 2022 22:27:26 +0000 (23:27 +0100)]
Fix asserts in Vector<> (#78765)

23 months agoRemove SystemReflectionMetadataLoadContextVersion from Versions.props (#78848)
Alexander Köplinger [Fri, 25 Nov 2022 18:33:31 +0000 (19:33 +0100)]
Remove SystemReflectionMetadataLoadContextVersion from Versions.props (#78848)

The last usage was removed in https://github.com/dotnet/runtime/commit/1f0a0960029f58a2363a6610b04c62265366f39d

23 months agoMove the `[With|Get]Element(SIMD)` folding to local morph (#76491)
SingleAccretion [Fri, 25 Nov 2022 16:51:57 +0000 (19:51 +0300)]
Move the `[With|Get]Element(SIMD)` folding to local morph (#76491)

* Migrate [Get|With]Element to local morph

* Delete code from morph

* Move fgMorphCombineSIMDFieldAssignments to local morph

* Save uses in Values instead of nodes

* Remove ReplaceWith

* Add ifdefs for clarity and to avoid regressing ARM

23 months agoUpdate convention on how to ref and pack analyzers (#78845)
Viktor Hofer [Fri, 25 Nov 2022 16:06:25 +0000 (17:06 +0100)]
Update convention on how to ref and pack analyzers (#78845)

d3af4921f36dba8dde35ade7dff59a3a192edddb made it possible to reference
and package an analyzer via the same msbuild item by setting custom
metadata.

While reviewing other places that could use the AnalyzerReference item,
I realized that using this custom item doesn't provide much value and
creates an artificial difference to the rest of the stack and our customers
[as we don't adhere to our own documentation](https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/#hello-world-source-generator-edition).

Instead, IMHO it makes much more sense to keep using a
`ProjectReference` item with the documented set of required metadata, to
reference an analyzer and just define an additional custom metadata to
support packaging the analyzer: `PackAsAnalyzer`.
The reason for that is that the additional metadata explains how the
reference works (no assembly output reference, added as an Analyzer
output item) vs. the `AnalyzerReference` which is a repo custom item
that doesn't tell you that behind the scenes it actually gets converted
to a `ProjectReference` with the same metadata as if you would declare
that yourself as a P2P.

To summarize the change:

1. Consume an analyzer
```xml
<!-- Before -->
<AnalyzerReference Include="..." />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
```

2. Pack an analyzer and consume it
```xml
<!-- Before -->
<AnalyzerReference Include="..." Pack="true" />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" OutputItemType="Analyzer" PackAsAnalyzer="true" />
```

3. Pack an analyzer without consuming it
```xml
<!-- Before -->
<AnalyzerReference Include="..." Pack="true" ReferenceAnalyzer="false" />
<!-- After -->
<ProjectReference Include="..." ReferenceOutputAssembly="false" PackAsAnalyzer="true" />
```

23 months agoAdd support for serializing properties in interface hierarchies (#78788)
Eirik Tsarpalis [Fri, 25 Nov 2022 14:35:48 +0000 (14:35 +0000)]
Add support for serializing properties in interface hierarchies (#78788)

* Add support for serializing properties in interface hierarchies.

* Attempt to fix trim analysis error.

* Work around trimmer warning issue and address misc feedback.

23 months agoMake DependencyGraphViewer a WinExe (#78843)
Michal Strehovský [Fri, 25 Nov 2022 11:21:20 +0000 (20:21 +0900)]
Make DependencyGraphViewer a WinExe (#78843)

It was WinExe in the CoreRT repo but this was apparently lost when porting it over to runtime repo.

23 months agoDisable CG on Linux musl installer jobs too (#78832)
Alexander Köplinger [Fri, 25 Nov 2022 10:05:08 +0000 (11:05 +0100)]
Disable CG on Linux musl installer jobs too (#78832)

We already had the same in eng/pipelines/common/templates/runtimes/xplat-job.yml and eng/pipelines/libraries/base-job.yml, it was just missing from the installer jobs.

It fixes a warning on the Linux musl installer job.

23 months ago[mono][tests] Fix FullAOT DivToMul test (#78816)
Vlad-Alexandru Ionescu [Fri, 25 Nov 2022 09:54:32 +0000 (10:54 +0100)]
[mono][tests] Fix FullAOT DivToMul test (#78816)

* Changed how NaN values are compared due to their multiple bit representations

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
* Fixed typo

Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
Signed-off-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
Co-authored-by: Vlad - Alexandru Ionescu <vlad-alexandruionescu@Vlads-MacBook-Pro-2.local>
23 months agoThis fixes Github issue 78206 - a heap corruption problem associated with mark stack...
Peter Sollich [Fri, 25 Nov 2022 07:59:25 +0000 (08:59 +0100)]
This fixes Github issue 78206 - a heap corruption problem associated with mark stack overflow (#78756)

* This fixes Github issue 78206 - a heap corruption problem associated with mark stack overflow.

Dumps provided by the customer showed in all cases that the min_overflow_address/max_overflow_address fields had values different from their initial values of MAX_PTR and 0. This implies that a mark stack overflow has occurred, but has not been properly handled.

Looking at the code, we realized that we may still have objects in the mark prefetch queue as we enter process_mark_overflow. These objects may cause another mark stack overflow when they are traced. So we need to drain the mark prefetch queue before we check the min_overflow_address/max_overflow_address fields.

We provided a private build of clrgc.dll to the customer reporting the issue, and customer has validated that the fix resolves the issue.

Looking at the code further, some calls to drain_mark_queue have now become superfluous because the mark queue is now guaranteed to be empty after calls to process_mark_overflow and scan_dependent handles. These calls have been replaced with calls to mark_queue.verify_empty.

23 months agoSIMDify ToLowerInvariant/ToUpperInvariant (#78262)
Egor Bogatov [Thu, 24 Nov 2022 21:42:44 +0000 (22:42 +0100)]
SIMDify ToLowerInvariant/ToUpperInvariant (#78262)

23 months agoImplement Equals & GetHashCode for LingerOption - fix Socket outerloop tests (#78747)
Tomas Weinfurt [Thu, 24 Nov 2022 20:21:24 +0000 (12:21 -0800)]
Implement Equals & GetHashCode for LingerOption - fix Socket outerloop tests (#78747)

23 months agoAdd `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`. (#78072)
Theodore Tsirpanis [Thu, 24 Nov 2022 18:20:48 +0000 (20:20 +0200)]
Add `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`. (#78072)

* Add `DllCharacteristics.ForceIntegrity` and `ControlFlowGuard`.

* Update src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEFileFlags.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
23 months agolinux-requirements.md: add missing line-continuation (#78476)
Anton Firszov [Thu, 24 Nov 2022 17:37:24 +0000 (18:37 +0100)]
linux-requirements.md: add missing line-continuation (#78476)

23 months agoClarify docs for Leading/TrailingZeroCount (#78510)
Drew Kersnar [Thu, 24 Nov 2022 17:36:52 +0000 (11:36 -0600)]
Clarify docs for Leading/TrailingZeroCount (#78510)

23 months agoFix some duplicative null checks (#78727)
Stephen Toub [Thu, 24 Nov 2022 17:32:20 +0000 (12:32 -0500)]
Fix some duplicative null checks (#78727)

23 months agoFix arithmetic overflow in Queue<T>'s MoveNext() (#78600)
Adeel Mujahid [Thu, 24 Nov 2022 17:17:46 +0000 (19:17 +0200)]
Fix arithmetic overflow in Queue<T>'s MoveNext() (#78600)

* Fix arithmetic overflow in Queue<T>'s MoveNext()

* Restrict the test to 64-bit platform

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Use SkipTestException

Co-authored-by: Stephen Toub <stoub@microsoft.com>
23 months agoRemove unnecessary % in ToFourDigitYear (#78728)
Stephen Toub [Thu, 24 Nov 2022 17:15:59 +0000 (12:15 -0500)]
Remove unnecessary % in ToFourDigitYear (#78728)

From previous checks we know year >= 0 && year < 100, so year % 100 == year.

23 months ago[wasm] bump devDependencies to rollup 3 and TypeScript 4.9 (#78726)
Aleksey Kliger (λgeek) [Thu, 24 Nov 2022 13:04:57 +0000 (08:04 -0500)]
[wasm] bump devDependencies to rollup 3 and TypeScript 4.9 (#78726)

* Bump dev dependencies

Typescript 4.9

rollup 2.79.1  (can't bump to rollup 3 until rollup-plugin-consts
1.1.1 is published to raise it's upper bound rollup dependency)

* bump to rollup 3

replace untmainained rollup-plugin-terser with @rollup/plugin-terser

replace rollup-plugin-consts with a shim @rollup/plugin-virtual.
They do the same thing, but consts is more opinionated about how it
names its modules

* Commit new package-lock.json

* Create package-lock.json using npm v6 (from Emscripten)

And use the dnceng npm registry

* update README with more details about upgrading NPM packages

* Make markdownlint happy

23 months agoBigger timeout (for perf slow). (#78632)
Jiri Cincura ↹ [Thu, 24 Nov 2022 11:14:11 +0000 (12:14 +0100)]
Bigger timeout (for perf slow). (#78632)

23 months agoRemove pointer relocs from GC statics (#78794)
Michal Strehovský [Thu, 24 Nov 2022 06:35:15 +0000 (15:35 +0900)]
Remove pointer relocs from GC statics (#78794)

23 months agoNativeAOT exports marked functions for exe apps. (#78738)
Jämes Ménétrey [Wed, 23 Nov 2022 23:56:05 +0000 (00:56 +0100)]
NativeAOT exports marked functions for exe apps. (#78738)

Functions decorated with the attribute UnmanagedCallersOnlyAttribute
are not inserted in the export table of the compiled file when the
.NET project is an executable (i.e., as opposed to a library).
This change removes the difference between a library and an executable
regarding the handling of the attribute UnmanagedCallersOnlyAttribute.
As such, decorated functions with this attribute are now adequately
exported for libraries and executables.

Fix #78663

23 months agoRemove code for CoreFxNetCloudService classic Azure Cloud Service (#78773)
Alexander Köplinger [Wed, 23 Nov 2022 23:37:01 +0000 (00:37 +0100)]
Remove code for CoreFxNetCloudService classic Azure Cloud Service (#78773)

It was replaced by a new endpoint (see https://github.com/dotnet/corefx/pull/41603) and the corefx-net.cloudapp.net endpoint was turned off.

23 months agoAllow interop resolvers to return self handle (#78004)
Adeel Mujahid [Wed, 23 Nov 2022 23:32:35 +0000 (01:32 +0200)]
Allow interop resolvers to return self handle (#78004)

When user-defined resolvers return self handle via `GetMainProgramHandle()`, we lookup the cached handle in mono and fail to find one because `internal_module` is not cached in `native_library_module_map`.

Fix is to test the resolver returned handle against self; before the map lookup (which happens under the lock).

Close #77985.

* Allow interop resolvers to return self handle

* Disable new test on windows and monointerpreter

* Add new test to monointerpreter ExcludeList

23 months agoRemove unnecessary null check in DataTable (#78725)
Stephen Toub [Wed, 23 Nov 2022 23:00:27 +0000 (18:00 -0500)]
Remove unnecessary null check in DataTable (#78725)

23 months agoIntroduce System.IO.Ports area (#78743)
Jeff Handley [Wed, 23 Nov 2022 22:17:48 +0000 (14:17 -0800)]
Introduce System.IO.Ports area (#78743)

23 months agoRemove members on `arguments_t` that are not related to the app itself (#78745)
Elinor Fung [Wed, 23 Nov 2022 22:00:05 +0000 (14:00 -0800)]
Remove members on `arguments_t` that are not related to the app itself (#78745)

23 months agoBump System.Data.SqlClient to 4.8.5 (#78774)
Alexander Köplinger [Wed, 23 Nov 2022 21:52:09 +0000 (22:52 +0100)]
Bump System.Data.SqlClient to 4.8.5 (#78774)

It addresses a component governance warning.

23 months agoConvert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)
Jan Kotas [Wed, 23 Nov 2022 21:38:23 +0000 (13:38 -0800)]
Convert some instances of Unsafe.SizeOf and Unsafe.As to regular unsafe code (#78741)

C# 11 allows use of managed types with pointers and sizeof. Replacing Unsafe.* with regular unsafe code makes the binaries a bit smaller and saves time and memory at runtime.

23 months agoUse Environment.IsPrivilegedProcess (#77847)
Ilya [Wed, 23 Nov 2022 20:02:34 +0000 (01:02 +0500)]
Use Environment.IsPrivilegedProcess (#77847)

* Use Environment.IsPrivilegedProcess

* Remove using System

23 months agoUse ASCII strings in source files (#78265)
Adeel Mujahid [Wed, 23 Nov 2022 19:59:22 +0000 (21:59 +0200)]
Use ASCII strings in source files (#78265)

23 months agoTar: Extra tests to confirm extra long paths are not treated as duplicate entries...
Carlos Sanchez [Wed, 23 Nov 2022 19:09:27 +0000 (11:09 -0800)]
Tar: Extra tests to confirm extra long paths are not treated as duplicate entries when the full path is in the extended attributes. (#78744)

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
23 months ago[wasm] More jiterpreter cleanup (#78519)
Katelyn Gadd [Wed, 23 Nov 2022 18:24:19 +0000 (10:24 -0800)]
[wasm] More jiterpreter cleanup (#78519)

    Move more jiterpreter configuration and constants into options
    Fix should_generate_trace_here not scanning across multiple basic blocks
    Disable specialized JIT call in threaded wasm mode (though I think it might work, it's better to turn it off to be sure for now)
    Introduces genmintops.py, a script that automatically generates mintops.ts from mintops.def
    Adjust typescript config to make it able to find the generated mintops.ts (and fix ESLint on Linux)
    Unroll memsets below a certain size into raw wasm opcodes, because v8 generates expensive function calls for memset and memcpy. Unrolling memcpy is a TODO for later
    Rename "always generate" to "disable heuristic" to more accurately describe what it does
    Fix jiterpreter_dump_stats hiding errors if startup failed before cwraps were ready
    Misc. code cleanup

23 months agofix DualMode ReceiveFrom on macOS (#78261)
Tomas Weinfurt [Wed, 23 Nov 2022 17:52:02 +0000 (09:52 -0800)]
fix DualMode ReceiveFrom on macOS (#78261)

* fix DualMode ReceiveFrom on macOS

* style

* feedback from review

* rollback

* Update src/libraries/Common/src/System/Net/SocketAddress.cs

Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
Co-authored-by: Ahmet Ibrahim AKSOY <aaksoy@microsoft.com>
23 months agoReenable a test after 78358 is fixed. (#78697)
Zoltan Varga [Wed, 23 Nov 2022 16:07:45 +0000 (11:07 -0500)]
Reenable a test after 78358 is fixed. (#78697)

23 months agoJIT: Ignore source indir when checking interference for block store source address...
Jakob Botsch Nielsen [Wed, 23 Nov 2022 16:04:05 +0000 (17:04 +0100)]
JIT: Ignore source indir when checking interference for block store source address (#78763)

For block stores we can contain both the source and destination address.
Since the source is a value we will have an indirection on top of the
address, such as

```
N015 (  3, 12) [000014] I---------- t14 =    CNS_INT(h) long   0xd1ffab1e static box ptr REG x1 $200
                                          ┌──▌  t14    long
N017 (  6, 14) [000001] #---G------  t1 = ▌  IND       ref    REG x1 $240
                                          ┌──▌  t1     ref
N019 (  8, 17) [000003] -c--G------  t3 = ▌  LEA(b+8)  byref  REG NA
                                          ┌──▌  t3     byref
N021 ( 32, 39) [000004] nc-XG--N---  t4 = ▌  IND       struct REG NA
N023 (???,???) [000025] Dc--------- t25 =    LCL_FLD_ADDR byref  V03 tmp1         [+0] NA REG NA
                                          ┌──▌  t25    byref
                                          ├──▌  t4     struct
N025 ( 42, 46) [000017] sA---------       ▌  STORE_BLK struct<Xunit.StackFrameInfo, 16> (copy) (Unroll) REG NA
```

where [000004] is the source indirection and [000003] is the source
address. The existing containment check was checking interference of
[000003] with [000004], which is conservative given that the indirection
itself is always contained.

23 months ago[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)
Marek Fišera [Wed, 23 Nov 2022 13:09:36 +0000 (14:09 +0100)]
[wasm] Use "node:crypto" to polyfill getRandomValues on older node (#78696)

23 months agoJIT: Keep FieldSeq in AssertionDesc (#78616)
Egor Bogatov [Wed, 23 Nov 2022 12:01:59 +0000 (13:01 +0100)]
JIT: Keep FieldSeq in AssertionDesc (#78616)

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
23 months agoUpdate NugetPackagingVersion to 6.2.2 (#78720)
Alexander Köplinger [Wed, 23 Nov 2022 10:21:40 +0000 (11:21 +0100)]
Update NugetPackagingVersion to 6.2.2 (#78720)

23 months agoAnonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (...
Adam Sitnik [Wed, 23 Nov 2022 09:29:54 +0000 (10:29 +0100)]
Anonymous pipe resource leak when DisposeLocalCopyOfClientHandle is not called (#78562)

23 months agoFix the tiering delay to account for changing IL/native code versions during the...
Koundinya Veluri [Wed, 23 Nov 2022 05:21:28 +0000 (21:21 -0800)]
Fix the tiering delay to account for changing IL/native code versions during the delay (#78668)

- Added a check to see if the currently active native code version has a code entry point

Fixes https://github.com/dotnet/runtime/issues/77973

23 months agoUse IndexOfAnyValues in Xml (#78664)
Miha Zupan [Wed, 23 Nov 2022 05:04:53 +0000 (05:04 +0000)]
Use IndexOfAnyValues in Xml (#78664)

* Use IndexOfAnyValues in Xml

* Avoid checking whitespace char twice

* More spans

23 months agoImprove IndexOfAnyAsciiSearcher ARM throughput (#78739)
Miha Zupan [Wed, 23 Nov 2022 05:02:57 +0000 (05:02 +0000)]
Improve IndexOfAnyAsciiSearcher ARM throughput (#78739)

* Improve IndexOfAnyAsciiSearcher ARM throughput

Also solves an edge-case bug for byte overloads on ARM64 where we'd get false positives (negatives for Except) when haystack values were exactly 128 above a value in the needle

* Remove type name asserts

23 months agoExtend preinitialization interpreter to support calling `string::Length` (#78680)
Michal Strehovský [Wed, 23 Nov 2022 03:25:14 +0000 (12:25 +0900)]
Extend preinitialization interpreter to support calling `string::Length` (#78680)

* Support `callvirt` to a non-virtual method
* Support accessing string's fields