Issue Details (XML | Word | Printable)

Key: LOG4NET-65
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Nicko Cadell
Reporter: Nicko Cadell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Log4net

Unhandled SecurityException exception for FileIOPermission while loading configuration file

Created: 21/Feb/06 04:47 AM   Updated: 21/Feb/06 04:50 AM
Return to search
Component/s: Core
Affects Version/s: 1.2.9
Fix Version/s: 1.2.10

Time Tracking:
Not Specified

Resolution Date: 21/Feb/06 04:50 AM


 Description  « Hide
If the calling application does not have the PathDiscovery FileIOPermission a SecurityException is generated from the XmlConfiguratorAttribute.Configure method. This is called from the first LoggerManager.GetLogger in a calling assembly.

The exception should be caught as we may potentially be injecting this exception into user code's class initialisation phase which the user would find unexpected.

An example stack trace for the exception is:

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +59
   System.AppDomainSetup.VerifyDir(String dir, Boolean normalize) +110
   System.AppDomain.get_BaseDirectory() +61
   log4net.Util.SystemInfo.get_ApplicationBaseDirectory() +31
   log4net.Config.XmlConfiguratorAttribute.Configure(Assembly sourceAssembly, ILoggerRepository targetRepository) +30
   log4net.Core.DefaultRepositorySelector.ConfigureRepository(Assembly assembly, ILoggerRepository repository) +314
   log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType, String repositoryName, Boolean readAssemblyAttributes) +532
   log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly repositoryAssembly, Type repositoryType) +42
   log4net.Core.DefaultRepositorySelector.GetRepository(Assembly repositoryAssembly) +80
   log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String name) +132
   log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name) +30
   log4net.LogManager.GetLogger(String name) +34


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #379212 Mon Feb 20 19:49:25 UTC 2006 nicko Fix for LOG4NET-65 Unhandled SecurityException exception for FileIOPermission while loading configuration file
Added additional try/catch blocks to the DefaultRepositorySelector and the XmlConfiguratorAttribute to wrap any path discovery permission checks made by the AppDomain.
Files Changed
MODIFY /logging/log4net/trunk/src/Config/XmlConfiguratorAttribute.cs
MODIFY /logging/log4net/trunk/src/Util/SystemInfo.cs
MODIFY /logging/log4net/trunk/src/Core/DefaultRepositorySelector.cs