Skip to content

Add [SuppressGCTransition] to p/invoke calls#126

Open
nikeee wants to merge 1 commit intojingwood:masterfrom
nikeee:SuppressGCTransition
Open

Add [SuppressGCTransition] to p/invoke calls#126
nikeee wants to merge 1 commit intojingwood:masterfrom
nikeee:SuppressGCTransition

Conversation

@nikeee
Copy link
Copy Markdown
Contributor

@nikeee nikeee commented Oct 30, 2024

See:
https://devblogs.microsoft.com/dotnet/improvements-in-native-code-interop-in-net-5-0/#suppressgctransition

This is a backport of what I've been using in nud2dlib:
nikeee/nud2dlib@79361de

Didn't encouter any issues in real-world uses.

@jingwood
Copy link
Copy Markdown
Owner

jingwood commented Nov 2, 2024

Thanks, @nikeee!

But our d2dlibexport project is targeted to net462 and netstandard2.0, the SuppressGCTransition attribute is not included in these .NET frameworks. And this PR will build failed.

(Seems in your forked project you have .NET6 Desktop framework.)

@nikeee
Copy link
Copy Markdown
Contributor Author

nikeee commented Nov 2, 2024

Oh yes, I didn't think of that. Then maybe this is something for a version far in the future that may target only .NET >= 6. If this is even planned. Just close this PR or shelve it, I don't mind.

@drewnoakes
Copy link
Copy Markdown
Collaborator

We could add a newer target and ifdef the attribute.

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