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 [SuppressGCTransition] to p/invoke calls #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nikeee
Copy link
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
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
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
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