473,408 Members | 2,009 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,408 software developers and data experts.

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 1948
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
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
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
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
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
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
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
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
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
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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
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...

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.