My Application will not launch after Windows startup, the application is registered in the register editor with the right path to my application exe.
here is my code to register my application to the register editor
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RUN", true);
if (e.PropertyName == nameof(isStartOnStartup))
{
if (isStartOnStartup)
{
reg.SetValue("CommunicationHub", Process.GetCurrentProcess().MainModule.FileName);
Settings.Default.Startup = true;
Settings.Default.Save();
}
else
{
reg.DeleteValue("CommunicationHub");
Settings.Default.Startup = false;
Settings.Default.Save();
}
}
}
I have checked EventViewer for crashes and have aswell added logging to the application root, both gave me nothing.
I have disabled UAC, to check if it was the administrator right that was hindering the application from running, still no result.
i feel lost, i hope someone can help me with the problem..