473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assembly loading

I am writing a server and an MMC console app that use remoting to talk
to each other. The MMC client and the server share a couple of
assemblies: one has the interface that is remoted from the server and
the other has some data structures that are passed across the remoted
interface from the server to the client. These assemblies are not
strong named and are not entered in the GAC. I could easily solve
this problem by putting the DLL in the System32 directory or in the
GAC, but I am trying to understand why it won't load one of the DLLs.

The directories are setup like this:

Machine A
\Program Files\Server\Server.exe
\Program Files\Server\Remote.dll
\Program Files\Server\DataStructs.dll

Machine B
\Program Files\Client\MMCSnapin.dll
\Program Files\Client\Remote.dll
\Program Files\Client\DataStructs.dll

The server runs on Machine A as expected. The MMC console runs on B
with the following problem: it loads the MMCSnapin.dll and Remote.dll
just fine but it can't load DataStructs.dll or atleast it thinks it
can't. I put a breakpoint in the MMCSnapin.dll where it creates the
remoted interface. At that point, I look at the Debug/Modules window
and I see all 3 DLL's loaded. I can even create objects from the
DataStructs.dll with no problem. The problem occurs when I call a
method on the remoted interface that returns one of the objects from
DataStructs.dll. The method throws an exception and says it can't
find the assembly, even though the Modules window says that it is
already loaded. I also checked
AppDomain.CurrentDomain.GetAssemblies() and the DataStructs.dll
assembly is there as it should be.

If I put the DataStructs.dll in the System32 directory where MMC.exe
is, it loads the assembly just fine and calls the remoted method
correctly. I suspect it would behave correctly if I put the assembly
into the GAC as well. But right now, my question is: why does the
Modules window say the assembly is loaded but calling the remoted
method cause it to not be able to find the assembly? I have
repeatedly compiled all components and scoured my drive to make sure
the are no outdated assemblies floating around to confuse things.

Thanks
Kent Rollins
Jul 21 '05 #1
1 1953
Hi,

your MMC client is acting as part of the MMC proceess, and it's working
directory is System32. You can capture the AppDomain.AssemblyResolve
event, and there to load the assembly you need from where it is.

Sunny
In article <61********************************@4ax.com>,
sp******@spamfree.com says...
I am writing a server and an MMC console app that use remoting to talk
to each other. The MMC client and the server share a couple of
assemblies: one has the interface that is remoted from the server and
the other has some data structures that are passed across the remoted
interface from the server to the client. These assemblies are not
strong named and are not entered in the GAC. I could easily solve
this problem by putting the DLL in the System32 directory or in the
GAC, but I am trying to understand why it won't load one of the DLLs.

The directories are setup like this:

Machine A
\Program Files\Server\Server.exe
\Program Files\Server\Remote.dll
\Program Files\Server\DataStructs.dll

Machine B
\Program Files\Client\MMCSnapin.dll
\Program Files\Client\Remote.dll
\Program Files\Client\DataStructs.dll

The server runs on Machine A as expected. The MMC console runs on B
with the following problem: it loads the MMCSnapin.dll and Remote.dll
just fine but it can't load DataStructs.dll or atleast it thinks it
can't. I put a breakpoint in the MMCSnapin.dll where it creates the
remoted interface. At that point, I look at the Debug/Modules window
and I see all 3 DLL's loaded. I can even create objects from the
DataStructs.dll with no problem. The problem occurs when I call a
method on the remoted interface that returns one of the objects from
DataStructs.dll. The method throws an exception and says it can't
find the assembly, even though the Modules window says that it is
already loaded. I also checked
AppDomain.CurrentDomain.GetAssemblies() and the DataStructs.dll
assembly is there as it should be.

If I put the DataStructs.dll in the System32 directory where MMC.exe
is, it loads the assembly just fine and calls the remoted method
correctly. I suspect it would behave correctly if I put the assembly
into the GAC as well. But right now, my question is: why does the
Modules window say the assembly is loaded but calling the remoted
method cause it to not be able to find the assembly? I have
repeatedly compiled all components and scoured my drive to make sure
the are no outdated assemblies floating around to confuse things.

Thanks
Kent Rollins

Jul 21 '05 #2

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

Similar topics

4
2851
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...
3
2539
by: Atul Godbole | last post by:
Suppose an assembly "Main" is using class "A" from another Assembly "Dep" as follows : A a = new A(); a.MethodOne(); At what time is the call to MethodOne linked to the actual MSIL (method...
4
2867
by: Mark | last post by:
I wan't to be able to deserialize a class from an assembly that is not in the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is...
2
4333
by: Sam Martin | last post by:
Morning all, Right, I've read untold articles now, listening to people bitch about there being no Unload method for Assembly. Plenty of people do counter that this is possible by loading the...
1
4993
by: Benjamin | last post by:
Hi, I'm currently writing a Web Services that interacts with a database. To allow me to use not just one database provider (for example, I could use MS Access, SQL Server or MySQL), the Web...
1
2909
by: Brian | last post by:
I've looked through the previous posts on this one and have verified permissions and location of my Dlls, but I am still getting an exception when I try to Load an assembly. The directory where...
1
5393
by: realgeek | last post by:
Hi. I am writing a class lib that has com interop enabled and it is housed and used within some other application. So then, I serialize one of the classes, and on subsequent launches I try to...
2
4953
by: peter.drienovsky | last post by:
Hello, let me describe my problem: ENVIRONMENT: ..Net 2.0, MSVS 2005, c#, WinXP SYMPTOMS: If assembly 'AgentDesktop' IS NOT in the (loading) application folder,
2
2011
by: Chen Zhuo | last post by:
Hi all experts, We are having a problem with the exact time when a C# dll gets loaded in managed C++. The scenario is like: In managed.cpp: #using MyCSharp.dll
7
10017
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having...
0
7174
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,...
0
7220
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...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
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...
0
5470
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,...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
1
665
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.