* 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]>
* 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.
* 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.
* Don't use Targets* helper properties in libs projs
This change makes it possible to migrate 200+ (ref+src) projects to use
TargetFramework instead of TargetFrameworks which avoids the additional
outer build evaluation and invocation which ultimately makes the overall
build faster.
Targets* properties (i.e. TargetsWindows, TargetsAnyOS, TargetsUnix,
etc.) rely on the TargetFramework property which usually are set
inside a project. The TargetFramework property is only
available before a project specifies it if it's explicitly set in a props
file or if the project is cross-targeting and the outer-build dispatches
into the inner-build. During the dispatch, the TargetFramework property
is passed in as a global property.
Until now that behavior wasn't a problem because every libraries project
cross-targeted (by setting the TargetFrameworks property) even though
many only include a single TargetFramework (i.e. NetCoreAppCurrent).
To allow projects to use the TargetFramework property instead of
TargetFrameworks, the Targets* helper properties can't be calculated
anymore early in a props file as the TargetFramework property isn't set
at that time.
In general, the guidance by the SDK/msbuild team is to not read from the
TargetFramework property before the project sets it
(in a property group). That effectively means that the TargetFramework
property shouldn't be used in props files at all.
Therefore these helper properties can't be used anymore for property
conditions and I'm replacing their usage with TargetPlatformIdentifier
comparisons for both properties and items.
In nearly all cases, the Targets* helper properties can be replaced with
TargetPlatformIdentifier checks on items and in the few cases where
TargetsUnix or TargetsLinux marks multiple tfms as compatible, the exact
tfms must be used instead for the TargetPlatformIdentifier comparison.
Whenever a project needs to condition properties on the platform, I'm
first setting the TargetPlatformIdentifier the same way the SDK sets it
so that the SDK later doesn't need to set it again to avoid the
additional expensive msbuild function call.
* Use TargetFramework singular to avoid outer builds
Use TargetFramework instead of TargetFrameworks property whenever a
projects only targets a single target framework. This avoid unnecessary
outer builds and evaluations and makes the build faster.
* Fold S.S.C.Csp into System.Security.Cryptography
This change leaves the tests in System.Security.Cryptography.Csp.Tests.dll,
because the crypto test infrastructure has not yet been upgraded to allow
for two algorithm provider tests in the same assembly (e.g. not both
Aes.Create() and AesCryptoServiceProvider can be tested)
* Change CryptoConfig string lookups to typeof for CSP types
* Fold S.S.C.Cng into S.S.Cryptography
* Fold S.S.C.OpenSsl into S.S.Cryptography
* Fold S.S.C.X509Certificates into S.S.Cryptography
* Fix dependent projects
* Fix ApiCompat errors
* Self-feedback
* Use typeof where now possible in CryptoConfig
* Don't use CNG's PKCS8 export for default EC objects
* RSA should probably function on Unix
* Fix nullability state of ChainPal.BuildChain across OSes
* Remove bad assert
* Special case macOS ECC data keys in CopyWithPrivateKey
* Undo some of the string resurrections
* Add missing Obsolete attribute
Adds ArgumentException.ThrowIfNullOrEmpty and then uses it in a bunch of places around the tree. Most of the replaced places used a resource string for the message, and I used it in places where it didn't feel like we were losing any meaningful information by centralizing on the single shared string, but I didn't use it in places where the resource string message used in the empty case conveyed something that seemed useful, e.g. a recommendation on what to use instead of an empty string.
There are a few places where I allowed for order of exception throws to change in the case where there were multiple user errors and the validation for a single argument was split, e.g. I changed a few cases of:
```C#
if (arg1 is null) throw new ArgumentNullException(...);
if (arg2 is null) throw new ArgumentNullException(...);
if (arg1.Length == 0) throw new ArgumentException(...);
if (arg2.Length == 0) throw new ArgumentException(...);
```
to:
```C#
ArgumentException.ThrowIfNullOrEmpty(arg1);
ArgumentException.ThrowIfNullOrEmpty(arg2);
```
even though it'll produce a different exception for `M("", null)` than it would previously. Technically a breaking change, but given this is a case of multiple usage errors and all the exceptions are ArgumentException-based, I think it's acceptable.
I wanted to get this in before we do the massive !! conversion, as I expect !! auto-fixes will make it a bit harder to roll this out. I explicitly did not do anything to roll out use of ArgumentNullException.ThrowIfNull, except in cases where I was modifying a method to use ArgumentException.ThrowIfNullOrEmpty, in which case for consistency I changed anything else in the function that could have been using ThrowIfNull to do so.
* All of System.Security.Cryptography.Primitives has been moved
* AsymmericKeyExchangeFormatter moved from S.S.C.Algorithms
* This just starts the process to keep the infrastructure pieces separate from code layout pieces.
Update slngen tooling to latest stable version and solution files since
a lot changed since the last time they were updated:
- NET7 (removal of older TFMs)
- Source Generators
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.
If you attempt to use any of the *OpenSsl primitives on macOS, this will currently abort the whole process.
This changes them to check for OpenSSL's presence and throw an appropriate exception instead of aborting.
When used as an internal implementation, the aborting behavior remains.
This change moves the RSAOpenSsl class (and the RSA.Create() internal class on Linux) to use EVP_PKEY
for the import and export operations, making the interaction with the underlying library based on
PKCS#8 PrivateKeyInfo and X.509 SubjectPublicKeyInfo key blobs.
A large portion of the code is just from splitting the key helpers files to not need all of the encrypted PKCS#8 support
in the System.Security.Cryptography.OpenSsl library, as the encrypted PKCS#8 <-> unencrypted PKCS#8 work provided
by the base classes is sufficient.
Once PKCS#8 and SPKI became the primary modes of interaction the spanified import and export routines for those got
overridden in RSAOpenSsl to avoid SPKI->RSAParameters->SPKI-style conversions.
This change completely eliminates SafeRsaHandle, and the only time that an `RSA*` is used at all is in the legacy RSAOpenSsl(IntPtr) constructor.
* Dead end S.Security.Cryptography.OpenSsl package
To reduce complexity of the cryptography OpenSsl library, dead ending
its package as most of the configurations are partial facades anyway and
adding OpenSsl to the targeting pack. It's already part of the runtime
and exposed in aspnetcore's targeting pack.
.NET Standard libraries can continue to use the latest available package
which harvests for .NET Standard configurations.
Contributes to https://github.com/dotnet/runtime/issues/47530
* Fix cofactor import and disable tests that require the ability to derive a new public key from a private key + curve + generator, order, and cofactor.
* Add missing member.
* Disable more tests against CanDeriveNewPublicKey.
* Use isSupported instead of ConditionalFact.
* Fix net47 build.
* Disable RC2 tests on Android. RC2 isn't supported by Android.
* Use PlatformSpecific attribute instead of SkipOnMono.
* Skip key file tests that use RC2 encryption on Android
* Use ConditionalFact instead of PlatformSpecific.
* Reorganize usings and fix build failure.
* Add RC2Provider.cs to OpenSSL tests to fill in the RC2Factory type.
* Fix windows build.
* Update public SafeHandle types to have public parameterless constructors.
Remove now-unneeded ILLink trim files.
Make public abstract SafeHandle constructors protected.
Remove comment on SafeWaitHandle
* Make SafeHandle constructors public for internal types.
Make internal abstract SafeHandle default constructors protected. Make non-abstract internal SafeHandles sealed when possible.
More internal SafeHandle types.
* Add new Marshal.InitHandle API.
Fix SetHandle accessibility
Fix test.
Use Marshal.InitHandle.
* PR feedback.
* Remove trailing whitespace.
* disable vs restore in vs for projects targeting platform specific older frameworks
* Add infra to auto-update solution files for restore
* Add NuGet.config files for solutions affected by restore issue
Co-authored-by: Viktor Hofer <[email protected]>
* Mark System.Security.Cryptography.OpenSsl as unsupported on browser
* Mark other System.Security.Cryptography APIs as unsupported on browser
* Mark System.Data.Odbc.* as unsupported on browser
* Mark System.DirectoryServices.Protocols APIs as unsupported on browser
* Mark System.Drawing.Common APIs as unsupported on browser
* Mark System.IO.Ports as unsupported on browser
- Remove depprojs which currently binplace external references into the RefPath folders in favor of PackageReference and PackageDownload items.
- Build all configurations by default when building an individual project (either on the CLI or inside VS) same as with the official SDK. This enables .NETFramework Test Explorer support.
- Centrally define libraries that compose the shared framework instead of in each Directory.Build.props file to be able to build the targeting pack first and consume it in the OOB libraries.
- Use ProjectReferences to reference OOB projects. Compile against the reference assembly but use the implementation assembly app-local during runtime.
- Remove OOBs from the testhost and remove the testhost folder for .NETFramework as it isn't required anymore.
- Only binplace for $(NetCoreAppCurrent) to compose a) the targeting pack, b) the runtime pack, c) the testhost, d) a full closure for the shims.
- Use Targeting Packs for OOB projects (with their implicit assembly references) but still explicitly define granular references for .NETCoreApp configurations (DisableImplicitAssemblyReferences switch). Use the implicit targeting pack references in some Microsoft.Extensions.* cases.
- Remove placeholder configurations as they aren't needed anymore with explicit P2Ps vs Targeting Pack references.
- Remove implicit assembly references (ie for .NETFramework, mscorlib)
- Remove AssemblySearchPath hacks that were introduced with b7c4cb7 as the targeting pack is now used by default.
- Reduce unnecessary .NETFramework configurations that were added to run tests in favor of the already existing ref&src configurations.
- Stop hardcoding the paths for wasm assemblies and use the returned TargetPath of the ProjectReferences.
- Addressed formatting (ItemGroups, References at the bottom of the project file, ordering of references, use LibrariesProjectRoot instead of a relative path, unnecessary AssemblyName and RootNamespace properties which are identical to the project name, ordering of tfms)
- Revert "fix clean (#33758)"
* Porting new netfx configurations for packages
* Add Netfx configurations to Microsoft.Extensions and missing System packages
* Making sure net461 configurations build against targeting pack assembly versions
* Undo changes to add netfx configurations on reference projects that don't ship in their package
* Fix issue with M.E.FP.P package by removing NetStandard.Library metapackage dependency
* Fix issues with depending on higher version than the one available in net461
* Disable UTF8String verifyClosure on package
* Undo changes to Microsoft.XmlSerializer.Generator
* Update src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj
Co-authored-by: Eric StJohn <[email protected]>
Co-authored-by: Eric StJohn <[email protected]>
Since the entire set of System.Security.Cryptography.* tests has been disabled on WASM recently in https://github.com/dotnet/runtime/pull/37723, we need to let everyone know that those areas are not quite supported on WASM at the moment. In that case System.Security.Cryptography classes could throw PlatformNotSupportedException until some solution comes (https://github.com/dotnet/runtime/issues/37669)