473,811 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why application is allowed to run if dependent assembly is missing

I notice the following strange behavior of the applications running under
..NET Framework.

Let say I have application MyApp.exe which reference assembly MyAssembly.dll.
The MyAssembly.dll is strong named assembly, which is installed in the GAC.

I notice that if MyAssembly.dll is not installed in GAC or the different
version
of MyAssembly.dll is installed in GAC then MyApp.exe starts OK. But as soon as
the MyApp.exe app tries to call any function from the MyAssembly.dll the
MyApp.exe
application crashes.

In unmanaged VC++ 6.0 world the application wouldn't even allowed to start
if some dll are missing. The system would display error message saying that
some dll's are missing and application would gracefully exit.

I wonder whether I misunderstand something or made any mistake? Why
MyApp.exe is allowed to start in order to crash right after attemp to use any
functionality from missing dependent assembly?

Can anyone clarify this situation?
Thanks
Boris
Nov 17 '05 #1
3 1561
Hi Boris,
I notice the following strange behavior of the applications running under
.NET Framework.

Let say I have application MyApp.exe which reference assembly MyAssembly.dll. The MyAssembly.dll is strong named assembly, which is installed in the GAC.
I notice that if MyAssembly.dll is not installed in GAC or the different
version
of MyAssembly.dll is installed in GAC then MyApp.exe starts OK. But as soon as the MyApp.exe app tries to call any function from the MyAssembly.dll the
MyApp.exe
application crashes.

In unmanaged VC++ 6.0 world the application wouldn't even allowed to start
if some dll are missing. The system would display error message saying that some dll's are missing and application would gracefully exit.

I wonder whether I misunderstand something or made any mistake? Why
MyApp.exe is allowed to start in order to crash right after attemp to use any functionality from missing dependent assembly?


Nope; it's working just as expected. The runtime will only load an assembly
when it needs to. This, btw, helps insure you don't load things you're not
gonna use, and, it enables some interesting scenarios with web-distributed
rich client applications (since you only have to download when you use it;
what you don't use doesn't need to be transferred at all!)

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
OK, this is not , this is "feature".
But how can I prevent the ugly crashes in described above situation and exit
gracefully?

Thanks
Boris

"Tomas Restrepo (MVP)" wrote:
Hi Boris,
I notice the following strange behavior of the applications running under
.NET Framework.

Let say I have application MyApp.exe which reference assembly

MyAssembly.dll.
The MyAssembly.dll is strong named assembly, which is installed in the

GAC.

I notice that if MyAssembly.dll is not installed in GAC or the different
version
of MyAssembly.dll is installed in GAC then MyApp.exe starts OK. But as

soon as
the MyApp.exe app tries to call any function from the MyAssembly.dll the
MyApp.exe
application crashes.

In unmanaged VC++ 6.0 world the application wouldn't even allowed to start
if some dll are missing. The system would display error message saying

that
some dll's are missing and application would gracefully exit.

I wonder whether I misunderstand something or made any mistake? Why
MyApp.exe is allowed to start in order to crash right after attemp to use

any
functionality from missing dependent assembly?


Nope; it's working just as expected. The runtime will only load an assembly
when it needs to. This, btw, helps insure you don't load things you're not
gonna use, and, it enables some interesting scenarios with web-distributed
rich client applications (since you only have to download when you use it;
what you don't use doesn't need to be transferred at all!)

--
Tomas Restrepo
to****@mvps.org

Nov 17 '05 #3
Exception Handling :-)

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"Boris" <Bo***@discussi ons.microsoft.c om> wrote in message
news:45******** *************** ***********@mic rosoft.com...
OK, this is not , this is "feature".
But how can I prevent the ugly crashes in described above situation and exit gracefully?

Thanks
Boris

"Tomas Restrepo (MVP)" wrote:
Hi Boris,
I notice the following strange behavior of the applications running under .NET Framework.

Let say I have application MyApp.exe which reference assembly

MyAssembly.dll.
The MyAssembly.dll is strong named assembly, which is installed in the

GAC.

I notice that if MyAssembly.dll is not installed in GAC or the different version
of MyAssembly.dll is installed in GAC then MyApp.exe starts OK. But as

