softarch presentation template · ai-assisted coding experimental preview extension for vs2017...

34
Saves the day. VS 2017 – News for C# Devs VS2017 Rainer Stropek software architects gmbh http://www.timecockpit.com [email protected] @rstropek C# Dev News Web Mail Twitter

Upload: others

Post on 03-Feb-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Saves the day.

VS 2017 – News for C# Devs

VS2017

Rainer Stropeksoftware architects gmbh

http://www.timecockpit.com

[email protected]

@rstropek

C# Dev News

Web

Mail

Twitter

Page 2: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Installation and ConfigurationNeed for Speed

Image source: https://www.flickr.com/photos/milchcow_peng/28746609584

Page 3: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

VS InstallerVS 2017

Side by side install of

preview and prod

Install performanceInstall while downloading

TipsLanguage packs independent of

OS language

Change install location (15.7)

Page 4: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Config Import/ExportVS 2017 15.9 Preview 2

Move VS config between

installations

Page 5: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Startup Performance

Manage VS Performance

Performance warnings

Page 6: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Editor

ImprovementsNavigation, writing code

Page 7: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Multi-Caret EditVS 2017 15.8

Ctrl + Alt + Click

TipsShift + Alt + .→ Add additional selections that

match current selection

Ctrl + Shift + Alt + .→ Skip over match

Ctrl + Shift + Alt + ,→ All matching selection in

document

Page 8: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Expand/ContractVS 2017 15.5

Shift + Alt + +→ Expand to next logical block

Shift + Alt + -→ Contract

Page 9: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Go to Last Editusing System;using System.Data;using System.Data.SqlClient;using System.Threading.Tasks;

namespace IntelliCode_Hello_World{

class Program{

static async Task Main(string[] args){

using (var conn = new SqlConnection("Server=(localdb)\\dev;Database=master")){

await conn.OpenAsync();const string query = "SELECT 1 AS x";using (var cmd = conn.CreateCommand()){

cmd.CommandType = CommandType.Text;cmd.CommandText = query;var reader = await cmd.ExecuteReaderAsync();while (await reader.ReadAsync()){

Console.WriteLine(reader[0]);}

}}

}}

}

VS 2017 15.8

DemoCursor on reader[0]

Shift + Alt + + until using

Ctrl + . to generate method

Rename to ExecuteQueryAsync

F12 (Ctrl + Click) on

ExecuteReaderAsync

Discover DbDataReader

Ctrl + Shift + Backspace

Go to last edit

Extract loop with Ctrl + .

Functional programming…

Page 10: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Go to Last Editusing System;using System.Data;using System.Data.Common;using System.Data.SqlClient;using System.Threading.Tasks;

namespace IntelliCode_Hello_World{

class Program{

static async Task Main(string[] args){

using (var conn = new SqlConnection("Server=(localdb)\\dev;Database=master")){

await conn.OpenAsync();

const string query = "SELECT 1 AS x";await ExecuteQueryAsync(conn, query, ProcessReaderAsync);

}}

private static async Task ExecuteQueryAsync(SqlConnection conn, string query,Func<DbDataReader, Task> processor)

{using (var cmd = conn.CreateCommand()){

cmd.CommandType = CommandType.Text;cmd.CommandText = query;var reader = await cmd.ExecuteReaderAsync();await processor(reader);

}}

private static async Task ProcessReaderAsync(DbDataReader reader){

while (await reader.ReadAsync()){

Console.WriteLine(reader[0]);}

}}

}

VS 2017 15.8

Final solution

Page 11: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Navigation

Ctrl+click for Go To DefinitionVS 2017 15.4

Ctrl+F12 for Go To ImplementationExample: IBoardContent in Tetris sample

Filter Go To All (Ctrl+,)Shortcut syntax

Recent files, current document

Example: Board in Tetris sample

New features in Find All References (Shift+F12)Structure results

Lock results

Syntax coloring

Page 12: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Code CleanupVS 2017 15.8

Respects .editorconfigDetails follow later

Page 13: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Keyboard SchemaVS 2017 15.8

