I have a WPF application. I have written the application in MVVM design pattern & calling My main View model from App.xaml.cs.
public partial class App : Application
{
private MainViewModel myVM;
**other variables declaration...................
protected override void OnStartup(StartupEventArgs e)
{
udocVM = new MainViewModel(window, msgBoxService, udocBl, docBl);
mainWindow.DataContext = udocVM;
}
}
So I am getting Code Analysis Critical Error for this:--
MainViewModel.MainViewModel(IWindowFactory, IMessageBoxService, IBl, IDocCenterBL, AutoResetEvent)' contains a call chain that results in a call to a virtual method defined by the class.
So how to fix this issue? Do I need to move this code in Xaml code behind file (MainWindow.xaml.cs)?