Presentation is loading. Please wait.

Presentation is loading. Please wait.

.Net Framework Joel Pereira Software Design Engineer WinFS API Team Microsoft Corporation.

Similar presentations


Presentation on theme: ".Net Framework Joel Pereira Software Design Engineer WinFS API Team Microsoft Corporation."— Presentation transcript:

1 .Net Framework Joel Pereira Software Design Engineer WinFS API Team Microsoft Corporation

2 Agenda Part I - Fundamentals Programming Models Design Goals and Architecture CLR Services Part II – Visual Studio 2005 Extending the Platform Improving the Platform Innovation in the Platform

3 Unify Programming Models Windows API.NET Framework Consistent API availability regardless of language and programming model ASPStateless, Code embedded in HTML pages MFC/ATLSubclassing,Power,Expressiveness VB Forms RAD,Composition,Delegation

4 Make It Simple To Use Organization Code organized in hierarchical namespaces and classes Unified type system Everything is an object, no variants, one string type, all character data is Unicode Component Oriented Properties, methods, events, and attributes are first class constructs Design-time functionality

5 How Much Simpler? HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window", 0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain); Form form = new Form(); form.Text = "Main Window"; form.Show(); Windows API.NET Framework

6 Hello World Demo What you need

7 Agenda

8 Common Language Runtime Design Goals Dramatically simplifies development and deployment Unifies programming models Provides robust and secure execution environment Supports multiple programming languages

9 Architectural Overview Common Language Runtime Framework Class loader and layout GC, stack walk, code manager IL to native code compilers Security Execution Support Base Classes

10 Assembly Compilation And Execution Source Code Language Compiler Compilation At installation or the first time each method is called Execution JIT Compiler NativeCode Code (IL) Metadata

11 Languages The CLR is Language Neutral All languages are first class players You can leverage your existing skills Common Language Specification Set of features guaranteed to be in all languages We are providing VB, C++, C#, J#, JScript Third-parties are building APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk…

12 Hello World Demo

13 Agenda

14 Component-Based Programming 3 core technologies make building and using components easy Type safety Automatic memory management Metadata This greatly simplifies application development

15 Type Safety Type safety ensures that objects are used the way they were intended to be used Prevents an object’s state from being corrupted The CLR enforces type safety Attempting to coerce an object to an incompatible type causes the CLR to throw an exception Type safety means code confidence Common programmer errors will be found immediately Rectangle(hwnd, 0, 0, 10, 10); //hwnd should be an hdc MessageBox(hwnd, “”, “”, IDOK); //IDOK should be MB_OK

16 Automatic Memory Management The CLR tracks the code’s use of objects and ensures Objects are not freed while still in use (no memory corruption) Objects are freed when no longer in use (no memory leaks) Code is easier to write because there is no question as to which component is responsible to free an object When passed a buffer, who frees it: caller or callee? Each process has 1 heap used by all components Objects can’t be allocated from different heaps You don’t have to know which heap memory was allocated in or which API to call to free the memory In fact, there is no API to free memory, the GC does it

17 Managed Data Lifetime Managed by Runtime (GC) Compacting GC eliminates fragmentation and reduces working set Data may be moved during collection Object references are updated automatically No more intrusive than a page fault Layout Provided by Runtime Usually automatic Metadata can specify OrderPacking Explicit layout

18 Metadata Set of data tables embedded in an EXE/DLL The tables describe what is defined in the file (Type, fields, methods, etc.) Every component’s interface is described by metadata tables A component’s implementation is described by Intermediate Language The existence of metadata tables enables many features No header files Visual Studio’s IntelliSense Components don’t have to be registered in the registry Components don’t need separate IDL or TLB files The GC knows when an object’s fields refer to other objects An object’s fields can be automatically serialized/deserialized At runtime, an application can determine what types are in a file and what members the type defines (also known as late binding) Components can be written/used by different languages

19 Metadata: Creation And Use Metadata (and code) Debugger SchemaGenerator Profiler Compilers Proxy Generator Type Browser Compiler SourceCode XML encoding (SDL or SUDS) Serialization Designers Reflection TLB Exporter

20 Runtime Execution Model Class Loader CPU Managed Native Code Assembly First call to method First reference to type Assembly Resolver First reference to Assembly IL to native conversion

