473,699 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with assembly loaded at runtime

When I load an assembly at runtime, that is to say, a plugin DLL through
Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly is
loaded by the main app, anyway, the old assembly is used. From where ?, I
don't know. I don't have an error here. Checked several times, because if I
delete the assembly, at runtime it is not detected by the
Directory.GetFi les() method. It is as if the updated assembly is not taken
into account and an old version is always reloaded.

How to solve that ? It is the same problem if I shutdown and restart VS2003
or the computer.
Thanks in Advance
Luis Arvayo
Jan 20 '06 #1
5 1844
Luis Arvayo wrote:
When I load an assembly at runtime, that is to say, a plugin DLL
through Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly
is loaded by the main app, anyway, the old assembly is used. From
where ?, I don't know. I don't have an error here. Checked several
times, because if I delete the assembly, at runtime it is not
detected by the Directory.GetFi les() method. It is as if the updated
assembly is not taken into account and an old version is always
reloaded.

How to solve that ? It is the same problem if I shutdown and restart
VS2003 or the computer.


Check if the old assembly is in the GAC:
vsvars32.bat
gacutil /l

you should also check the download cache:
gacutil /ldl

and if it's there, clear it:
gacutil /cdl

If you know the filename, it's often better to use LoadFrom.

Frans

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jan 20 '06 #2
Frans Bouma [C# MVP] wrote:
Luis Arvayo wrote:

When I load an assembly at runtime, that is to say, a plugin DLL
through Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly
is loaded by the main app, anyway, the old assembly is used. From
where ?, I don't know. I don't have an error here. Checked several
times, because if I delete the assembly, at runtime it is not
detected by the Directory.GetFi les() method. It is as if the updated
assembly is not taken into account and an old version is always
reloaded.

How to solve that ? It is the same problem if I shutdown and restart
VS2003 or the computer.

Check if the old assembly is in the GAC:
vsvars32.bat
gacutil /l

you should also check the download cache:
gacutil /ldl

and if it's there, clear it:
gacutil /cdl

If you know the filename, it's often better to use LoadFrom.

Frans

I once had a problem when a plugin got into the download cache. I found
it by opening a cmd shell and typing:

dir "%USERPROFILE%\ ..\PlugIn.dll" /B /S
Is you DLL listed at a place where it shouln't be?

HTH,
ANdy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40 @*NO*SPAM*gmx.n et
Jan 20 '06 #3
The loader uses the following logic to find your assembly (by default,
you can change this somewhat)

GAC (If the assembly has a strong name)
CODEBASE
Probing (searching the APPBASE directory (where the configuration file
resides) and any subdirectories that are specified in apps configuration
assemblyBinding element) ... basically, it first looks for a library
with the appropriate name in the APPBASE directory, if it cannot find
it, it looks for a directory with the name of the assembly, and looks in
that directory for the assembly (library.) If that fails, it goes back
and uses the .exe extension vs. the .dll extension for the previous two
steps. If still not found it starts looking down the paths specified in
the assemblyBinding element.

An exception to the steps above is that if your load request contains a
cultural identifier, the loader will try to include that in the path as
well.
After all that ... are you running a copy of this from an ASP.NET
session and just compiling the library? In that case, you library could
be in the shadow directory?


Luis Arvayo wrote:
When I load an assembly at runtime, that is to say, a plugin DLL through
Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly is
loaded by the main app, anyway, the old assembly is used. From where ?, I
don't know. I don't have an error here. Checked several times, because if I
delete the assembly, at runtime it is not detected by the
Directory.GetFi les() method. It is as if the updated assembly is not taken
into account and an old version is always reloaded.

How to solve that ? It is the same problem if I shutdown and restart VS2003
or the computer.
Thanks in Advance
Luis Arvayo

Jan 20 '06 #4
> Is you DLL listed at a place where it shouln't be?
Yes, thank you this tip solved the problem.

"Andreas Mueller" <me@privacy.net > escribió en el mensaje
news:43******** *****@individua l.net...
Frans Bouma [C# MVP] wrote:
Luis Arvayo wrote:

When I load an assembly at runtime, that is to say, a plugin DLL
through Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly
is loaded by the main app, anyway, the old assembly is used. From
where ?, I don't know. I don't have an error here. Checked several
times, because if I delete the assembly, at runtime it is not
detected by the Directory.GetFi les() method. It is as if the updated
assembly is not taken into account and an old version is always
reloaded.

How to solve that ? It is the same problem if I shutdown and restart
VS2003 or the computer.

Check if the old assembly is in the GAC:
vsvars32.bat
gacutil /l

you should also check the download cache:
gacutil /ldl

and if it's there, clear it:
gacutil /cdl

If you know the filename, it's often better to use LoadFrom.

Frans

I once had a problem when a plugin got into the download cache. I found it
by opening a cmd shell and typing:

dir "%USERPROFILE%\ ..\PlugIn.dll" /B /S
Is you DLL listed at a place where it shouln't be?

HTH,
ANdy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40 @*NO*SPAM*gmx.n et

Jan 21 '06 #5

Thanks for the clear explain. It take me directly to the fact that the DLL
was located in a wrong place.
"John Murray" <jm*****@pluck. com> escribió en el mensaje
news:Oh******** ******@TK2MSFTN GP09.phx.gbl...
The loader uses the following logic to find your assembly (by default, you
can change this somewhat)

GAC (If the assembly has a strong name)
CODEBASE
Probing (searching the APPBASE directory (where the configuration file
resides) and any subdirectories that are specified in apps configuration
assemblyBinding element) ... basically, it first looks for a library with
the appropriate name in the APPBASE directory, if it cannot find it, it
looks for a directory with the name of the assembly, and looks in that
directory for the assembly (library.) If that fails, it goes back and
uses the .exe extension vs. the .dll extension for the previous two steps.
If still not found it starts looking down the paths specified in the
assemblyBinding element.

An exception to the steps above is that if your load request contains a
cultural identifier, the loader will try to include that in the path as
well.
After all that ... are you running a copy of this from an ASP.NET session
and just compiling the library? In that case, you library could be in the
shadow directory?


Luis Arvayo wrote:
When I load an assembly at runtime, that is to say, a plugin DLL through
Assembly.Load, an old version of the assembly is loaded.
If I recompile the DLL and then copy the result to where the assembly is
loaded by the main app, anyway, the old assembly is used. From where ?, I
don't know. I don't have an error here. Checked several times, because
if I delete the assembly, at runtime it is not detected by the
Directory.GetFi les() method. It is as if the updated assembly is not
taken into account and an old version is always reloaded.

How to solve that ? It is the same problem if I shutdown and restart
VS2003 or the computer.
Thanks in Advance
Luis Arvayo

Jan 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2877
by: Arnaud Debaene | last post by:
Hello group. I have an app which can load "plugins" assemblies that are described in the registry (each registry entry gives the full path to the plugin ..dll file). The plugins may be anywhere on the disk. Each plugin defines a class which implements an interface known to the app. The main app loads the plugin with Assembly.LoadFrom and then uses Assembly.GetTypes() and Type.FindInterface to find the concrete types in the plugin that...
28
5214
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
1
2790
by: Zachary Hartnett | last post by:
I was trying to write a routine this morning that would open a given assembly, walk the inheritance tree of classes in the assembly, and provide a list of classes in the assembly that inherit from DataSet. Here is a snippet from the routine I came up with: ------------------------------------------------------------ openFileDialog.ShowDialog(); Assembly assembly = Assembly.LoadFile(openFileDialog.FileName);
4
1535
by: Edward Diener | last post by:
I have a class Y in assembly B which is derived from a class Z in assembly C. So I correctly add a reference to assembly C in assembly B, build assembly B and everything builds fine. Now I create an assembly A which refers to class Y in assembly B. So I add a reference in assembly A to assembly B, and attempt to build. I get an error message, C3264, saying that it could not find the type Z, and that it is in assembly C to which I have no...
3
1961
by: fong01 | last post by:
See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it Server stack trace: at System.Net.Sockets.Socket.Connect(EndPoint remoteEP) at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket() at...
12
3268
by: Steven Berkovitz | last post by:
I have several ASP.NET applications with near identical web.config files. In one of them I am successfuly able to bind to an assembly while on others I am not. All of them have the following qualifiers: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <qualifyAssembly partialName="OrderDynamics.ImageService.Interfaces"...
5
6027
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the assembly 3- I am trying to deserialize from an EXE that references version 2.0 of the assembly 4- Both version 1.0 and 2.0 of the assembly reside in the GAC (no policy redirects exist).
19
1590
by: Larry Smith | last post by:
Hi there, When I run the following on my app's primary thread: System.Type.GetType("System.Windows.Forms.Form") It works as expected. If I then launch a thread via the "BackgroundWorker" class immediately after the above call, and invoke the above again as soon as the thread starts, it now returns null instead. Can anyone explain this. Thanks.
4
4471
by: =?Utf-8?B?SmFu?= | last post by:
I have a .NET 2.0 application divided in two assemblies; the exe and a dll. The application generates a plugin-dll which is then loaded in a separate AppDomain (along with a second instance of my application dll). It's been working for months and now the it's not working from my application exe anymore but still working from NUnit when testing the dll. What could have changed in my exe? Some configuration thing in my VS2005 project?
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8884
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7751
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.