System::Diagnostics::Trace ConfigurationErrorsException Visual Studio 2012 RRS feed

  • Question

  • HiWhen I migrate projects from Visual Express 2008 to Visual Studio 2012 the following exception breaks my program(cause by Trace::WriteLine):

    I used to use Visual Studio 2005 and Visual Express 2008 before.

    I used System::Diagnostic::Trace and Debug::WriteLine very often.

    An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll

    Additional information: Configuration system failed to initialize

    Any suggestions will be appreciated

    Example of project:

    using namespace System;

    using namespace System::Collections;

    using namespace System::Windows::Forms;

    using namespace System::Diagnostics;

    public ref class Form1 : public System::Windows::Forms::Form








    /// <summary>

    /// Clean up any resources being used.

    /// </summary>



    if (components)


    delete components;



    private: System::Windows::Forms::Button^  button1;


    System::ComponentModel::Container ^components;

    #pragma region Windows Form Designer generated code

    void InitializeComponent(void)


    this->button1 = (gcnew System::Windows::Forms::Button());


    this->button1->Location = System::Drawing::Point(112, 57);

    this->button1->Name = L"button1";

    this->button1->Size = System::Drawing::Size(111, 41);

    this->button1->TabIndex = 0;

    this->button1->Text = L"button1";

    this->button1->UseVisualStyleBackColor = true;

    this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

    this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);

    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

    this->ClientSize = System::Drawing::Size(292, 266);


    this->Name = L"Form1";

    this->Text = L"Form1";



    #pragma endregion

    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

    Trace::WriteLine( "line1" );




    Thursday, November 15, 2012 11:18 AM


  • Hi Lesze,

    Welcome to the MSDN Forum.

    What is the call stack?

    And how about these action?

    1. Add <configSections></configSections> to the config file. Rebuild and run. How about it?

    2. How many appSettings do you have in the config file?

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 16, 2012 3:33 PM