Wouterdek / NodeNetwork

A C# library with a WPF node editor component based on ReactiveUI
Apache License 2.0
854 stars 150 forks source link

Facing an odd Issue in the hello world example. #109

Open Offline-R503B opened 3 years ago

Offline-R503B commented 3 years ago
DefaultViewLocator: Failed to resolve view for view model type 'System.Object'.

ViewModelViewHost: The ViewModelViewHost could not find a valid view for the view model of type NodeNetwork.ViewModels.NodeViewModel and value NodeNetwork.ViewModels.NodeViewModel.

I am getting these when trying to run the Hello World.

We are currently using the NodeNetwork in docked window (Syncfusion control)

If I run the Hello world in a normal window (Not part of docking) It works again.

Any help would be appreciated ! :D

Wouterdek commented 3 years ago

The Splat view locator is used to find the view type that corresponds to a viewmodel type (e.g. NodeViewModel => NodeView). For some reason, it is trying to locate a view for System.Object, which is not a viewmodel type and therefore fails. This probably means there is a ViewModelViewHost or listview somewhere that contains an object with type 'System.Object'. Beyond that, it's hard to tell what's going on without more context.

Offline-R503B commented 3 years ago

The Splat view locator is used to find the view type that corresponds to a viewmodel type (e.g. NodeViewModel => NodeView). For some reason, it is trying to locate a view for System.Object, which is not a viewmodel type and therefore fails. This probably means there is a ViewModelViewHost or listview somewhere that contains an object with type 'System.Object'. Beyond that, it's hard to tell what's going on without more context.

For giving context

As for our default MVVM framework we use Catel MVVM We used to have Avalon Docking (Dirksters lib) for docking.

We now obtained licenses for syncfusions controls and thus moved all docked windows to their library.

The interesting thing is that it used to work when we had avalondocks. But now that we switched , it doesn't seem to want to do that anymore.

If you happen to have some spare time to investigate : https://github.com/WolvenKit/WolvenKit Branch : dev

(sorry for the 2nd edit as I wrote a reply some1 merged the PR branch)

I personally think it might be of how the DockingManager / Adapter system of syncfusion works (they apply a sort of 'hack' to have it function in MVVM).

Thanks in advance !

Edit : Please do let me know / contact me if you do check it out , I might have to make a small edit so the tool will be visible without making a whole project ( I forgot not everyone has Cyberpunk 2077 installed haha )