I have a Visual Studio project in Dropbox, I have been working on this project from two different computers (NOT at the same time) but for some reason, it just stopped working on one computer, I can open it in one but when I try to open it from the other computer I see an error.
FYI - One computer is running Windows 7 and the Other one is running Windows 10 but both are running Visual Studio 2015. Also, I'm using MVVM Light in this solution.
Error:
TypeInitializationException was unhandled by user code
An exception of type 'System.TypeInitializationException' occurred in MyApp.exe but was not handled in user code
Additional information: The type initializer for 'MyApp.ViewModel.MainViewModel' threw an exception.
I tried cleaning the solution but nothing, no luck.
Any idea why it would stop working on one computer but not the other if it's the same solution?
EDIT: Added code.
namespace MyApp.ViewModel
{
public class ViewModelLocator
{
private static MainViewModel _main;
public ViewModelLocator()
{
_main = new MainViewModel();
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
"CA1822:MarkMembersAsStatic",
Justification = "This non-static member is needed for data binding purposes.")]
public MainViewModel Main
{
get
{
return _main;
}
}
public static void Cleanup()
{
}
}
}
Constructor fo MainViewModel
public MainViewModel()
{
CurrentViewModel = MainViewModel._findrViewModel;
FindrViewCommand = new RelayCommand(() => ExecuteFindrViewCommand());
CalculatorViewCommand = new RelayCommand(() => ExecuteCalculatorViewCommand());
ProductionTimesViewCommand = new RelayCommand(() => ExecuteProductionTimesViewCommand());
}