Interop problems with >1 assemblies OR private static members

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

I have a .NET web service proxy client that is intended to be invokable from
ASP 2.0 (Classic as follows)

MyOrg.web.publications.OrderData - Data class that is at the highest level
MyOrg.web.publications.iOrderData - Interface for
MyOrg.web.publications.OrderData
MyOrg.web.publications.OrderLines - MyOrg.web.publications.OrderData
contain these
MyOrg.web.publications.iOrderLines - interface for
MyOrg.web.publications.OrderLines
MyOrg.web.publications.Order - the actual web service proxy client
built using WSE 2.0
MyOrg.web.publications.iOrder - interface for
MyOrg.web.publications.iOrder

The interfaces were present because I need it for interop to work.

1) Interfaces are defined as
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
2) classes are set to implement their corresponding interfaces
3) Methods are marshalled like this:
public string PlaceOrder([MarshalAs(UnmanagedType.IUnknown)] OrderData
order)

Two Problems
1) These all work fine when they are in the same Visual Studio 2003 project
in the same class library project. However, if I put the data sturcture
classes/assemblies in one assembly, and Order,iOrder in another, when
PlaceOrder is invoked from ASP2.0 (Classic), I get a "Object reference not
set to an instance ....." exception!

2) I can't get log4net working! The following SINGLE line of code would
cause failure!:
private static readonly log4net.ILog log =
log4net.LogManager.GetLogger("Order");

I am using version 1.2.0 Beta8 of log4net at
http://prdownloads.sourceforge.net/log4net/log4net-1.2.0-beta8.zip?download

Are these two problems related ?(i.e., interop having problem with using
classes from a different assembly). Note, I seem to be able to use other
..NET classes (e.g.System.Diagnostics.EventLog), although it is preferable to
use a more scalable logging tool like log4NET or the Microsoft Logging
application block).

Is it true that I can't use static members within a .NET Class library if it
were to be exposed to COM client (ASP 2.0 Classic) via regasm?

Note
1) the log4net log variable is a PRIVATE static variable that is used
internally (but not exposed)
2) the data classes used (when split into 2 assemblies) are NOT static
members
3) I manage to use the "native" System.Diagnostic.Eventlog.WriteEvent STATIC
method OK with no problem.

How could I fix these?
 
Any one about the use of static private members with .NET Interop?

No idea why I can use a static member System.Diagnostic.EventLog.WriteEvent
but I can't event instantiate a static private variable for log4net!
 
Back
Top