[Mono-devel-list] Fwd: MethodCall target not working on Windows?

Valient Gough valient at gmail.com
Fri Jul 29 12:34:08 EDT 2005


When building NLog (http://nlog.sf.net) with Mono, the resulting dll
works on Mono but not on Windows .NET.  If the .dll is built with csc,
then it works both on .NET and Mono (both Windows and Linux).

The symptom is that the simple test program can't run.  But I don't
understand what's causing it -- missing metadata (see the last part of
the error message)?

Valient
  

---------- Forwarded message ----------
From: Valient Gough <valient at gmail.com>
Date: Jul 23, 2005 1:01 PM
Subject: MethodCall target not working on Windows?
To: nlog-list at lists.sourceforge.net


I'm using a MethodCall target in order to capture log messages within
my program.  It works under Mono on Linux, but fails on Windows with
DotNet 1.1.

I've created a simple example.  Attached is logtest.cs and
logtest.exe.nlog.  When run under Windows, an exception dialog pops up
saying an unhandled exception was caught and if I let it terminate
then I get the following log on the console:



Unhandled Exception: System.TypeInitializationException: The type
initializer for "Foo.Test" threw an exception. --->
System.IO.FileLoadException: The located assembly's manifest
definition with name 'NLog' does not match the assembly reference.
File name: "NLog"
   at System.Reflection.CustomAttribute.CreateCAObject(Int32& propNum,
Assembly& assembly)
   at System.Reflection.CustomAttribute.GetObject()
   at System.Reflection.CustomAttribute.CheckConsistencyAndCreateArray(CustomAttribute
caItem, Type caType)
   at System.Reflection.CustomAttribute.GetCustomAttributes(MemberInfo
member, Type caType, Boolean inherit)
   at System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Type
attributeType, Boolean inherit)
   at NLog.Internal.PropertyHelper.BuildPropertyInfoDictionary(Type t)
   at NLog.Internal.PropertyHelper.GetPropertyInfo(Type targetType,
String propertyName)
   at NLog.Internal.PropertyHelper.IsArrayProperty(Type t, String name)
   at NLog.Config.XmlLoggingConfiguration.ConfigureTargetFromXmlElement(Target
target, XmlElement element)
   at NLog.Config.XmlLoggingConfiguration.ConfigureTargetsFromElement(XmlElement
element)
   at NLog.Config.XmlLoggingConfiguration.ConfigureFromXmlElement(XmlElement
configElement, String baseDirectory)
   at NLog.Config.XmlLoggingConfiguration.ConfigureFromFile(String fileName)
   at NLog.Config.XmlLoggingConfiguration..ctor(String fileName)
   at NLog.LogManager.get_Configuration()
   at NLog.LogManager.GetLogger(String name)
   at NLog.LogManager.GetCurrentClassLogger()
   at Foo.Test..cctor()

=== Pre-bind state information ===
LOG: DisplayName = NLog, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null (Fully-specified)
LOG: Appbase = C:\INCOMING\
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: NLog, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/INCOMING/NLog.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN

   --- End of inner exception stack trace ---
   at Foo.Test.Main()


Any ideas?  I don't know what that "post-policy reference" stuff is
about.  The NLog was built normally and does contain a public key
token.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logtest.cs
Type: application/octet-stream
Size: 404 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050729/7195fd6a/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logtest.exe.nlog
Type: application/octet-stream
Size: 362 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050729/7195fd6a/attachment-0001.obj 


More information about the Mono-devel-list mailing list