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

Poly fill Index and Range types #104170

Merged
merged 3 commits into from
Jul 3, 2024
Merged

Conversation

tarekgh
Copy link
Member

@tarekgh tarekgh commented Jun 28, 2024

Fixes #28285

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-issue-labeler dotnet-issue-labeler bot added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners new-api-needs-documentation labels Jun 28, 2024
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@tarekgh tarekgh added area-System.Memory and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 28, 2024
@tarekgh tarekgh added this to the 9.0.0 milestone Jun 28, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-memory
See info in area-owners.md if you want to be subscribed.

@tarekgh tarekgh requested a review from ericstj June 28, 2024 17:47
@tarekgh
Copy link
Member Author

tarekgh commented Jun 28, 2024

CC @stephentoub @bartonjs @tannergooding @terrajobst @jaredpar

@ViktorHofer I appreciate if you can take a quick look too.

@jkotas

This comment was marked as resolved.

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, most comments here are just on style. Tried to look for precedent elsewhere in repo. If you take the suggestions please do the same in src project.

@terrajobst
Copy link
Member

What's the reason to target .NET Core explicitly when we just give it the .NET Standard 2.1 assets?

@tarekgh
Copy link
Member Author

tarekgh commented Jun 28, 2024

What's the reason to target .NET Core explicitly when we just give it the .NET Standard 2.1 assets?

The existing type Base64Url poly fill ns2.1. Index & range type forward in ns2.1 target.

@terrajobst
Copy link
Member

Gotcha, so .NET Core and .NET Standard are in fact not getting the same assets. I read the configuration wrong then.

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM. I agree with @stephentoub that we should replace the existing usages of IncludeIndexRangeTypes.

@jkoritzinsky
Copy link
Member

We need to make sure to ship the netstandard2.0 version of Microsoft.Bcl.Memory in the ref pack in the analyzers/cs folder, otherwise we'll break the ComInterfaceGenerator. Looking at the build artifacts, it's not being included currently.

@ViktorHofer
Copy link
Member

ViktorHofer commented Jul 1, 2024

This is a strange case. You probably need to add the BCL project name here

But then you also need to make sure that System.Memory.dll is present as this library depends on it. Redistributing System.Memory.dll which last shipped in 2022 from a corefx branch inside the Microsoft.NETCore.App.Ref targeting pack is problematic, to say the least. Unless we know that the compiler already includes System.Memory.dll when targeting .NET Framework, then it would be fine to omit the assembly (source generators are just compiler plugins).

I find it very weird that we now ship this Bcl assembly inside the Microsoft.NETCore.App.Ref targeting pack (inside the source gen folder) but given that source generators must target netstandard2.0, this might be OK. cc @jaredpar as this is related to your design doc about compilers shipping inside the SDK vs VS.

@tarekgh
Copy link
Member Author

tarekgh commented Jul 1, 2024

@jkoritzinsky @ViktorHofer do you know how I can add Microsoft.Bcl.Memory ns2.0 version to analyzers/dotnet/cs folder in the ref package? I am not seeing a straightforward way to do that.

This is a strange case. You probably need to add the BCL project name here:

This didn't work and I am not sure either if it will be correct. The list there is detect if it is analyzer and handle it accordingly. It is not right every project reference Microsoft.Bcl.Memory will be treated as analyzer.

@ViktorHofer
Copy link
Member

I will take a look tomorrow.

</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" Pack="true" PackagePath="analyzers/dotnet/cs" />
<ProjectReference Include="$(LibrariesProjectRoot)\Microsoft.Bcl.Memory\src\Microsoft.Bcl.Memory.csproj" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the ProjectReference above. You need to specify Pack and PackagePath so that the ProjectReference gets copied correctly.

Suggested change
<ProjectReference Include="$(LibrariesProjectRoot)\Microsoft.Bcl.Memory\src\Microsoft.Bcl.Memory.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)\Microsoft.Bcl.Memory\src\Microsoft.Bcl.Memory.csproj" Pack="true" PackagePath="analyzers/dotnet/cs" />

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try that. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkoritzinsky @stephentoub after trying and talking to @ViktorHofer, looks it needs non-trivial change in the infra to allow bin-placing the Bcl library next to the source gen library in the ref pack. For now, I am going to revert the source gen changes and will create an issue to track the infrastructure work and to add the source gen dependency on the new Bcl library.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the issue #104308 to track the work need to be done.

@jaredpar
Copy link
Member

jaredpar commented Jul 8, 2024

@jaredpar as this is related to your dotnet/sdk#41790.

That doc only covers two items:

  1. The version of the compiler used in builds.
  2. How analyzers load in VS.

It wouldn't change anything related to how dependencies of analyzers load

@tarekgh tarekgh deleted the IndexRangePolyFill branch August 6, 2024 20:04
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Range package similar to System.ValueTuple
8 participants