unoplatform/uno · error · Error
The current DragDropExtension does not match the provided ar
Error message
The current DragDropExtension does not match the provided args
What it means
Thrown by DragDropExtension.disable when the provided pArgs does not match the _dispatchDropArgs stored during enable. This guard prevents one consumer from disabling a DragDropExtension that was enabled by a different consumer (mismatched enable/disable pairs).
Source
Thrown at src/Uno.UI/ts/Windows/ApplicationModel/DataTransfer/DragAndDropExtension.ts:36
if ((<any>globalThis).DotnetExports !== undefined) {
DragDropExtension._dispatchDropEventMethod = (<any>globalThis).DotnetExports.UnoUI.Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension.OnNativeDropEvent;
} else {
throw `DragDropExtension: Unable to find dotnet exports`;
}
}
if (DragDropExtension._current) {
throw new Error("A DragDropExtension has already been enabled");
}
DragDropExtension._dispatchDragDropArgs = pArgs;
DragDropExtension._nextDropId = 1;
DragDropExtension._current = new DragDropExtension();
}
public static disable(pArgs: number): void {
if (DragDropExtension._dispatchDragDropArgs != pArgs) {
throw new Error("The current DragDropExtension does not match the provided args");
}
DragDropExtension._current.dispose();
DragDropExtension._current = null;
DragDropExtension._dispatchDragDropArgs = null;
}
constructor() {
// Events fired on the drop target
// Note: dragenter and dragover events will enable drop on the app
this._dropHandler = this.dispatchDropEvent.bind(this);
document.addEventListener("dragenter", this._dropHandler);
document.addEventListener("dragover", this._dropHandler);
document.addEventListener("dragleave", this._dropHandler); // Seems to be raised also on drop?
document.addEventListener("drop", this._dropHandler);
// Events fired on the draggable target (the source element)
//this._dragHandler = this.dispatchDragEvent.bind(this);View on GitHub (pinned to 0418340488)
Solutions
- Pass the exact same pArgs value to disable that was passed to enable — store it and reuse it.
- Ensure enable/disable calls are balanced per consumer; do not let consumer A disable consumer B's extension.
Example fix
// before: mismatched args DragDropExtension.enable(argsA); DragDropExtension.disable(argsB); // argsA !== argsB → throws // after: balanced pair DragDropExtension.enable(argsA); DragDropExtension.disable(argsA); // matches
Defensive patterns
Strategy: validation
Validate before calling
// Ensure args match before disabling
if ((<any>DragDropExtension)._dispatchDragDropArgs === pArgs) {
DragDropExtension.disable(pArgs);
} Try / catch
try {
DragDropExtension.disable(pArgs);
} catch (e) {
if (e.message.includes('does not match')) {
// args mismatch — log and reconcile state
} else { throw e; }
} Prevention
- Store the pArgs from enable and pass the exact same value to disable.
- Never let one consumer disable another consumer's extension.
- Log enable/disable args pairs to detect mismatches during debugging.
When it happens
Trigger: disable is called with a pArgs pointer different from the one passed to the preceding enable, or disable is called when enable was never invoked (so _dispatchDropArgs is null and pArgs is a non-null pointer).
Common situations: Two different drop targets each with their own args calling disable on the shared singleton; a stale args handle from a disposed managed object; calling disable after the extension was already disabled by another path.
Related errors
- A DragDropExtension has already been enabled
- No pending drag and drop data.
- retrieveFiles failed to find pending drag and drop data for
- Item ${guid} is a directory handle. You cannot use it as a F
- Item ${guid} is of an unknown type. You cannot use it as a F
AI-assisted analysis of unoplatform/uno@0418340488 (2026-08-13).
Data as JSON: /api/errors/c9da39f1eeddad6c.
Report an issue: GitHub.