21 Assemblies Collections of types and binding information Unit of deployment One or more files, independent of packaging Self-describing via metadata (“manifest”) Unit of Versioning Captured by compiler Policy per-application as well as per- machine Security boundary Assemblies are granted permissions Methods can demand proof that a permission has been granted to entire call chain Mediate type import and export Types always referenced relative to assembly

22 Assembly Identity Assemblies can be Private or Shared Private – used only by a single application Shared – used by any installed application Shared assemblies are identified by Name – such as System.Drawing Publisher – such as Microsoft Identified with publishers key Version – 4 part version number Not associated with product version Culture Easier localization

23 Assembly Storage Private Assemblies Installed in application directory Xcopy deployment, Not registration Zero impact install, copy and run Shared Assemblies Installed in Global Assembly Cache (GAC) Extensive binding policy support Use specific version, Publisher policy Policy control per machine or per application

24 Assembly Binding Applications are configurable units Made up of one or more assemblies Application-specific files or data Assemblies are located based on… Assembly Identity and The binding policy of the application Applications can have private versions of assemblies Version policy can be per-application

25 Compiling IL To Native Econo JIT (not a v1 deliverable) Generates un-optimized native code Code can be discarded and regenerated Most portable JIT compiler Standard JIT Generates optimized native code Includes verification of IL code Install time code generation (Pre-JIT) Done at install time Reduces start-up time Native code has version checks and reverts to runtime JIT if they fail

26 Exception Handling Language neutral exception model Supports both typed and filtered exceptions Compilers emit EH tables Handlers located based on EH Tables 2 pass algorithm, Find handler, handle exception Very little overhead in the non- exceptional case Tightly integrated with Structured Exception Handling

27 JIT Compiler - Inline

28 Standardization A subset of the.NET Framework and C# submitted to ECMA ECMA and ISO International Standards Co-sponsored with Intel, Hewlett-Packard Common Language Infrastructure Based on Common Language Runtime and Base Framework Layered into increasing levels of functionality

29 Rotor (SSCLI) Shared-Source version of the CLR+BCL+C# compiler Ports available: Windows, FreeBSD, OSX, etc Real product code offers real world learning

30 Calling Unmanaged Code Common Language Runtime Unmanaged Code Managed Object Unmanaged Object Managed Object Unmanaged Code

31 COM Interop Provides a bridge between the runtime and COM and vice versa Maintains programming model consistency on both sides Abstracts the inconsistencies between the two models Different data types Method signatures Exception/Hresults Activation models Object discovery

32 Platform Invoke (P/Invoke) Provides access to static entry points in unmanaged DLLs Similar to: VB Declare statement Load library / GetProcAddress Requires method definition with custom attribute Uses same underlying marshaling service as COM Interop

33 Developer Roadmap “Orcas” release “Orcas” release Windows “Longhorn” integrationWindows “Longhorn” integration New UI tools and designersNew UI tools and designers Extensive managed interfacesExtensive managed interfaces Visual Studio Orcas “Longhorn” Visual Studio.NET 2003 “Everett Release” “Everett Release” Windows Server 2003 integrationWindows Server 2003 integration Support for.NET Compact Framework and device developmentSupport for.NET Compact Framework and device development Improved performanceImproved performance Visual Studio 2005 “Yukon” “Whidbey” release “Whidbey” release SQL Server integrationSQL Server integration Improved IDE productivity and community supportImproved IDE productivity and community support Extended support for XML Web servicesExtended support for XML Web services Office programmabilityOffice programmability

34 Agenda

35 SQL Server Integration Design Goal Bring framework programming model into the database tier Allow business logic to easily migrate to the most appropriate tier Enable safe database extensions Result: Stored Procedures, Triggers, data types defined in managed code

36 VS.NET Project Assembly: geom.dll VB, C#, … Build SQL Server SQL Data Definition: create assembly … create function … create procedure … create trigger … create type … SQL Queries: SELECT name FROM Supplier WHERE Location.Distance ) < 3 CLR hosted by SQL (in-proc) SQL CLR Functionality Define Location.Distance()

