When i try to open my MainForm in Visual Studio in the designer, this error pops up instead of the designer of the Visual Studio.
Can't find the SubSonicService section of the application config file
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
It worked before and there are a lot of other Forms/Controls in the Project and they work. I also can build my project and run it without any problems, it seems just to be the designer.
My app.config has a section of SubSonic and i didn't change it so it should be correct because it worked before.
I use C# with Visual Studio 2005 and .net 2 with SubSonic 2, i can't switch, it's an existing project.
Has anyone a idea how to fix this?
I think you try to load a subsonic object in the constructor of your main form or any other custom control in it. This is a common error that happen with other objects that don't work within the designer. For this case there is a property DesignMode which you can check:
That said, I would suggest to not rely on the app.config to configure subsonic in windows forms projects. There are different ways to inject a provider into subsonic2 without using a app.config. In a web project there is always an web.config file that holds most config options for the whole project but in a windows forms app there are other challenges like:
Look at my answer here: Subsonic: dynamic connections how to do this.
(the code isn't from me but the original page is down)
This method works like a charm for me.