-
Notifications
You must be signed in to change notification settings - Fork 94
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
Consider implementing Dispose pattern for handle typedefs #596
Comments
I think this will be blocked by the solution in #610, which should establish how to reliably identify what nativedef structs are handles. |
I don't think so... #610 is about picking which structs should get an |
Yes, I guess we have to know HOW to release it, to be able to release it. Adding this won't be too bad. |
Should this be able to be turned on/off by a setting? Or would there be no benefit in that? |
I don't anticipate any downside to it, so I wouldn't add a switch unless a downside presents itself. |
@AArnott if we add |
The handle struct would no longer be blittable and would also be subject to tearing. |
So we can't use |
No, it's not the So maybe we could do the IDisposable struct thing if we new analyzers don't and would never call out disposing them. But I'm leaning against doing it at all given that's SafeHandle territory. |
That is probably a good idea. So should we close this issue or limit it to structs without associated methods tagged with |
Given the risk that an analyzer exists or comes long that would try to coerce people to dispose of their typedef structs, I'd lean toward not implementing |
When a typedef struct represents a releasable handle, we could implement
IDisposable
so that C#using
syntax would allow deterministic release of these handle.The text was updated successfully, but these errors were encountered: