A Place For My Thoughts, Technical Activities & Dev Stuff

image_60140ec0-ce46-4dbf-a14f-4210eab7f42c

Architecture of .NET Framework

by

.NET Framework is developed by Microsoft.

The .NET Framework is Microsoft platform for Software Development. It provides a Universal Platform that let Microsoft Developers Program in same way and with the same languages regardless of whether for working for the Web, for Desktop or for Mobile.

There’re also class libraries available for particular type of applications! So if someone working upon a particular environment then appropriate libraries are available. Like when someone working upon Web then libraries like Sockets and other communication standards are available.

Basically .NET Framework has following Components;

  • Framework Class Library (FCL)

It is Standard class library for .NET development that provides core capabilities such as UI Management, Data Access, Security etc. It Delivers basic functionality for developing: XML, ADO.NET, LINQ, ASP.NET, WPF, WCF, WWF, Silverlight, Web services, Windows Forms.

The C# runs in a Managed Code Environment;

  • Common Language Runtime (CLR):

It is the Environment for controlled execution of programmed code – like a virtual machine. It Executes .NET applications.

  • SDK, Compilers and Tools.
  • .NET Framework Architecture

  • The Operating System;

The OS manages the resources, the processes and the users of the machine. Provides to the applications some services (threads, I/O, GDI+, DirectX, COM, COM+, MSMQ, IIS, WMI, …). CLR is a separate process in the OS.

  • Common Language Runtime (CLR);

CLR is the nucleus of .NET Framework. It manages the execution of the .NET code. Manages the memory, concurrency, security…

  • Base Class Library (BCL);

Rich object-oriented library with fundamental classes. Input-output, collections, text processing, networking, security, multi-threading…

  • Application Class Libraries and Services;

It includes Services. i.e. Database access, ADO.NET, LINQ, LINQ-to-SQL and Entity Framework. Strong XML support

  • WCF and WWF (Communication and Workflow Tier);

Windows Communication Foundation (WCF) and Windows Workflow Foundation (WWF) for the SOA world.

  • Common Language Specification;

User interface technologies: Web based, Windows GUI, WPF, Silverlight, mobile. Including ASP.NET, WPF, Web forms, others…

  • Programming Languages;

And then the top layer of Programming Languages come, in which lot of language include; C#, C++, VB, J#, F#, Jscript, F# etc…

CLR;

Managed execution environment and Controls the execution of managed .NET programming code

Something like virtual machine Like the Java Virtual Machine (JVM).

Not an interpreter. Compilation on-demand is used Known as Just in Time (JIT) compilation.

Possible compilation in advance.

  • Responsibility of CLR;
    • Execution of the IL code and the JIT compilation
    • Managing memory and application resources
    • Ensuring type safety
    • Interaction with the OS
    • Managing security
      • Code access security
      • Role-based security
    • Managing exceptions
    • Managing concurrency – controlling the parallel execution of application threads
    • Managing application domains and their isolation
    • Interaction with unmanaged code
    • Supporting debug / profile of .NET code
  • CLR Architecture;

Managed Code;

CLR executed code is called managed code. Represents programming code in the low level language MSIL (MS Intermediate Language) Contains metadata. i.e. Description of classes, interfaces, properties, fields, methods, parameters, etc.

Programs, written in any .NET language are Compiled to managed code (MSIL). Packaged as assemblies (.exe or .dll files)

Object-oriented, Secure, Reliable, Protected from irregular use of types (type-safe), Allows integration between components and data types of different programming languages, Portable between different platforms, Windows, Linux, Max OS X, etc.

Unmanaged (Win32) Code;

No protection of memory and type-safety. Reliability problems and Safety problems.

Doesn’t contain metadata. Needs additional overhead like (e.g. use COM), Compiled to machine-dependent code, Need of different versions for different platforms, Hard to be ported to other platforms.

  • Memory Management;

CLR manages memory automatically. Dynamically loaded objects are stored in the managed heap. Unusable objects are automatically cleaned up by the garbage collector. Some of the big problems are solved. Memory leaks and Access to freed or unallocated memory. Objects are accessed through a reference.

  • Intermediate Language (MSIL);

Low level language (machine language) for the .NET CLR. It has independent set of CPU instructions. Loading and storing data, calling methods, Arithmetic and logical operations, Exception handling, Etc.

MSIL is converted to instructions for the current physical CPU by the JIT compiler.

Sample MSIL Program;

Compilation and Execution;

How CLR Executes MSIL?

C# Does not compile to machine code, its code compile to Bytecode. A format that can be interpreted and executed on multiple operating systems. While the .NET framework is built for Windows, so there’ve been number of efforts to create environment for C# that can be executed by a layer called Common Language Runtime (CLR). The CLR is a Virtual Machine similar to JVM (Java Virtual Machine). It Provides Machine Level Security, memory management and OS level security and much more…

The .NET Stack;

So! All of these framework supports C#. And you can also build Universal Windows App for Windows 10. Moreover, now through Bridge Tools you can also build Native Apps through C#. So Distinct Compilers are required for each OS!

Microsoft Visual C# is the managed language that is compiled to Byte code. As compare to this, there’re are native languages which are compiled to machine code. For them we need distinct compilers across each OS. Common Native Languages are C, C++, Objective C.

As the C# is the managed language, so it is compiled to intermediate format. It also typically are cross OS compatible (like Java). So it compiles to Byte code, note the machine code. Then that bytecode is executed at Runtime by CLR (Common Language Runtime) on Windows. Similarly, that bytecode can also be executed at Runtime on another OS without having to be recompile by the third party compilers…

Warning: Invalid argument supplied for foreach() in D:\home\site\wwwroot\wp-includes\translations.php on line 1445

9 Comments

  1. “I’m curious to find out what blog platform you have been working with? I’m having some minor security issues with my latest site and I would like to find something more safe. Do you have any recommendations?”

  2. Oh my goodness! an amazing post dude. Thank you Nevertheless I am experiencing issue
    with ur rss . Do’t understand why Unable to subscribe to it.
    Is there anyone getting identical rss difficulty? Anyone who understands kindly react.
    Thnkx

Leave a Reply

Your email address will not be published.

*

Latest from Microsoft Visual C#.

Go to Top