Can you send me a complete (simple) 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: > <[EMAIL PROTECTED] > 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, 10 Oct 2005 21:39:06 PDT > Mailing-List: contact [EMAIL PROTECTED]; > run by ezmlm > Precedence: bulk > list-help: <mailto:[EMAIL PROTECTED]> > list-unsubscribe: <mailto:[EMAIL PROTECTED]> > List-Post: <mailto:[email protected]> > Reply-To: "Log4NET User" <[email protected]> > List-Id: <log4net-user.logging.apache.org> > 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+q0eiSMmwOsCOuq9miQJ2r387fjCMZ6OmQP+H T89zoEibx8Si1xfkLHTrmmVcIO0q9hA4lmqRYO8= ; > Message-ID: <[EMAIL PROTECTED]> > Date: Mon, 10 Oct 2005 21:39:06 -0700 (PDT) > From: depsi programmer <[EMAIL PROTECTED]> > Subject: RE: TypeInitializationException was unhandled > To: Log4NET User <[email protected]> > In-Reply-To: > <[EMAIL PROTECTED]> > 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: <[EMAIL PROTECTED]> > > 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"> > > > > > > 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 exception 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, > 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) > > > > > > 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/ > > >
