Commit Graph
967 Commits
Author SHA1 Message Date
Stephen Toub 35717a3ea6 Use u8 in a few more places (#70568) 2022-06-10 23:15:10 -04:00
Stephen Toub d6e8686e56 Enable IDE0036 (Modifers are not ordered) (#70502) 2022-06-10 06:45:48 -04:00
Stephen Toub 0c4ee9e749 Use u8 in more places (#69995)
* Use u8 in more places

Primarily replacing Encoding.UTF8/ASCII.GetBytes("literal") with "literal"u8.ToArray()

* Address PR feedback (and fix some vars)
2022-06-07 13:42:23 -04:00
Eric Erhardt 37a0d9fd6b Fix Stream.ReadAtLeast perf regression in DataContractSerializer (#69879)
* Fix Stream.ReadAtLeast perf regression in DataContractSerializer

#69272 changed DCS to no longer call Stream.Read inside a loop, but instead call the new ReadAtLeast method. ReadAtLeast only takes a Span<byte>, and not a byte[]. This caused a regression because the internal encoding stream wrapper classes don't override Read(Span<byte>), so the base implementation is used. The base implementation is slower because it needs to rent a byte[] from the pool, and do 2 copies.

Overriding Read(Span<byte>) on the internal encoding stream wrapper classes allows ReadAtLeast to be just as fast.

Fix #69730

* Add Span overloads for Stream Read and Write implementations that don't currently override the Span overloads.
2022-05-27 19:16:45 -05:00
55e2378d86 Fix typos (#69537)
* Fix typos

* Fix typo: seperate -> separate

* Rename ApplicationNameSetFromArgument

* Update src/coreclr/vm/methodtablebuilder.cpp

* Update docs/coding-guidelines/clr-code-guide.md

Co-authored-by: Dan Moseley <[email protected]>

* Update src/mono/mono/tests/verifier/make_tests.sh

Co-authored-by: Dan Moseley <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2022-05-23 10:14:58 -07:00
Eric Erhardt de27aa1584 Add Stream ReadAtLeast and ReadExactly (#69272)
* Add Stream ReadAtLeast and ReadExactly

Adds methods to Stream to read at least a minimum amount of bytes, or a full buffer, of data from the stream.
ReadAtLeast allows for the caller to specify whether an exception should be thrown or not on the end of the stream.

Make use of the new methods where appropriate in net7.0.

Fix #16598

* Add ReadAtLeast and ReadExactly unit tests

* Add XML docs to the new APIs

* Preserve behavior in StreamReader.FillBuffer when passed 0.

* Handle ReadExactly with an empty buffer, and ReadAtLeast with minimumBytes == 0.

Both of these cases are a no-op. No exception is thrown. A read won't be issued to the underlying stream. They won't block until data is available.
2022-05-20 09:20:06 -05:00
Theodore Tsirpanis eead8e3040 Support ref fields in System.Reflection.Metadata.Ecma335.BlobEncoder. (#69378)
* Support ref fields in `System.Reflection.Metadata.Ecma335.BlobEncoder`.
Fixes #68309.
A test case was added.
2022-05-17 09:31:36 -07:00
Vladimir Sadov 10883a7bae Normalize Nil PublicKeyToken to an empty array (#69169)
* Normalize Nil PublicKeyToken to an empty array

* Fix tests

* Do not parse assembly name from metadata

* Force PublicKey bit on assembly names fetched from definitions.

* better comment

* PR feedback.
2022-05-12 19:40:35 -07:00
Viktor Hofer 24cabc6eb0 Update solution files to include missing deps (#68668) 2022-05-02 20:14:05 +02:00
Viktor HoferandJeremy Barton ba055bd94e Minimize the build graph by deleting unnecessary references (#68603)
* Minimize the build graph by deleting references

Minimizing projects' dependency graph. There are tons of unnecessary
Reference and ProjectReference items which aren't required anymore as
the referenced projects became full facade assemblies. Removing those
from a leaf's graph makes the graph smaller and therefore the project's
evaluation and build faster.

* Update src/libraries/System.Net.Quic/ref/System.Net.Quic.csproj

Co-authored-by: Jeremy Barton <[email protected]>

* Update Versions.props

Co-authored-by: Jeremy Barton <[email protected]>
2022-04-28 15:04:26 +02:00
Viktor Hofer b54561a957 Fix VS complaining about missing projects in slns (continued) (#68543)
* Infra clean-up to simplify auto references

* Ref project file updates

* Src project file updates

* Test project file updates
2022-04-27 17:27:56 +02:00
Eric Erhardt 18be907176 Change Nullable to default to enable in libraries src and ref projects (#68102)
* Change the default Nullable to enabled for src projects

* Set Nullable=enable as the default for ref projects

* Fixup merge conflicts

* Disable nullable on shim projects and EventLog.Messages

* Set Nullable to blank on EventLog.Messages

This way no CodeAnalysis attributes are emitted into the assembly.
2022-04-25 11:15:37 -05:00
Stephen Toub 46871b8541 Enable new CA1311 (ToLower/Upper culture) and CA1852 (seal internal/private types) rules (#68268)
* Enable new CA1311 (ToLower/Upper culture) and CA1852 (seal internal/private types)

CA1311 flagged a few issues, all addressed by using ToLowerInvariant/ToUpperInvariant.

CA1852 flagged a bunch that previous cleanups around sealing types missed or that are new since.  Sealing types then highlighted places where protected or virtual members were being exposed unnecessarily, so those were fixed, too.  Adding sealed to things also highlighted some discrepancies in the order of "unsafe sealed" keywords, where the vast majority in the repo were "sealed unsafe", so I fixed the few that weren't.

* Address PR feedback and fix more CI failures

* Fix unit test build error
2022-04-21 16:22:53 -04:00
Stephen Toub 215b39abf9 Remove usage of !! from dotnet/runtime (#68178)
* Remove usage of !! from dotnet/runtime

- Use ArgumentNullException.ThrowIfNull instead where possible.  It's only usable for projects that only target .NET 6+, and it can't be used in places like this(...) or base(...).
- In other cases, if the project already has a ThrowHelper, augment it for null as needed and use that.
- For most of the extensions projects, add a ThrowHelper.ThrowIfNull that replicates ArgumentNullException.ThrowIfNull.
- For everything else, just use "throw new".

* Address PR feedback

* Address PR feedback

* Remove false positives from searches

* Address PR feedback
2022-04-21 13:25:52 -04:00
Marek Safar 6a889d2342 Enable CA1822 (Mark members as static) analyzer (#66333) 2022-03-25 12:06:33 +01:00
Elinor Fung a0635832f1 Rename DllImportGenerator project to LibraryImportGenerator (#66029) 2022-03-03 22:17:23 -08:00
Viktor Hofer febaf76743 Fix slngen.proj and update solution files (#65711)
* Fix slngen.proj

The SolutionName property is defined by the SDK and hence the condition was always true. Also the star (*) didn't expand when using the ValurOrDefault msbuild function. Fixing this by using a different name `SolutionNameOverride` and avoiding the ValueOrDefault msbuild function.

* Update solution files

Updating the solution files as those changed because of
microsoft/slngen@cb57e28 and apparently the solution files never were
updated.
2022-02-22 17:18:54 +01:00
WraithandVlad Brezae ddb22ef2ac Remove S.R.CS.Unsafe and Intrinsify Unsafe (#64861)
* private assemblies moved from Internal to System Runtime.CompilerServices

* reformat existing unsafe vm intrinsics

* implement Copy, CopyBlock, CopyBlockUnaligned, InitBlock, InitBlockUnaligned, Unbox, Add, Subtract, SubtractByteOffset

* remove System.Runtime.CompilerServices.Unsafe il project and replace with forward only cs project

* change all ilproj references to csproj

* remove nativeaot Unsafe

* add conditional package reference for S.R.CS.Unsafe on netcoreapp 6.0

* regenerate solutions

* mono interp

* [mono][interp] Implement Copy and Unbox intrinsics

* [mono][jit] Implement Copy and Unbox intrinsics

Co-authored-by: Vlad Brezae <[email protected]>
2022-02-19 21:50:14 -08:00
Stephen Toub 1ba0394d71 Second round of changing null checks to !! (#65108) 2022-02-10 20:40:07 -05:00
Stephen Toub 3ae87395f6 Initial roll out of !! (#64720)
* Bump version of C# compiler

This should be reverted when arcade brings in a new enough compiler.

* Fix a few new warnings from updating compiler

* Enable IDE0190 to employ parameter null checking

* Initial roll out of !!

* Fix more compiler warnings from upgrade, plus some test fixes / reverts

* Fix a few more tests

* Disable profiling test
2022-02-08 16:06:59 -05:00
Vladimir Sadov 2cf4826634 Moved AssemblyName helpers to managed (part 2) (#63915)
* implement GetAssemblyName via dynamic call to MetadataReader

* A few more file-locking tests.

* fix #28153

* no need for version when getting MetadataReader

* rename the argument to match AssemblyName

* perf tweaks

* use memory-mapped file to read metadata

* adjust tests for the new implementation

* use "bufferSize: 1" when stream is going to be mapped.

* null-conditional operator.

* do Dispose before re-throwing

* get rid of the platform-specific/native stuff

* remove assemblyname.hpp

* remove `VerifyIsAssembly()`

* PR feedback

* put back gStdMngIEnumerableFuncs and the others
2022-01-26 14:51:07 -08:00
Bar Arnon d34c0ff7c1 Add UnreachableException (#63922) 2022-01-26 02:58:21 -07:00
Roman Marusyk bdc0d1a409 Fix formatting of resource string where excess arguments are passed (#63824)
* Fix formatting of resource string where excess arguments are passed. #63607

* Fix BuildCharExceptionArgs and ECCurve.Validate

* Fix CA2208

* Fix CA2208. Remove paramName becaus it is in error message

* Code review fixes

* Code review fixes
2022-01-25 16:08:51 -07:00
David Wrighton 352a6b8d0d Add alignment to mapped field stream (#63305)
* Align MappeFieldDataStream at 8 byte boundary

* Add test to verify that the mapped field rva data blob is aligned to ManagedPEBuilder.MappedFieldDataAlignment

* Only align when the mapped field data is of size not equal to 0
2022-01-23 14:25:26 -08:00
Eric StJohn 1d751ba856 Update XUnit to 2.4.2-pre.22 (#63948)
* Update to Xunit build 2.4.2-pre.13

Also pick up latest pre-release of analyzers

* Disambiguate calls to Assert.Equals(double,double,int)

Xunit added a new Assert overload that caused a lot of ambiguous calls.
https://github.com/xunit/xunit/issues/2393

Workaround by casting to double.

* Fix new instances of xUnit2000 diagnostic

* Workaround xUnit2002 issue with implicit cast

Works around https://github.com/xunit/xunit/issues/2395

* Disable xUnit2014 diagnostic

This diagnostic forces the use of Assert.ThrowsAsync for any async method,
however in our case we may want to test that a method will throw
synchronously to avoid regressing that behavior by moving to the async
portion of the method.

* Use AssertExtensions to test for null ArgumentException.ParamName

Workaround https://github.com/xunit/xunit/issues/2396

* Update to Xunit 2.4.2-pre.22

* Fix another ArugmentException.ParamName == null assert
2022-01-20 10:35:50 -08:00
MSDN.WhiteKnight 3956126d55 Fix typo in SRM package description (#63782) 2022-01-14 10:33:03 -05:00
Marek Safar 6de7147b92 Enable IDE0059 analyzer: Unnecessary assignment of a value (#63340) 2022-01-12 18:10:45 +01:00
c49c65df80 [LoongArch64] Port libraries directory (#62888)
Co-authored-by: qiaopengcheng <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2022-01-07 08:24:34 -08:00
Theodore Tsirpanis 6845361b97 Make ControlFlowBuilder.Clear public. (#62811) 2021-12-15 14:13:05 -08:00
Santiago Fernandez Madero f7544966e9 Update previous netcoreapp version to run API Compat against 6.0 ref pack (#61437) 2021-12-04 10:28:33 -06:00
Buyaa Namnan eeb79b33d2 Lock MemeoryMappedFile CreateViewAccesssor call (#62288) 2021-12-02 14:18:41 -08:00
e10532af7e Obsolete thumbtacked AssemblyName properties (#59522)
* Obsolete thumbtacked AssemblyName properties

Fix #59061

* Ignore obsoletion

* Fix pragma

* Merge the AssemblyName member obsoletions into a single diagnostic id

* Fix pragma to use updated diagnostic id

* Suppress SYSLIB0037 in reflection tests

* Suppress SYSLIB0037 warnings

Co-authored-by: Jeff Handley <[email protected]>
Co-authored-by: Jeff Handley <[email protected]>
2021-11-15 17:06:46 -08:00
Elinor Fung 2da44f3262 Use DllImportGenerator in System.Diagnostics.PerformanceCounter (#61389) 2021-11-11 08:18:30 -08:00
Michal Strehovský b6657214f4 Remove sorting requirement for interface lists (#60541)
Fixes #60454.
2021-11-08 13:55:37 -08:00
Steve Pfister 8c6aeea1d8 Bring up full library test CI runs on iOS / tvOS devices (#59503)
This change enables device runs on CI by building each test app on the helix instance it was deployed to. In past attempts, we looked at enhancing what takes place on the build machine via build tricks, compressing / cleaning up files early, etc and we could not overcome the need for excessively long timeouts and far more disk space.

The change also adopts the patterns established in the wasm test build, giving us the opportunity to support different scenario runs as well as workloads testing in the future.
2021-11-02 07:43:15 -04:00
Theodore Tsirpanis db9c3f1aeb Remove legacy light-up code from System.Reflection.Metadata et.al. (#56587)
* Remove legacy light-up code for the pointer-based Encoding.GetString.

* Remove legacy light-up code for the memory-mapped file block code.

* Remove FileStreamLightUp.IsFileStream and the need for it.

* Address PR feedback.

* Use hardware-accelerated population count where available.

* Remove a try/finally with an empty try where CERs are not supported.

* Use named arguments when constructing a memory-mapped file.
2021-09-16 08:48:06 +02:00
Viktor Hofer 67354a2fb4 Upgrade to net7.0 and remove target frameworks (#58011)
* Remove EOL tfms and upgrade to net7.0

* Make linker tests net7 aware

Make installer tests run on net7.0

Don't attempt to use live apphost

Fix payloads

Regenerate test files

Fix package testing
2021-09-08 22:04:23 +02:00
Viktor Hofer 36b6247cc7 Update solution files for correct ordering of elements (#58655)
With the newest udpate of slngen, the order of elements (configuration, folders, etc.) is in sync with how Visual Studio arranges them.
Also the order is now deterministic.

Based on that, updating all solution files to have the correct ordering of elements. This change also unblocks adding CI protection for
making sure that solution files are up-to-date in regards to their dependencies as slngen is now generating the files deterministically.
2021-09-04 00:16:15 +02:00
Viktor Hofer 49c74eec15 Update changed solution files under src/libraries (#57483)
* Update slngen logic and remove unnecessary P2Ps

* Update changed soluion files under src/libraries

* Fix Platforms build

* Update comment in slngen.targets
2021-08-18 19:35:54 +02:00
Viktor HoferandSantiago Fernandez Madero 4d82932722 Automatically generate .NETStandard compat errors (#57057)
* Automatically generate .NETStandard compat errors

Before this change, a project had to explicitly add a
NETStandardCompatError item to declare that a given tfm range
shouldn't be supported when packaging.

Automate this logic so that projects don't need to specify the item
themselves anymore. Instead condition the NETStandardCompatError target
calcuation logic on the existence of both a .NETStandard and a
.NETCoreApp tfm.

* Update Directory.Build.targets

* Update packaging.targets

* Update eng/packaging.targets

Co-authored-by: Santiago Fernandez Madero <[email protected]>

Co-authored-by: Santiago Fernandez Madero <[email protected]>
2021-08-10 07:19:06 +02:00
Viktor Hofer 503ae5145a Replace all remaining pkgprojs with NuGet Pack task (#56712)
* Runtime specific and doc file packaging fixes

* Replace all remaining pkgprojs with NuGet Pack task

* Avoid NuGet/Home/issues/10368

* Update PackageValidation package to latest
2021-08-05 11:03:23 +02:00
Viktor Hofer a6b9a63f35 Update libraries solution and NuGet.config files (#56430)
* Update slngen and invocation

* Update NuGet.config files

* Update solution files with slngen
2021-07-28 18:44:17 +02:00
Tomáš Matoušek 2a02896735 Use native allocator instead of pinning when decompressing embedded PDB (#56336) 2021-07-27 15:16:59 -07:00
Stephen Toub dfd618dc64 Use interpolated strings in more places 2021-07-13 10:11:51 -04:00
Viktor HoferandBuyaa Namnan bbf96599d5 Don't reference the netstandard shim inside the shared framework (#53023)
* Don't reference ns.dll inside shared framework

The netstandard.dll shim shouldn't be referenced inside the shared
framework as it's a compat shim that shouldn't be required to compose
the shared framework.

This removes the necessity of a separate RefPath build and improves
incremental build times as only the few OOB projects that require the
shim would need to rebuild.

* Reference netstandard shim in OOBs that require it

There are a few OOB projects that require the netstandard.dll shim as
they intentionally reference projects that only expose a netstandard
configuration.

Co-authored-by: Buyaa Namnan <[email protected]>
2021-06-11 00:32:53 +02:00
Viktor Hofer 0377558d94 Include NetCoreAppCurrent configs in packages (#53439)
* Include NetCoreAppCurrent configs in packages

The NetCoreAppCurrent configurations were omitted from packages to avoid
ever growing packages. Now that we adhere to the support policy for
packages we don't need to exclude them anymore as the policy defines a
baseline for .NETCoreApp configurations.

This will remove an artificial difference when source building the
repository and also make it so that partner repositories which don't
depend on a transport package like windowsdesktop (winforms) receive
the very latest assets that are included in the shared framework as
well.

* Fix package validation for non exposed inbox libs
2021-06-08 23:36:01 +02:00
Viktor Hofer c95aa3f48a Remove NS1.x assets from building and packaging (#53283)
* Remove NS1.x assets from build and packaging

These ten projects still built for netstandard1.x. This PR
trims out these assets from both the build which also results
in them not being packaged anymore as there is no harvesting
mechanism in the repository anymore.

Suppressing the package warnings for the intentionally dropped
assets and cleaning up conditions in the project file as well.

For more details please see the reasoning in the linked issue.

Contributes to https://github.com/dotnet/runtime/issues/53282
2021-05-26 21:51:12 +02:00
hrrrrustic 57c3a8558e System.Reflection.* missed Equals nullable annotations (#52162)
* add NotNullWhen attribute
2021-05-22 13:54:40 -07:00
Ankit Jain d36313d3da [wasm][aot] Update disabled tests to track new fixes on main (#52396)
* [wasm][aot] System.Runtime.Tests failing with a different issue now

The earlier one (https://github.com/dotnet/runtime/issues/51960) was
fixed.
New: https://github.com/dotnet/runtime/issues/52393

* Enable Common.Tests test tracked in https://github.com/dotnet/runtime/issues/50955, already fixed on main

* [wasm] System.Reflection.Tests - update to track change from crash to a

.. test failure.
Issue: https://github.com/dotnet/runtime/issues/51673

* Re-enable System.Collections.Tests, issue: https://github.com/dotnet/runtime/issues/51037

* Disable Microsoft.Extensions.Logging.Generators, and System.IO.Pipelines

Issue: https://github.com/dotnet/runtime/issues/52384
Issue: https://github.com/dotnet/runtime/issues/50959

* Enable two System.Reflection.Metadata* tests

Issue: https://github.com/dotnet/runtime/issues/51958

* Fix path for Microsoft.Extensions.Logging.Generators.Tests
2021-05-06 19:39:37 -05:00
Ankit Jain f372f6b5fd [wasm][tests] Fix test failures due to trimming (#51697)
- Both EAT, and AOT builds are completely green now.
- Number of tests for EAT goes from 147 -> 185
- Number of tests for AOT goes from 147 -> 174 (the difference is because of aot only failures)
- Test run on a regular wasm build runs 206 libraries
2021-04-28 15:19:10 -04:00