Increase your .NET Productivity with Visual Studio 2019

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
we are going to move on today to increasing your dotnet productivity with Visual Studio 2019 with our friends Kendra and mica hey you have two stages the transition hi I'm still kendra havens and my name is mica Dumont and we're here to talk to you about increasing your dotnet productivity with Visual Studio 2019 yeah so we have a ton to cover we're gonna first talk about live share and then we're gonna talk about code fixes and refactorings analyzers code cleanup editor config the new code analysis project properties page and then we're gonna talk about in Teleco test explorer and maybe if we have time we'll talk about some new preview features right if you're good okay so first off we want to talk about live share I'm gonna go ahead and say if we're repeating a lot of concepts today and you've kind of heard about live share before or editor config or code clean up all of the stuff we're going to cover we get thousands of new users every week several thousand new users every week so we want everyone to be on the same page so that's what we're gonna do okay so live share is an excellent tool for a collaborative co-edited experience it's all about peer programming so let me go ahead and start a life stare share session from my machine as soon as I hit that button at the top right corner of Visual Studio it generates a link I'll go ahead and paste that link over to mica in my favorite chatting app and if we go from tameka's machine you can actually see when she clicks on this link it will launch another instance of her favorite editor so this one is set to Visual Studio she can also join the collaboration session from Visual Studio by just pasting in that link so when this load she'll get my full editing context we'll be able to debug I could step through her debugger I'll know her variables what else can we do I can actually can write code and I can just editor right now that's pretty sweet whoa oh no you're leaving me something to do yeah okay Jamie need to tell you and you can see yeah so she can see what I select she has full access to my like solution Explorer what else do we have yeah and I also can access your terminal as well as your server server also visual studios whoa share with people you trust that's a lot of access okay make sure you know these people cool so I'll next talk about we'll dive into the refactorings let's see code fixes and refactorings there we go okay so I have a ton on this slide and so these are only the top few that we've chosen from the last few releases ever since Visual Studio 16.0 we've released hundreds of code fixes and refactorings in the past year so there's a very very long list all of them are covered in my talks so please please know that this is just like a small example of everything that you can't access so I'll go ahead and stop my live share session sorry Amiga okay so let's say you're re are connecting your app and I might be having a problem with my display because I was using multi desktop and I was not communicating with the channel 9 team which one I should be but I can drag that over to my second desktop and just display that does that work oh I should probably exit presenter mode that's probably what I needed to do there you go Oh worked for a second oh this is all on me and I would say in everything but goes smoothly today exit yeah trying to get out of here do I want to keep Inc annotations I'm gonna discard those okay there you go okay now you can recognize screen excellent all right so let's say I'm Ryoka tech team my solution I am dragging and dropping files into new folders all of that a lot of people want their namespaces to stay in sync with their file structure so I can do that by placing my cursor in a namespace hitting ctrl dot or opening this little screwdriver icon to show all of the available quick fixes and refactorings and I can change my name says main to notch my folder structure so we're automatically we can read what folder structure you have and suggest yeah the right naming that you want to use next one that I'm very excited about so Mads and Bill just talked about switch expressions so let's say I have a switch statement I can now easily convert it to a switch expression with a clever little refactoring and check this out Wow I know saves so much so many lines of code much much easier to read refactoring code braiding such statements to such expressions so to use this you do need to be using the C sharp 8 feature switch expressions so go ahead and upgrade that alright the next thing I want to call out is yeah over here an emoji search ok so let's say that I'm importing something into a file so let's say I'm trying to use Jason convert but I'm I don't have that using for a Newton soft Jason that library at the top of my file I'm still getting intellisense completions for this this is completions for unimportant types so we're now able to offer all of the types in your intellisense list that exist in any of your dependencies on a project on your project so this makes your intellisense list a lot longer and a lot I have a lot more options of what completions to offer if you wanted your intellisense lipt list to be scoped to only the things you have imported at the top of your file you can use this little filter button just scope it again right so if you like to using that before you don't lose that functionality so if I go ahead and accept that suggestion you can see it also added the needed using yeah ok so if I go ahead and write a bit more on the rest of this line the next code fix and refactoring that I want to show is we have a ton of ways to generate different parameters or generate different variables within your scope the most recently added was generating a parameter so then it automatically appears up in my find emojis method pretty sweet and let's see what do I have going on here I have a bunch of calls in order to read calls a little bit easier we now have wrapping chained calls I believe this was a community contribution too so thank you so much to the community so now that I have these I'm like oh yeah I'm actually have some needless duplication in there I can go ahead and clean that up a little bit cool so that was wrapping chained calls next up is toggling a single line comment so we've had control KC control cat you for commenting for a really long time in Visual Studio recently we've added control shift forward slash that's the multi-line comment as well as control case flash so that will comment the entire line and if my cursor is anywhere inside that line if I can hold ctrl K slash again it will toggle that comment off and now so if I have any selection I control shift forward slash and it adds a multi-line comment to the entire selection and again if I have my cursor anywhere within this block and hit control shift slash again it toggles off comments for the entire block so this was sort of a commenting method that they had in vs code that was really popular that we were like well what's at it let's add a few more keyboard shortcuts alright next thing I want to show off is also suggested by the community so this is splitting and merging if statements so if you have an if statement with multiple suggestions or multiple conditions you can actually split it into two nested if statements which is pretty sweet yeah I love that feature right and if I wanted to say I had a lot of if statements and I wanted to see hey can I actually merge any of these you can also merge with your outer if statement pretty cool all right so you might have noticed I have actually had well first off I have some unsorted using this is kind of hard to look at why don't I go ahead and use ctrl Q and I'll go ahead and search for sort using so we've added the sort using command didn't we already have yes so it might look kind of familiar and this is actually a good point for saying that feedback is so so important to us so we knew that removing sort usings we're called almost all the time right next to each other so we were like why don't we just combine these two into one command so we did and then we got lots of feedback but that wasn't the right thing to do that so just checking to see if everyone's like thank you for feedback we added it back in as a completely separate command because there were totally scenarios but people wanted to sort using with without removing everything that they had there so I can go ahead and sort my musings and you can find that under edit intelligence as well and lastly for the quick fixes and refactorings I have the ability to now decide where I want to place my usings and and actually enforce that as a code style across my entire project so here I can place my musings inside a namespace and I can configure all of that in my code style so why don't I go to control Q and I'll search for code style and it'll pop up all of my C sharp code Styles yeah that I save in my project here's where I set my using preferences right now I have ice it's set to inside a namespace and empyrion as a suggestion so now I can get that a little bit more regularly that's my whole project right so all of these code fixes and refactorings Mikko what power is these yeah so all these coefficients that you just showed are powered through the Roseland analyzer is also known as the dotnet compiler platform analyzers and what analyzers are are they're a tool that analyze your code and reports diagnostics and errors as you're typing so if you're in and this typically manifests in the editor as squiggles so if you're in Visual Studio and you see squiggles those are Roslyn analyzers running in the background Wow yeah it's pretty much a power everything okay yeah and if we take a look at my error list over here you can see that analyzers also come with severity x' so there is an error severity a warning severity as well as an information severity there's also a fourth severity called hidden but it wouldn't show up in your air list because it is hidden and you can go ahead and configure these severity x' with an editor config so next I want to talk about editor config and code cleanup but first for those of you who don't know an editor config is a single file that documents all of your code style options and it lives at the root of your repository and it can be managed by your regular source controlled and share see your entire team so that's pretty cool and so here's where my editor config is and this is the analyzer that Kendra just showed so this is the usings inside or outside a namespace analyzer and let's say my team is like super adamant about having this analyzer you know having these names these these usings within the namespace so i want to go ahead and bump the severity of that analyzer to a warning instead of having it on silent so then i will notice if i am violating that code style option so going back over here you can see that i now have these warning squiggles and my errorless has been updated with all these warnings so I can just place my cursor over here and type control dot and here I can actually move these using directives to be inside my name space and those warnings will now disappear but notice how I have these faded out using statements and if I hover my mouse over here Visual Studio is letting me know that these using directives are unnecessary so again I can either type control dot and accept that code fix or better yet you can actually run a code clean up with this so you can move these along with other code style violations with our one-click code cleanup so you can pretty much use code clean up by clicking on this tiny little broom icon or by typing the keyboard shortcut control ke and that will fix all of your code style violations on the current document oh but what if I wanted to apply it to my entire solution well yeah I thought you would never ask Kendra so you can simply just right-click on the solution name within the solution Explorer and you can select analyze and code cleanup and then you can actually run the code cleanup and that will apply those fixers that was that so you got applied a subset of all of the fixers that could be applied to my project yes exactly gotcha okay so code style analyzers help imply them through errors and warnings okay yeah and if you take a look at the next warning I have over here if I have my mouse over this visual Studios letting me know that I should add a serializable attribute to my class now I haven't seen that before what yeah so this is actually not built into the IDE but it is actually a nougat package called Microsoft code analysis ethics cop analyzers and so what our team did was we took the most popular ethics cop you know rules code quality rules and we ported them into this one nougat package and it was a bit too verbose to have within both into Visual Studio so we kind of just created a new get package so anyone can just go ahead on nougat and grab that so this nougat package is actually changing what like errors and warnings I get in my IDE so it helps me code it's not necessarily like a library that I'm taking a dependency on it's something that affects Visual Studio yeah exactly yeah it's really awesome it just helps you be more productive write better code so I love the sneak a package sweet and this package will live under this dependencies node within the solution Explorer under this analyzers node and then I can just expand this and these are all the different analyzers or rules and you can simply just right-click on one of these and you can actually set the severity of this Wow yeah but a brand new feature that I am super excited to show off is the ability to configure the severity level of an analyzer within the editor show me yeah so here if I type control dot i can select configure the severity and here let's say I want to bump up the severity level of this analyzer to an error instead of a warning you can see here that my error list has now been updated I have a red squiggle turned into an angry red squiggle yeah it's super angry and then if I scroll down over here you can see that it actually just added this rule for me in my editor config and the severity level has been updated to an error instead of a warning nice and if you don't have an editor config it will go ahead and just generate an editor config for you so it's pretty awesome it's a it's pretty easy to edit your editor config so you know oh yeah it's almost too easy yeah at that point so make sure as you're going through and using this cool new flyout menu to configure your analyzers know that when you push that editor config to repo which is one of the great things about editor config that it lives with the rest of your code so your entire team will have the same one but that also means keep aware of like merge conflicts and stuff if everyone's editing one resource of course yeah exactly cool yeah so with great power comes great responsibility responsible guys the next thing that I want to talk about so a lot of people have asked to have the ability to have you know add third-party analyzers to actually break builds but not necessarily not necessarily like show up while they're typing so I want to talk about the code analysis project properties page fancy very fancy so I'm going to close these nodes a bit just a little yeah yeah you know so here I'm going to right click on my project name and I'm gonna select properties and under this code analysis tab I can actually deselect run on live analysis and you will notice that the error has disappeared vanishing acts okay and not only that if I go ahead and type control shift B to run my build it reappeared yeah and my build actually fails build yeah so yeah so we now have the ability to configure these you know it's a break build so okay so if I don't only want to see certain analyzers when I'm about to check in so like when I do a build and make sure my build completes I can but while I'm actually coding I don't need all those very sort of yeah exactly cool so you can actually configure that exactly oh I like it me saying so much all right well sorry next off is Intelli code yeah I'd love to talk a little bit about that so Intel occurred is visual studios AI model that was trained over 2000 dot net repositories yeah to basically give you the right hint so we have dock completion we have argument complete we have a few things in preview right now we've also recently added Visual Basic its completion scheme as well as my sequel and my sequel also has AVS code extension so you can still get sequel completion in vs code pretty cool okay so now I went to show and this takes some concentration so I don't really trust my tests until I see them fail at least once so I'm going to go ahead and add some assert fields to these lines and naturally as soon as I get to demo it even though it works fine the first thousand times hold on let me see if I can recover it's really cool guys just just what yeah just you guys I've seen okay I know it's amazing and this feature is in preview if I get it to show off it is not gonna show off okay well let's try it one more time ah tella code suggested edits please please please please I don't make enough sacrifices to the demo gods let's see okay it's great if I close out if I save it exit this is the ritual that we do to please okay you actually can see let's see oh you know I'm not even getting Intelli code suggestions in here so my extension could have crashed do do anyway so now that I have some failing tests let's go ahead and run these in my test Explorer so you might have noticed we have a huge test Explorer update in 16.2 so it's a lot more customizable we are focusing entirely on better handling of large test sets so we have customers with over 200,000 tests right so organization and customizability of everything that's in your display is really really key so test Explorer got a pretty big facelift okay first thing I want to call out are these filter buttons so I can easily filter down to only the failed tests or show past us and not run and all that we have easily filter buttons next to things are these buttons at the top so this is repeat last test run and the repeated failed test so I can go ahead and hit that so those were keyboard shortcuts that did exist before but I would get asked for them to add them to the product about once or twice a month which is pretty frequent yeah so basically we didn't think people were discovering them so now they have icon they are icon worthy I like it alright so the next thing that is pretty cool in this test Explorer is being able to kind of customize what columns you see so you guys probably noticed I didn't have my duration column here so if I'm not doing performance work I can actually high in my duration column and uncheck that checkbox and all I need to do is right click in order to display certain columns pretty sweet a more customized ability is your group by so by default the group bys group to a project namespace in link class this is each tier in the hierarchy that you see so this is the project namespace and then we go down to the class level so you can also completely customize this group by so if I wanted to group by state to notice state has a one beside it and then class I can do that and as soon as I click out boom it's back to being failed and then a class name so that is a customized group by we also have the ability to create these playlists but now they open up in a separate window so if you really wanted to focus in on this subset of tests kind of ignore everything else in your test list just focusing on one thing it's really easy to do because you have a separate tab to do that and you can save this just like you normally would as a dot plate list file but if you don't if you want it to kind of be an impermanent thing that you build up and then goes away and you don't have to worry about it you can just exit out of it and it's not a permanent kind of test list nice the playlist lines I actually want to talk a little bit about live unit testing so live unit testing is an enterprise only feature that run tests Auden automatically in the background as you type but it only runs the tests that were impacted by your code changes so it kind of runs this subset so it appears it gives feedback right in the editor of tests that failed and if I go into my product code but I go go somewhere with a little bit more test coverage there we go I can actually see how many tests are covering which lines of code so yeah you know so it'll give me feedback I can navigate and run those all from my product code and as soon as I break something or let's say I retype something it senses those changes and reruns only the tests that covered that line so in live unit testing we also had the ability to include or exclude certain tests now we have a live unit testing window that will actually help you keep track of your whole test list that you've included or excluded out of little buttons to help filter and you know all that goodness that you like in the new view the my very last thing I wanted to call out was you may have noticed we are of much easier handling of multi targeted tests so not only do I have a target framework column that easily lets me know hey if I have a test that's compiling against both net core app 2.1 and like net 46 one I know which one is which when I look into the test Explorer which was a bit of an effort before um I can now easily see that and I can even group by my certain target framework so if I wanted to easily kind of delve into bugs that it was experienced on it on a certain platform I can't alright let's seal some so we have time for do we have time for crazy features I think we do yeah they've been good great audience yeah all right let's jump into it so preview features this came out today right today yeah yes let's Felicia 16.3 awesome so the first thing dot for preview one yes right okay so the first feature I want to show is go to base go to base allows you to navigate up the inheritance chain so you can right-click on here and our go to base is a right-click context menu option or you can use all tome which is the keyboard shortcut and there you go now I just jump to my I tweet alert interface and this also works for method override so here if I place my cursor and type alt home and this method it will open this window and I can just jump to either method that I have overridden so that's pretty pretty sweet okay and the next feature I want to show is it's actually an analyzer that was built by one of our very own interns this past summer go into yes and it's an all checks for all none all checks for all parameters so here if I place my cursor and type control dot it will actually end select ad null check small parameters will actually add all these if statements that text annuity of all these you know knowable non-tech parameters this is so so I don't have to go one by one anymore exactly it's new Moulton Visual Studio will do that for you I like it is a ton of time and then you might have noticed all these XML comments so we now have code cells for these if I hover over the ice we to learn interface you can see that quick info will show me italics as well as bolding bullets and a clickable link you can directly to more documentation from your code and if you add this inherit doc tag over here might tweet alert class will actually inherit the XML comments from my I tweet alert interface and it works for method overrides so here I have a method that says this method saw something and then if I hover over this method it'll actually show that inherited that small comment so it worked for both the class that inherited the interface as well as overridden yes exactly ice okay yeah sweet let's see do we have resources to share at the end so we did okay there's a resources so if you wanna file bugs on our team or on all Visual Studio go to developer community op Visual Studio calm if you want to check out more all of the refactorings that we just packed into this cuz please visit akms slash refactor it'll take you right to our Docs and yeah so our team we can I work on the dotnet to lean team or Roslyn which is our Tyler so go to a kms lash Mirage line - yeah engage with our team and file bugs or contribute yeah
Info
Channel: Microsoft Visual Studio
Views: 14,697
Rating: undefined out of 5
Keywords: .NET, dotNET, productivity, collaborate, Visual Studio, Visual Studio 2019, IntelliCode, productive, team, VS Code
Id: mg2aocZA9Pc
Channel Id: undefined
Length: 26min 45sec (1605 seconds)
Published: Mon Sep 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.