Visual Studio Code

ReSharper

Page 14: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

IntelliCode

Image source: https://www.flickr.com/photos/mikemacmarketing/30212411048

Image via www.vpnsrus.com

Page 15: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

AI-Assisted Coding

Experimental preview extension for VS2017Currently available for C# and Python

Replace static rules with AITrained with high-profile OSS projects from GitHub

No user-defined code is sent to Microsoft for analysis

Assisted IntelliSenseSort completion lists

Inferred code styling and formattingCreates .editorconfig from codebase

Just the beginning…

Read more at https://visualstudio.microsoft.com/services/intellicode/

Page 16: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Demousing System;using System.Data;using System.Data.SqlClient;using System.Threading.Tasks;

namespace IntelliCode_Hello_World{

class Program{

static async Task Main(string[] args){

using (var conn = new SqlConnection("Server=(localdb)\\dev;Database=master")){

await conn.OpenAsync();const string query = "SELECT 1 AS x";using (var cmd = conn.CreateCommand()){

cmd.CommandType = CommandType.Text;cmd.CommandText = query;var reader = await cmd.ExecuteReaderAsync();while (await reader.ReadAsync()){

Console.WriteLine(reader[0]);}

}}

}}

}

IntelliCode

Assisted IntelliSense

Infer .editorconfig

BTW: async main

Page 17: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Async MainC# 7.1

https://docs.microsoft.com/en-us/dotnet/csharp/whats-

new/csharp-7-1#async-main

Page 18: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Settings

Page 19: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

EditorConfig

Consistent coding styles between editors and IDEshttps://editorconfig.org/

Tip: EditorConfig Language Services

See also https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017

Page 20: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

IdentityVS 2017

Roam settingsRoaming extension manager

Fewer sign-in promptsServer-side fix

Page 21: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Profiling and

Debugging

Image source: https://www.flickr.com/photos/28208534@N07/4047355843

Page 22: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

CPU UsageVS 2017 15.8

CPU Usage Tools can be

enabled/disabled

https://github.com/rstropek/Samples/blob/master/ProfilingWor

kshop/SimpleCpuProfiling/Program.cs

Page 23: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Allocation TrackingVS 2017 15.8

Collection of stack trace for

every object allocation

https://github.com/rstropek/Samples/blob/master/ProfilingWor

kshop/MemoryProblem/Program.cs

Page 24: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Live Unit TestingVS 2017 15.3 (Enterprise Edition)

https://github.com/rstropek/htl-csharp/tree/master/csharp-

recap/0010-tetris

Page 25: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

SnapshotsVS 2017 15.5

Complete snapshot on

breakpoints and

exceptions

Backwards and forward in

time without restarting

debugging session

https://github.com/rstropek/htl-csharp/tree/master/csharp-

recap/0010-tetris

Page 26: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Docker

Page 27: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Docker SupportVS 2017 15.5

Updated Docker imagesDocker Hub

Alpine images

.NET Core 2.2 Preview Images

ASP.NET Core Images

Multi-step Build Dockerfiles

Page 28: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Live ShareVS 2017 15.7

Image source: https://www.flickr.com/photos/cogdog/8188824613

Page 29: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Live Share (Preview)

VSCode >= 1.22 and VS >= 2017 15.7MacOS and Linux support with VSCode

Collaborative editing and debuggingNot screen sharing

Via internet

SecureEnd-to-end encryption → no publishing of code

Read-only mode available

Supported languages and platforms…

Page 30: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Live Share VS → VSCode

Page 31: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Other

Improvements

Image source: http://www.thebluediamondgallery.com/wooden-tile/i/improve.html

Alpha Stock Images - http://alphastockimages.com/

Page 34: softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017 Currently available for C# and Python Replace static rules with AI Trained with high-profile

Saves the day.

VS 2017 – News for C# Devs

Q&A

Rainer Stropeksoftware architects gmbh

[email protected]

http://www.timecockpit.com

@rstropek

Thank your for coming!

Mail

Web

Twitter