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
Assignees
Labels
area: Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. area-Clipboard Issues related to Clipboard

Comments

@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented Dec 9, 2024

  1. An object that implements only IDataObject interface can't be used in clipboard or drag and drop operations that use the new APIs
  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.
@Tanya-Solyanik Tanya-Solyanik self-assigned this Dec 9, 2024
@Tanya-Solyanik Tanya-Solyanik added the area-Clipboard Issues related to Clipboard label Jan 9, 2025
@KlausLoeffelmann KlausLoeffelmann added area: Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. and removed area: Analyzers and Fixers labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Analyzers/CodeFixes A Roslyn Analyzer is either needed for the context, needs to be scope extended or fixed. area-Clipboard Issues related to Clipboard
Projects
None yet
Development

No branches or pull requests

2 participants