Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 无效';sectionGroupName';保存用户首选项时发生异常_.net_Wpf_Settings_App Config_User Preferences - Fatal编程技术网

.net 无效';sectionGroupName';保存用户首选项时发生异常

.net 无效';sectionGroupName';保存用户首选项时发生异常,.net,wpf,settings,app-config,user-preferences,.net,Wpf,Settings,App Config,User Preferences,我正在开发一个基于.NETFramework4.5的WPF应用程序,系统上安装了.NET4.6。我使用UserPreference类来存储我的一些变量,并在退出应用程序时保存它们。 在退出应用程序时,有时我会观察到如下所述的异常 [09/14/15 12:01:49] Critical : APPLICATION : Application Error: System.Reflection.TargetInvocationException: Exception has been th

我正在开发一个基于.NETFramework4.5的WPF应用程序,系统上安装了.NET4.6。我使用UserPreference类来存储我的一些变量,并在退出应用程序时保存它们。 在退出应用程序时,有时我会观察到如下所述的异常

[09/14/15 12:01:49]  Critical : APPLICATION     : Application Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The parameter 'sectionGroupName' is invalid.
Parameter name: sectionGroupName
   at System.Configuration.MgmtConfigurationRecord.GetSectionGroup(String configKey)
   at System.Configuration.ClientSettingsStore.DeclareSection(Configuration config, String sectionName)
   at System.Configuration.ClientSettingsStore.GetConfigSection(Configuration config, String sectionName, Boolean declare)
   at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
   at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
   at System.Configuration.SettingsBase.SaveCore()
   at System.Configuration.SettingsBase.Save()
   at System.Configuration.ApplicationSettingsBase.Save()
   at MyWpfApplication2.Database.UserPreferenceManager.Save()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   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)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   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)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at MyWpfApplication2.AppController.App.Main()

我在谷歌上搜索了一些关于这个错误的信息,但没有一个人提到wpf应用程序。他们都在谈论web和其他方面,因此没有找到令人满意的答案。

您能给我们看一下引发此错误的代码吗?实际上,我不知道引发异常的确切代码,但我在UnhandledException()中捕获了此异常在app.xaml.cs中定义的方法。是否查看了内部异常详细信息?当应用程序通过exe而不是从visual studio运行时,我会收到此异常。所以除了这个调试,我什么都没有。还有一个问题是,我并不是每次都会遇到这个错误。还有一件事,一个计时器正在主线程上运行,当用户设置在3分钟后更改时,它会保存用户设置。OK。您能显示调用save的代码吗?与用户首选项交互的任何代码。另外,您是用C#、vb.net还是其他语言编写代码?您能告诉我们引发此错误的代码吗?实际上我不知道引发异常的确切代码,但我在UnhandledException()中捕获此异常在app.xaml.cs中定义的方法。是否查看了内部异常详细信息?当应用程序通过exe而不是从visual studio运行时,我会收到此异常。所以除了这个调试,我什么都没有。还有一个问题是,我并不是每次都会遇到这个错误。还有一件事,一个计时器正在主线程上运行,当用户设置在3分钟后更改时,它会保存用户设置。OK。您能显示调用save的代码吗?与用户首选项交互的任何代码。另外,您是用C#、vb.net还是其他语言编写代码的?