Thanks Nicko,

My problem is solved. I was missing this section in my program's app.config

Depsi

Nicko Cadell <[EMAIL PROTECTED]> wrote:
If you look at the InnerExceptions within the
TypeInitializationException you will see that the underling error is a
System.Configuration.ConfigurationErrorsException thrown by the .NET
runtime because the App.config file contains unrecognised elements.

You need to add this to your App.config file so that it is the first
element inside the element.



type="System.Configuration.IgnoreSectionHandler" />


Nicko

> -----Original Message-----
> From: Saurabh Dani [mailto:[EMAIL PROTECTED]
> Sent: 13 November 2005 03:04
> To: Nicko Cadell
> Subject: RE: TypeInitializationException was unhandled
>
> Thanks Nicko,
>
> A sample is attached here.
>
> Saurabh
>
>
> ________________________________
>
> Return-Path:
> > org> Sat Nov 12 18:29:59 2005
> Received: from hermes.apache.org [209.237.227.199] by
> mail25.webcontrolcenter.com with SMTP; Sat, 12 Nov 2005 18:29:59 -0700
> Received: (qmail 67107 invoked by uid 500); 13 Nov 2005 01:29:58 -0000
> Received: (qmail 67096 invoked by uid 99); 13 Nov 2005 01:29:58 -0000
> Received: from asf.osuosl.org (HELO asf.osuosl.org)
> (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP;
> Sat, 12 Nov 2005 17:29:58 -0800
> Received: from [80.168.17.114] (HELO hermes.neoworks.co.uk)
> (80.168.17.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat,
& gt; 12 Nov 2005 17:29:49 -0800
> Received: from kronos.neoworks.co.uk (kronos.neoworks.co.uk
> [10.0.0.132]) by hermes.neoworks.co.uk (8.13.1/8.13.1) with
> ESMTP id jAD1OoiT000865 for
> ; Sun, 13 Nov 2005 01:24:54 GMT
> Mailing-List: contact [EMAIL PROTECTED];
> run by ezmlm
> Precedence: bulk
> list-help:
> list-unsubscribe:
> List-Post:
> Reply-To: "Log4NET User"
> List-Id:
> Delivered-To: mailing list [email protected]
> X-ASF-Spam-Status: No, hits=0.8 required=10.0 tests=INFO_TLD,SPF_PASS
> X-Spam-Check-By: apache.org
> Received-SPF: pass (asf.osuosl.org: domain of
> [EMAIL PROTECTED] om designates 80.168.17.114 as permitted sender)
> Content-class: urn:content-classes:message
> Subject: RE: TypeInitializationException was unhandled
> MIME-Version: 1.0
> Content-Type: text/plain;
> charset="us-ascii"
> Content-Transfer-Encoding: quoted-printable
> x-mimeole: Produced By Microsoft Exchange V6.5.6944.0
> Date: Sun, 13 Nov 2005 01:29:28 -0000
> Message-ID:
>
> X-MS-Has-Attach:
> X-MS-TNEF-Correlator:
> Thread-Topic: TypeInitializationException was unhandled
> Thread-Index: AcXjlWjJng8sg0d8Qgq4PqpSyLu0+AEW9J4w
> From: "Nicko Cadell"
> To: "Log4NET User"
> X-Virus-Checked: Checked by ClamAV on apache.org
> X-SmarterMail-Spam: SPF_Pass
> X-Rcpt-To:
>
> Can you send me a complete (si mple) project that reproduces
> this. I have tried to reproduce this issue with the RTM build
> of .NET 2.0 in a Windows App and in an ASP.NET App. I have
> tried using the 1.2.9 log4net assembly build against .NET 1.0
> and with a version built against .NET 2.0. So far I have not
> been able to reproduce the TypeInitializationException.
>
> Thanks,
> Nicko
>
> > -----Original Message-----
> > From: Saurabh Dani [mailto:[EMAIL PROTECTED]
> > Sent: 05 November 2005 10:00
> > To: [email protected]
> > Subject: RE: TypeInitializationException was unhandled
> >
> > Is anyone else able to use log4net with ASP.net 2.0? I am
> getting same
> > exception with this sample program.
> >
> > Saurabh
> >
> >
> > ________________________________
> >
> > Return-Path:
& gt; >
> > org> Mon Oct 10 21:39:31 2005
> > Received: from hermes.apache.org [209.237.227.199] by
> > mail25.webcontrolcenter.com with SMTP; Mon, 10 Oct 2005
> 21:39:31 -0700
> > Received: (qmail 23025 invoked by uid 500); 11 Oct 2005
> 04:39:29 -0000
> > Received: (qmail 23014 invoked by uid 99); 11 Oct 2005
> 04:39:29 -0000
> > Received: from asf.osuosl.org (HELO asf.osuosl.org)
> > (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP;
> Mon, 10 Oct
> > 2005 21:39:29 -0700
> > Received: from [66.163.178.50] (HELO
> > web33803.mail.mud.yahoo.com) (66.163.178.50) by apache.org
> > (qpsmtpd/0.29) with SMTP; Mon, 10 Oct 2005 21:39:30 -0700
> > Received: (qmail 17888 invoked by uid 60001); 11 Oct 2005
> > 04:39:06 -0000
> > Received: from [59.161.71.20] by
> web33803.mail.mud.yahoo.com via HTTP;
> > Mon, 1 0 Oct 2005 21:39:06 PDT
> > Mailing-List: contact [EMAIL PROTECTED];
> > run by ezmlm
> > Precedence: bulk
> > list-help:
> > list-unsubscribe:
> > List-Post:
> > Reply-To: "Log4NET User"
> > List-Id:
> > Delivered-To: mailing list [email protected]
> > X-ASF-Spam-Status: No, hits=1.3 required=10.0
> > tests=DNS_FROM_RFC_ABUSE,INFO_TLD
> > X-Spam-Check-By: apache.org
> > Received-SPF: pass (asf.osuosl.org: local policy)
> > DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024;
> d=yahoo.com;
> > h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Ve
> > rsion:Content-Type:Content-Transfer-Encoding;
> > b=wvcgcYfX1IUaaxPO2cAIFVTj6Bk3ZlUhKdjfT0ahHmmFwOC4rYjHdR1JZH0+
> BBNcVPWTo7i4358I+/h+X6FKoiYN/TyS/zy+q0eiSMmwOsCOuq9miQJ2r387fj
> CMZ6OmQP+H
> T89zoEibx8Si1xfkLHTrmmVcIO0q9hA4lmqRYO8= ;
> > Message-ID: <[EMAIL PROTECTED]>
> > Date: Mon, 10 Oct 2005 21:39:06 -0700 (PDT)
> > From: depsi programmer
> > Subject: RE: TypeInitializationException was unhandled
> > To: Log4NET User
> > In-Reply-To:
> >
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=iso-8859-1
> > Content-Transfer-Encoding: 8bit
> > X-Virus-Checked: Checked by ClamAV on apache.org
> > X-SmarterMail-Spam: SPF_Pass
> > X-Rcpt-To:
> >
> > Thanks
> >
> > I am building a Windows Application using Microsoft Visual
> Basic 2005
> > Beta 2.
> >
> > In my app.config file I have put
> >
> > type="log4net.Appender.RollingFileAppender">
> >
> >
> >
> >
> &g t;
> > type="log4net.Appender.RollingFileAppender+MinimalLock"/>
> >
> >
> > value="%date|[%thread]|%-5level|%logger|%property{NDC}|%messag
> > e%newline"/>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > The sample application code in which I am trying to write log for a
> > button click with time of clicking is:
> >
> > Public Class Form1
> > 'Declaration part
> > Private Shared ReadOnly logger As log4net.ILog =
> > log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetC
> > urrentMethod().DeclaringType)
> >
> > Private Sub Form1_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Me.Load
> > log4net.Config.XmlConfigurator.Configure()
> > 'Initialize log4net ---> here it generates e xception End Sub
> >
> > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles Button1.Click 'trying to write in log
> > log4net.NDC.Push("Form1.vb")
> > logger.Info("Button1 Clicked at :" & Now)
> > log4net.NDC.Pop()
> > End Sub
> > End Class
> >
> >
> > --- Nicko Cadell wrote:
> >
> > > What type of application are you building? From the look of
> > the call
> > > stack it looks like some kind of VS add-in. If so which
> > version of VS?
> > > I can't reproduce this with a simple forms app so it may be some
> > > interaction with the hosting process.
> > >
> > > Is it possible for you to post the source to a bare bones
> > version of
> > > your app? Just something that it launched in the same way,
> & gt; has a form
> > > which is displayed, and calls XmlConfigurator.Configure from the
> > > OnLoad method. If I can reproduce the problem it is much
> easier to
> > > fix.
> > >
> > > Cheers,
> > > Nicko
> > >
> > > > -----Original Message-----
> > > > From: depsi programmer
> > > [mailto:[EMAIL PROTECTED]
> > > > Sent: 04 October 2005 05:40
> > > > To: Log4NET User
> > > > Subject: TypeInitializationException was unhandled
> > > >
> > > > Hi
> > > >
> > > > I am getting following error in log4.net
> > > >
> > > > The exact error message and stack trace:
> > > >
> > > > System.TypeInitializationException was unhandled
> > > >
> > > > Message ="The type initializer for
> > > > 'log4net.Core.LoggerManager' threw an exception."
> > > >
> > > > Source="log4net"
> > > >
> > > > TypeName="log4net.Core.LoggerManager"
> > > >
> > > > StackTrace:
> > > >
> > > > at
> > > > log4net.Core.LoggerManager.GetRepository(Assembly
> > > > repositoryAssembly)
> > > >
> > > > at log4net.LogManager.GetRepository(Assembly
> > > > repositoryAssembly)
> > > >
> > > > at
> > > log4net.Config.XmlConfigurator.Configure()
> > > >
> > > > at
> > > System.Windows.Forms.Form.OnLoad(EventArgs e)
> > > >
> > > > at
> > > System.Windows.Forms.Form.OnCreateControl()
> > > >
> > > > at
> > > > System.Windows.Forms.Control.CreateControl(Boolean
> > > > fIgnoreVisible)
> > > >
> > > > at
> > > System.Windows.Forms.Control.CreateControl()
> > > >
> > > > at
> > > > System.Windows.Forms.Control.WmShowWindow(Message&
> > > m)
> > > >
> > > > at
> > > System.Windows.Forms.Control.WndProc(Message&
> > > > m)
> > > >
> > > > at
> > > >
> > >
> > System.Windows.Forms.ScrollableControl.WndProc(Message&
> > > > m)
> > > >
> > > > at
> > > >
> > >
> > System.Windows.Forms.ContainerControl.WndProc(Message&
> > > > m)
> > > >
> > > > at
> > > > System.Windows.Forms.Form.WmShowWindow(Message& m)
> > > >
> > > > at
> > > System.Windows.Forms.Form.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.SendMessage(HandleRef
> > > > hWnd, Int32 msg, Int32 wParam, Int32 lParam)
> > > >
> > > > at
> > > > System.Windows.Forms.Form.SetVisibleCore(Boolean
> > > > value)
> > > >
> > > > at
> > > > System.Windows.Forms.Control.set_Visible(Boolean
> > > > value)
> > > >
> > > > at
> > > >
> > >
> > System.Windows.Forms.Application.ThreadContext.RunMessageLoopI
> > > > nner(Int32
> > > > reason, ApplicationContext context)
> > > >
> > > > at
> > > >
> > >
> > System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
> > > > reason, ApplicationContext context)
> > > >
> > > > at System.Windows.Forms.Application.Run(Form
> > > > mainForm)
> > > & gt;
> > > > at
> > > System.AppDomain.nExecuteAssembly(Assembly
> > > > 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)
> > > >
> > > > at
> > > System.Threading.ThreadHelper.ThreadStart()
> > > >
> > > > When I checked the inner exception it was
> > > >
> > > > The inner exception is
> > > > The type initializer for
> > > 'log4net.Core.LoggerManager'
> > > > threw an exception.
> > > > Stack Trace is
> > > > at
> > > log4net.Core.LoggerManager.GetRepository(Assembly
> > > > repositoryAssembly)
> > > > at log4net.LogManager.GetRepository(Assembly
> > > > repositoryAssembly)
> > > > at log4net.Config.XmlConfigurator.Configure()
> > > > at xyz.FrmMain.Form1_Load(Object sender,
> > > EventArgs
> > > > e) in xyz.vb:line 147
> > > > at System.Windows.Forms.Form.OnLoad(EventArgs e) at
> > > > System.Windows.Forms.Form.OnCreateControl()
> > > > at
> > > > System.Windows.Forms.Control.CreateControl(Boolean
> > > > fIgnoreVisible)
> > > > at System.Windows.Forms.Control.CreateControl()
> > > > at
> > > > System.Windows.Forms.Control.WmShowWindow(Message&
> > > m)
> > > > at System.Windows.Forms.Control.WndProc(Message&
> > > m)
> > > > at
> > > >
> > >
> > System.Windows.Forms.ScrollableControl.WndProc(Message&
> > > > m)
> > > > at
> > > >
> > >
> > System.Windows.Forms.ContainerControl.WndProc(Message&
> > > > m)
> > > > at
> > > System.Windows.Forms.Form.WmShowWindow(Message&
> > > > m)
> > > > at System.Windows.Forms.Form.WndProc(Message& m) at
> > > >
> > >
> > System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&
> > >
> > === message truncated ===
> >
> >
> >
> >
> > __________________________________
> > Yahoo! Music Unlimited
> > Access over 1 million songs. Try it free.
> > http://music.yahoo.com/unlimited/
> >
> >
> >
>
>
>


Yahoo! FareChase - Search multiple travel sites in one click.

Reply via email to