Future of VB and C# Lucian Wischik VB Language PM Microsoft.

Slides:



Advertisements
Similar presentations
DEV324 C# VB 7.0 Managed Code C# VB 8.0 Generics C# VB 9.0 Language Integrated Query C# VB 10.0 Dynamic + Language Parity.
Advertisements

Roslyn: el futuro de C# Rodolfo Finochietti
“a language+framework push for compositional asynchrony” Async.NET Working Group, F#, Axum, Task Avner Aharoni, Mads Torgersen, Stephen Toub, Alex Turner,
Pavel Yosifovich Hi-Tech College
Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Adjunct Professor: U. of Illinois, Chicago and Loyola University Chicago
Asynchronous programming Deadlock All The Things!.
Software development. Chapter 8 – Advanced Topics.
Developing for Windows 8/WinRT Session 4 Fundamentals Kevin Stumpf.
Lucian Wischik VB+C# language PM Microsoft Corporation The Future of VB and C#
Async Programming WITH ASYNC TASK
Active X Microsoft’s Answer to Dynamic Content Reference: Using Active X by Brian Farrar QUE
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
DEV317 New: Async CTP SP1 Refresh (works on Windows Phone) New: Async “as is” EULA New: XNA for VB.
Introducing Xamarin 2.0 Introducing Xamarin 2.0 Michael Hutchinson
Managed Code Generics Language Integrated Query Dynamic + Language Parity C# VB 11.0 Windows Runtime + Asynchrony C# VB 7.0 C# VB.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
JavaScript & jQuery the missing manual Chapter 11
1 Ajax. 2 What’s Ajax? AJAX is a combination of a few technologies that has come together in the past few years AJAX used to be an acronym for Asynchronous.
Chapter 6 JavaScript and AJAX. Objectives Explain the purpose and history of JavaScript Describe JavaScript features Explain the event-driven nature of.
Effective WinRT with C++ Tips and tricks for developing WinRT applications in C++
Eric Vogel Software Developer A.J. Boggs & Company.
Joe Hummel, PhD Technical Staff: Pluralsight Adjunct Professor: UIC, LUC
Reactive Extensions Ye olde introduction and walk-through, with plenty o’ code.
please wait for the next slide clicking won’t make it come any faster.
Consuming REST Services from C# SoftUni Team Technical Trainers Software University
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Parallel Programming: Responsiveness vs. Performance Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Professor: U. of Illinois,
Joe Hummel, PhD Microsoft MVP Visual C++ Technical Staff: Pluralsight, LLC Professor: U. of Illinois, Chicago stuff:
Joe Hummel, the compiler is at your service Chicago Code Camp 2014.
Developing ASP.NET AJAX Controls with Silverlight Barry Gervin Microsoft Regional Director John Bristowe Developer Advisor, Microsoft.
WHO WILL BENEFIT FROM THIS TALK TOPICS WHAT YOU’LL LEAVE WITH ASP.NET developers, including Web Forms & MVC History of async programming in.NET How async.
IAsyncResult ar = BeginSomething(…); // Do other work, checking ar.IsCompleted int result = EndSomething(ar);
Asynchronous Programming Writing Asynchronous Code in C# SoftUni Team Technical Trainers Software University
Joe Hummel, the compiler is at your service SDC Meetup, Sept 2014.
TAP into async programming
Other news? async and await Anonymous types (var, dynamic) Tuples Object instantiation Extension methods UCN Teknologi/act2learn1FEN 2014.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
Visual Basic 2005: Advanced Language and IDE Features Amanda Silver Program Manager Visual Basic Session Code: DEV343.
please wait for the next slide clicking won’t make it come any faster.
Debug in Visual Studio Windows Development Fundamentals LESSON 2.5A.
TOPICS WHAT YOU’LL LEAVE WITH WHO WILL BENEFIT FROM THIS TALK.NET library developers : with knowledge of async/await in C# / VB interested in low-level.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
Patterns of Parallel Programming with.NET 4 Stephen Toub Principal Architect Parallel Computing Platform Microsoft Corporation
C# Present and Future Marita Paletsou Software Engineer.
C# 5.0 Alex Davies 22 nd December What we will cover C# 5.0,.NET 4.5, Visual Studio 11 Caller Info Attributes Upgrade from synchronous to asynchronous.
Joe Hummel, the compiler is at your service Chicago Coder Conference, June 2016.
Lucian Wischik SESSION CODE: DEV401. Advanced Use of the New Microsoft Visual Basic 2010 Language Features Lucian Wischik, VB spec lead.
Async Made Simple in Windows 8, with C# and Visual Basic Alex Turner Program Manager VB/C# Compilers Microsoft Corporation DEV332.
Asynchronous Programming Writing Concurrent Code in C# SoftUni Team Technical Trainers Software University
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
THE FUTURE OF C#: GOOD THINGS COME TO THOSE WHO ‘AWAIT’ Joseph Albahari SESSION CODE: DEV411 (c) 2011 Microsoft. All rights reserved.
Asynchronous Programming with C# v.Next
The Future of C# and Visual Basic
TechEd /6/2018 6:15 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Using Microsoft Visual Basic to Build Windows Phone Applications
Async or Parallel? No they aren’t the same thing!
JavaScript an introduction.
Staying Afloat in the .NET Async Ocean
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
12 Asynchronous Programming
Creating Windows Store Apps Using Visual Basic
CSE 154 Lecture 22: AJAX.
Asynchronous Programming in .NET
Building responsive apps and sites with HTML5 web workers
Microsoft Connect /7/ :18 AM
Build /2/2019 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Hold up, wait a minute, let me put some async in it
03 | Async Programming & Networking Intro
Presentation transcript:

