102 Commits
Author SHA1 Message Date
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 <[email protected]>
Co-authored-by: Dan Moseley <[email protected]>
Co-authored-by: Alexander Köplinger <[email protected]>
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 <[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
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
Adeel Mujahid 4141913109 Fix typos (#69011) 2022-05-07 11:55:53 -07:00
Jan KotasandTheodore Tsirpanis b59c6491dd Rename CoreRT to NativeAOT (1/N) (#68888)
Co-authored-by: Theodore Tsirpanis <[email protected]>
2022-05-05 18:14:28 -07:00
Igor Velikorossov 3088b0549d Update breaking-change-rules.md (#66978)
* Update breaking-change-rules.md

Add the rule for the removal of finalizers

* Update breaking-change-rules.md

* Update breaking-change-rules.md

* Update breaking-change-rules.md

* Update breaking-change-rules.md
2022-04-14 17:19:47 -07:00
Viktor Hofer 538934c25f Only add placeholder pkg file if folder is empty (#67647)
* Only add placeholder pkg file if folder is empty

Originally reported in https://github.com/dotnet/runtime/issues/63413,
placeholder files are added unconditionally by the .NETStandard compat
error packaging infrastructure, even if the
buildTransitive/$(SupportedTFM) folder isn't empty.

That hinders our libraries to package their own set of buildTransitive
props and targets files for the supported set of tfms.

This change makes sure that placeholder files are added only if no None
or Content items are declared that point to the same package folder.

Adding documentation that explains the .NETStandard compatibility
packaging infrasturcture and how to correctly package hand-authored
msbuild files next to the generated targets files.

* Fix NETStandardCompatError empty cases

* Update packaging.targets
2022-04-12 22:16:00 +02:00
Adeel Mujahid 1094cee781 Update coding-style.md (#67801)
* Remove mention of outdated formatting script and C++ language that was removed from libraries.
* Move C# coding style at the top of document.
2022-04-09 06:37:05 -07:00
Eric Erhardt 7508080ebc Update coding-style to include target-typed new() guideline (#67061)
* Update coding-style to include target-typed new guideline

Similar to `var` usage, `new()` usage is only allowed when the Type can be understood from the same line.

Fix #53369

* Fix coding style violations
2022-03-23 18:54:51 -06:00
Elinor Fung c2ec86b1c5 Rename GeneratedDllImportAttribute -> LibraryImportAttribute (#66307) 2022-03-09 18:07:52 -08:00
Jan Kotas 17662fc30c Replace TargetFrameworks with TargetFramework where possible (#66198) 2022-03-04 22:21:59 -08:00
Elinor Fung a0635832f1 Rename DllImportGenerator project to LibraryImportGenerator (#66029) 2022-03-03 22:17:23 -08:00
Viktor Hofer 9ebe0efa48 sfx+oob split, shim project refactoring, P2Ps
Split the build of shared framework and out-of-band projects so that
it's possible to just build the shard framework projects, which was
requested by the CLR teams. In the next infrastructure rollout, the
current "libs.ref+libs.src" subsets should be removed. Generate the
targeting pack with an incomplete (without shims) frameworklist as part
of the "libs.sfx" subset.

Build the shim projects after the shared framework and oob projects and
re-generate the targeting pack's frameworklist to include the shims.

Refactor the shims so that they aren't grouped anymore by generated &
manual. Instead group them by "ref" and "src" same as other libraries
in the tree which allows to reference the source project shims and read
from the ReferenceAssembly metadata.

Use ProjectReferences in traversal projects and shim projects instead
of named references that point to binplace directories (see graph below)
This allows to build parts of the product dynamically, i.e. the shim
projects, apicompat.proj, sfx.proj and oob.proj.
2022-02-24 12:32:04 +01: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
Viktor Hofer ef5803de62 Delete NS2x runtime specific impls (#64610)
* Remove .NETStandard runtime implementations

Remove the remaining ten .NETStandard runtime specific implementations.
For reasoning please see https://github.com/dotnet/runtime/issues/64536.

* Remove infra support for NS platform specific tfms

Also cleaning-up some logic and stop disabling AppendTargetFramework.
2022-02-01 22:51:32 +01:00
Eric Erhardt d99fa6789a Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile (#63943)
* Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile

Two small follow up changes from #58446

- Fix a type-o that breaks incremental build. Forgot to use MSBuild property syntax
- Instead of having the infrastructure hard-code removing 'Abstractions', packages can set their own Disable source gen property name.

* PR feedback
2022-01-24 10:42:15 -06:00
Andy Gocke 83f8df4e78 Revert "Enable System.Text.Json tests on netfx (#63803)" (#64108)
This reverts commit 34794bc5f2.
2022-01-21 13:32:37 -08:00
Krzysztof Wicher 34794bc5f2 Enable System.Text.Json tests on netfx (#63803)
* Enable System.Text.Json tests on netfx

* use NETFRAMEWORK define

* disable another two test cases after rebase

* disable last test case which repros only on CI for me

* add p2p only on netfx
2022-01-19 13:45:01 +01:00
Matt KotsenasandStephen Toub 83c97613a3 Clarify P/Invoke shims guidance for OOB assemblies (#63470)
* Clarify P/Invoke shims guidance for OOB assemblies

The discussion in PR #63421 clarified that System.Native shims for UNIX
APIs aren't appropriate for assemblies that don't ship as part of the
Microsoft.NETCore.App framework.

Updating the interop guidelines to capture that clarification.

* Update docs/coding-guidelines/interop-guidelines.md

Co-authored-by: Stephen Toub <[email protected]>

Co-authored-by: Stephen Toub <[email protected]>
2022-01-07 15:31:55 -05:00
Elinor Fung 4a1bcc3524 Add comment about using source-generated p/invokes to interop guidelines (#63350) 2022-01-04 15:29:44 -05:00
Jeremy Koritzinsky a526e77b6d Move clang-format download into dotnet/runtime and add docs for setting up auto-formatting in the repository (#59374) 2021-09-23 14:34:00 -07:00
Viktor Hofer 331823f404 Simplify .NETFramework tfms (#58558)
* Simplfy .NETFramework tfms

Libraries which target .NET Framework usually have rid agnostic tfms,
i.e. net461. If the library targets netstandard2.0-windows as well,
the .NET Framework tfm must be rid specific, as rid specific
.NET Framework apps would otherwise pick the .NETStandard asset over
the .NETFramework one (based on the RID compatibility rules)

There is yet another reason that requires .NETFramework tfms to be RID
specific, which is when a project P2Ps other projects which are
rid-specific. Without the RID specific .NETFramework tfm, a compatible
.NETStandard asset would be picked instead.

NuGet doesn't support setting a TargetPlatform in the TargetFramework
alias when targeting .NETFramework or .NETStandard. Any such tfms in
dotnet/runtime are currently leveraging a hack that strips the
TargetPlatform / TargetFrameworkSuffix away during restore and packaging
(as NuGet Pack uses the project.assets.json file).

As NuGet will likely never support RID specific .NETFramework tfm
aliases, the distinction between a RID specific and a RID agnostic
.NETFramework tfm is unnecessary.

Remove all "TargetFrameworkSuffixes" / TargetPlatforms / RIDs
(whatever you would like to call them) from .NETFramework tfms and let
the packaging targets handle the cases where a RID specific asset is
required in the package.

Explictly don't set TargetsWindows to true for .NETFramework builds as
the Targets* properties are infered from the platform / suffix and
many projects make the assumption that net461
(without the "-windows" part) doesn't set TargetsWindows=true.

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

* Warn on .NETFramework duplicate runtime assets

* Ignore .NEtFramework non Windows and non empty RIDs

Also cleaning up the packaging.targets file and removing
the ExcludeFromPackage option which isn't needed anymore as
target frameworks aren't excluded from packages produced in
dotnet/runtime anymore.
2021-09-10 09:50:11 +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 6c47cf8a2f Rename transport packages to follow convention (#57504)
* Rename transport packages to follow convention

As agreed on in https://github.com/dotnet/windowsdesktop/pull/1936, we
want to follow a common schema when naming our transport packages.

Also updating the docs to reflect the name changes and to also
accomodate for the WindowsDesktop transport package.

* Update src.proj

* Update src.proj
2021-08-16 22:18:08 +02:00
Viktor Hofer 21e340dcaf P2P instead of binplacing aspnetcore transport pkg (#57239)
Use ProjectReferences to compose the aspnetcore tranport package.
Avoid binplacing and with that unnecessary copies which overall
simplifies the infrastructure and allows to add additional transport
packages without creating a binplace configuration for each.

This also makes sure that the dependencies are compatible with the
package's tfm.
2021-08-12 20:37:23 +02:00
Viktor Hofer 22cee85aa0 Clean-up pkgproj leftovers in libs and apply fixes (#56899)
* Clean-up pkgproj leftovers in libs and apply fixes

Remove any pkgproj infrastructure that was only used by src/libraries
(which is the majority). Delete the packageindex *YAY*.
Update the documentation that covered the packageindex and the pkgprojs.

Avoid any incremental builds during packaging by removing
libraries-packages.proj and use src.proj for packaging instead. Make use
of the `GeneratePackageOnBuild` property to build package during the
allconfigurations without requiring a different entry target.

Fix the addition of the DocumentationFile during packaging when
`GeneratePackageOnBuid` is used by hooking onto the
`DocumentationProjectOutputGroup` that NuGet uses and replacing the
generated documentation file with the one that comes via the
intellisense package.
Also introduce a property to choose the generated documentation file
over the one from the intellisense package:
<UseIntellisenseDocumentationFile>false</UseIntellisenseDocumentationFile>

Removing a few leftover PackageDescription properties from the projects'
Directory.Build.props file.

Cleaning up properties in Directory.Build.props & Directory.Build.targets
files.

* Actually run packaging during the allconfigurations build

* Update docs

* make runtime specific pkgs non packable

* io.ports native pkg fixes
2021-08-06 12:01:36 +02:00
iinuwa f0d1a8b390 Fix indentation on Interop directory tree example (#56718) 2021-08-02 13:17:23 -04:00
Eric StJohn ffa4923a6e Add analyzers to ref-pack / ASP.NET transport package (#54950)
* Add analyzers to ref-pack / ASP.NET transport package

* Updating shared framework SDK

* Respond to feedback

* Update arcade SDKs and remove property
2021-07-01 05:49:52 -07:00
Viktor Hofer 663c40dbc4 Expose missing references which are present in the runtime and in packages in the targeting pack (#54147)
* Expose missing refs from runtime in targeting pack

The platform analyzers warns for usages of APIs which aren't available
on specific platforms. Exposing the missing reference assemblies which
are already part of the runtime pack in the targeting pack.

The big benefit of doing so is that customers don't need to reference
the corresponding packages to target these APIs and that these five
packages can be dead-ended.

For more in-depth reasoning, see the detailed summary:
https://github.com/dotnet/runtime/issues/53892#issuecomment-858542280

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

* Update dependents of dead-ended packages

Update depents by referencing the latest available package. Making sure
that packages are never used on NetCoreAppCurrent by applying
.NETCoreApp version conditions.

* Fixes

* Remove pkg validation suppression file

* Update Windows Compatibility pack

* Fix DirectoryServices pkg references

* Fix netfx Pkcs restore/build

* Fix version conflict

* Packageindex and nits

* nits
2021-06-15 19:32:15 +02:00
Aaron Robinson c28b1897ae Guidance on source generator projects (#54082)
* Guidance on source generator projects
2021-06-14 21:36:08 -07: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
Eric StJohn c0a1734094 Remove the use of IsPartialFacadeAssembly in refererences (#52793)
* Remove the use of IsPartialFacadeAssembly in refererences

This flag requires assembly-re-writing to replace type-defs in reference
assemblies with type forwards, when the same type exists in references.

We've pretty much exclusively used this on .NETFramework, since it's
not friendly to source build (CCI isn't part of source build).
.NETFramework isn't going to be changing so it doesn't save us much
to generate these typeforwards in the build.

We also used these to make sure the netstandard surface area was
compatible with .NETFramework facades (we'd use the pre-rewritten
reference assemblies for contract), but this need goes away now that we
have package validation based APICompat that compares netstandard refs
to net4x facades.

* Fix some projects I missed after changing naming convention

* Fixup another project

* Fix build of System.System.Threading.AccessControl

* Adding a section to ref-source docs on .NETFramework facades

* Address feedback
2021-05-19 08:22:04 +02:00
Eric StJohn a50f309886 Add Analyzer packaging support and packaging documentation (#52554)
* Add Analyzer packaging support and packaging documentation

To package Microsoft.Extensions.Logging.Abstractions we needed support
for packing an Analyzer.  This adds that support.

I wanted to document this addition, so I created the start of a doc that's
meant to describe the packaging options for libraries in dotnet/runtime.

* Address code review feedback.

* More feedback

* Address more feedback

* Remove src.proj build of generators

* Update to use Microsoft.DotNet.PackageTesting

* Fix typos

* Fix package testing on net46*
2021-05-14 10:06:41 -07:00
Matt Thalman 09ad9e7eb4 Add section to interop guidelines about tracking dependencies (#52302)
* Add section to interop guidelines about tracking dependencies

* Set code owner

* Update wording
2021-05-13 06:56:34 -07:00
Eric Erhardt 99f4062f8e Add documentation on ILLink files (#50302)
* Add documentation on ILLink files

* Add link to ILLink-files from project-guidelines
2021-03-28 16:52:37 -05:00
Stephen Toub 0817e748b7 Seal internal types in libraries (#50225) 2021-03-25 20:50:33 -04:00
CadenJi 9a70e7a688 Rule number correction (#49288) 2021-03-08 06:39:08 -05:00
Viktor Hofer 3553284bea Rename mention to master branch to main (#48824) 2021-03-01 10:09:31 +01: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
Doug Bunting e63969dba5 Clean up aspnetcore casing in ref to that repo (#47347)
- address difference I introduced in dotnet/aspnetcore#29511 and more
    - conflict detected in dotnet/aspnetcore#29520
- also s|aspnet/aspnetcore|dotnet/aspnetcore|
2021-01-22 14:43:06 -08:00
Anirudh Agnihotry 891e8d4d4f move netcore platforms and targets to csproj (#46474) 2021-01-04 15:45:22 -08:00
Vladimir Sadov 99f3f55697 renaming clrcompression --> System.IO.Compression.Native (#45713)
* renaming `clrcompression` --> `System.IO.Compression.Native`

* rename `clrcompression.def` file

* exclude `System.*.Native.dll` when creating managed shims

* static library should be `System.IO.Compression.Native.lib` on Windows. Same as Globalization - without `lib` prefix

* revert change to the resource string in tests

* move consts to src/Interop, remove `lib` prefix on Windows

* Delete what used to be System.IO.Compression.clrcompression package

* Preserve old PlatformManifestFileEntry for clrcompression.dll

* partially revert the src\Interop change

* Adjust projects for removal of `Interop\Interop.Libraries.cs`

revert 1

* Undo entire System.IO.Compression.csproj to get rid of an invisible edit.
2020-12-08 15:50:10 -08:00
Jan Kotas 10381a2cdc Find&Replace coreclr/src -> coreclr (#45761) 2020-12-08 10:40:17 -08:00
Stephen Toub aebd598664 Update nullability.md 2020-11-23 22:45:58 -05:00
Levi Broderick f56a56f90f Convert aka.ms links to https (#44501) 2020-11-11 13:03:43 -08: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
Stephen Toub 47e50116e6 Update coding-style.md 2020-10-29 16:25:32 -04:00
Eric Erhardt 4d784693eb Updating ref source documentation for full facades (#41629) 2020-08-31 19:56:28 -05:00