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

PolySharp.SourceGenerators.PolyfillGenerator is not generating files #74

Open
martinsuchan opened this issue Jun 9, 2023 · 3 comments

Comments

@martinsuchan
Copy link

In our solution of about 200 projects, all targeting .NET 4.7.2 and using SDK Style format, one project does not have any polyfills generated, see the screenshot. I have no idea why it's not working for this one specific project.
PXL_20230609_132001143

It should generate polyfills in all projects.
Is there a way how can I debug this package or polyfill? Is there any logging that I can read or exception that is thrown?

System info

Polysharp 1.13.2, VS 2022 17.6.2, project targeting .NET 4.7.2 in SDK style.
(Have you tested Polysharp in .NET 4.7.2 SDK style projects?)

Additional context (optional)

Note in each of our projects I can see this error/warning in the Analyzers section: POLYSP0003 Unsupported C# version, even though it works in all but one project. Possibly false positive?

@martinsuchan
Copy link
Author

Forgot to mention we have defined LangVersion 11.0 in our Directory.Build.props file.

@martinsuchan
Copy link
Author

I have repro!
Repro.zip

Tl;dr if a dependency project has PolySharp installed and uses InternalsVisibleTo("App"), then polyfills are not generated in App even when PolySharp is also included, but in this case C#11 features work becuase internals from dependency project are used.
The problem is if there are two dependencies with PolySharp and both with InternalsVisibleTo("App"). In this case it's not possible to use records/init properties and other features in App because there are two attributes available in the same namespace - ambiguation for the compiler.

How to solve it? Ideally generate polyfills even if there are polyfills available through InternalsVisibleTo from other asembly.
Also if possible fix the issue with POLYSP0003 warning.

@martinsuchan
Copy link
Author

Looks like a duplicate of #50

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

No branches or pull requests

1 participant