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 net48 without system.reflection.metadata #3236

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bruno-garcia
Copy link
Member

@bruno-garcia bruno-garcia commented Mar 23, 2024

We had a few customers sharing challenges when building for net48 because of dependencies.

This is an attempt to reduce dependencies when building specifically for newer .NET Framework.

I also believe we should bump the min version to 6.0.0 (as opposed to 5.0.0 which we have now and is deprecated):

https://www.nuget.org/packages/System.Reflection.Metadata/6.0.0#dependencies-body-tab

Copy link
Contributor

github-actions bot commented Mar 23, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- add net48 without system.reflection.metadata ([#3236](https://github.com/getsentry/sentry-dotnet/pull/3236))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against d8eca51

@@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(SolutionName)' != 'Sentry.Unity'">
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net6.0;netstandard2.1;netstandard2.0;net462;net48</TargetFrameworks>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this supposed to be a new target or to replace the net462 target?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we need to keep supporting the older one, but we can at least improve for apps running on the latest version

@jamescrosswell
Copy link
Collaborator

I'm not sure I get it. Sentry has a dependency on System.Reflection.Metadata for .NETFramework 4.6.2, .NETStandard 2.0 and .NETStandard 2.1.

Surely one of those is being resolved when compiling for net48. What does having Sentry target net48 specifically do for us?

@bruno-garcia
Copy link
Member Author

I'm not sure I get it. Sentry has a dependency on System.Reflection.Metadata for .NETFramework 4.6.2, .NETStandard 2.0 and .NETStandard 2.1.

Surely one of those is being resolved when compiling for net48. What does having Sentry target net48 specifically do for us?

If using .NET 4.8, it should pick the net462 of our SDK which does have the dependency. BUT this is breaking, because.. .NET Framework and these problems with dependency resolution (is my assumption).

With 2 customers I debugged this with, I suggested they try adding the dependency directly to their app (S.R.M that is) and it resolved the issue. I didn't have access (nor I have a WIndows machine) to debug the issue myself

@jamescrosswell
Copy link
Collaborator

If using .NET 4.8, it should pick the net462 of our SDK which does have the dependency. BUT this is breaking, because.. .NET Framework and these problems with dependency resolution (is my assumption).

With 2 customers I debugged this with, I suggested they try adding the dependency directly to their app (S.R.M that is) and it resolved the issue. I didn't have access (nor I have a WIndows machine) to debug the issue myself

OK, with this commit, we're basically dropping the following dependencies for people using .net48 :

<PackageReference Include="System.Reflection.Metadata" Version="5.0.0" />
  </ItemGroup>
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />

Is that because these packages are included as part of .net48 and later? I couldn't find this documented anywhere but maybe I'm just not looking in the right places...

@bitsandfoxes
Copy link
Contributor

I couldn't find this documented anywhere but maybe I'm just not looking in the right places...

I think this is part of the problem. It "should" work. But we don't know. I'd like to hold off on this for now.

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.

3 participants