stride3d/stride · error · ArgumentNullException
ArgumentNullException: pasteResultItem
Error message
ArgumentNullException: pasteResultItem
What it means
Argument-null validation guard in UIHierarchyPasteProcessor.Paste: the pasteResultItem parameter is null when the paste operation is invoked. The processor needs a valid paste item to build the pasted UI element hierarchy; a null item means no content was actually pasted, so the operation is rejected immediately.
Solutions
- Ensure the copy/clone step produced a non-null IPasteItem before invoking Paste
- Guard the call site: skip paste (or show a message) when the paste item is null
- If using the built-in pipeline, confirm the clipboard actually contains copied UI elements before triggering paste
Example fix
// before
await processor.Paste(copiedItem, graph, ref accessor, ref container); // copiedItem may be null
// after
if (copiedItem != null)
await processor.Paste(copiedItem, graph, ref accessor, ref container); Defensive patterns
Strategy: type-guard
Validate before calling
if (pasteItem == null) return; // nothing to paste
Type guard
bool CanPaste(IPasteItem item) => item?.Data != null;
Try / catch
try { await processor.Paste(item, graph, ref accessor, ref container); }
catch (ArgumentNullException) { // clipboard was empty; show 'nothing to paste' feedback
} Prevention
- Check clipboard/clone result is non-null before invoking paste processors
- Unit-test the copy->paste round trip for custom processors
- Disable paste UI actions when the copy buffer is empty
When it happens
Trigger: Invoking the paste pipeline on a UI asset with a null IPasteItem — typically a null result from an upstream copy/clone step passed straight into Paste.
Common situations: Custom copy-paste processors or editor automation that call Paste directly with the result of a failed/absent copy operation; clipboard API returning null on empty paste buffer.
Related errors
- ArgumentNullException: child
- Custom strides is not supported with packed PixelFormats
- Model property is unset.
- The given component type does not inherit from…
- A region can only be specified for Textures with…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/89d21ad926fd8117.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Assets.Presentation/ViewModel/CopyPasteProcessors/UIHierarchyPasteProcessor.cs:23
using System.Threading.Tasks;
using Stride.Core.Assets;
using Stride.Core.Assets.Editor.Services;
using Stride.Core.Assets.Editor.ViewModel.CopyPasteProcessors;
using Stride.Core.Assets.Quantum;
using Stride.Core;
using Stride.Core.Quantum;
using Stride.Assets.Quantum;
using Stride.Assets.UI;
using Stride.UI;
using Stride.UI.Panels;
namespace Stride.Assets.Presentation.ViewModel.CopyPasteProcessors
{
public class UIHierarchyPasteProcessor : AssetCompositeHierarchyPasteProcessor<UIElementDesign, UIElement>
{
public override Task Paste(IPasteItem pasteResultItem, AssetPropertyGraph assetPropertyGraph, ref NodeAccessor nodeAccessor, ref PropertyContainer container)
{
if (pasteResultItem == null) throw new ArgumentNullException(nameof(pasteResultItem));
var propertyGraph = (UIAssetPropertyGraph)assetPropertyGraph;
var parentElement = nodeAccessor.RetrieveValue() as UIElement;
// 1. try to paste as hierarchy
var hierarchy = pasteResultItem.Data as AssetCompositeHierarchyData<UIElementDesign, UIElement>;
if (hierarchy != null)
{
// Note: check that adding or inserting is supported is done in CanPaste()
foreach (var rootUIElement in hierarchy.RootParts)
{
var asset = (UIAssetBase)propertyGraph.Asset;
var insertIndex = parentElement == null ? asset.Hierarchy.RootParts.Count : ((parentElement as Panel)?.Children.Count ?? 0);
propertyGraph.AddPartToAsset(hierarchy.Parts, hierarchy.Parts[rootUIElement.Id], parentElement, insertIndex);
}
}
return Task.CompletedTask;
}View on GitHub (pinned to 96fad776d2)