37 Sql Programming Model Splitting a string The old way…. varchar(200) = 'Microsoft Corporation|SQL Server|2003|SQL-CLR| |11:32:00|Document|3.b.3' SELECT + '|', 0 + 1, + '|', 0 + 1) ), + '|', 0 + 1) ), + '|', + '|') + 1, + '|', + '|', + '|') + 1) - + '|') + 1) - + '|') - 1 ), + '|') - 1 ), + '|', + '|', + '|') + 1) + 1, + '|') + 1) + 1, + '|', + '|', + '|', + '|', + '|') + 1) + 1) - + '|') + 1) + 1) - + '|', + '|', + '|') + 1) - 1 ), + '|') + 1) - 1 ), + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1, + '|') + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) - + '|') + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|') + 1) + 1) - 1 ), + '|') + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 ) + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 ) varchar(200) = 'Microsoft Corporation|SQL Server|2003|SQL-CLR| |11:32:00|Document|3.b.3' SELECT + '|', 0 + 1, + '|', 0 + 1) ), + '|', 0 + 1) ), + '|', + '|') + 1, + '|', + '|', + '|') + 1) - + '|') + 1) - + '|') - 1 ), + '|') - 1 ), + '|', + '|', + '|') + 1) + 1, + '|') + 1) + 1, + '|', + '|', + '|', + '|', + '|') + 1) + 1) - + '|') + 1) + 1) - + '|', + '|', + '|') + 1) - 1 ), + '|') + 1) - 1 ), + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1, + '|') + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) - + '|') + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|') + 1) + 1) - 1 ), + '|') + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) - 1 ), + '|') + 1) + 1) + 1) + 1) + 1) - 1 ), + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1, + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1, + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - + '|') + 1) + 1) + 1) + 1) + 1) + 1) + 1) - + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|', + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 ) + '|') + 1) + 1) + 1) + 1) + 1) + 1) - 1 )

38 Sql Programming Model Splitting a string Public Shared Sub SplitString() Dim s As String Dim s As String s = "Microsoft Corporation|SQL Server|2003|SQL-CLR| |11:32:00|Document|3.b.3" s = "Microsoft Corporation|SQL Server|2003|SQL-CLR| |11:32:00|Document|3.b.3" Dim myArray() As String = Split(s, "|") Dim myArray() As String = Split(s, "|") End Sub The new way….

39 Strongly Typed Resources

40 Moving to 64 bit 64 bit for Servers and workstations X64 and IA64 bit support Enable Yukon and ASP.NET Verifiable managed binaries just run! VS: Runs as a 32bit application You can develop, deploy, and debug 32 and 64bit applications

41 Agenda

42 Performance Objectives: make.NET an even greater programming platform Long-Term: make the performance characteristics of the CLR similar to native code Reduce marginal cost of additional managed processes Reduce startup time and working set NGen Compiles IL code to native code, saving results to disk Advantages: no need to recompile IL to native code, and class layout already set so better startup time Whidbey: Significant reductions in the amount of private, non-shareable working set OS: ‘no-Jit’ plan, all managed code will be NGened

43 Performance everywhere New, Performant APIs APIs for faster resource lookup Lightweight CodeGen: only generates essential code (contrast to Reflect Emit) Existing APIs Improved Cross AppDomain Remoting Between 1.1 and 200x faster. Biggest gains for simpler items (strings, integers, serializable objects) Delegate invoke performance has more than doubled AppDomain Footprints: significantly reduced UTF8Encoding: translation is 2.5x faster

44 TryParse

45 RAD Debugging Edit and Continue: Edit Code at runtime Allowed Edits: Examples Add private fields to a class Add private non-virtual methods to a class Change a function body, even while stepping Disallowed Edits: Examples Removing fields/methods Edits to generic classes Serialization will not recognize new fields Display Attributes for a better debugging experience

46 Debugger Display Views

47 CLR Security New cryptography support PKI and PKCS7 support XML encryption support Enhanced support for X509 certificates Enhanced Application Security Permission Calculator Integration with ClickOnce Better SecurityException Debug-In-Zone Managed ACL Support

48 IO and other Improvements

49 Agenda

50 Generics Why generics? Compile-time type checking Performance (no boxing, no downcasts) Reduced code bloat (typed collections) VB, C#, MC++ produce & consume generics Use generics freely in internal APIs Consider using generics in public APIs Generics are not yet in CLS To be CLS compliant, provide a non-generic API alternative Microsoft is actively pursuing standardization of generics in runtime and languages

