122 Commits
Author SHA1 Message Date
Alexander Köplinger 883ffc4d18 Fix format.sh script and remove dotnet-format tool from dotnet-tools.json (#94839)
We're no longer using the separate dotnet-format tool since it is integrated into the dotnet SDK now.

With the move to the SDK the options changed a bit so we now need to use the `whitespace` format command so we can continue using the `--folder` option: https://github.com/dotnet/format/issues/1385

To run not just whitespace but code style formatters as well we'd need a workspace context (i.e. pass the .csproj to dotnet format), but inferring that from just the changed file list is hard.
2023-11-16 15:38:39 +01:00
Aleksey Kliger (λgeek) 4110bcea5b Bump mono to -std=gnu11 (#91421)
Change the mono build to require C11 (with gnu extensions on gcc/clang platforms).
* Change `g_static_assert` to be `_Static_assert` or `static_assert` as apropriate.
* Change `_DN_STATIC_ASSERT` to be `static_assert`
* Add static asserts in `jiterp.c` when it casts between `T*` and `atomic_T*`
* Add C11 guidance to the mono coding guide doc

Contributes to #90404 

---

* Bump mono to -std=gnu99; use static_assert

* don't fall back to runtime checks for g_static_assert

* fix static assert that wasn't a constant expression

* use static_assert in shared containers

* bump C standard in offsets-tool.py

* use _Static_assert before C23

   Dont' include assert.h in glib.h because some of our older 3P code includes assert.h on its own and there are conflicts

* use CMAKE_C_STANDARD and related properties

* jiterp: static_assert that atomic ops are (less likely) to go wrong

   Not every C implementation guarantees that atomic operations on arbitrary types are lock free.  So for example, casting between atomic_ushort* and uint16_t* might not actually be ok to do.  We can't assert that they're inter-castable, but at least assert that they're the same size and that atomic_ushort is always lock-free. There might still be restrictions (for example atomic_ushort might have to be aligned differently) but this should at least catch obvious data corruption.

* Add C11 guidance to the Mono coding guide

* jiterp: long is 32-bits on wasm; use llong
2023-09-01 18:04:35 -04:00
MSDN.WhiteKnight 9ddb731683 Update Package readme guidelines with new template (#90842)
* Update package readme guidelines

* Fix typo
2023-08-21 12:44:18 +02:00
1b37389af6 Introduction to vectorization with Vector128 and Vector256 (#84115)
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
2023-06-29 11:00:07 +02:00
Viktor Hofer 07ae197db5 Use analyzers from targeting pack for NetCoreAppCurrent (#87726)
* Use analyzers from targeting pack for NetCoreAppCurrent

Fixes that analyzer failures didn't show-up in #74897

Add analyzers to the frameworklist that OOB projects in src/libraries
use, and only auto ProjectReference the analyzers in generators.targets
when not using the analyzers from the targeting pack.

Also move the generator projects related code into a separate file.

Continuation of https://github.com/dotnet/runtime/pull/75093

* Fix project build

* Add missing reference to Regex tests

* Add missing generators for netfx build

* Fix paht in test project

* Fix typo

* Disable runtime marshalling for SharedTypes.csproj

* Disable runtime marshalling for NativeExports.csproj
2023-06-19 23:27:38 +02:00
Bonuspunkt a15eaf7440 link to the latest version of Framework Design Guidelines (#86216)
also added Jeremy Barton because he was inconsistently mentioned
2023-05-15 09:58:01 -04:00
Tom Deseyn 21fb96b6ee Try to untangle the rid calculation. (#82832)
* Try to untangle the rid calculation.

* Ignore __portableOS.

* Add back musl detection.

* Try fix AnyOS tests.

* Try fix coreclr linux_musl_arm64 job.

* src/tests/build.proj: use PackageRID for restore.

* Use RuntimeOS as an override for _packageOS.

* Remove (probably) out-dated override for non-portable ToolsRID.

* CI cross-builds for linux-musl use linux.

* Add missing arch to rid.

* Try simplified ToolsRID.

* Update comments.

* Rename OutputRid to OutputRID.

* Tweak comment.

* Move TargetsLinux{Bionic,Musl} with the other Targets properties.

* Don't use RuntimeOS for PackageRID for CrossBuilds.

* Move RuntimeOS condition to ToolsRID assignment.

* Clean up a few things.

* Fix broken Condition.

* Try fix the linux-bionic build.

* Try fix the linux-bionic build, part II.

* Try fix the linux-bionic build, part III.

* Fix PackageRID.

* Use RuntimeOS as _packageOS override.

* Remove RuntimeOS.

* Fix '-os linux-musl' mapping.

* Clean up .

* Rename __PortableOS to __PortableTargetOS.

* Extend comments.

* Extend OutputRID comment too.

* build.sh: include linux-bionic, linux-musl in usage.

* SourceBuild.props: no need to pass RuntimeOS. Only set ToolsOS, PackageOS when RuntimeOS is not empty.

* Fix comment.

* linux-bionic doesn't get built on linux-bionic.

* Unconditionally assign TargetsLinuxBionic/TargetsLinuxMusl.

* Remove SkipInferTargetOSName.
2023-04-21 10:02:07 +02:00
Dan Moseley 17c563e9a1 add link to interop guidelines (#83987) 2023-03-27 12:40:19 -06:00
Adeel Mujahid 3b63eb1346 Replace remaining instances of COMPlus with DOTNET (#82985)
* Replace remaining instances of COMPlus with DOTNET

* Fix heading in RyuJIT tutorial
2023-03-05 08:40:20 -08:00
Viktor Hofer 2ca7cf7140 Lowercase TargetOS (#80164)
Follow-up on #32451
Follow-up on #80074

In #43651, the "Windows" OS name was lowercased to achieve target frameworks with RIDs in them. At that time, the original plan was to lowercase all TargetOS values but that had to be cut because of resources. This PR finishes that and updates build systems, YML, markdowns and managed components.

To not break existing developer workflows, the passed-in -os value is automatically lower-cased in the script entry points and validated in the msbuild entry point.
2023-01-11 17:58:32 +01:00
Viktor Hofer 212fb54730 Use shipping runtime.json for RID targeting (#80074)
* Use shipping runtime.json for RID targeting

- Use the shipping runtime.json file to target RIDs when building
  instead of the custom OSGroups.json which only contained a subset of
  the available rids.
- To facilitate that, lower-case the existing platforms in the target
  frameworks strings which is the expected format anyway by the SDK and
  msbuild. This will eventually make it possible to bring some of the
  custom build infrastructure back into the SDK.
- Remove a few outdated code pieces and update docs.
2023-01-02 21:42:52 +01:00
Eirik TsarpalisandViktor Hofer 97a51ccdb1 Add nullable reference type annotations to System.Text.Json source gen (#79613)
* Add nullability annotaitons to sourcegen components.

* Move sourcegen testing from Roslyn4.0 to Roslyn4.4.

* Fix accessibility modifiers

* Allow source generators to multi-target

* Binplace only netstandard2.0 compiled source generators

* Use live NetCoreAppCurrent tfm

* Update Directory.Build.targets

* Pick correct analyzer asset for consumption

* Fix build

* Revert "Move sourcegen testing from Roslyn4.0 to Roslyn4.4."

This reverts commit fe7857066040ddf0ef632c135e83e49b097c28f7.

* Make analyzer P2Ps choose the right asset

* PR feedback

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs

* Make source generator target an LKG

* Update project-guidelines.md

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2022-12-16 18:44:06 +00:00
MSDN.WhiteKnightandViktor Hofer 479d0133f3 Split library and package Readme (#78888)
* Split library and package Readme

* Fix punctuation

* Fix lint issues

* Automatically include package readme file if existent

* Rename README.md to PACKAGE.md

* Move PACKAGE.md into source directory

* Reinstate examples in README.md

* Update contributing guidelines

* Update docs/coding-guidelines/libraries-packaging.md

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2022-12-12 11:57:58 +01:00
Viktor Hofer 49dc7ba85c Update convention on how to ref and pack analyzers (#78845)
d3af4921f3 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" />
```
2022-11-25 17:06:25 +01:00
960e4d723c Leverage the shipping, roslyn based ApiCompat in dotnet/runtime (#73263)
* ApiCompat infra changes

* Convert baseline to suppression files

* ApiCompat.proj

* update suppressions

* sorted suppressions

* rebase and update suppressions

* enable attribute and param rules

* Enable optional rules

* WebAssemblyThreading proj

* CompatSuppression for XmlREaderWriter

* Enable optional rules correctly...

* ThreadPool UnsupportedOSPlatformAttribute

* VBCore CP0017

* Migrate all CoreLibs over

* Update ApiCompat.proj

* Add ApiCompat.proj baselines

* Update ApiCompat.proj

* Clean-up suppression files with nint/IntPtr fix

* Clean-up CoreLib suppression

* Update suppression files with latest apicompat fix

* Update suppression files

* update suppressions

* Update suppression files

* Clean-up obsolete suppression files

* Update suppression files

* update suppressions

* huge reduction in suppression file size

* update suppressions

* more suppressions removed

* update suppressions

* Update dependencies and clean-up

* Add suppression files for CoreLib and fix path

* Update CoreLib coreclr suppression file

* Update coreclr suppression files

* Suppression file fixes and Linux path fixes

* Update coreclr suppression again)

* Fix suppression file path calculation

* Fix previous mistake

* Diagnostics.Tracing suppression file

* Threading suppression file fix

* use global suppression for CryptoSignedXmlRecursionException

* Add Specification.Tests suppression

* Disable NoTargets ref copying

* Fix for coreclr build

* Avoid duplicate project evals

Co-authored-by: smasher164 <akhilindurti@microsoft.com>
Co-authored-by: Akhil Indurti <aindurti@gmail.com>
2022-10-16 15:15:28 +02:00
Jan Kotas 32ac664fca Replace net7 with net8 in dogfooding and workflow docs (#75453) 2022-09-12 20:40:44 -07:00
Jan Kotas f49851cad9 Delete NGen flavor of JIT configs (#73383)
* Delete NGen flavor of JIT configs

We do not need them anymore since the JIT configs are specified on AOT tool command line now.

* Update docs
2022-08-04 13:17:18 -07:00
Alexander KöplingerandViktor Hofer 8762a02634 Add reference assembly for System.Private.CoreLib.dll (#72143)
We now compile against the reference assembly in all places where we were compiling against the mono/coreclr System.Private.CoreLib.dll implementation assembly before.

The new reference assembly consumes sources from the existing contracts to avoid checking in a generated version of SPC.dll (this would add ~20k lines of .cs which is mostly duplicated with System.Runtime.cs)

Since a few contracts have only partially moved types to SPC we wrap contract types with `#if !BUILDING_CORELIB_REFERENCE` so we can hide them when compiling the SPC reference assembly. This needed a few GenAPI changes which are implemented here: https://github.com/dotnet/arcade/pull/10003.

Note that this means that the types which live in CoreLib are moved to the end of the ref .cs file which causes a GitHub diff to show up, but it is actually a no-op.

Regenerating the ref .cs files works the same way as before, by running the `GenerateReferenceAssemblySource` target in the contract's src\ folder.

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

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2022-08-02 17:58:13 +02:00
Adeel Mujahid 9d6396deb0 Fix typos (#72709) 2022-07-23 20:24:28 -07:00
Adeel Mujahid 3ea30ed321 Fix typos (#72314)
* Fix typos

* Cleanup trailing whitespaces in committed files

* Revert a macro for win32 compat

* Disambiguate test data method

* Revert XMLPath test which rely on external assets

* Revert whitespace change in Xml tests

* Revert ClrEtwAl and ILLink.Shared

* Revert crossgen2 props/targets and *.wxl
2022-07-16 22:11:11 -07:00
Huo Yaoyuan f9999cc1aa Fix typo in GC_FORBID doc (#71050) 2022-06-21 14:11:10 +02:00
08692dcf6b Mono Code Guidelines (#70507)
* Mono Code Guidelines

* markdownlint

* Add "Naming" and "public API" sections

* Add a section on assertions

* Fix sentence fragment; add threading design doc link

* Apply suggestions from code review

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2022-06-10 17:37:39 -04:00
Aaron Robinson 2747f30e53 Update updating-ref-source.md (#70169)
Update flags for using GenAPI.
2022-06-02 13:54:51 -07: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 <danmose@microsoft.com>

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

Co-authored-by: Dan Moseley <danmose@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2022-05-23 10:14:58 -07:00
Viktor Hofer d3af4921f3 Define convention to consume and/or package analyzers (#69069)
* Define convention to include analyzers in ref pack

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

Until now we required source libraries to define ProjectReferences when
an analyzer should be part of the shared framework. That strategy causes
analyzer projects to leak into the ProjectReference closure and by that
into a solution file.

As an example:
When another library references the source library that references the
analyzer, the analyzer is part of the dependency closure even though it
might not be required.

This change makes it possible to define the shared framework analyzer
projects in the NetCoreAppLibrary.props file for both the .NETCoreApp,
and the AspNetCoreApp shared framework.

Out-of-band projects which ship analyzers inside their produced package,
continue to reference the analyzers via the `AnalyzerProject` item.

* Use AnalyzerReference consistently

* Don't reference analyzer when its packaged

* Fix P2P reference

* Fix multi target roslyn component target condition
2022-05-12 09:22:26 +02:00