In C#windows application I'm using "Log4net"thrid party toolto generate the log files;
With the belowcode i'mtrying to create the instance of logger to generate the log file
Private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
the above code snippet was working fine with.NET F/w 2.0; VS2005; Windows XP software configuration.
i Started migrating the application to .NET F/w 3.5 VS2008; Windows Vista Business OS.
but the code "MethodBase.GetCurrentMethod().DeclaringType" throwing an "System.ArgumentException"exception with a Exceptionmessage of"Cannot evaluate security function".
This exception is not caught; but it's just not generating the Log file.
The abovecode was working fine with .NET F/w 2.0; VS2005; Windows XP.
I solved this problem by adding the below line ofcode instead of above code.
"XmlConfigurator.Configure(new Filenfo(//app.config));"
where it will getthe logging details from app.config file. and creates the log file and works as before.
But i want to find out why the code "MethodBase.GetCurrentMethod().DeclaringType"doesn't work with .NET3.5, VS2008, Vista.