digimezzo / dopamine-windows

Audio player which tries to make organizing and listening to music as simple and pretty as possible.
https://digimezzo.github.io/site/
GNU General Public License v3.0
1.88k stars 263 forks source link

Constructing NotificationService failed on startup #762

Closed darkon42 closed 6 years ago

darkon42 commented 6 years ago

I'm submitting a...


[X] Regression 
[ ] Bug report  
[ ] Feature request

Could this be related to #502 ? as it seems to also be linked to the NotificationService.

I'm using these versions

Reproduction steps

Observed behavior

Crashes on start-up.

Log indicated an issue with the NotificationService. Reverting back to 1.3, Dopamine starts normally.

Desired behavior

Open window

Log file

System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Stack trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Inner Exception 1: System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) 2018-05-20 12:46:27.692|Error|App.xaml.RegisterTypes|270|Constructing NotificationService failed. Falling back to LegacyNotificationService. Exception: Object reference not set to an instance of an object. 2018-05-20 12:46:27.811|Error|App.xaml.ExecuteEmergencyStop|501|Unhandled Exception. Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Stack trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Inner Exception 1: System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) 2018-05-20 12:49:10.191|Error|App.xaml.RegisterTypes|270|Constructing NotificationService failed. Falling back to LegacyNotificationService. Exception: Object reference not set to an instance of an object. 2018-05-20 12:49:10.333|Error|App.xaml.ExecuteEmergencyStop|501|Unhandled Exception. Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Stack trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Inner Exception 1: System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) 2018-05-20 12:49:17.840|Error|App.xaml.RegisterTypes|270|Constructing NotificationService failed. Falling back to LegacyNotificationService. Exception: Object reference not set to an instance of an object. 2018-05-20 12:50:54.196|Error|App.xaml.RegisterTypes|270|Constructing NotificationService failed. Falling back to LegacyNotificationService. Exception: Object reference not set to an instance of an object. -->
digimezzo commented 6 years ago

It looks like it's searching for a setting that it cannot find. I think there was an issue upgrading the settings from 1.3 to 1.5.14. Do you also have the crash when doing a clean install of 1.5.14?

digimezzo commented 6 years ago

I confirm this issue. I can reproduce it here. It's indeed a settings upgrade bug. It doesn't happen on a clean install. Only on an upgrade.

For developers: this is caused by the migration to Prism 7. Initialization of the services now happens earlier, before the settings migration. I'll make migration happen before the services initialization.

darkon42 commented 6 years ago

FYI I removed 1.3, rebooted, installed 1.5.14. Still crashes. See below. But if I delete the %appdata% folder, then it worked.

2018-05-21 08:27:22.995|Error|App.xaml.RegisterTypes|270|Constructing NotificationService failed. Falling back to LegacyNotificationService. Exception: Object reference not set to an instance of an object. 2018-05-21 08:27:23.046|Error|App.xaml.ExecuteEmergencyStop|501|Unhandled Exception. Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Stack trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at DryIoc.SingletonScope.GetOrAddItem(Object[] bucket, Int32 index, CreateScopedValue createValue) at DryIoc.SingletonScope.GetOrAdd(Int32 id, CreateScopedValue createValue) at DryIoc.ReflectionFactory.CreateServiceExpression(MemberInfo ctorOrMember, Expression factoryExpr, Expression[] paramExprs, Request request) at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) at DryIoc.Factory.GetExpressionOrDefault(Request request) at DryIoc.Factory.GetDelegateOrDefault(Request request) at DryIoc.Container.ResolveAndCacheDefaultDelegate(Type serviceType, Boolean ifUnresolvedReturnDefault) at Prism.DryIoc.Ioc.DryIocContainerExtension.Resolve(Type type) at Prism.Ioc.IContainerProviderExtensions.Resolve[T](IContainerProvider provider) at Dopamine.App.RegisterTypes(IContainerRegistry containerRegistry) at Prism.PrismApplicationBase.Initialize() at Prism.PrismApplicationBase.InitializeInternal() at Dopamine.App.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) Inner Exception 1: System.NullReferenceException: Object reference not set to an instance of an object. at Digimezzo.Utilities.Settings.SettingsClient.GetValue[T](String settingNamespace, String settingName) at Dopamine.Services.ExternalControl.ExternalControlService..ctor(IPlaybackService playbackService, ICacheService cacheService)

digimezzo commented 6 years ago

Thanks for confirming. I forgot that the appdata folder is not removed when uninstalling. But that is indeed what should fix it. As the settings are then re-created from scratch and would resolve this issue.