public class InstallerStep { ... /// <summary> /// Класс страницы GUI /// </summary> public Type PageClass { get; set; } /// <summary> /// Страница /// </summary> public Page Page { get; set; } ... } private void CreateNewPageForCurrentStep() { ConstructorInfo constructorInfo = CurrentUserStep.PageClass.GetConstructor(new Type[] { }); CurrentUserStep.Page = (Page)constructorInfo.Invoke(new object[] { }); } on line
CurrentUserStep.Page = (Page)constructorInfo.Invoke(new object[] { }); creates an exception:
11.04.2016 10:28:27.983 Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType) at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at Installer.InstallerWizardData.InstallerData.CreateNewPageForCurrentStep() in C:\Задачи\KS-5600.Скрипты\cs-installer\Installer\Installer\InstallerWizardData\InstallerData.cs:line 117 at Installer.InstallerWizardData.InstallerData.NextPage() in C:\Задачи\KS-5600.Скрипты\cs-installer\Installer\Installer\InstallerWizardData\InstallerData.cs:line 95 at Installer.SystemClasses.NavigationButtonsControl.NextButton_Click(Object sender, RoutedEventArgs e) in C:\Задачи\KS-5600.Скрипты\cs-installer\Installer\Installer\SystemClasses\NavigationButtonsControl.xaml.cs:line 64 Object reference not set to an instance of an object. at Installer.WAS.Configuration.ConfigurationPage..ctor() in C:\Задачи\KS-5600.Скрипты\cs-installer\Installer\Installer\WAS\Configuration\ConfigurationPage.xaml.cs:line 39 How can this be fixed?
Pageclass look like? - GrundyPageClass- GrundyConfigurationPageclass. - VladD