winforms
winforms copied to clipboard
Add RCW for IDataObject
Or better, I should just finish https://github.com/dotnet/winforms/pull/7087
Thank you. However, the biggest qestion here is how we test this? And ensure we haven't missed anything else...
Or better, I should just finish #7087
We're in RC1 and the runway is too small for any significant changes, and risks are too great
I can help test this, possibly. It needs to be an end to end test like the drag & drop tests in UIIntegration
, but the drag operation needs to start from Explorer. My problem is I don't know how to automate the mouse drag & drop operation from Explorer yet.
If I knew how to get the coordinates of a file located on the screen, I could write the test.
I thin we need something more complicated then UIIntegration
. Maybe some "test running" which will run EXE files and then perform interaction over the OS. Maybe we can automate interaction using https://github.com/Microsoft/WinAppDriver . Probably that way we will test and Accessibility itself albeit indirectly.
Basically less risky change would be undo these 2 changes in this file https://github.com/dotnet/winforms/pull/6976/files#diff-efdc83ac4513276157401c19a46f9c20f7c2aa84d9b9eb1cd19f37aca86420d5R33 Also we should add tests, so this issue will never appears on our radar.
I can help test this, possibly. It needs to be an end to end test like the drag & drop tests in
UIIntegration
, but the drag operation needs to start from Explorer. My problem is I don't know how to automate the mouse drag & drop operation from Explorer yet.
It's possible to open an new instance of Explorer and select a file in it, e.g. cmd /c "explorer /select,<full path to file>"
. More docs are available at https://ss64.com/nt/explorer.html.
The question is how we can find the screen coordinates of that file... ~WinAppDriver appears to able to do this somehow: https://github.com/microsoft/WinAppDriver/blob/9c561a52ace7b57bb375bc752389731a68dbcc53/Samples/C%23/NotepadTest/ScenarioPopupDialog.cs#L81.~
Files in Windows Explorer are displayed in a ListView control, so each file/folder is just a listview item. Accessibility tools (e.g., Narrator, etc.) can work it out, so we should be able too.
Perhaps this could help https://docs.microsoft.com/windows/win32/winauto/uiauto-clientportal and https://docs.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomation-getfocusedelement
Pinging @vladimir-krestov for ideas.
It's possible to open an new instance of Explorer and select a file in it, e.g. cmd /c "explorer /select,
". More docs are available at https://ss64.com/nt/explorer.html.
Thank you.
I'm still trying to answer the question of how we can reliably find the screen coordinates of that file, but for the record, I can reproduce the issue in a UIIntegration
test if I hard code the Explorer screen coordinates and drag to the application.
A manual test that already exists and reproduces this issue is in WinformsControlsTest.DragDrop
.
I will test these changes.
Basically less risky change would be undo these 2 changes in this file https://github.com/dotnet/winforms/pull/6976/files#diff-efdc83ac4513276157401c19a46f9c20f7c2aa84d9b9eb1cd19f37aca86420d5R33 Also we should add tests, so this issue will never appears on our radar.
@kant2002 the team has chatted and we think it's probably for the best that we do as you suggest here for .NET 7, and we take the completed fix in .NET 8 with the additional testing. Does that work for you?
Yes. I think so too. I think smallest thing to undo would be just 2 lines but if you think whole PR should be undone I'm fine. We should have stable WinForms a priority
Yes. I think so too. I think smallest thing to undo would be just 2 lines but if you think whole PR should be undone I'm fine. We should have stable WinForms a priority
if we do not have any other known scenario regressed and this reported scenario is fixed by undoing those two lines, we should stick to those lines in this and monitor for any new reports. Meanwhile, I will ask our test team to run some drag/drop scenarios to see if there are any pri0 scenarios that need to be addressed?
@kant2002 tested this PR using 2 sample projects, the issue still repro. Please take a look, thanks.
One project is from https://github.com/c-ohle/RationalNumerics with targeting the latest .Net 7.0
Another is the one we created about drag-dropping image on pictureBox in Winforms from file explorer:
WinFormsApp14.zip
@kant2002 , did you get a chance to look latest comments here?
Basically less risky change would be undo these 2 changes in this file #6976 (files)
Would you be able to action this? The window for RC1 is closing fast.
If only undo, I can do that.
@kant2002 , would it be possible to make the requested changes here before coming Monday?
@RussKie - I now know how to write the automated test, dragging from Explorer, using IUIAutomation::GetFocusedElement
and IUIAutomationElement::GetClickablePoint
. Your help has been invaluable.
@RussKie Igor Velikorossov FTE - I now know how to write the automated test, dragging from Explorer, using
IUIAutomation::GetFocusedElement
andIUIAutomationElement::GetClickablePoint
. Your help has been invaluable.
You're giving me too much credit. I randomly blurbed something and you did all the work :) And now I'm eager to learn how to do that, you'll have to show us a test.
You're giving me too much credit. I randomly blurbed something and you did all the work :) And now I'm eager to learn how to do that, you'll have to show us a test.
I mean all of your help so far, you are like a code whisperer.
I'm unsure how to proceed with the test, should I create a separate issue?
I'm unsure how to proceed with the test, should I create a separate issue?
Yes please.
The current status of this "draft" PR has persisted for over 180 days, making it highly probable that it is no longer aligned with the latest codebase. Our repository is set up to automatically close draft PRs that have become outdated, and it requests the author to revisit and reopen them if they deem it necessary, thereby bringing them to the team's attention.