Future of VB and C# Lucian Wischik VB Language PM Microsoft

This is Vegas WIN BIG MONEY !!! Each speaker- eval earns $5 to Doctors Without Borders. Drop off at registration desk.

History Managed Code Generics LINQ Co-evolution C#1, VB7 C#2, VB8 C#4, VB10 C#3, VB9

History Async Managed Code Generics LINQ Co-evolution C#1, VB7 C#2, VB8 C#4, VB10 C# vNext, VB11 C#3, VB9

History Async Managed Code Generics LINQ Co-evolution C#1, VB7 C#2, VB8 C#4, VB10 C# vNext, VB11 C#3, VB9 ??? “Roslyn”

History Async, Win8, CallerInfo VB: VBCore, Global, Iterators Managed Code Generics, EnC, My, partial, nullables, XML-comments LINQ, lambdas, XML literals, type inference, extensions Co-evolution, NOPIA, Dynamic/DLR, covariance C#1, VB7 C#2, VB8 C#4, VB10 C# vNext, VB11 C#3, VB9 ??? “Roslyn” ???

History Async, Win8, CallerInfo, VB: VBCore, Global, Iterators Managed Code Generics, EnC, My, partial, nullables, XML-comments LINQ, lambdas, XML literals, type inference, extensions Co-evolution, NOPIA, Dynamic/DLR, covariance C#1, VB7 C#2, VB8 C#4, VB10 C# vNext, VB11 C#3, VB9 ??? “Roslyn” ??? Async CallerInfo Roslyn

Async is a new, easier way to write connected apps. In the past… ● “Connected” has generally meant either a UI that freezes, or unmaintainable spaghetti code, or multithreading. C# and VB future: Async… ● Two new keywords: Await and Async in VB and C# ● A new Task-based design pattern for APIs, the "T.A.P." (Task Asynchronous Pattern) ● A new set of.NET Framework APIs Async CallerInfo Roslyn

