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

feat: Added initial Trimming support. #21

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

HavenDV
Copy link
Contributor

@HavenDV HavenDV commented Jun 7, 2024

Closes #20

But because preview version of System.Memory.Data does not explicitly support net6.0, this warning appears here

0>System.Text.Encodings.Web.targets(4,5): Warning  : System.Text.Encodings.Web 9.0.0-preview.4.24266.19 doesn't support net6.0 and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
0>Microsoft.Bcl.AsyncInterfaces.targets(4,5): Warning  : Microsoft.Bcl.AsyncInterfaces 9.0.0-preview.4.24266.19 doesn't support net6.0 and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
0>System.Text.Json.targets(4,5): Warning  : System.Text.Json 9.0.0-preview.4.24266.19 doesn't support net6.0 and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
0>System.Memory.Data.targets(4,5): Warning  : System.Memory.Data 9.0.0-preview.4.24266.19 doesn't support net6.0 and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.

There are two ways out:

  • Ignore, this can work without problems
  • Add #ifdef/ MSBuild Conditions to use old behavior for net6 and new for net8/netstandard

I'm waiting for feedback

@HavenDV HavenDV marked this pull request as ready for review June 7, 2024 07:40
Copy link
Collaborator

@KrzysztofCwalina KrzysztofCwalina left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! The core fixes look good! I just have a question and a change request I commented inline in the sources.

@@ -6,6 +6,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAI", "src\OpenAI.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAI.Examples", "examples\OpenAI.Examples.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrimmingHelper", "helpers\TrimmingHelper\TrimmingHelper.csproj", "{4C6C7FB5-DD4E-44A8-9CBF-D739284FDC23}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we want the TrimmingHelper project in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will delete this after the review, right now it is still needed for re-checking

src/OpenAI.csproj Outdated Show resolved Hide resolved
src/OpenAI.csproj Outdated Show resolved Hide resolved
@@ -7,7 +7,7 @@
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>beta.3</VersionSuffix>

<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the reason for adding this explicit target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that attributes only appeared in net7, I'm not sure that net6 issues all the appropriate warnings for trimming, so I always try to add net8 to see actual problems.
Also, adding net8 allows you to avoid using polyfills for it and opens up access to other optimizations, as well as up-to-date diagnostics / in some cases more complete nullability markup
I can remove this, it can be added later if needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

@stephentoub, what are your thoughts on this? We have been trying to minimize the number of cross-targets, as the matrix can become supper messy after a while, but maybe adding net 8 is not too bad?

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want net8.0 at least by Nov when net6.0 goes out of support. Might as well add it now, and gain the additional benefits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trimming/NativeAOT support
4 participants