dotnet / dotnet/wpf

IDataObjectAsyncCapability in .Net10

Open
#11,389 3 comments 1 reaction 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

Hi there

The migrating from .Net9 to .Net10 broke our DragDrop implementation for the new Outlook. We had the async DragDrop working for .Net9. But with .Net10, the ComObject needed to cast to the interface "IDataObjectAsyncCapability", so the (downloading) operation can be started with "StartOperation" (and ended with "EndOperation) is not accessible anymore in the .Net10 context.

### Reproduction Steps

` private object GetNativeIDataObject(DragEventArgs e)
{
// WPF IDataObject zu nativem COM IDataObject konvertieren
var wpfDataObject = e.Data;

// Reflection verwenden um an das native DataObject zu gelangen
var field = wpfDataObject.GetType()
.GetField("_innerData", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

if (field != null)
{
object innerData = field.GetValue(wpfDataObject);
var fields = innerData.GetType().GetFields(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

field = innerData.GetType().GetField("_innerData", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
innerData = field.GetValue(innerData);
return innerData;
}

// Alternative: OLE Clipboard verwenden
try
{
var oleDataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)wpfDataObject;
return oleDataObject;
}
catch
{
return wpfDataObject;
}
}`

In .Net10 the private field "_innerData" of "_innerData" is not accessible anymore and all other available objects do not match the interface signature of "IDataObjectAsyncCapability". In .Net9, the object referenced in _innerData._innerData could be casted to "IDataObjectAsyncCapability" to download the email to a temporary folder and then processing it further from there.

### Expected behavior

An ComObject able to cast to "IDataObjectAsyncCapability".

### Actual behavior

An object which is not castable "IDataObjectAsyncCapability".

### Regression?

Yes, it worked in .Net9.

Please see attached sample project. The only change has to be made in "DragDrop_Test.csproj", line 5:

net9.0-windows

does work

net10.0-windows

does NOT work.

(Please make sure, to clean and rebuild, so VS is executing the code in the correct .Net version context.)

### Known Workarounds

Switch back to .Net9

### Impact

New Outlook DragDrop does not work anymore.

### Configuration

VisualStudio 2026 / Windows 11 Pro / .Net9 & .Net10 / WPF

### Other information

[DragDrop_TestSample.zip](https://github.com/user-attachments/files/24864092/DragDrop_TestSample.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.