Async is a new, easier way to write connected apps. In the past… ● “Connected” has generally meant either a UI that freezes, or unmaintainable spaghetti code, or multithreading. C# and VB future: Async… ● Two new keywords: Await and Async in VB and C# ● A new Task-based design pattern for APIs, the "T.A.P." (Task Asynchronous Pattern) ● A new set of.NET Framework APIs Async CallerInfo Roslyn Fundamentals Demo How it works Big picture

Async: Fundamentals

webClient.UploadString(uri); print("done"); webClient.UploadString(uri); print("done");

“A waiter’s job is to wait on a table until the patrons have finished their meal. If you want to serve two tables concurrently, you must hire two waiters.”

The following is from the Android dev blog. Can you spot the flaw? 1. “A good practice in creating responsive applications is to make sure your main UI thread does the minimum amount of work.” 2. “Any potentially long task that may hang your application should be handled in a different thread.” 3. “Typical examples of such tasks are network operations, which involve unpredictable delays.”

How best to explain the sequence of events in a restaurant with several tables? From the perspective of the patrons? or of the waiter?

Demo: async

This is the IL that’s emitted when you using async/await Async: How it works

async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } UI thread IOCP thread Async: How it works

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click [1/12] A button-click arrives on the UI queue

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click downTask [2/12] Invoke some functions; get back “downTask” from the API

async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } downTask async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } UI thread IOCP thread Click downTask » sc.Post{Κ1} [3/12] “await downTask” assigns a continuation and returns diggTask Κ1: diggTask

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } diggTask async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click downTask » sc.Post{Κ1} [4/12] “await diggTask” assigns a continuation and returns Κ1: Κ2: diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss [5/12] Network packet arrives with data downTask » sc.Post{Κ1} Κ1: Κ2: diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss sc.Post{Κ1(rss)} [6/12] Invoke downTask’s continuation with that data downTask » sc.Post{Κ1} Κ1: Κ2: diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click diggTask » sc.Post{Κ2} rss K1(rss) [7/12] Continuation is a “Post”, i.e. addition to the UI queue Κ1: Κ2: sc.Post{Κ1(rss)}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss K1(rss) [8/12] UI thread executes K1, giving a result to the “await” Κ1: Κ2: sc.Post{Κ1(rss)} diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss K1(rss) [9/12] “Return story” will signal completion of task Κ1: Κ2: sc.Post{Κ1(rss)} diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss K1(rss) sc.Post(Κ2(story)) [10/12] Invoke diggTask’s continuation with data (by posting to UI queue) K2(story) Κ1: Κ2: sc.Post{Κ1(rss)} diggTask » sc.Post{Κ2}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } UI thread IOCP thread Click rss K1(rss) sc.Post(Κ2(story)) K2(story) [11/12] Return from handling the K1 continuation Κ1: Κ2: sc.Post{Κ1(rss)}

