* 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.
* Clean-up DllImportGenerator packaging infra
Most of what DllImportGenerator was trying to achieve via targets or by setting common packaging properties is already handled by libraries common packaging infrastructure (packaging.props) which is imported when a project sets `IsPackable=true`.
* 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
Update the Roslyn Testing SDK version and update the DllImportGenerator unit tests to crash in a way that produces a dump for some of our intermittent issues (https://github.com/dotnet/runtime/issues/60909, https://github.com/dotnet/runtime/issues/62223). This mechanism will crash the process during the "exception filter" phase, so it will still have the throwing frame on the stack (no unwinding). Hopefully this will enable us to get more actionable dumps to investigate these issues and determine if they're Roslyn bugs or GC holes.
* Consume renamed TargetFramework package
* Rename CoreLibs generator parent dir
Projects under src/libraries/ which are located under a "gen" directory
are automatically treated as source generator projects. Because the
CoreLib generator was placed under a different directory "generators",
it was treated as a RuntimeAssembly which gets binplaced into the
runtime path. The runtime tests then take the assemblies from there and
copy them into their CORE_ROOT directory.
Renaming the CoreLib source generators parent directory fixes that so
that it is treated as source generator and it brings consistency into
src/libraries.
* Expand System.Runtime.InteropServices.NFloat to support the APIs required by Xamarin
* Apply suggestions from code review
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* Adding NFloat tests (p1)
* Temporarily disable negative conversions involving nfloat->nint
* Adjusting the skip condition for the Mono failures
* Adding additional tests covering the NFloat.Is* APIs
* Fixing the IsNormal and IsSubnormal test to account for 64-bit vs 32-bit
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* 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
* Exposing Sum<T> for Vector64/128/256<T>
* Adding support for ShiftLeft, ShiftRightArithmetic, and ShiftRightLogical to Vector<T> and Vector64/128/256<T>
* Adding support for Load, LoadAligned, LoadAlignedNonTemporal, and LoadUnsafe to Vector64/128/256<T>
* Adding support for Store, StoreAligned, StoreAlignedNonTemporal, and StoreUnsafe to Vector64/128/256<T>
* Adding support for ExtractMostSignificantBits to Vector64/128/256<T>
* Adding tests covering Vector64/128/256<T>.Sum
* Adding tests covering Vector64/128/256<T>.ShiftLeft, ShiftRightArithmetic, and ShiftRightLogical
* Moving System.Runtime.InteropServices.UnmanagedType down to System.Runtime so the `unmanaged` constraint can be used
* Adding tests covering Vector64/128/256<T>.Load, LoadAligned, LoadAlignedNonTemporal, and LoadUnsafe
* Fixing a few issues in the source and tests to ensure the right paths are being taken
* Adding tests covering Vector64/128/256<T>.Store, StoreAligned, StoreAlignedNonTemporal, and StoreUnsafe
* Adding tests covering Vector64/128/256<T>.ExtractMostSignificantBits
* Ensure AlignedAlloc is matched by AlignedFree
* Fixing a couple test issues and the handling of Scalar.ExtractMostSignificantBit for nint/nuint
* Applying formatting patch
* Ensure gtNewOperNode uses TYP_INT when dealing with the shiftCount
* Fixing a couple ARM64 node types
* Ensure the shift intrinsics use impPopStack().val on ARM64
* Responding to PR feedback
When user passes versioned native compiler argument such as
`-clang10.1` or `-gcc9.2` to the top-level `:/build.sh`,
`:/eng/build.sh` transforms that to msbuild property called
`<Compiler>` with raw/unprocessed value.
In coreclr, libs, corehost and tests partitions, we end up calling
`:/eng/native/build-commons.sh`, which slices the compiler name, major
and minor versions, then calls `:/eng/native/gen-buildsys.sh` with
individual components. That is just a pass-thru script for the final
`:/eng/common/native/init-compiler.sh`, where those arguments are
actually used.
In `mono.proj` and `NativeExports.csproj`, we do not use
`build-commons` script, but instead, invoke `init-compiler.sh` directly
with the raw `<Compiler>` property. That causes an error when versioned
native compiler is specified on the command line.
This PR fixes this issue by pushing version parsing code into
`init-compiler.sh` so all its consumers get the same behavior.
* Update GetPinnableReference() usage in multi-step custom tyep marshalling
Change GetPinnableReference() on a marshaller type to be used as a side effect when marshalling in all cases when a fixed() statement is usable.
Use the Value property getter to get the value to pass to native in all cases.
Update our marshallers and tests to follow this design update.
* Apply suggestions from code review
Co-authored-by: Aaron Robinson <[email protected]>
* Don't emit the assingment to the Value property in the Unmarshal stage when using [Out]
* Fix the unmarshalling conditions
* Fix Utf16StringMarshaller to correctly handle the "null pointer" case now that we're using spans internally for storage in all cases.
Co-authored-by: Aaron Robinson <[email protected]>
* Enable DllImport generator for all source projects.
* Convert OleDb to only use GeneratedDllImport.
* Update source generator to distinguish between "no marshalling info"
which can cause a failure vs "missing support" which enables us to
fallback to the marshalling forwarder.
* Remove unused DllImports.
* Reuse existing P/Invoke definitions.
* Add TFM and version support query to marshaller interface.
* If any marshaller fails to support the current tfm version, fallback
to using the built-in DllImport attribute.
* Add tests for fallback generation on downlevel or generation if marshallers
are supported on the target framework.
* Convert CreateCompilationWithReferenceAssemblies to CreateCompilation overload.
Co-authored-by: Elinor Fung <[email protected]>
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