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 code analyzers to enforce that ITypedDataObject interface is implemented for data objects #12608

Open
Tanya-Solyanik opened this issue Dec 9, 2024 · 0 comments

Comments

@Tanya-Solyanik
Copy link
Member

  1. An object that implements only ITypedDataObject interface can't be used in clipboard or drag and drop operations
  2. Suggest implementing ITypedDataObject interface whenever IDataObject interface is implemented, otherwise the typed APIs such as Clipboard.TryGetData(...) and DataObject.TryGetData(..) would throw an unsupported exception when invoked.
  3. When overriding virtual methods in the WinForms concrete DataObject class, suggest overriding protected virtual bool TryGetDataCore as well to support the new APIs
  4. if Clipboard.SetData or Clipboard.SetDataObject, or DataObject.SetData is invoked with an IDataObject data, verify if ITypeDataObject is implemented as well and suggest implementing it if it's not implemented.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant