Loading a referenced Framework 1.1 assembly from a Framework 2.0 Application


S

Stefan Born

Hello,
We reference System.Messaging from our library that is a .Net Framework 1.1
assembly. This library is then referenced within our .Net Framework 2.0 Beta
2 application:

Expected references:
Application (2.0) ==> Custom Library (1.1) ==> System.Messaging (1.1)

Now we have the problem that when the application starts, the framework
loads our library and System.Messaging into its process, but
System.Messaging is the version from Framework 2.0 and not the originally
referenced from Framework 1.1. That causes our application to crash on
dispose.

Loaded references:
Application (2.0) ==> Custom Library (1.1) ==> System.Messaging (2.0)

Exception (thats the whole Exception):
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Messaging.MessageQueue.MQCacheableInfo.Dispose(Boolean
disposing)
at System.Messaging.MessageQueue.MQCacheableInfo.Finalize()


I have to say that we aren't able to move our library to Framework 2.0 (at
least not yet), and with Framework 1.1 and Framework 2.0 Beta 1 there were
no problems (maybe Microsoft changed the MessageQueue class from Beta 1 to
Beta 2).

Is there a way to force the Framework to load the originally referenced
version? And shouldn't that be the default behavior? In our opinion it makes
no sense that the framework loads by default the Framework 2.0 assembly even
Framework 1.1 is installed and our library references the assembly from
Framework 1.1. Shouldn't it load by default the originally referenced
assembly and only if not found the new one?

But thats a general problem, it has nothing todo with the System.Messaging;
the framework always loads assemblies in this manner. Is this a bug or by
design?

We can create a workaround for this by adding a binding policy for
System.Messaging but thats only a temporary solution, because we won't force
every application to load System.Messaging from Framework 1.1.

We use Framework v1.1.4322 and v2.0.50215.

Any help or suggestions are realy appreciated!

Regards,
Stefan Born
___________________________________
Software Engineer
bfa solutions ltd.
Switzerland
 
Ad

Advertisements

M

Mattias Sjögren

Exception (thats the whole Exception):
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Messaging.MessageQueue.MQCacheableInfo.Dispose(Boolean
disposing)
at System.Messaging.MessageQueue.MQCacheableInfo.Finalize()

If you can create a repro of this you may want to report it as a bug
at the MSDN Product feedback center.

Is there a way to force the Framework to load the originally referenced
version? And shouldn't that be the default behavior? In our opinion it makes
no sense that the framework loads by default the Framework 2.0 assembly even
Framework 1.1 is installed and our library references the assembly from
Framework 1.1. Shouldn't it load by default the originally referenced
assembly and only if not found the new one?

No it loads the version that comes with the framework version you're
running. See

http://blogs.msdn.com/alanshi/archive/2004/02/15/73244.aspx



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top