IVsCoTaskMemFreeMyStrings Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Used in association with certain other interfaces to indicate that strings returned from those interfaces should be freed by the caller.
public interface class IVsCoTaskMemFreeMyStrings
public interface class IVsCoTaskMemFreeMyStrings
__interface IVsCoTaskMemFreeMyStrings
[System.Runtime.InteropServices.Guid("47811DA4-330F-4EB5-9D14-BBC82773DA66")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsCoTaskMemFreeMyStrings
[<System.Runtime.InteropServices.Guid("47811DA4-330F-4EB5-9D14-BBC82773DA66")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsCoTaskMemFreeMyStrings = interface
Public Interface IVsCoTaskMemFreeMyStrings
- Attributes
Remarks
Normal COM rules require that any string passed back to a caller should be a copy of the string that the caller eventually disposes of. In other words, the caller is given ownership of the string and can dispose of the string when the caller sees fit.
Some interfaces in the Visual Studio extensibility space do not adhere to this rule of passing ownership to the caller for performance reasons. The callers of those special interfaces understand this change in the rule and do not attempt to dispose of the string. However in managed code, the parameter declarations for returned strings in those special interfaces imply always passing ownership of the string to the caller.
Managed code should implement the IVsCoTaskMemFreeMyStrings interface on those specific interfaces to indicate that the string really should be freed by the caller; otherwise, the caller does not free the string.
Notes to Implementers
Implement this interface on the same interfaces that contain the following methods. Implementing this interface indicates that the string returned from the following methods is to be disposed of by the caller; otherwise, the string is not disposed of.
GetText(UInt32, VSTREETEXTOPTIONS, String) (IVsLiteTreeList interface)
GetTipText(UInt32, VSTREETOOLTIPTYPE, String) (IVsLiteTreeList interface)
GetSourceContext(UInt32, IntPtr, UInt32) (IVsObjectList interface)
GetText(UInt32, VSTREETEXTOPTIONS, String) (IVsObjectList interface)
GetNameAt(UInt32, IntPtr) (IVsLibraryMgr interface)
GetSeparatorString(String[]) (IVsLibrary interface)
GetDisplayText(Int32, String, Int32[]) (IVsCompletionSet interface)
FullTextRead(String, Int32) (IVsFullTextScanner interface)
Read(String, Int32) (IVsTextScanner interface)
GetEntryText(Int32, Int32, String) (IVsDropdownBarClient interface)
Image_FullTextRead(String, Int32) (IVsPersistentTextImage interface)
Notes to Callers
If you have unmanaged code calling into managed code to one of the methods in the list shown in the Notes for Implementers section, call the QueryInterface
method on the interface that contains the method to obtain the IVsCoTaskMemFreeMyStrings interface. If the IVsCoTaskMemFreeMyStrings interface can be obtained, you are responsible for freeing the string by calling the FreeCoTaskMem
function (not the SysFreeString
function). If you cannot obtain the IVsCoTaskMemFreeMyStrings interface, do not attempt to free the returned string.