VS2017 Web http://www.timecockpit.com Mail rainer@timecockpit.com - - PowerPoint PPT Presentation

vs2017
SMART_READER_LITE
LIVE PREVIEW

VS2017 Web http://www.timecockpit.com Mail rainer@timecockpit.com - - PowerPoint PPT Presentation

VS 2017 News for C# Devs Rainer Stropek software architects gmbh VS2017 Web http://www.timecockpit.com Mail rainer@timecockpit.com Twitter @rstropek C# Dev News Saves the day. Installation and Configuration Need for Speed Image


slide-1
SLIDE 1

Saves the day.

VS 2017 – News for C# Devs

VS2017

Rainer Stropek

software architects gmbh http://www.timecockpit.com rainer@timecockpit.com @rstropek

C# Dev News

Web Mail Twitter

slide-2
SLIDE 2

Installation and Configuration

Need for Speed

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

slide-3
SLIDE 3

VS Installer

VS 2017

Side by side install of preview and prod Install performance

Install while downloading

Tips

Language packs independent of OS language Change install location (15.7)

slide-4
SLIDE 4

Config Import/Export

VS 2017 15.9 Preview 2

Move VS config between installations

slide-5
SLIDE 5

Startup Performance

Manage VS Performance Performance warnings

slide-6
SLIDE 6

Editor Improvements

Navigation, writing code

slide-7
SLIDE 7

Multi-Caret Edit

VS 2017 15.8

Ctrl + Alt + Click Tips

Shift + Alt + .

→ Add additional selections that match current selection

Ctrl + Shift + Alt + .

→ Skip over match

Ctrl + Shift + Alt + ,

→ All matching selection in document

slide-8
SLIDE 8

Expand/Contract

VS 2017 15.5

Shift + Alt + +

→ Expand to next logical block

Shift + Alt + -

→ Contract

slide-9
SLIDE 9

Go to Last Edit

using 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

Demo

Cursor 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…

slide-10
SLIDE 10

Go to Last Edit

using 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

slide-11
SLIDE 11

Navigation

Ctrl+click for Go To Definition

VS 2017 15.4

Ctrl+F12 for Go To Implementation

Example: IBoardContent in T etris sample

Filter Go To All (Ctrl+,)

Shortcut syntax Recent files, current document Example: Board in T etris sample

New features in Find All References (Shift+F12)

Structure results Lock results Syntax coloring

slide-12
SLIDE 12

Code Cleanup

VS 2017 15.8

Respects .editorconfig

Details follow later

slide-13
SLIDE 13

Keyboard Schema

VS 2017 15.8

Visual Studio Code ReSharper

slide-14
SLIDE 14

IntelliCode

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

slide-15
SLIDE 15

AI-Assisted Coding

Experimental preview extension for VS2017

Currently available for C# and Python

Replace static rules with AI

Trained with high-profile OSS projects from GitHub No user-defined code is sent to Microsoft for analysis

Assisted IntelliSense

Sort completion lists

Inferred code styling and formatting

Creates .editorconfig from codebase

Just the beginning…

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

slide-16
SLIDE 16

Demo

using 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

slide-17
SLIDE 17

Async Main

C# 7.1

https://docs.microsoft.com/en-us/dotnet/csharp/whats- new/csharp-7-1#async-main

slide-18
SLIDE 18

Settings

slide-19
SLIDE 19

EditorConfig

Consistent coding styles between editors and IDEs

https://editorconfig.org/

Tip: EditorConfig Language Services

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

slide-20
SLIDE 20

Identity

VS 2017

Roam settings

Roaming extension manager

Fewer sign-in prompts

Server-side fix

slide-21
SLIDE 21

Profiling and Debugging

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

slide-22
SLIDE 22

CPU Usage

VS 2017 15.8

CPU Usage Tools can be enabled/disabled

https://github.com/rstropek/Samples/blob/master/ProfilingWor kshop/SimpleCpuProfiling/Program.cs

slide-23
SLIDE 23

Allocation Tracking

VS 2017 15.8

Collection of stack trace for every object allocation

https://github.com/rstropek/Samples/blob/master/ProfilingWor kshop/MemoryProblem/Program.cs

slide-24
SLIDE 24

Live Unit Testing

VS 2017 15.3 (Enterprise Edition)

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

slide-25
SLIDE 25

Snapshots

VS 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

slide-26
SLIDE 26

Docker

slide-27
SLIDE 27

Docker Support

VS 2017 15.5

Updated Docker images

Docker Hub Alpine images .NET Core 2.2 Preview Images ASP .NET Core Images

Multi-step Build Dockerfiles

slide-28
SLIDE 28

Live Share

VS 2017 15.7

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

slide-29
SLIDE 29

Live Share (Preview)

VSCode >= 1.22 and VS >= 2017 15.7

MacOS and Linux support with VSCode

Collaborative editing and debugging

Not screen sharing Via internet

Secure

End-to-end encryption → no publishing of code Read-only mode available

Supported languages and platforms…

slide-30
SLIDE 30

Live Share VS → VSCode

slide-31
SLIDE 31

Other Improvements

Image source: http://www.thebluediamondgallery.com/wooden-tile/i/improve.html Alpha Stock Images - http://alphastockimages.com/

slide-32
SLIDE 32

Other Improvements

Accessibility Improvements

In VS 2017 15.3 More details…

YAML Build

Example… More details…

Many new refactorings

More details…

slide-33
SLIDE 33

Visual Studio Roadmap…

slide-34
SLIDE 34

Saves the day.

VS 2017 – News for C# Devs

Q&A

Rainer Stropek

software architects gmbh rainer@timecockpit.com http://www.timecockpit.com @rstropek

Thank your for coming!

Mail Web Twitter