Silverlight 2 CoreCLR Andrew Pardoe Program Manager CLR Execution Engine Andrew.Pardoe@microsoft.com Rich interactive applications Web deployment gives broad reach Windows, Mac OS X, Linux IE, Firefox, Safari, Konquerer Sandboxing provides security Productive design and development Reusable knowledge (XAML & .NET) Best developer tools in the industry Separate design and development Mac OS X 10.4+ Silverlight 1.0 supports all hardware Silverlight 2 supports Intel Mac Mac is fully supported by Microsoft Major Linux distributions Moonlight runtime implemented by Mono Full cooperation of Microsoft Access to documentation and tests Legal covenant protecting Mono users Sandboxed applications No user elevation or security prompts within the browser—just click a URL Applications prevented from doing malicious things Limited local interaction Safe isolated storage Client based file upload controls Cross domain networking support Silverlight “code-behind” model Code lives behind the page Updating the code doesn’t change the design Productive design and development Reusable knowledge (XAML & .NET) Best developer tools in the industry Separate design and development Designers and developers are different. Developers work from the inside outward. Getting started Silverlight 2 Beta 1 Notepad No SDK required, everything is text A better option… Silverlight Tools for Visual Studio 2008 Expression Blend 2.5 March Preview Everything you need is online http://www.silverlight.net .NET is a desktop technology. Why use it on the web? Developers, developers, developers! Performance and expressiveness Silverlight lets you use what you already know C#, VB, JScript—Silverlight CoreCLR supports all .NET languages SL2 DLR adds popular dynamic languages like IronPython and IronRuby CoreCLR builds from same source code as the desktop CLR 100% compatible execution environment Much smaller package 4.3 MB download for SL2 Beta 1 What’s different in CoreCLR? We’ll look at the desktop CLR and compare it to CoreCLR Browser hosts through ActiveX CoreCLR DLR BCL Presentation Core UI Core JS Interop Inputs, Controls, Media, DRM C# source Write a program in .NET Compile to MSIL executable MSIL + Metadata Runs with Base Class Library Running code loads the CLR EE Code + .NET Layout objects in memory JIT produces native code VM & GC Managed protected environment Small size allows on-demand install Fewer scenarios than desktop CLR Sandboxed code Smaller Base Class Library Only hosted by ActiveX controls Supported on Intel Apple Mac OS X Dynamic Language Runtime Execution engine JIT compiler Garbage collector Virtual machine New security model Security Transparency replaces Code Access Security Transparency may be supported in desktop Not just C# and VB (C++/CLI, F#) Ada Cobol Eiffel Forth Fortran Nemerle Lisp Perl Pascal many more DLR adds popular web languages DLR creates MSIL at runtime Built on a message-passing system Objects respond to messages Behavior based on language semantics Messages converted to MSIL Built on dynamic method dispatch and dynamic type system Messages are bound to methods Dynamic types are CLR types DLR Console OpenFileDialog for read-only local file system access IsolatedStorageFile provides storage Define the scope with a using directive Exiting scope disposes file objects Web-hosting reduces scenarios Click-time install reduces size Simplified BCL is based on .NET CF Non-generic collections removed Localization culture information from OS BackgroundWorker for most threading See BCL team blog for more details Guidance available to help port existing .NET code to Silverlight’s smaller BCL Versioning and binding are transparent ActiveX host loads CoreCLR, creates appdomain and applies policies Full access to XAML and HTML DOMs XAML can be written dynamically Javascript objects and DOM elements wrapped in managed wrappers SL 1.0: XAML and Javascript SL 2 with shared CoreCLR Another SL 2 app shares same CoreCLR Browser tabs share a single CoreCLR SL 2 app in separate browser Different browser gets new CoreCLR You need a CLR to run managed code Could use the CLR on Windows… …but changing code changes behavior CoreCLR runs in-process with CLR Managed browsers can host SL Multiple CoreCLRs in-process 100% Silverlight compatibility no matter what CLR is already on your machine CoreCLR and CLR side-by-side Same JIT on Mac and Windows No NGen in Silverlight 2 CoreCLR runs on Mac OS X 10.4+ Only supported on Intel Macs CoreCLR, Base Class Libraries and other platform assemblies Platform Adaptation Layer Mac OS X 10.4+ (Intel) Windows (32-bit) Same execution engine as CLR Core functionality: JIT, GC Virtual machine: EH, threading Simplified security model CAS is gone! Transparent, Safe Critical and Critical All user code is transparent No more evidence, permissions, policy levels or code groups No more complicated documentation No more stackwalks for code access Transparent code can call public methods, use public types and override methods… If it’s platform or same application’s code If it’s Safe Critical or Transparent security User code (transparent) wants to write a file WINAPI CreateFile (Critical code) creates file without any validation System.IO.IsolatedStorageFile StreamWriter (SafeCritical code) verifies the request and calls Windows API C# source Use same .NET skills DLR adds new languages MSIL + Metadata Web has simpler scenarios Code uses smaller BCL Code + .NET Same CoreCLR on any host Security Transparency is easy VM & GC Same CLR means no surprises Woodgrove Financial Chess: Javascript vs. CoreCLR Questions? Silverlight – Get Started http://silverlight.net/GetStarted BCL team blog http://blogs.msdn.com/bclteam Shawn Farkas’ blog on CLR security http://blogs.msdn.com/shawnfa Where to find these slides http://blogs.msdn.com/apardoe © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.