-
Notifications
You must be signed in to change notification settings - Fork 7
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
Suggestion: Allow code marking to be disabled/less intrusive #112
Comments
Hi, I have a few questions:
|
To be honest, I use DisposableFixer as a VS-wide extension for all my projects. However for SharpDX it is even more valuable as failure to properly dispose causes system-level DX warnings to be thrown, and significant memory leaks. Very undesirable.
All sharpDX components have to follow the DirectX model of destruction; meaning, they have to deallocate their resources in the reverse order in which they were created (a good example article about this subject). With this in mind, the screenshot I provided you was a sample of a function called "InitDX" which does all the initial allocation and configuration of each required object in order, and stores them in the class as private objects (which are dually exposed as public Fields for ease of use in certain cases). When the class is Disposed, it calls a function "DestroyDX" which disposes and destroys each object:
and DisposeSafe is just a simple wrapper function that does the following (I borrowed the code from the SharpDX Utilities class (Line 1186) and added my own logging functions for tracking):
It was included as that small second image with the red arrow. EDIT: I did some looking into, and I think it's actually called a "code suggestion" which is new for VS2017. The following screen shot was taken from the current-day manifestation of the CopFX project located at the Visual Studio Marketplace.
This is the latest stable version, 4.2.0. SharpDX code is rather difficult to piece together as it's mostly partial classes that get combined. Even I get lost trying to find things in the source, and documentation tends to be very sparse. Most of the time, SharpDX interface objects are simply COM wrappers around the native DirectX interface (that usually matches it in name). So for SwapChain1, it would be wrapping IDXGISwapChain1. Thank you so much for considering this improvement! |
Hi, Severity Level: Until I checked this, I was not sure this would change the underlining. But it works. Special Dispose Methods: The DisposableFixer is already aware of the situation, that a Dispose class is not always like
To add this, I need the complete signature of the dispose method including class and namespace name. As I see it, this should be But this will not help you, since you are using your own wrapper. I don't think this is open source? I don't want to add configurations for closed source projects, because I can't test and verify that these are working and it would be to much. But we have an other possibility: If this works, then I can create an annotations package, that you can reference (pretty much like JetBrains.Annotations). |
@szalkerous Is this still an issue? |
@BADF00D I apologize for not keeping up with this issue. I will take your suggestion regarding the code marking and try it out in VS2019, along with the As for the SharpDX code, it is all open source. The utilities class with the Dispose functionality is located here. |
More often than not I find DisposableFixer is marking the code constantly for objects that are disposed elsewhere in the code properly. This results in the code editor being littered with code marking that is unnecessary (see example 1). I realize it would be improbable to be able to efficiently detect every object's proper disposal, so a good compromise would be the configurable setting to disable code marking (using the error list or build process as a reference instead) or use the CopFx style marking (small dots under the beginning of the object, as seen in example 2)
Thank you for considering this suggestion, it would make a world of difference!
The text was updated successfully, but these errors were encountered: