473,388 Members | 1,399 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,388 software developers and data experts.

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 1536
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***@discussions.microsoft.com> wrote in message
news:45**********************************@microsof t.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
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...
5
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...
1
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....
3
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...
0
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...
3
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,...
2
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...
18
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...
6
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...
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
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
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
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...

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.