3
Vote

Register throws exception when class without ctor and static field is registered

description

See this question (http://stackoverflow.com/questions/13284526/in-winrt-static-field-not-initialized-at-all/13285323#13285323) on Stackoverflow.

The problem is the method GetConstructorInfo in the SimpleIoc class which throws an exception "Multiple constructors found but none marked with PreferredConstructor", cause the class has a default ctor and a static ctor.

comments

Necroman wrote May 19, 2013 at 9:51 AM

Same here, I got these two constructors in MainViewModel, but I am getting exception that none has PreferredConstructor attribute:
    public MainViewModel()
    {
    }

    [PreferredConstructor]
    public MainViewModel(INavigationService navigationService)
    {
        _navigationService = navigationService;
        InitializeCommands();
    }