stride3d/stride · error · ArgumentNullException
ArgumentNullException: nodeContainer
Error message
ArgumentNullException: nodeContainer
What it means
The protected PropertiesViewModel constructor requires a NodeContainer that provides access to the inspected object's property nodes, and throws ArgumentNullException when it is null. The container is stored and used to create the GraphViewModelService.
Solutions
- Pass the valid NodeContainer from the session/asset node system
- Obtain it via NodeContainerFactory/ISessionService before constructing the view model
- Initialize the node container earlier in the view-model construction chain
Example fix
// before
public MyPropertiesViewModel(IViewModelServiceProvider sp) : base(sp, GetContainer()) { }
// after
public MyPropertiesViewModel(IViewModelServiceProvider sp) : base(sp, GetContainer() ?? throw new InvalidOperationException("NodeContainer not available")) { } Defensive patterns
Strategy: type-guard
Validate before calling
if (nodeContainer == null) throw new InvalidOperationException("NodeContainer must be resolved before creating PropertiesViewModel"); Type guard
static bool HasNodeContainer([NotNullWhen(true)] NodeContainer? nc) => nc is not null;
Try / catch
try { base(serviceProvider, nodeContainer); } catch (ArgumentNullException ex) { logger.LogCritical(ex, "NodeContainer missing in PropertiesViewModel"); throw; } Prevention
- Resolve the NodeContainer from the session before constructing derived view models
- Order initialization so node infrastructure exists before property views
- Enforce non-null base constructor arguments in derived class factories
When it happens
Trigger: Deriving from PropertiesViewModel and calling the base constructor with nodeContainer == null.
Common situations: Building a custom properties/editor view model where the NodeContainer came from an unresolved session or a not-yet-initialized node system.
Related errors
- entity must contain a non-null asset entity.
- ArgumentNullException: templates
- ArgumentNullException: dependencyManager
- ArgumentNullException: deletedObjects
- ArgumentNullException: removeAction
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/8450c9b5279f3941.
Report an issue: GitHub.
Appendix: source
Thrown at sources/editor/Stride.Core.Assets.Editor/Components/Properties/PropertiesViewModel.cs:44
{
protected readonly GraphViewModelService ViewModelService;
protected readonly NodeContainer NodeContainer;
private readonly object lockObject = new object();
private GraphViewModel viewModel;
private bool canDisplayProperties;
private string fallbackMessage;
private int currentToken;
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesViewModel"/> class.
/// </summary>
/// <param name="serviceProvider">The view model service provider to use.</param>
/// <param name="nodeContainer">The <see cref="NodeContainer"/> containing the nodes used to access object properties.</param>
protected PropertiesViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] NodeContainer nodeContainer)
: base(serviceProvider)
{
if (nodeContainer == null) throw new ArgumentNullException(nameof(nodeContainer));
NodeContainer = nodeContainer;
// Create the service needed to manage graph view models
ViewModelService = new GraphViewModelService(nodeContainer);
// Update the service provider of this view model to contains the GraphViewModelService we created.
ServiceProvider = new ViewModelServiceProvider(serviceProvider, ViewModelService.Yield());
RegisterNodePresenterCommand(new CreateNewInstanceCommand());
RegisterNodePresenterCommand(new AddNewItemCommand());
RegisterNodePresenterCommand(new AddPrimitiveKeyCommand());
RegisterNodePresenterCommand(new RemoveItemCommand());
RegisterNodePresenterCommand(new RenameStringKeyCommand());
RegisterNodePresenterCommand(new MoveItemCommand());
RegisterNodePresenterCommand(new FlagEnumSelectAllCommand());
RegisterNodePresenterCommand(new FlagEnumSelectNoneCommand());
RegisterNodePresenterCommand(new FlagEnumSelectInvertCommand());
View on GitHub (pinned to 96fad776d2)