Skip to content

Define the polyfills of DynamicallyAccessedMembers only where they are missing - #383

Open
AlexanderV wants to merge 1 commit into
empira:masterfrom
AlexanderV:upstream/polyfill-guards
Open

Define the polyfills of DynamicallyAccessedMembers only where they are missing#383
AlexanderV wants to merge 1 commit into
empira:masterfrom
AlexanderV:upstream/polyfill-guards

Conversation

@AlexanderV

Copy link
Copy Markdown

DynamicallyAccessedMembersAttribute and DynamicallyAccessedMemberTypes in PdfSharp.Shared/dotnet/CodeAnalysis.cs are compiled for every target framework below .NET 8:

#if !NET8_0_OR_GREATER

Both types exist since .NET 5, so building the sources for .NET 6 or .NET 7 fails with CS0433 — the type exists in both PdfSharp.Shared and System.Runtime (388 errors in my build for net6.0).

The condition is now NET462 || NETSTANDARD2_0, i.e. the polyfills are compiled where the types are really missing. PdfSharp.System/dotnet/CodeAnalysis.cs already disables its copy for the same reason.

No effect on the target frameworks PDFsharp is built for today — the block was already excluded for net8.0/net9.0/net10.0 and is unchanged for netstandard2.0.

Verified on top of current master: builds for net10.0 and netstandard2.0, full PdfSharp.Tests suite green (252 passed, 0 failed).

This PR is independent of my other PRs; each of them applies to master on its own.

…e missing

Both DynamicallyAccessedMembersAttribute and DynamicallyAccessedMemberTypes
were compiled for every target framework below .NET 8. Both types exist since
.NET 5, so compiling the sources for .NET 6 or .NET 7 fails with CS0433,
because the type exists in PdfSharp.Shared and in System.Runtime.

They are now compiled for .NET Framework 4.6.2 and .NET Standard 2.0 only,
which is where they are really missing. The target frameworks PDFsharp is
built for are not affected.
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.

2 participants