async void button1_Click() { var diggTask = GetDiggAsync(); var digg = await diggTask; textBox1.Text = digg; } async Task GetDiggAsync() { var web = new WebClient(); var downTask = web.DownTaskAsync(" var rss = await downTask; var digg = XElement.Parse(rss).. ; return digg; } rss K2(story) Click K1(rss) UI thread IOCP thread sc.Post(Κ2(story)) Κ1: Κ2: [12/12] UI thread executes K2, giving a result to the “await” sc.Post{Κ1(rss)}

SINGLE-THREADED ASYNCHRONY AND CONCURRENCY is when we run asynchronous and concurrent tasks with NO additional threads (beyond those that the operating system already provides). No worries about mutexes &c. If you want extra threads, create them explicitly through Task.Run. SINGLE-THREADED ASYNCHRONY AND CONCURRENCY is when we run asynchronous and concurrent tasks with NO additional threads (beyond those that the operating system already provides). No worries about mutexes &c. If you want extra threads, create them explicitly through Task.Run.

 2008: Silverlight2: all its lengthy APIs are async  2010: [Feb] Windows Phone 7: all its lengthy APIs are async  2004: Asynchronous javascript (AJAX) hits big-time Async: big picture

 2008: Silverlight2: all its lengthy APIs are async  2010: [Feb] Windows Phone 7: all its lengthy APIs are async  2004: Asynchronous javascript (AJAX) hits big-time Async: big picture

 2008: Silverlight2: all its lengthy APIs are async  2010: [Feb] Windows Phone 7: all its lengthy APIs are async  2004: Asynchronous javascript (AJAX) hits big-time Async: big picture

 2008: Silverlight2: all its lengthy APIs are async  2010: [Feb] Windows Phone 7: all its lengthy APIs are async  2004: Asynchronous javascript (AJAX) hits big-time Async: big picture

TASK UNIFIES ALL THESE AREAS; ASYNC TIES THEM TOGETHER Use Async Functions to compose other tasks, for the “orchestration” of your app async Task DoWorkAsync() { try { string[] vidUrls = await ScrapeYoutubeAsync(url); // Network-bound Task t1 = DownloadVideoAsync(vidUrls(0)); // Start 2 downloads Task t2 = DownloadVideoAsync(vidUrls(1)); Video[] vids = await TaskEx.WhenAll(t1, t2); // Wait for both Video v = await MashupVideosAsync(vids(0), vids(1)); // CPU-bound await v.SaveAsync(textbox1.Text); // IO-bound } catch (WebException ex) { ReportError(ex); } } async Task DoWorkAsync() { try { string[] vidUrls = await ScrapeYoutubeAsync(url); // Network-bound Task t1 = DownloadVideoAsync(vidUrls(0)); // Start 2 downloads Task t2 = DownloadVideoAsync(vidUrls(1)); Video[] vids = await TaskEx.WhenAll(t1, t2); // Wait for both Video v = await MashupVideosAsync(vids(0), vids(1)); // CPU-bound await v.SaveAsync(textbox1.Text); // IO-bound } catch (WebException ex) { ReportError(ex); } }

Async CallerInfo Roslyn

CallerInfo will help with logging and in boilerplate code like INotifyPropertyChanged. void Log([CallerLineNumber] int line = 0, [CallerFilePath] string f = null, [CallerMemberName] string m = null) { Console.WriteLine(“{0}:{1} - {2}”, f, line, m); } Async CallerInfo Roslyn

Demo: CallerInfo

Async CallerInfo Roslyn

is about opening up the internals of the compiler to let everyone use the VB/C# languages in powerful ways. Async CallerInfo Roslyn

is about opening up the internals of the compiler to let everyone use the VB/C# languages in powerful ways. Async CallerInfo Roslyn

IL emit Binder Symbols Metaimp Parser

IL emit Binder Symbols Metaimp Parser Syntax tree API Symbol API Bind/flow API Emit API

IL emit Binder Symbols Metaimp Parser Syntax tree API Symbol API Bind/flow API Emit API Colorizer Formatter Outlining NavigateTo ObjBrowser GoToDef ExtractMeth QuickInfo Rename FindAllRefs IntellisenseEnC

IL emit Binder Symbols Metaimp Parser Syntax tree API Symbol API Bind/flow API Emit API Colorizer Formatter Outlining NavigateTo ObjBrowser GoToDef ExtractMeth QuickInfo Rename FindAllRefs IntellisenseEnC Interactive “REPL” window Script files (think.vbs) --.csx.vbx Use C#/VB as scripting languages for your app

Demo: Roslyn

Async CallerInfo Roslyn

Async Download the Async CTP Start making Task-returning APIs today CallerInfo Wait patiently… Roslyn Download the Roslyn CTP Give us feedback Async CallerInfo Roslyn

Module Module1 Sub Main() Dim robots = {"Number5", "Asimo", "Cylon"} Dim xml = Robot Status <%= Iterator Function() For Each r In robots Yield Robot reporting for duty Next End Function() %> Console.WriteLine(xml) End Sub End Module A parting word from VB: ITERATOR LAMBDAS! A parting word from VB: ITERATOR LAMBDAS!