.NET and .NET Core: Languages, Cloud, Mobile and AI

Slides:



Advertisements
Similar presentations
What is.Net Gary Devendorf. .Net Framework.Net framework works like the Domino Objects only much lower level and very complete It is part of the OS (or.
Advertisements

Ahead of Time Dynamic Translation PreJit/NGEN by any other name George Bosworth Microsoft MRE04 March 21, 2004.
Introduction to .NET Framework
.NET Framework Overview
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
History of.Net Introduced by Microsoft Earlier technology was VC++ and VB VC++ comes with so many library and VB was so easy to use and not flexible to.
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
Henrico Dolfing Business Segment Partners. Océ Document Technologies GmbH2 June, NET Framework Version 3.0.
.NET Technology.
Overview of the.NET Framework. What is the.NET Framework A new computing platform designed to simplify application development A consistent object-oriented.
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
Introducing the Common Language Runtime. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution engine.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Creating and Running Your First C# Program Telerik Software Academy Telerik School Academy.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
.NET Framework Introduction: Metadata
Introduction to .Net Framework
CSC300 Visual Programming Dr. Craig Reinhart. Objectives Teach the basics of C++ –You won’t be an expert but hopefully a very good novice –GUI development.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
Meir Botner David Ben-David. Project Goal Build a messenger that allows a customer to communicate with a service provider for a fee.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
.NET Framework & C#.
 Internet providing backbone for applications  Use of several web sites and devices to provide one complete solution  Software as services  Quick software.
Understanding Code Compilation and Deployment Lesson 4.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Introduction .NET Framework
ASSEMBLIES AND THE GAC CHAPTER 1, LESSONS 4-7 & LAB.
C# Overview and Features. Content I.History of C# II.Architecture III.How to install IV.Features V.Code Sample VI.Microsoft.NET Platform VII.Why use C#
CS795/895: Introduction. Topics Distributed Systems –Availability –Performance –Web Services Security –Authentication –Authorization –Confidentiality.
.NET Framework Danish Sami UG Lead.NetFoundry
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Microsoft .NET A platform that can be used for building and running windows and web applications such that the software is platform and device-independent.
Common Language Runtime Introduction  The common language runtime is one of the most essential component of the.Net Framework.  It acts.
The Execution System1. 2 Introduction Managed code and managed data qualify code or data that executes in cooperation with the execution engine The execution.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
Just-In-Time Compilation. Introduction Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance.
Intro to ASP.NET CS-422 Dick Steflik. What is.NET As applications in the Enterprise become more and more netcentric and less and less standalone.NET is.
Introduction to the Microsoft.NET Framework Chris Wastchak Student Ambassador to Microsoft.
.NET Framework.
Introduction to Visual Basic. NET,. NET Framework and Visual Studio
Introducing the Microsoft® .NET Framework
What is .NET.
Introduction to .NET framework
Suresh Ramachandran Duke Energy
.NET Omid Darroudi.
Introduction to .NET Manuel Costa
An Introduction to the Shared Source Common Language Infrastructure (SSCLI) Damien Watkins Copyright Watkins 2002.
.NET Framework 2.0 .NET Framework 3.0 .NET Framework 3.5
Introduction to Visual Basic 2008 Programming
.Net A brief introduction to
Introduction to .NET Framework Ch2 – Deitel’s Book
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
1.1. .NET architectural components and .NET Core
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
Module 1: Getting Started
Introduction to C# AKEEL AHMED.
Programming in C# CHAPTER 1
.NET and .NET Core 7. XAML Pan Wuming 2017.
Introduction to .NET By : Mr. V. D. Panchal Content :
ASP.NET
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
Module 10: Implementing Managed Code in the Database
.NET Base Type (CTS Data Type) Managed Extensions for C++ Keyword
DOT NET ARCHITECTURE (OR) DOT NET FRAME WORK ARCHITECTURE
IS 135 Business Programming
Presentation transcript:

.NET and .NET Core: Languages, Cloud, Mobile and AI 2. Runtime and Assembly Pan Wuming 2018

Topics .NET Framework Common Language Runtime (CLR) Example Language integration Assembly: Application Unit Metadata Runtime host Application domains Key Terms

Functional Programming CLR in .NET Framework Programming Languages for .Net Managed Web Applications ASP.Net Runtime Managed Applications C# Foundation Class Library VB IIS CLR OS and Hardware C++ F# Functional Programming Unmanaged Applications Python R Javascript Typescript

WPF: Modern graphical display system for Windows Built-in hardware acceleration Resolution independence The underlying graphics technology is DirectX Graphics, media and animation as the first-class programming concepts A web-like layout model Declarative user interface Programming: XAML whether you’re designing complex three-dimensional graphics (DirectX’s forte) or just drawing buttons and plain text, all the drawing work travels through the DirectX pipeline.

WCF: New Programming Model to increases a developer’s productivity Earlier technologies will continue to work unchanged A WCF component can be hosted in any kind of environment, be it a console application, a Windows application, or IIS. Services Share the Schema and Contract, Not the Class COM/DCOM, Microsoft Message Queuing (MSMQ), Microsoft Transaction Server (MTS), COM+ ASMX, ASP.NET web services, Web Services Enhancements (WSE), Enterprise Services, System.Messaging, and .NET Remoting

The services the .NET implementations provides CLR Memory management. A common type system. An extensive class library. Development frameworks and technologies. ASP.NET, ADO.NET, and WCF... Language interoperability. Intermediate Language (IL) Version compatibility. Side-by-side execution. Multitargeting. Performance, Safety and Security for applications Memory management. In many programming languages, programmers are responsible for allocating and releasing memory and for handling object lifetimes. In .NET Framework applications, the CLR provides these services on behalf of the application. A common type system. In traditional programming languages, basic types are defined by the compiler, which complicates cross-language interoperability. In the .NET Framework, basic types are defined by the .NET Framework type system and are common to all languages that target the .NET Framework. An extensive class library. Instead of having to write vast amounts of code to handle common low-level programming operations, programmers can use a readily accessible library of types and their members from the .NET Framework Class Library. Development frameworks and technologies. The .NET Framework includes libraries for specific areas of application development, such as ASP.NET for web applications, ADO.NET for data access, and Windows Communication Foundation for service-oriented applications. Language interoperability. Language compilers that target the .NET Framework emit an intermediate code named Common Intermediate Language (CIL), which, in turn, is compiled at run time by the common language runtime. With this feature, routines written in one language are accessible to other languages, and programmers can focus on creating applications in their preferred language or languages. Version compatibility. With rare exceptions, applications that are developed by using a particular version of the .NET Framework can run without modification on a later version. Side-by-side execution. The .NET Framework helps resolve version conflicts by allowing multiple versions of the common language runtime to exist on the same computer. This means that multiple versions of applications can also coexist, and that an application can run on the version of the .NET Framework with which it was built. Multitargeting. By targeting the .NET Framework Portable Class Library, developers can create assemblies that work on multiple .NET Framework platforms, such as Windows 7, Windows 8, Windows 8.1, Windows Phone, and Xbox 360. Productivity for Developers

IL: intermediate language .NET Application A .NET Application contains one or more Assemblies An assembly contains Metadata and IL Code, and resources, within one or many files A .NET Application must run in a host environment The execution of a .NET Application is Managed by CLR IL: intermediate language Self-Host?

.NET runtimes Common Language Runtime (CLR) for the .NET Framework Core Common Language Runtime (CoreCLR) for .NET Core .NET Native for Universal Windows Platform The Mono runtime for Xamarin.iOS, Xamarin.Android, Xamarin.Mac, and the Mono desktop framework

Managed execution process Choosing a compiler. Compiling your code to MSIL. Compiling MSIL to native code. Running code. Managed By CLR Create Assembly

CLR Services Class Layout Security JIT Compiler Other Runtime Services Type Awareness Exception Integration JIT Compiler Other Runtime Services Class Layout Memory & GC Security

Common Language Runtime (CLR)

The Roles of CLR Compiler Assembly Development Source code C# VB F# … public static void Main(String[] args ) usr=Environment.GetEnvironmentVariable("USERNAME"); try { { String usr; FileStream f; StreamWriter w; w.WriteLine(usr); w=new StreamWriter(f); f=new FileStream(“C:\\test.txt",FileMode.Create); Console.WriteLine("Exception:"+e.ToString()); } catch (Exception e){ w.Close(); } Compiler public static void Main(String[] args ) usr=Environment.GetEnvironmentVariable("USERNAME"); try { { String usr; FileStream f; StreamWriter w; w.WriteLine(usr); w=new StreamWriter(f); f=new FileStream(“C:\\test.txt",FileMode.Create); Console.WriteLine("Exception:"+e.ToString()); } catch (Exception e){ w.Close(); } Source code C# VB F# … MSIL Metadata Resources

Global Assembly Cache (GAC) Application Directory The Roles of CLR Assembly Development Compiler Assembly Development C# VB F# … MSIL Metadata Resources public static void Main(String[] args ) usr=Environment.GetEnvironmentVariable("USERNAME"); try { { String usr; FileStream f; StreamWriter w; w.WriteLine(usr); w=new StreamWriter(f); f=new FileStream(“C:\\test.txt",FileMode.Create); Console.WriteLine("Exception:"+e.ToString()); } catch (Exception e){ w.Close(); } Source code Global Assembly Cache (GAC) Install Setup Copy Browser Application Directory Download Cache

The Roles of CLR Assembly on Target Machine Development Application Directory Setup Copy Browser Download Cache Deployment Assembly on Target Machine Global Assembly Cache (GAC) Install Policy <security> <mscorlib> <configuration> <?xml version="1.0" encoding="utf-8" ?> <policy> version="1" <CodeGroup class="UnionCodeGroup" <PolicyLevel version="1"> PermissionSetName="Nothing" Description="Code group grants no permissio ns and forms the root of the code group tree."> Name="All_Code" <IMembershipCondition clas s="AllMembershipCondition" version="1"/> PermissionSetName="FullTrust" Execution IL to Native Compiler Class Loader Security Assembly Loader Garbage Collection Native code + GC table Code Manager Exception Manager Thread Support COM Interop Debug Engine

JIT Process JITCompiler function { Method Structure to Console static void WriteLine() Managed.exe JitCompiler static void Main() { Console.WriteLine("Hello"); Console.WriteLine("GoodBye"); } static void WriteLine(string) JitCompiler (remaining members) JitCompiler MSCorEE.dll Native CPU instructions JITCompiler function { In the assembly that implements the type (Console) look up the method (Writeline) being called in metadata. From the metadata, get the IL for this method. Allocate the block of memory. Compile the IL into native CPU instructions; the native code is saved in the memory allocated in step 3. Modify the method's entry in the Type's table so that it now points to the memory block allocated in step 3. Jump to the native code contained inside the memory block. }

Console Managed.exe MSCorEE.dll static void WriteLine() JitCompiler static void Main() { Console.WriteLine("Hello"); Console.WriteLine("GoodBye"); } static void WriteLine(string) Native CPU instructions Native (remaining members) JitCompiler MSCorEE.dll JITCompiler function { In the assembly that implements the type (Console) look up the method (Writeline) being called in metadata. From the metadata, get the IL for this method. Allocate the block of memory. Compile the IL into native CPU instructions; the native code is saved in the memory allocated in step 3. Modify the method's entry in the Type's table so that it now points to the memory block allocated in step 3. Jump to the native code contained inside the memory block. }

Benefits of Presence of the CLR Performance improvements Cross-language integration Cross-language exception handling Enhanced security Versioning and deployment support A simplified model for component interaction Debugging and profiling services.

Example: Language Integration C# Project A Static Public Method It will be used for F#, C++ and VB codes

F#

C++

The previous C# Assembly used by a VB project Similar XAML UI Two controls: a textbox and a button A method delegate for button’s Click event

Assembly: Application Unit Contains Code Security boundary. Type boundary Reference scope boundary Version boundary Deployment unit To support Side-by-side execution

Manifest Enumerates the files that make up the assembly. Governs how references to the assembly's types and resources map to the files that contain their declarations and implementations. Enumerates other assemblies on which the assembly depends. Provides a level of indirection between consumers of the assembly and the assembly's implementation details. Renders the assembly self-describing.

GAC and Strong-Named Assembly Global Assembly Cache: Machine-wide Code Cache Strongly Named Assemblies Are Tamper-Resistant Strong-Named the simple text name the version number optional culture information a digital signature, and the token of the public key that corresponds to the private key used for signing. Delay Signing or Partial Signing an Assembly Assemblies deployed in the GAC must have a strong name

Signing an assembly

The AssemblyRef metadata information

Metadata within a PE File Win32 Portable Executable File Format

Metadata Tables and Heaps Each metadata table holds information about a certain type of elements of your program Method, type, and so on Metadata also stores information in four heap structures String Blob: binary objects of arbitrary size user string GUID: 16-byte binary objects Metadata tokens are used in MSIL to reference a row of a particular metadata table.

Application Domains Application domains are typically created by runtime hosts To provide isolation between assemblies Objects that pass between domains are either copied or accessed by proxy

Runtime Hosts Shell executables IE ASP.NET Before any managed code can be executed, the host must load and initialize the CLR. Loads the runtime into a process Creates the application domains within the process Loads user code into the application domains The hosting APIs All hosts start with an unmanaged stub because the runtime is not yet running in the process. C++! #include <metahost.h> #pragma comment(lib, "mscoree.lib") … hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID*)&pMetaHost);

Class library: types of applications and services Paradigms Evolving and Abstracting Console applications. Windows GUI applications (Windows Forms). Windows Presentation Foundation (WPF) applications. ASP.NET applications. Windows services. Service-oriented applications using Windows Communication Foundation (WCF). Workflow-enabled applications using Windows Workflow Foundation (WF).

Finally, These are the key words: Common Language Runtime (CLR) Assembly Metadata Manifest Global Assembly Cache(GAC) Strong Named Assembly Intermediate language (IL) Delay Sign JIT Complier Application Domains