Skip to content

fix #13508 Original text box is not empty after drag and drop the value to a new text box #13526

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

Merged
merged 1 commit into from
May 27, 2025

Conversation

Epica3055
Copy link
Member

@Epica3055 Epica3055 commented May 27, 2025

Fixes #13508

code snippet before PR13431

            {
                ClearDropDescription();
                DragDropHelper.Drop(dragEvent);
            }

            _owner.OnDragDrop(dragEvent);
            *pdwEffect = (DROPEFFECT)dragEvent.Effect;
        }
        else
        {
            *pdwEffect = DROPEFFECT.DROPEFFECT_NONE;
        }

        _lastEffect = DragDropEffects.None;
        _lastDataObject = null;
        return HRESULT.S_OK;
    }

code snippet after PR13431

    private HRESULT HandleOnDragDrop(DragEventArgs e, IDataObjectAsyncCapability* asyncCapability, DROPEFFECT* pdwEffect)
    {
#pragma warning disable WFO5003 // Type is for evaluation purposes only
        if (asyncCapability is not null && _owner is IAsyncDropTarget asyncDropTarget)
#pragma warning restore WFO5003
        {
            // We have an implemented IAsyncDropTarget and the drag source supports async operations, push to a
            // worker thread to allow the drop to complete without blocking the UI thread.
            Task.Run(() =>
            {
                DROPEFFECT effect = DROPEFFECT.DROPEFFECT_NONE;

                try
                {
                    asyncDropTarget.OnAsyncDragDrop(e);
                    effect = (DROPEFFECT)e.Effect;
                }
                finally
                {
                    HRESULT result = asyncCapability->EndOperation(HRESULT.S_OK, null, (uint)effect);
                    asyncCapability->Release();
                }
            });

            // It isn't clear what we're supposed to do with the effect here as the actual result comes from
            // EndOperation. Perhaps DROPEFFECT_COPY would be a better default?
            *pdwEffect = DROPEFFECT.DROPEFFECT_NONE;
            return HRESULT.S_OK;
        }

        // We don't have the IAsyncDropTarget or the drag source doesn't support async operations, so just call
        // the normal OnDragDrop.

        DROPEFFECT effect = DROPEFFECT.DROPEFFECT_NONE;

        try
        {
            _owner.OnDragDrop(e);
            effect = (DROPEFFECT)e.Effect;
        }
        finally
        {
            if (asyncCapability is not null)
            {
                HRESULT result = asyncCapability->EndOperation(HRESULT.S_OK, null, (uint)effect);
                asyncCapability->Release();
            }
        }

        return HRESULT.S_OK;
    }

I think we forgot to update *pdwEffect after _owner.OnDragDrop(dragEvent);

Proposed changes

  • update *pdwEffect after _owner.OnDragDrop(dragEvent);

Regression?

  • Yes

Screenshots

Before

Image

After

pull_13526

Test methodology

  • manually
Microsoft Reviewers: Open in CodeFlow

@Epica3055 Epica3055 requested a review from a team as a code owner May 27, 2025 06:41
@github-actions github-actions bot added the area-controls-PropertyGrid PropertyGrid and editor related issues label May 27, 2025
@Epica3055 Epica3055 requested a review from JeremyKuhne May 27, 2025 06:43
Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.40411%. Comparing base (9a17505) to head (5a9c261).
Report is 1 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #13526          +/-   ##
====================================================
+ Coverage   76.59478%   97.40411%   +20.80933%     
====================================================
  Files           3230        1176        -2054     
  Lines         639165      352557      -286608     
  Branches       47297        5356       -41941     
====================================================
- Hits          489567      343405      -146162     
+ Misses        146015        8398      -137617     
+ Partials        3583         754        -2829     
Flag Coverage Δ
Debug 97.40411% <ø> (+20.80933%) ⬆️
integration ?
production ?
test 97.40411% <ø> (ø)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JeremyKuhne JeremyKuhne merged commit 7ec2fbb into dotnet:main May 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-PropertyGrid PropertyGrid and editor related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Original text box is not empty after drag and drop the value to a new text box
2 participants