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

IsExternalInit not generated correctly in multitargeting projects #98

Open
Lordfirespeed opened this issue Mar 3, 2024 · 4 comments
Open
Labels
needs more info Can't repro or unclear issue, needs further info

Comments

@Lordfirespeed
Copy link

Lordfirespeed commented Mar 3, 2024

Reproduction Steps

Make a project that targets netstandard2.1 and net8.0

<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>

and add a record class to it with some members, or alternatively a class with required init properties.

Expected Behavior

IsExternalInits type should be included in the compiled assembly targeting netstandard2.1.

Actual Behavior

Compilation succeeds, but IsExternalInits type is not included in the compiled assembly targeting netstandard2.1.

System info

This section should contain useful info such as:

  • PolySharp NuGet version 1.14..1
  • Operating system version Pop!_OS (Ubuntu) 22.04
  • .NET SDK version 8.0.100
  • Runtime is Unity 2022.3.9f1 (implements net48 and netstandard2.1)
Lordfirespeed added a commit to lc-sigurd/avalonia-bepinex-console that referenced this issue Mar 3, 2024
@AArnott
Copy link

AArnott commented Jun 21, 2024

IsExternalInit must be emitted all the time, for all frameworks. Even if the framework already declares it.
The explanation of why is here: manuelroemer/IsExternalInit#5

@Sergio0694
Copy link
Owner

"IsExternalInit must be emitted all the time, for all frameworks."

This is not accurate. PolySharp generates the correct [TypeForwardedTo] in that case, instead of the polyfill. Not generating the polyfill is only a binary breaking changes if you don't generate the correct forwards, but PolySharp does that, so that's fine.

"Compilation succeeds, but IsExternalInits type is not included in the compiled assembly targeting netstandard2.1."

@Lordfirespeed I need more info from your end. First, I can't repro this:

image

Second, how is your project even compiling at all, if you're saying the .NET Standard 2.1 target doesn't have that polyfill?

Are you sure you're not looking at the wrong place or perhaps it was just VS not showing all generated files correctly?

@Sergio0694 Sergio0694 added the needs more info Can't repro or unclear issue, needs further info label Jun 21, 2024
@AArnott
Copy link

AArnott commented Jun 21, 2024

@Sergio0694 You are quite right. Brilliant solution that I hadn't thought of so didn't check for. My apologies for spreading FUD.

@Sergio0694
Copy link
Owner

All good, no worries! Just wanted to make sure there were no misunderstandings! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Can't repro or unclear issue, needs further info
Projects
None yet
Development

No branches or pull requests

3 participants