Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2005

Tip: Looking for answers? Try searching our database.

Loading a referenced Framework 1.1 assembly from a Framework 2.0 Application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stefan Born - 30 May 2005 15:23 GMT
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
Mattias Sjögren - 30 May 2005 18:57 GMT
>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

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.