Week 2 - DOT NET Framework
Week 2 - DOT NET Framework
• However, this approach also provides the industry with a subtle problem.
• In a world in which .NET is extremely popular who is responsible for developing an MSIL-to-
native compiler when a new processor is released?
COMMON LANGUAGE RUNTIME
• The Common Language Runtime (CLR) is the heart of .NET.
• CLR takes your .NET application, compiles it into native processor code, and runs
it.
• It provides an extensive range of functionalities to help applications run properly:
• Code loading and execution
• Application isolation
• Memory management
• Security
• Exception handling
• Interoperability
CODE LOADING AND EXECUTION
• The code loading and execution part of the CLR deals with reading the MSIL code
from the disk and running it.
• It compiles the code from MSIL into the native code (machine code) that the
processor understands.
• Java also has a concept similar to MSIL, known as byte code, which the Java
runtime loads and executes.
APPLICATION ISOLATION
• One important premise of modern operating systems such as Windows and Linux
is that applications are isolated from one another.
• This is critically important from the standpoint of both security and stability.
• Imagine that you have a badly written program and it crashes the PC.
• This shouldn’t happen; only the badly behaved program should crash.
• You don’t want other applications or the operating system itself to be affected by
a program running on it.
• For example, if your email program crashes, you don’t want to lose any unsaved
changes in your word processor.
• With proper application isolation, one application crashing should not cause
others to crash.
• The other aspect to application isolation is one of security.
• Imagine that you are writing a personal and sensitive email
APPLICATION ISOLATION
• You don’t want other applications running on your computer to be able to grab or
even stumble across the contents of the email and pass it on to someone else.
• Applications running in an isolated model can’t just take what they want.
• Instead, they have to ask whether they can have something, and they are given it
only if the operating system permits it.
• This level of application isolation is already available in Windows.
• .NET extends and enhances this functionality by further improving it.
Security
• .NET has powerful support for the concept of code security.
• The Framework was designed to give system administrators, users, and software
developers a fine level of control over what a program can and can’t do.
• Windows (old framework) does not understand the difference between a script
file you write that looks through your address book and sends emails to
everyone, and those written by others and delivered as viruses.
• .NET solves this problem by building security features into the CLR.
• Under the CLR, code requires evidence to run.
• This evidence can consist of policies set by you and your system administrator.
• As well as the origin of the code (for example, whether it came off your local
machine, off a machine on your office network, or over the Internet).
Interoperability
• Interoperability in the .NET Framework is achieved on various levels.
• One kind of interoperation is at the core of the Framework, where data types are
shared by all managed languages.
• This is known as the Common Type System (CTS).
• The other type of interoperation is that of communicating with existing COM
interfaces.
• Because a large application-software base is written in COM, it was inevitable that
.NET should be able to communicate with existing COM libraries.
• This is also known as COM interop.
EXCEPTION HANDLING
• Exception handling is the concept of dealing with exceptional happenings when
you are running the code.
• Imagine that you have written a program that opens a file on disk.
• What if that file is not there?
• Well, the fact that the file is not there is exceptional, and you need to handle it in
some way.
• It could be that you crash or you could display a window asking the user to supply
a new filename.
• Either way, you have a fine level of control over what happens when an error
does occur.
• .NET provides a powerful exception handler that can catch exceptions when they
occur and give your programs the opportunity to react and deal with the problem
in some way.
THE COMMON TYPE SYSTEM AND COMMON LANGUAGE
SPECIFICATION
• Microsoft’s motivation was to get any developer using any language to use .NET,
and for this to happen, all languages had to be treated equally.
• Likewise, applications created in one language have to be understood by other
languages.
• For example, if you create a class in Visual Basic 2015, a C# developer should be
able to use and extend that class.
• Alternatively, you might need to define a string in C#, pass that string to an object
built in Visual Basic 2015.
• That object should be able to understand and manipulate the string successfully.
• The CTS enables software written in different languages to work together.
• Before .NET, Visual Basic and C++ handled strings completely differently, and you
had to go through a conversion process each time you went from one to the
other.
THE COMMON TYPE SYSTEM AND COMMON LANGUAGE
SPECIFICATION
• With the CTS in place, all .NET languages use strings, integers, and so on in the
same way, so no conversion needs to take place.
• In addition, the Common Language Specification (CLS) was introduced by
Microsoft to make it easier for language developers to adapt their languages to
be compatible with .NET.
INSTALLING VISUAL STUDIO 2015 AND DOT NET
FRAMEWORK
1 2 3 4
Double click
“vs_community_ENU
Select your If you want to install
all features, select
Finally, click
installation
__266050523.14878 location and type default; if you want the "Install"
83645.exe” and click of installation. to install specified button.
"Run". features, select
custom.
INSTALLING
VISUAL STUDIO
2015 AND DOT
NET
FRAMEWORK
INSTALLING VISUAL STUDIO
2015 AND DOT NET
FRAMEWORK