soon as
the MyApp.exe app tries to call any function from the MyAssembly.dll the MyApp.exe
application crashes.

In unmanaged VC++ 6.0 world the application wouldn't even allowed to start if some dll are missing. The system would display error message saying

that
some dll's are missing and application would gracefully exit.

I wonder whether I misunderstand something or made any mistake? Why
MyApp.exe is allowed to start in order to crash right after attemp to
use any
functionality from missing dependent assembly?


Nope; it's working just as expected. The runtime will only load an assembly when it needs to. This, btw, helps insure you don't load things you're not gonna use, and, it enables some interesting scenarios with web-distributed rich client applications (since you only have to download when you use it; what you don't use doesn't need to be transferred at all!)

--
Tomas Restrepo
to****@mvps.org

Nov 17 '05 #4

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

Similar topics

7
2785
by: Brian Sabolik | last post by:
I'm not sure if I've broken any Object Oriented rules or not, but ... I have projects in 2 different solutions that need to use each other's methods. Therefore I may have an "update" method in project 1-solution A accessing a "save" method in project 2-solution B as well as "getinfo" method in project 2 accessing a "read" method in project A. Is this permitted? I am getting the "dependency file in project cannot be copied... conflict...
5
488
by: Bob L. | last post by:
Hi everyone, I have two small applications I have written that I am trying run from a network directory. Both applications have a dependency on another assembly (.dll), and I have .NET security wide open. One application is dependent on an interop assembly (Interop.IWshRuntimeLibrary.dll), and it works fine. The other application depends on three assemblies that I have written, and although the executable starts successfully, as soon as...
1
2947
by: Thorpe | last post by:
I have build a .Net (C#) winform application. The application opens and reads and writes to an xml file that is stored with the assembly. When I run the program on my local PC everything works. I have the need for a number of different people to run the application. I copied the assembly and related files on a server I connected to the a share on the server from my local PC and tried running the application I got an error that said ...
3
11819
by: Gustavo L. Fabro | last post by:
Greetings! I'm testing VS 2005 Beta 2, and I've compiled a program that runs just fine on my computer (where VS is installed). I've tried to run this same program on another computer (after having installed MS .NET Framework 2.0 Beta 2 on it, from http://www.microsoft.com/downloads/details.aspx?FamilyId=7ABD8C8F-287E-4C7E-9A4A-A4ECFF40FC8E&displaylang=en), but got the following message:
0
1605
by: Ashok Mistry | last post by:
Hi all, I have a problem in loading Assembly dynamically through the Reflection. I want to Load an assembly, say, Main.dll. The Main.dll is dependent on a DLL, say Abc.dll, which is placed in another known directory. \AppRoot\Main.dll \AppRoot\AGroupOfDLLs\Abc.dll
3
1332
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
When we want to make updates to our application, we have to make sure all users are logged out, or they will get kicked out when we copy a new DLL. Our web application, using the 1.1 framework, we are not allowed to use VS2003 to copy changes up to the application. Reason we are told this is because it is in our DMZ and cannot be reached by computers in other domains. Also, we were told that we are not allowed to copy front page...
2
1855
by: wzhao2000 | last post by:
Back in COM time, it's possible to use #import statement in cpp to load COM object type info and use it at coding time. When the application is started, the underlying COM DLL will not be loaded until that part of code is called. Is there a similar thing in .Net (C#) application ? When I create C# application, I need to add reference to another assembly if I want to use its classes (I don't want to use reflection here). But this will...
18
2401
by: Rainer Queck | last post by:
Hello NG, I realized, that my application won't start, if a referenced assembly is missing. Basically this is understandable, but since I destribute my applictaion without a setup, it can happen that I forget one or the other .dll. Since my app depends on a whole bunch of .dll it would be great, if the app could tell me which assemblies are missing instead of not starting at all.
6
2837
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have asked previously, how to get the rid of 'Server application unavailable' error. Mr Llibre tried tried diligently to help, but same problem. I would like a bullet proof suggestion as to how to get my .aspx pages to be shown on IIS. Here is the error. Event Type: Error Event Source: ASP.NET 2.0.50727.0 Event Category: None Event ID: 1089 Date: 18/05/2007
0
9730
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
10651
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...
1
10403
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
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
9208
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...
0
6893
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
4341
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
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.