This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I'm trying to imitate the Getting Started Video using a WinForm but keep getting the following error:
on this line of code: _context = new LightSpeedContext<CAFEPUnitOfWork>("default"); referring to the <lightSpeedContexts> section of my app.config file. My app.config file seem to be almost identical to that in the video What am I doing wrong?
------------------------------------------------------------------------- The full error is: System.Configuration.ConfigurationErrorsException was unhandled Message=Configuration system failed to initialize Source=System.Configuration BareMessage=Configuration system failed to initialize Line=0 StackTrace: at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection.Read() at Mindscape.LightSpeed.LightSpeedContext..ctor(String configurationName) at Mindscape.LightSpeed.LightSpeedContext`1..ctor(String configurationName) at LightSpeed1C.Form1.button1_Click(Object sender, EventArgs e) in M:\Visual Studio 2010\Projects\LightSpeed1C\LightSpeed1C\Form1.cs:line 28 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at LightSpeed1C.Program.Main() in M:\Visual Studio 2010\Projects\LightSpeed1C\LightSpeed1C\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Configuration.ConfigurationErrorsException Message=Unrecognized configuration section lightSpeedContexts. (M:\Visual Studio 2010\Projects\LightSpeed1C\LightSpeed1C\bin\Debug\LightSpeed1C.vshost.exe.Config line 6) Source=System.Configuration BareMessage=Unrecognized configuration section lightSpeedContexts. Filename=M:\Visual Studio 2010\Projects\LightSpeed1C\LightSpeed1C\bin\Debug\LightSpeed1C.vshost.exe.Config Line=6 StackTrace: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) InnerException: |
|
|
Your problem is that in the configSections declaration you have: <section name="lightSpeedContext" but when you use it you have: <lightSpeedContexts> i.e. singular vs. plural. It doesn't matter which you use but it needs to be the same in both places.
|
|
|
Thanks Ivan (embarrassed)
Regards ... Mark |
|