stride3d/stride · error · ArgumentNullException
Value cannot be null. (Parameter 'e')
Error message
Value cannot be null. (Parameter 'e')
What it means
Argument-null validation in UIElement.RaiseEvent: the RoutedEventArgs e is null. RaiseEvent identifies which RoutedEvent to raise from the event data carried in e; without it nothing can be routed, so it throws ArgumentNullException named 'e', exactly as the method's <exception> documentation declares. All the RaiseTouch*/RaiseKeyPressed helpers pass constructed event args, so this fires when user code calls RaiseEvent with null.
Solutions
- Pass a non-null RoutedEventArgs (or a derived type matching the RoutedEvent) to RaiseEvent.
- Construct the event args at the call site — e.g. in RaiseTouchDownEvent/RaiseKeyPressedEvent helpers — before raising, and never forward a null args reference.
- Guard call sites where event args come from an external source (input pipeline, pooling) and may be null.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at sources/engine/Stride.UI/UIElement.Events.cs:165 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/f516b54da9526210.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.UI/UIElement.Events.cs:165
RoutedEventHandlerInfoListPool.Enqueue(pooledList);
}
// propagate afterwards if bubbling
if (routedEvent.RoutingStrategy == RoutingStrategy.Bubble)
VisualParent?.PropagateRoutedEvent(e);
}
/// <summary>
/// Raises a specific routed event. The <see cref="RoutedEvent"/> to be raised is identified within the <see cref="RoutedEventArgs"/> instance
/// that is provided (as the <see cref="RoutedEvent"/> property of that event data).
/// </summary>
/// <param name="e">A <see cref="RoutedEventArgs"/> that contains the event data and also identifies the event to raise.</param>
/// <exception cref="ArgumentNullException"><paramref name="e"/> is null.</exception>
/// <exception cref="InvalidOperationException">The type of the routed event argument <paramref name="e"/> does not match the event handler second argument type.</exception>
public void RaiseEvent(RoutedEventArgs e)
{
if (e == null)
throw new ArgumentNullException(nameof(e));
if (e.RoutedEvent == null)
return;
if (!e.RoutedEvent.HandlerSecondArgumentType.GetTypeInfo().IsAssignableFrom(e.GetType().GetTypeInfo()))
throw new InvalidOperationException("The type of second parameter of the handler (" + e.RoutedEvent.HandlerSecondArgumentType
+ ") is not assignable from the parameter 'e' type (" + e.GetType() + ").");
var sourceWasNull = e.Source == null;
if (sourceWasNull) // set the source to default if needed
e.Source = this;
e.StartEventRouting();
PropagateRoutedEvent(e);
e.EndEventRouting();
View on GitHub (pinned to 96fad776d2)