Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a polyfill to enable newer compiler features #10315

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a polyfill to enable newer compiler features
New versions of C# offer many features that improve quality of life:
nullable annotations, record types, init and required properties, etc.
These can be enabled in projects targeting older framework versions by
adding the right attributes and types to the compilation.

PolySharp is a source generator which automatically does this.  For each
project, it will generate all of the types/attributes which are missing.
In the case of an InternalsVisibleTo reference, it is smart enough to
only define types in the second assembly that are not being consumed
from the first assembly (avoiding duplicate type definitions).
  • Loading branch information
jimmylewis committed Jan 7, 2025
commit a63ab20d2dc8c6c063b828009ae026114445f4f0
5 changes: 4 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,7 @@
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit" Version="2.9.0" />
</ItemGroup>
</Project>
<ItemGroup>
<GlobalPackageReference Include="PolySharp" Version="1.15.0" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<clear />
<packageSource key="NuGet.org">
<package pattern="Antlr" />
<package pattern="AngleSharp.*" />
<package pattern="AngleSharp.*" />
<package pattern="AngleSharp" />
<package pattern="Autofac.*" />
<package pattern="Autofac" />
Expand Down Expand Up @@ -52,6 +52,7 @@
<package pattern="Owin" />
<package pattern="Polly.Extensions.Http" />
<package pattern="Polly" />
<package pattern="PolySharp" />
<package pattern="Portable.BouncyCastle" />
<package pattern="RazorEngine" />
<package pattern="RouteMagic" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private async Task<IReadOnlyList<WritableRepositoryInformation>> GetResultsFromG

var request = new SearchRepositoriesRequest
{
Stars = new Range(_minStars, upperStarBound),
Stars = new(_minStars, upperStarBound),
Language = Language.CSharp,
SortField = RepoSearchSort.Stars,
Order = SortDirection.Descending,
Expand Down