Browse Source
Allow IDataObjectAsyncCapability (#13431)
Allow IDataObjectAsyncCapability (#13431)
Chromium based apps don't support file drop without using IDataObjectAsyncCapability. This includes the new Outlook. To support this we'll look for this interface in our current code paths and utilize it. This makes the async operation sync, which works, but isn't ideal. Chromium will pop a dialog that will leave WinForms modal as well until it is responded to. If this behavior creates an issue it can be disabled with the appcontext switch: "Windows.DragDrop.DisableSyncOverAsync" In order to truly support async we're also introducing a new interface to allow calling back off of the UI thread. This will be shipped as experimental for .NET 10 as there is a small risk we'll want to change the API based on real-world feedback. See #13422.pull/13479/head

committed by
GitHub

No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 181 additions and 12 deletions
-
1docs/list-of-diagnostics.md
-
7src/Common/tests/TestUtilities/AppContextSwitchNames.cs
-
1src/System.Private.Windows.Core/src/NativeMethods.txt
-
30src/System.Private.Windows.Core/src/System/Private/Windows/CoreAppContextSwitches.cs
-
1src/System.Windows.Forms.Analyzers/src/System/Windows/Forms/Analyzers/Diagnostics/DiagnosticIDs.cs
-
2src/System.Windows.Forms/PublicAPI.Unshipped.txt
-
115src/System.Windows.Forms/System/Windows/Forms/OLE/DropTarget.cs
-
36src/System.Windows.Forms/System/Windows/Forms/OLE/IAsyncDropTarget.cs
@ -0,0 +1,2 @@ |
|||
[WFO5003]System.Windows.Forms.IAsyncDropTarget |
|||
[WFO5003]System.Windows.Forms.IAsyncDropTarget.OnAsyncDragDrop(System.Windows.Forms.DragEventArgs! e) -> void |
@ -0,0 +1,36 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
|
|||
using System.Windows.Forms.Analyzers.Diagnostics; |
|||
|
|||
namespace System.Windows.Forms; |
|||
|
|||
/// <summary>
|
|||
/// Interface for a drop target that supports asynchronous processing.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// <para>
|
|||
/// This is currently marked as experimental as there is some uncertainty around the API that might need
|
|||
/// to be addressed in the future. With additional scenario feedback, we will make changes if needed.
|
|||
/// </para>
|
|||
/// </remarks>
|
|||
[Experimental(DiagnosticIDs.ExperimentalAsyncDropTarget, UrlFormat = DiagnosticIDs.UrlFormat)] |
|||
public interface IAsyncDropTarget : IDropTarget |
|||
{ |
|||
/// <summary>
|
|||
/// When supporting this interface, this method will be callled if the drop source supports asynchronous processing.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// <para>
|
|||
/// Similar to <see cref="IDropTarget.OnDragDrop"/>, but this method is called when a drop operation supports
|
|||
/// asyncronous processing. It will not block the UI thread, any UI updates will need to be invoked to occur
|
|||
/// on the UI thread.
|
|||
/// </para>
|
|||
/// <para>
|
|||
/// Avoid dispatching the <see cref="DragEventArgs"/> back to the UI thread as invoking <see cref="DragEventArgs.Data"/>
|
|||
/// on the UI thread will block it until the data is available. If existing code needs <see cref="DragEventArgs"/>
|
|||
/// consider creating a new instance with a new <see cref="DataObject"/> that has extracted the data you're looking for.
|
|||
/// </para>
|
|||
/// </remarks>
|
|||
void OnAsyncDragDrop(DragEventArgs e); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue