Commit Graph
491 Commits
Author SHA1 Message Date
Jo Shields b5f9c224e7 Linux-bionic (Android libc w/o Android interop) initial implementation (#66147)
Implement support for "Linux Bionic", a RID which builds a Linux runtime against an Android libc but without Android OS functions like JNI, Dalvik, Instrumentation, etc. This configuration has been requested by a team working on an IoT scenario.

* The new RID is linux-bionic-arm64/linux-bionic-x64.
* The build reuses the existing Android build dockerfiles and Helix queues
* Since we don't have JNI, we don't have Android Crypto - instead, use an Android build of OpenSSL. As an errata, it is incumbent upon the end user to supply this in their OS environment (we download one ad-hoc for testing purposes, which was compiled by Google)
* Some tests cannot be completed due to SELinux policies affecting the shell user executing tests via adb shell in the world-writable /data/local/tmp directory. We expect those tests would pass if they pass on Android, in a real-world IoT scenario with a custom OS (rather than recycling Google's OS images intended for phones)

Closes: #66027
2022-05-19 15:27:40 -04:00
Viktor Hofer 24cabc6eb0 Update solution files to include missing deps (#68668) 2022-05-02 20:14:05 +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
Dan Moseley a11266d57d Add retries to some FSW tests (#68368) 2022-04-22 21:46:06 -06: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
Viktor Hofer 20e8f905d0 Don't use Targets* helper properties in libs (#64500)
* 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.
2022-02-12 13:07:16 +01:00
Jo Shields df69293bdb Port Mono to Raspberry Pi, ship as new linux-armv6 RID (#62594)
* Initial ARMv6 arch addition. Builds mono runtime, not CoreCLR (Mono already supports the CPU arch subset used by Raspberry Pi, whilst porting CoreCLR to e.g. VFPv2 would be major work)
* Build small clr subset on ARMv6, it's needed for SDK and we want to check it works
2022-01-24 16:29:57 -05: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
Jan Kotas 00c1692306 Move System.Runtime.InteropServices.RuntimeInformation to CoreLib (#63140)
- Makes RuntimeInformation.ProcessArchitecture a JIT/AOT-time constant (constant returning property)
- Eliminates tiny netcoreapp assembly with just a few types

Fixes #57152
Contributes to #2138
2021-12-27 10:07:34 -08:00
Viktor Hofer 0964be0ae9 Update slngen and solution files (#60871)
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
2021-10-26 21:23:54 +02:00
Elinor Fung 39048dd5de Undo solution and config changes from DllImportGenerator (#60481)
* Remove dotnet-experimental feed from NuGet.config
* Revert changes to solution files and restore configs
2021-10-15 11:06:12 -07:00
Jeremy Koritzinsky 27034bc84b Run slngen to regenerate the solution files. 2021-09-22 17:02:14 -07:00
Jeremy Koritzinsky 81293bfc1e Merge branch 'main' of https://github.com/dotnet/runtime into merge-main 2021-09-14 16:29:42 -07:00
Jeremy Koritzinsky 5b8ce63f73 Update DllImportGenerator to the latest version (#59117) 2021-09-14 16:15:21 -07: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
Jeremy Koritzinsky 108fcdb61c Merge branch 'main' of github.com:dotnet/runtime into feature/use-dllimport-generator 2021-07-29 10:44:59 -07: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
c7dedccd96 Use more string interpolation (#55738)
* Use more string interpolation

I previously did a pass looking for opportunities.  Finding a few more, as well as fixing some misuse of existing methods.

* Update src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs

Co-authored-by: halgab <[email protected]>

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>

Co-authored-by: halgab <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2021-07-16 06:38:51 -04:00
Stephen Toub dfd618dc64 Use interpolated strings in more places 2021-07-13 10:11:51 -04:00
Elinor Fung cbf6a82fda Merge remote-tracking branch 'upstream/main' into feature/use-dllimport-generator 2021-05-24 22:47:06 -07:00
Elinor Fung 5513d6190f Use GeneratedDllImport in System.Diagnostics.FileVersionInfo and System.Runtime.InteropServices.RuntimeInformation (#52739)
* Convert System.Diagnostics.FileVersionInfo
* Convert System.Runtime.InteropServices.RuntimeInformation
* Use SYSTEM_INFO* instead of GeneratedDllImport for GetSystemInfo/GetNativeSystemInfo
2021-05-20 16:28:28 -07:00
Ulrich Weigand dc088c3fc0 Add public Architecture enum value for s390x (#52906)
* Add S390x value to System.Runtime.InteropServices.Architecture enum

* Add native s390x architecture detection
2021-05-19 19:29:39 +02:00
Alexander Köplinger bc9f00c226 Cleanup PlatformSpecific/SkipOnMono attributes that skip a platform (#50907)
We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.

The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.
2021-04-09 13:20:18 +02:00
Stephen Toub ce0f0b8bc3 Remove use of string.GetHashCode(StringComparison) (#47883)
All of our call sites to it pass in a const StringComparison; GetHashCode will then turn around and decide which property on StringComparer to use, and then call GetHashCode on the relevant instance... we may as well just pick the instance directly, which not only saves the lookup and enables devirtualization, it also enables better trimming, as string.GetHashCode(StringComparison) ends up rooting all of the StringComparer properties in case you pass in the appropriate StringComparison.
2021-02-06 07:27:37 -05:00
Stephen Toub 2b0e2785e5 Use [NotNullWhen(true)] in more places (#47598)
* Use [NotNullWhen(true)] in more places

Did a quick search/audit for methods that returned bool and took nullable object as the first input, and added [NotNullWhen(true)] where it was obviously correct.

* Address PR feedback
2021-01-30 06:09:28 -05:00
Dan Moseley 7216466cd5 Add more logging for abrupt test failures on Linux (#47102) 2021-01-18 07:55:48 -08:00
Dan Moseley 32586d6962 Add memory related logging to S.R.IS tests in Helix (#46517)
* Log more info in Helix

* feedback:

* lambda
2021-01-04 13:03:41 -08:00
Viktor Hofer ed295782bf Add workflow to update solution files with SlnGen and update them initially (#44703)
* Add slngen infra

* Update all solution files
2020-11-17 18:23:30 +01:00
Anirudh Agnihotry b37f10a504 Changing Windows_NT -> Windows for enabling TargetPlatformMoniker feature of the sdk for platform specific tfms. (#43651)
* eng change

* coreclr change

* libraries change

* tests change

* installer & mono change

* py files changed

* .md change

* .yml change

* remove redundant targetos property

* Windows_NT -> windows after ninja change

* fixing runtime build failure
2020-11-02 14:25:58 -08:00
Steve Pfister d575f10471 [Wasm] Ensure monovm_initialize is called on startup and address other startup items (#39446)
This PR addresses:

- Calling monovm_initialize matches how other mono platforms init themselves (Fixes https://github.com/dotnet/runtime/issues/39074)
- Set the entry assembly (Fixes https://github.com/dotnet/runtime/issues/38994)
- Make sure the assembly location is set to empty for assemblies that are loaded from memory (Fixes https://github.com/dotnet/runtime/issues/39650)
2020-08-07 09:30:15 -04:00
Adam Sitnik 3ea278dae3 Remove new platform members from OSPlatform (#40373)
* Remove new platform members from OSPlatform

* remove IsOSPlatformEarlierThan and IsOSPlatformOrLater methods

* remove unused resource and dependency

* delegate RuntimeInformation.IsOSPlatform to call OperatingSystem.IsOSPlatform. it won't compile now as the new guards have not been merged yet (#40457)

* remove OSPlatform.Browser and it's usage
2020-08-07 12:18:34 +02:00
Anirudh Agnihotry 621ed57461 Correcting Mismatch between ref and src (#39741)
* minor formatting

* ref changes
2020-07-30 14:52:46 -07:00
Alexander Köplinger a07b70c7e3 [wasm] Address TODO in pal_runtimeinformation.c (#40133)
The WASM architecture wasn't added there since we already hardcode the architecture to wasm in the managed layer.
For consistency we should still define it in the PAL though and address the TODO comment.

Also added a test that verifies we indeed get the correct wasm architecture on the Browser platform.
2020-07-30 18:04:37 +02:00
Viktor Hofer 809a06f451 Remove depprojs in favor of PackageReferences (#35606)
- 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)"
2020-07-23 17:20:26 +02:00
Adam Sitnik 7006ff2c53 don't aquite lock when calling RuntimeInformation.OSArchitecture and OSArchitecture.ProcessArchitecture (#39196)
* don't aquite lock when calling RuntimeInformation.OSArchitecture and OSArchitecture.ProcessArchitecture

* make the arch fields volatile

* proper fix of the Unix code

* apply [SuppressGCTransition]
2020-07-14 19:07:59 +02:00
Adam SitnikandJan Kotas 2c573b59aa add OSPlatform.macOS, switch to OrdinalIgnoreCase for OSPlatform comparisons (#39209)
* add OSPlatform.macOS, hide OSX

* use OrdinalIgnoreCase for platform name comparisons

* RuntimeInformation.IsOSPlatform(OSPlatform.macOS) must return true on OSX

* add new test cases for IsOSPlatformEarlierThan and IsOSPlatformOrLater

* cache the IsCurrent information

* apply code review suggestion

Co-authored-by: Jan Kotas <[email protected]>

* apply code review suggestion

Co-authored-by: Jan Kotas <[email protected]>
2020-07-14 19:06:23 +02:00
Adam Sitnik 3480a74e0b add IsOSPlatformOrLater and IsOSPlatformEarlierThan methods (#39005)
* add tests for IsOSPlatformOrLater and IsOSPlatformEarlierThan methods

* add IsOSPlatformOrLater and IsOSPlatformEarlierThan methods

* add xml docs that explain what the API does and what input is supported

* address code review feedback

* numbers in the middle of the platform name are not supported
2020-07-10 21:04:47 +02:00
Mitchell HwangandMitchell Hwang 838486f43b [wasm] Addressing System.Runtime.InteropServices.RuntimeInformation.Tests failures (#39073)
Co-authored-by: Mitchell Hwang <[email protected]>
2020-07-10 19:28:03 +02:00
Alexander Köplinger a9944fa8a7 Add OSPlatform entries for iOS/tvOS/watchOS/Android (#36704)
* Add OSPlatform entries for iOS/tvOS/watchOS/Android

Implements the non-controversial new OSPlatform members from https://github.com/dotnet/runtime/issues/33331

* Add tests for new OSPlatform entries
2020-07-10 11:26:54 +02:00
Anirudh AgnihotryandSantiago Fernandez Madero b62b16acf5 addressing some missing feedback Relating to Browser (#38968)
* addressing some missing feedback

* Apply suggestions from code review

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

* remove odbc32 from ref

* fix stuff

Co-authored-by: Santiago Fernandez Madero <[email protected]>
2020-07-09 23:45:40 -07:00
Stephen Toub 6072e4d3a7 Update license headers (#38793) 2020-07-08 09:23:11 -04:00
Anirudh Agnihotry 5ce04ccc9a Make browser peer for windows_nt and unix (#37944)
Fixes https://github.com/dotnet/runtime/issues/38559
2020-07-08 12:59:37 +02:00
Stephen Toub ed78fadab6 Fix CA1805 for unnecessary initialization of fields (#38410)
This has three primary benefits:
1. In some cases, in particular for static fields where other static fields have non-default initialization, the C# compiler can't elide the default initialization, resulting in more IL.
2. It highlights places where the field is otherwise unused and can be deleted, but where the presence of the initialization was silencing the C# compiler's warnings about the unused field.
3. It increases consistency and decreases maintenance / code size / etc.
2020-06-26 07:52:35 -04:00
Alexander Köplinger da10ba8ca7 Use ConditionalFact/Theory for skipping RemoteExecutor on unsupported platforms (#37479)
RemoteExecutor doesn't work on platforms that can't spawn processes like iOS/Android/WebAssembly.
2020-06-09 12:40:44 +02:00
Marek Safar 2cec8b46ef Add Browser version of RuntimeInformation (#37256) 2020-06-08 18:32:00 +02:00
Jan Kotas 7d4f73ca0a Delete FX_PRODUCT_VERSION host key/value pair (#35455)
It is no longer necessary now that the whole runtime is being built together in dotnet/runtime repo.
2020-04-25 18:28:19 -07:00
Marcus Turewicz 890fab0a64 Use attribute Link syntax for Common files (#35436)
* Change <Link>...</Link> to Link="..."

* Format existing Link="..."
2020-04-25 05:26:50 -07:00
Larry Ewing 3b4c5a5704 Add OSPlatform.Browser and Architecture.Wasm (#34781) 2020-04-16 22:55:45 +02:00