473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.GetFiles() 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 1834
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.GetFiles() 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.GetFiles() 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.net
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.GetFiles() 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*************@individual.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.GetFiles() 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.net

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**************@TK2MSFTNGP09.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.GetFiles() 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
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...
28
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();...
1
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...
4
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...
3
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...
12
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...
5
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...
19
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"...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.