RE: Intermittent MissingFieldException




Thanks Steven. Yes, we ran with the log4net assembly in the GAC in test last
night and didn't get a reoccurrence of the problem. Thanks especially for the
KB 813833 link - that's just the sort of evidence we need to push this change
through to production.

Regards,
- Lee


"Steven Cheng[MSFT]" wrote:

> HI Lee,
>
> Welcome to ASPNET newsgroup.
> Regarding on the problem you mentioned, I think the problem is just due to
> the Log4net 's assembly is a strong-named assembly and be put in the
> asp.net application's private bin path. Currently the ASP.NET application
> host dosn't support strong-named assembly in private bin dir, we should
> always put strong-named ones into GAC. At runtime, asp.net will shadow copy
> the private assemblies in the private bin dir , however for strong-named
> ones in it, they may not be shadow copied so that after the appdomain(of
> the application) restart, we'll encountering loading type/assembly failed
> for those assemblies. Also, from the fusion log you attached, we can find
> the the runtime locate the asp.net temporary dir didn't find the copied one
> and locate the assembly in private bin dir but failed to load it.
>
> Please try put all the strong-named assemblies in your app's private bin
> dir and register them in GAC to see whether this do the work. In addition
> ,here 're some kb articles discussing on some other existing issue when
> deploying strong-named assembly in asp.net app's private bin path:
>
> http://support.microsoft.com/?id=813833
>
> http://support.microsoft.com/?id=813830
>
> Hope also helps. Thanks,
>
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> --------------------
> | Thread-Topic: Intermittent MissingFieldException
> | thread-index: AcWzwCzOmnwAiKdQTaW8YeD0n1xIAw==
> | X-WBNR-Posting-Host: 194.200.242.250
> | From: "=?Utf-8?B?TGVlIENoYXBtYW4=?=" <LeeChapman@xxxxxxxxxxxxxxxx>
> | Subject: Intermittent MissingFieldException
> | Date: Wed, 7 Sep 2005 08:24:02 -0700
> | Lines: 350
> | Message-ID: <86BC61AD-33AC-4AF1-99AF-6DE1045E80FB@xxxxxxxxxxxxx>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 7bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | Xref: TK2MSFTNGXA01.phx.gbl
> microsoft.public.dotnet.framework.aspnet:122909
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> |
> | Hi,
> |
> | I have a problem where my ASP.NET application occasionally generates a
> | MissingFieldException exception. This unexpectedly happened on my
> development
> | box, and so I was able to extract some information from the debugger:
> |
> | The field that is "missing" is called 'logger'. Here's it's description
> | taken from ildasm.exe:
> |
> | .field public static class [log4net]log4net.ILog logger
> |
> | This field is in a class called 'Utility', which is in an assembly called
> | 'Infrastructure'. This Infrastructure's assembly manifest shows that the
> | log4net assembly is referenced thus:
> |
> | .assembly extern log4net
> | {
> | .publickeytoken = (07 01 22 69 AF 86 3A C7 )
> | .ver 1:2:9:0
> | }
> |
> | The log4net assembly is a strongly named assembly, but it isn't in the
> GAC.
> | I have a suspicion that the fact that the assembly is strongly named may
> be
> | relevant, because the problem never occurs with our other assemblies.
> |
> | System.AppDomain.CurrentDomain.GetAssemblies() showed that there were 40
> | assemblies loaded. The MissingFieldException exception was being
> generated
> | because the Infrastructure assembly wasn't loading properly. When I
> called
> | GetTypes() on the Infrastructure assembly, a ReflectionTypeLoadException
> | exception was thrown saying that "One or more of the types in the
> assembly
> | unable to load". Here are the exception's details (taken from the Visual
> | Studio watch window):
> |
> | - System.AppDomain.CurrentDomain.GetAssemblies()[14].GetTypes() {"One or
> | more of the types in the assembly unable to
> | load."} System.Reflection.ReflectionTypeLoadException
> | + System.SystemException {"One or more of the types in the assembly
> unable
> | to load."} System.SystemException
> | + _classes {Length=72} System.Type[]
> | - _exceptions {Length=4} System.Exception[]
> | - [0] {"log4net"} System.IO.FileLoadException
> | - System.IO.IOException {System.IO.FileLoadException}
> System.IO.IOException
> | - System.SystemException {"Access is denied:
> | 'log4net'."} System.SystemException
> | - System.Exception {"Access is denied: 'log4net'." } System.Exception
> | System.Object {System.IO.FileLoadException} System.Object
> | _className null string
> | _COMPlusExceptionCode -532459699 int
> | _exceptionMethod <undefined value> System.Reflection.MethodBase
> | _exceptionMethodString null string
> | _helpURL null string
> | _HResult -2147024891 int
> | _innerException { } System.Exception
> | _message "Access is denied: 'log4net'." string
> | _remoteStackIndex 0 int
> | _remoteStackTraceString null string
> | _source null string
> | _stackTrace <undefined value> System.Object
> | _stackTraceString null string
> | _xcode -532459699 int
> | _xptrs 0 int
> | HelpLink null string
> | HResult -2147024891 int
> | InnerException { } System.Exception
> | Message "Access is denied: 'log4net'." string
> | Source null string
> | StackTrace null string
> | TargetSite <undefined value> System.Reflection.MethodBase
> | _fileName "log4net" string
> | _fusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
> |
> file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation/bin/log4net
> .DLL.\r\n" string
> | FileName "log4net" string
> | FusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
> |
> file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation/bin/log4net
> .DLL.\r\n" string
> | Message "Access is denied: 'log4net'." string
> | - [1] {"log4net"} System.IO.FileLoadException
> | - System.IO.IOException {System.IO.FileLoadException}
> System.IO.IOException
> | - System.SystemException {"Access is denied:
> | 'log4net'."} System.SystemException
> | - System.Exception {"Access is denied: 'log4net'." } System.Exception
> | System.Object {System.IO.FileLoadException} System.Object
> | _className null string
> | _COMPlusExceptionCode -532459699 int
> | _exceptionMethod <undefined value> System.Reflection.MethodBase
> | _exceptionMethodString null string
> | _helpURL null string
> | _HResult -2147024891 int
> | _innerException { } System.Exception
> | _message "Access is denied: 'log4net'." string
> | _remoteStackIndex 0 int
> | _remoteStackTraceString null string
> | _source null string
> | _stackTrace <undefined value> System.Object
> | _stackTraceString null string
> | _xcode -532459699 int
> | _xptrs 0 int
> | HelpLink null string
> | HResult -2147024891 int
> | InnerException { } System.Exception
> | Message "Access is denied: 'log4net'." string
> | Source null string
> | StackTrace null string
> | TargetSite <undefined value> System.Reflection.MethodBase
> | _fileName "log4net" string
> | _fusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
> |
> file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation/bin/log4net
> .DLL.\r\n" string
> | FileName "log4net" string
> | FusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
> |
> file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation/bin/log4net
> .DLL.\r\n" string
> | Message "Access is denied: 'log4net'." string
> | - [2] {"log4net"} System.IO.FileLoadException
> | - System.IO.IOException {System.IO.FileLoadException}
> System.IO.IOException
> | - System.SystemException {"Access is denied:
> | 'log4net'."} System.SystemException
> | - System.Exception {"Access is denied: 'log4net'." } System.Exception
> | System.Object {System.IO.FileLoadException} System.Object
> | _className null string
> | _COMPlusExceptionCode -532459699 int
> | _exceptionMethod <undefined value> System.Reflection.MethodBase
> | _exceptionMethodString null string
> | _helpURL null string
> | _HResult -2147024891 int
> | _innerException { } System.Exception
> | _message "Access is denied: 'log4net'." string
> | _remoteStackIndex 0 int
> | _remoteStackTraceString null string
> | _source null string
> | _stackTrace <undefined value> System.Object
> | _stackTraceString null string
> | _xcode -532459699 int
> | _xptrs 0 int
> | HelpLink null string
> | HResult -2147024891 int
> | InnerException { } System.Exception
> | Message "Access is denied: 'log4net'." string
> | Source null string
> | StackTrace null string
> | TargetSite <undefined value> System.Reflection.MethodBase
> | _fileName "log4net" string
> | _fusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
> |
> file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation/bin/log4net
> .DLL.\r\n" string
> | FileName "log4net" string
> | FusionLog "=== Pre-bind state information ===\r\nLOG: DisplayName =
> | log4net, Version=1.2.9.0, Culture=neutral,
> PublicKeyToken=07012269af863ac7\n
> | (Fully-specified)\r\nLOG: Appbase =
> | file:///C:/Environments/XXXX/Development/YYYY/Apply/Presentation\r\nLOG:
> | Initial PrivatePath = bin\r\nCalling assembly : Infrastructure,
> | Version=0.0.0.44, Culture=neutral, PublicKeyToken=null.\r\n===\n\r\nLOG:
> | Attempting download of new URL
> | file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET
> | Files/applysource/f27b5c84/cdeddc66/log4net.DLL.\r\nLOG: Attempting
> download
> | of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary
> | ASP.NET Files/applysource/f27b5c84/cdeddc66/log4net/log4net.DLL.\r\nLOG:
> | Attempting download of new URL
.