VS2017 saturday - Historical debugging with intelli trace in visual studio
softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017...
Transcript of softarch Presentation Template · AI-Assisted Coding Experimental preview extension for VS2017...
Saves the day.
VS 2017 – News for C# Devs
VS2017
Rainer Stropeksoftware architects gmbh
http://www.timecockpit.com
@rstropek
C# Dev News
Web
Installation and ConfigurationNeed for Speed
Image source: https://www.flickr.com/photos/milchcow_peng/28746609584
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)
Config Import/ExportVS 2017 15.9 Preview 2
Move VS config between
installations
Startup Performance
Manage VS Performance
Performance warnings
Editor
ImprovementsNavigation, writing code
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
Expand/ContractVS 2017 15.5
Shift + Alt + +→ Expand to next logical block
Shift + Alt + -→ Contract
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…
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
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
Code CleanupVS 2017 15.8
Respects .editorconfigDetails follow later
Keyboard SchemaVS 2017 15.8
Visual Studio Code
ReSharper
IntelliCode
Image source: https://www.flickr.com/photos/mikemacmarketing/30212411048
Image via www.vpnsrus.com
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/
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
Async MainC# 7.1
https://docs.microsoft.com/en-us/dotnet/csharp/whats-
new/csharp-7-1#async-main
Settings
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
IdentityVS 2017
Roam settingsRoaming extension manager
Fewer sign-in promptsServer-side fix
Profiling and
Debugging
Image source: https://www.flickr.com/photos/28208534@N07/4047355843
CPU UsageVS 2017 15.8
CPU Usage Tools can be
enabled/disabled
https://github.com/rstropek/Samples/blob/master/ProfilingWor
kshop/SimpleCpuProfiling/Program.cs
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
Live Unit TestingVS 2017 15.3 (Enterprise Edition)
https://github.com/rstropek/htl-csharp/tree/master/csharp-
recap/0010-tetris
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
Docker
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
Live ShareVS 2017 15.7
Image source: https://www.flickr.com/photos/cogdog/8188824613
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…
Live Share VS → VSCode
Other
Improvements
Image source: http://www.thebluediamondgallery.com/wooden-tile/i/improve.html
Alpha Stock Images - http://alphastockimages.com/
Other Improvements
Accessibility ImprovementsIn VS 2017 15.3
More details…
YAML BuildExample…
More details…
Many new refactoringsMore details…
Visual Studio Roadmap…
Saves the day.
VS 2017 – News for C# Devs
Q&A
Rainer Stropeksoftware architects gmbh
http://www.timecockpit.com
@rstropek
Thank your for coming!
Web