microsoft / microsoft/microsoft-ui-xaml

DragUI.SetContentFromDataPackage() with StandardDataFormats.Bitmap in data package where bitmap cannot be decoded causes crash on drag over

Open
#10,368 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-DragAndDrop needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

I'm using UWP but the equivalent exists in WindowsAppSDK (needs checking).

If I call DragUI.SetContentFromDataPackage() on drag starting, and I have set the data package contents to a bitmap which isn't valid (probably even can set a valid image of some type but which Windows can't decode), then on DragOver (if drop allowed and accepted) the app will crash. There's no way to catch the error (except perhaps in the unhandled exception handler). I haven't tested it but I imagine this might crash another app if dragging between apps (not actually sure which app will crash in that case). This should not result in a crash. It should simply either show a generic image icon or just the drag cursor or whatever is appropriate, there is no need to crash, and one can't always easily verify that the bitmap data set in the data package is something that can be decoded by Windows.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the drag-over crash with DragUI.SetContentFromDataPackage() and an undecodable StandardDataFormats.Bitmap, checking the UWP and WindowsAppSDK behavior mentioned in the report. Trace the drag-over handling and verify that invalid bitmap data no longer crashes the app and instead receives an appropriate fallback presentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.