Pregunta

According to this question, using ReactiveUI and CM should be a walk in the park: ReactiveUI and Caliburn Micro together? however I am having difficulties at the baby steps already.

I am going with my usual setup:

ShellViewModel + ShellView and different forms of ContentViewModel + ContentView and a simple MEF Bootstrapper.

I am also using Fody to weave the PropertyChanged and PropertyChanging for ReactiveUI, but I get the error without Fody, too.

[Export]
public class ShellViewModel : ReactiveObject
{
    public ShellViewModel()
    {
        ActiveItem = new ContentViewModel();
    }
    public ContentViewModel ActiveItem { get; set; }
}

and its XAML:

<Window x:Class="UiTest.Views.ShellView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ShellView" Height="300" Width="300">
    <ContentControl x:Name="ActiveItem"></ContentPresenter>
</Window>

The other two files are an empty class and usercontrol.

On application start I am greeted by a StackOverflowException in ReactiveUI.Core, which means I must be doing something fundamentally wrong. I would love for some kind of up to date documentation, if anyone has some, by the way.

Update

I only get the error when I am using RxUI 5.x, not when using RxUI 4.x. I have ruled out MEF being obnoxious: if instead of the ShellViewModel I make the ContentViewModel a ReactiveObject, it will still give us a nice stack overflow. This happens on ctor, by the way. Caliburn doesn't touch anything yet, so I guess I should change the topic title.

Stack trace:

System.Reactive.Core.dll!System.Reactive.ObserverBase<System.Exception>.ObserverBase() + 0x23 bytes 
    System.Reactive.Core.dll!System.Reactive.AnonymousObserver<System.Exception>.AnonymousObserver(System.Action<System.Exception> onNext, System.Action<System.Exception> onError, System.Action onCompleted) + 0x38 bytes 
    System.Reactive.Core.dll!System.Reactive.AnonymousObserver<System.Exception>.AnonymousObserver(System.Action<System.Exception> onNext) + 0x4c bytes 
    System.Reactive.Core.dll!System.Reactive.Observer.Create<System.Exception>(System.Action<System.Exception> onNext) + 0xd4 bytes 
ReactiveUI.dll!ReactiveUI.RxApp.Initialize() + 0xb9 bytes   
ReactiveUI.dll!ReactiveUI.RxApp.DependencyResolver.get() + 0x7c bytes   
ReactiveUI.dll!ReactiveUI.RxApp.Initialize() + 0xcd bytes   
ReactiveUI.dll!ReactiveUI.RxApp.DependencyResolver.get() + 0x7c bytes   
ReactiveUI.dll!ReactiveUI.RxApp.Initialize() + 0xcd bytes   
ReactiveUI.dll!ReactiveUI.RxApp.DependencyResolver.get() + 0x7c bytes   
ReactiveUI.dll!ReactiveUI.RxApp.Initialize() + 0xcd bytes   
ReactiveUI.dll!ReactiveUI.RxApp.DependencyResolver.get() + 0x7c bytes

... about 100.000 lines later:

ReactiveUI.dll!ReactiveUI.RxApp.Initialize() + 0xcd bytes   
ReactiveUI.dll!ReactiveUI.RxApp.DependencyResolver.get() + 0x7c bytes   
The maximum number of stack frames supported by Visual Studio has been exceeded.    
¿Fue útil?

Solución

This is a bug in the current version of ReactiveUI that I'll fix momentarily. Thanks for the report.

Update: This is fixed, grab 5.1.2 from the gallery.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top