51 public class List { private object[] elements; private object[] elements; private int count; private int count; public void Add(object element) { public void Add(object element) { if (count == elements.Length) Resize(count * 2); if (count == elements.Length) Resize(count * 2); elements[count++] = element; elements[count++] = element; } public object this[int index] { public object this[int index] { get { return elements[index]; } get { return elements[index]; } set { elements[index] = value; } set { elements[index] = value; } } public int Count { public int Count { get { return count; } get { return count; } }} Generics public class List public class List { private ItemType[] elements; private ItemType[] elements; private int count; private int count; public void Add(ItemType element) { public void Add(ItemType element) { if (count == elements.Length) Resize(count * 2); if (count == elements.Length) Resize(count * 2); elements[count++] = element; elements[count++] = element; } public ItemType this[int index] { public ItemType this[int index] { get { return elements[index]; } get { return elements[index]; } set { elements[index] = value; } set { elements[index] = value; } } public int Count { public int Count { get { return count; } get { return count; } }} List intList = new List(); intList.Add(1);intList.Add(2);intList.Add(“3"); int i = (int)intList[0]; List intList = new List(); intList.Add(1); // Argument is boxed intList.Add(2); // Argument is boxed intList.Add(“3"); // Should be an error int i = (int)intList[0]; // Cast required List intList = new List (); intList.Add(1); // No boxing intList.Add(2); // No boxing intList.Add(“3"); // Compile-time error int i = intList[0]; // No cast required

52 Generics in VB Public Class List(Of ItemType) Private elements() As ItemType Private elements() As ItemType Private elementcount As Integer Private elementcount As Integer Public Sub Add(ByVal element As ItemType) Public Sub Add(ByVal element As ItemType) If elementcount = elements.Length Then Resize(elementcount * 2) If elementcount = elements.Length Then Resize(elementcount * 2) elements(elementcount) = element elements(elementcount) = element count += 1 count += 1 End Sub End Sub Public Default Property Item(ByVal index As Integer) As ItemType Public Default Property Item(ByVal index As Integer) As ItemType Get Get Return elements(index) Return elements(index) End Get End Get Set (ByVal Value As ItemType) elements(index) = Value Set (ByVal Value As ItemType) elements(index) = Value End Set End Set End Property End Property Public ReadOnly Property Count As Integer Public ReadOnly Property Count As Integer Get Get Return elementcount Return elementcount End Get End Get End Property End Property End Class Dim intList As New List(Of Integer) intList.Add(1) ‘ No boxing intList.Add(2) ‘ No boxing intList.Add(“3") ‘ Compile-time error Dim i As Integer = intList(0) ’ No cast required

53 Generics in C++ generic generic public ref class List { array ^ elements; array ^ elements; int count; int count;public: void Add(T element) { void Add(T element) { if (count == elements->Length) Resize(count * 2); if (count == elements->Length) Resize(count * 2); elements[count++] = element; elements[count++] = element; } property T default [int index] { property T default [int index] { T get() { return elements[index]; } T get() { return elements[index]; } void set(T value) { elements[index] = value; } void set(T value) { elements[index] = value; } } property int Count { property int Count { int get() { return count; } int get() { return count; } }}; List ^ intList = gcnew List (); intList->Add(1); // No boxing intList->Add(2); // No boxing intList->Add(“3"); // Compile-time error int i = intList[0]; // No cast required

54 Enhancing the Base Library Generic Collections System.Collections.Generic classes List Dictionary Dictionary StackQueue System.Collections.Generic interfaces IList IDictionary IDictionary ICollectionIEnumerableIEnumeratorIComparableIComparer

55 Enhancing The Base Library Other Generics to look out for Nullable(Of T) Extremely useful for situations where null is a value, such as database valuetypes EventHandler EventHandler Saves on making your own EventHandlers Dim intVal as Nullable(Of Integer) = 5 If intVal.HasValue Then ‘ checks for a value delegate void EventHandler (Object sender, T e) where T : EventArgs;

56 Whidbey Tracing Features Pluggable Formatters Pre-Whidbey : Formatting of Trace information was predefined, and not controllable Whidbey : Predefined formatters (delimiter, xml) added, and you can make your own MySource;Error;13;Wrong key;;;;;; ; Additional Listeners Pre-Whidbey : No Console listener, ASP had their own tracing mechanism Whidbey : Added Console listener. Integrated ASP tracing into our own, and added ETW listener

57 Whidbey Tracing Features Auto-generated Data Pre-Whidbey : Standard information such as timestamp or callstack would have to be explicitly generated Whidbey : An Admin can easily generate this data automatically, via config settings

58 Whidbey Tracing Features Listener Filtering Pre-Whidbey : Formatting of Trace information was predefined, and not controllable Whidbey : Assign filtering to listeners, so only certain messages are traced. This allows filtering on any property of a message. E.g., ID, TimeStamp, etc. Switches Pre-Whidbey : Couldn’t determine what tracing a component supported Whidbey : Support the ability to determine what tracing mechanisms a component has

59 MemoryPressure

60 Summary Extending the Platform SQL Server Integration Moving to 64 bit Improving the Platform Performance work RAD Debugging Security improvements Innovating in the Platform Generics support BCL Enhancements

61 Attend a free chat or web cast List of newsgroups communities/newsgroups/en-us/default.aspx MS Community Sites Local User Groups Community sites

62 Resources BCL Blog BCL Website BCL public mail alias Framework Standard Library Annotated Reference Applied Microsoft.Net Framework Programming

63 Q & A:

64 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

65 Backup

66 Diagnostics

67 PerformanceCounter Integrated with WMI EventLog Custom Message Resources Structured Data Tracing Correlating Trace Events Tracing Integrated with ASP.NET Tracing Integrated with ETW Enhancing the Base Library System.Diagnostics for Enterprise

68 Whidbey Tracing Features Pluggable Formatters Pre-Whidbey : Formatting of Trace information was predefined, and not controllable Whidbey : Predefined formatters (delimiter, xml) added, and you can make your own MySource;Error;13;Wrong key;;;;;; ; Additional Listeners Pre-Whidbey : No Console listener, ASP had their own tracing mechanism Whidbey : Added Console listener. Integrated ASP tracing into our own, and added ETW listener

69 Whidbey Tracing Features Auto-generated Data Pre-Whidbey : Standard information such as timestamp or callstack would have to be explicitly generated Whidbey : An Admin can easily generate this data automatically, via config settings

70 Whidbey Tracing Features Listener Filtering Pre-Whidbey : Formatting of Trace information was predefined, and not controllable Whidbey : Assign filtering to listeners, so only certain messages are traced. This allows filtering on any property of a message. E.g., ID, TimeStamp, etc. Switches Pre-Whidbey : Couldn’t determine what tracing a component supported Whidbey : Support the ability to determine what tracing mechanisms a component has

71 Jit

72 JIT-Compilation What is it? Compiles methods, on-demand, from IL to native code Native code discarded after process terminates Disadvantages? Native code not shared across AppDomains or processes JIT compiler uses memory: ~300 KB for its code, plus more for its working data structures Touches otherwise ‘cold’ metadata, so increasing memory usage

73 NCL

74 FTP protocol support Automatic proxy discovery Integrated with IE HTTP request caching Integrated with the IE cache Improved socket security SSL stream and authentication support over sockets Network tracing Easier to debug network errors Enhancing the Base Library Improved Networking

75 System.Uri Performance enhancements Support for relative URI’s HTTP Listener Receive HTTP requests inside your application Network information Enumerate cards on the machine, get notified when things change Enhancing the Base Library Improved Networking

76 Enhancing the Base Library Handling network change events public static void AddressChanged(object source, AddressChangedEventArgs e){ Console.WriteLine("Address Changed"); receivedNetworkChange = true; } public static void Main() { NetworkInformation netInfo = new NetworkInformation(); netInfo.AddressChanged += new NetworkInformation.AddressChangedEventHandler(Class1.Address Changed); netInfo.StartListeningForAddressChanges();while(true){ if (receivedNetworkChange) if (receivedNetworkChange) netInfo.StopListeningForAddressChanges(); netInfo.StopListeningForAddressChanges();}}

77 Enhancing the Base Library FTP Protocol Support Sub DownloadFile() Sub DownloadFile() Dim filename As String Dim filename As String filename = "ftp://ms.com/files/dotnetfx.exe" filename = "ftp://ms.com/files/dotnetfx.exe" Dim client As New WebClient Dim client As New WebClient client.DownloadFile(filename, "dotnextfx.exe") client.DownloadFile(filename, "dotnextfx.exe") End Sub

78 Automatic proxy discovery Integrated with IE HTTP Listener Receive HTTP requests inside your application HTTP request caching Integrated with the IE cache Improved socket security SSL stream and authentication support over sockets Network tracing Easier to debug network errors Enhancing the Base Library Improved Networking

79 Enhancing the Base Library Check network availability Dim netInfo as new NetworkInformation() If (netInfo.GetIsConnected() = True) 'use network resources 'use network resourcesElse 'use local cache 'use local cache End If

80 Standardization

81 Standard for CLI and C# ECMA approved December 2001 ISO expected October 2002 Several CLI implementations.NET Framework.NET Compact Framework SSCLI (“Rotor”) – Shared source on XP, FreeBSD, OS X “Mono” – Open source on Linux Whidbey maintains a high level of compliance Active engagement continues Generics, parallel processing extensions, etc

82 Reliability – Managed Code ‘SafeHandle’ Can clean up unmanaged resources in exceptional conditions HostProtectionAttribute Allow hosts to decide what features to support Reliable Managed Code Guidance Upcoming whitepaper & samples

83 Threading

84 Threading Semaphore Resource counting for mutex’s // construct a semaphore with a count of 3 Semaphore sem = new Semaphore(3); private void UseResource { // Wait until a count is available… sem.WaitOne(); //  the sem count is reduced by one // other code … // Release the count: sem.Release(); //  the count is incremented by one

85 Threading Named Events V1.0 and V1.1: Events can only signal the same process Whidbey: Named Events allow cross process communication V1.0 and V1.1: Events can only signal the same process Whidbey: Named Events allow cross process communication Public Class EventWaitHandle Inherits WaitHandle Public Sub New EventWaitHandle(initialState As Boolean, type As EventType, name As String )

86 Backup

87 Tools Client Application Model AvalonWindows Forms Web & Service Application Model ASP.NET / Indigo Win FS Compact Framework Yukon Mobile PC Optimized System.Help System.Drawing System.NaturalLanguageServices Data Systems Application Model Presentation Data Mobile PC & Devices Application Model Communication Command Line NT Service DataSet Mapping ObjectSpaces ObjectSpace Query Schema Item Relationship Media Audio Video Images System.Messaging System. Discovery System.DirectoryServices System.Remoting System.Runtime.Remoting Active Directory Uddi System.Web.Services Web.Service Description Discovery Protocols System.MessageBus Transport Port Channel Service Queue PubSub Router System.Serialization System.Threading System.Text System.Design Base & Application Services Fundamentals System.ComponentModel System.CodeDom System.Reflection System.EnterpriseServices System.Transactions Security System.Windows. TrustManagement System.Web. Security System.Message Bus.Security Authorization AccessControl Credentials Cryptography System.Web.Configuration System.MessageBus.Configuration System.Configuration System.Resources System.Management System.Deployment System.Diagnostics ConfigurationDeployment/Management System.Windows System.Windows.Forms System.Console System.ServiceProcess System.Windows.Forms System.Web System.Storage System.Data.SqlServer Animation Controls Control Design Panel Controls Dialogs SideBar Notification System.Windows Documents Text Element Shapes Shape Ink UI Element Explorer Media System.Windows.Forms Forms Control Print Dialog Design System.Web.UI Page Control HtmlControls MobileControls WebControls Adaptors Design Ports InteropServices System.Runtime System.IO System.Collections Generic System.Search Annotations Monitoring Logging Relevance System.Data SqlClient SqlTypes SqlXML OdbcClient OleDbClient OracleClient Core Contact Location Message Document Event System.Storage System.Web Personalization Caching SessionState System.Xml Schema Serialization Xpath Query Permissions Policy Principal Token System.Security System.Collaboration RealTimeEndpoint TransientDataSession SignalingSession Media Activities HttpWebRequest FtpWebListener SslClientStream WebClient System.Net NetworkInformation Sockets Cache System.Web Administration Management Navigation Peer Group Policy Serialization CompilerServices Recognition System.Speech Synthesis System System.Globalization Namespaces


Download ppt ".Net Framework Joel Pereira Software Design Engineer WinFS API Team Microsoft Corporation."

Similar presentations


Ads by Google