Showing posts with label today's. Show all posts
Showing posts with label today's. Show all posts

Wednesday, February 4, 2026

Debugging Tips and Tricks Part 2

>> On today's Toolbox,
we're going to continue
fixing the app we started
working on last week,
and Leslie will show us additional
tips and tricks for debugging.
Hi, welcome to Visual Studio Toolbox.
I'm your host Robert Greene,
and joining me today for part two of
our debugger tips and tricks
is Leslie Richardson.
>> Hey there.
>> Hi, Leslie.
>> Hi.
>> Welcome back.
>> Thank you.
>> You haven't changed a bit since
we recorded the last episode.
>> I know. It was almost like it
like happened five minutes ago.
>> Almost.
>> Yeah.
>> So refresh our memories,
what did we see in part one.
>> Yeah. So in part one, we talked
about a lot of different things,
from Run To Click, set
to .NET statement,
Text Visualizers, DebuggerDisplay
which is my personal favorite,
and of course,
conditional breakpoints,
tracepoints and the list goes on.
>> Cool. So what are
we going to see today?
>> So today we're going to see
a lot of different things,
including some of
the new 2019 features like
Search for the Watch window,
manage data breakpoints.
>> Okay.
>> Then other little things peppered
throughout in the Watch window
such as return value,
keywords, and format specifiers.
>> All right. Cool.
>> It goes on.
>> All right. We're
using the same app.
>> Yeah.
>> Which in spite of
the fact that we've
spent all last week fixing it,
still isn't 100 percent correct.
>> Yeah. Still many, many problems.
>> We like to mimic
the real-world in this show.
>> Fair enough. Yeah. So again,
as a refresher, this is
the same app as in part one,
but it's an app that
will randomly give me
a list of books that I can choose
to read and add to my shelf,
or I can choose not to read it and
it won't be added to my shelf.
So there's several more bugs
that we didn't
fix last week or throughout
the week either,
so they're still here.
So let's investigate those.
So I'm going to add a book,
in this case, this book called
Middlemarch to my shelf.
When I click on it, one of
the problems I have been
experiencing revolves
around this String
here that says that I've
read the book one time.
>> Already. Wow.
>> Yeah, already. I know. I
haven't even heard of the book.
>> That leads you to where to
get to your 100 books done.
If you just click it, it
will mark it as read.
>> Yes. There I already read it.
>> Then I'm going to predict
that that date is an issue.
>> Yeah. That date is also an issue.
>> Looking ahead.
>> Lots of problem is going on here.
>> Okay.
>> Yeah. So what's supposed to happen
is when I select 'I
finished this book',
this value should increment by one.
It's already saying I read one time,
which is ominous in and of itself.
>> Okay.
>> So if I say that I
finished this book,
it should jump from one to two,
but if I do it in this case,
it's jumped from one to four.
So either I subconsciously
read this book three more
times in the last three seconds,
or there's something going on
in Visual Studio and my code.
>> Then the date changes.
>> Yeah. All right.
So let's see if we can
fix that problem of
reading it three additional
times out of nowhere.
>> Okay.
>> So I'm going to
set a breakpoint at
the start of my index function here,
and that will hit when I
go back to my shelf page.
From there, I want to hone in on
that specific book which
was called Middlemarch.
I can't even remember the title
and I read it three times.
So from there, instead
of simply expanding until
I find what I want,
I can use the brand new
search tool available and
the Autos, Locals, and Watch windows
for our Visual Studio 2019.
>> Oh, yes.
>> So from here,
I'm going to do Middlemarch,
I think I can just say middle.
As you can see, I'm directly
taken to where I need to go.
>> That's so cool. Again,
that is new in 2019.
>> Yeah. It is brand new.
>> Now, I remember correctly
you wrote a blog post on that.
>> I did. I recently wrote
a blog post on that,
where you can go to
aka.mswatchwindowsearch,
and then check it out.
>> Cool.
>> For more detailed info.
So from there, I have that.
You'll also notice that
as I start typing,
it will automatically
start highlighting for me.
So in the case you don't want
to execute the full search,
you can just type away and
if it's visible on screen,
it will start highlighting
and you can find things
that way as well.
Especially, this is
really nice if you have
a bunch of items in
the Watch window at a time,
which can save you
the trouble of having it all.
>> Does that do both the
name and the value?
>> Yeah. So you can search for name,
value or type if you wanted to.
>> Okay.
>> So if you just wanted
to see all the types,
I can search a reading list and
as you can see I'll start going.
>> Okay. Cool.
>> All right. So from
there I have Middlemarch,
and I'm specifically interested
in a property that this book has
called timesRead and
this is the property
that's supposed to increment
every time I finish it.
So I'm going to go into timesRead,
and this time I get
a notification telling me
that it couldn't be found,
but luckily, it's giving
me the suggestion to
bump up my search depth
to a larger number.
So I'm going change the search
depth here to three,
so that I can search more thoroughly.
>> Does it default to two.
>> For me I set my default to two,
but normally when you first download
Visual Studio for the first time,
it's set to three.
>> Where do you change
that, is that an option?
>> Yes.
>> Or just remember
the last thing you set.
>> Yeah, it will remember.
>> Okay. Got it.
>> So if you set your search depth to
10 and then you exit out of
the session if it's reading one,
it will remember that you were at 10.
>> Okay.
>> Yeah. I'm going to
bump mine up to three,
and then I'm taken to
that particular property,
again saving some time of having
to remember where that property is.
Now, the case that I'm
trying to deal with is,
why is this timesRead property
changing without my knowledge?
Normally, this is when I might
have to play some trial and
error and try to narrow down
where it could possibly
be coming from,
but I ultimately don't know
where that location could be.
So I can use something
called a data breakpoint,
which has existed in C++ for awhile,
but is brand new to manage
code users in .NET Core 3.0 in 2019.
So this is a breakpoint
that will allow me to halt
my code when a specific
object's property changes,
even if it goes out of scope.
So I'm going to use that in
order to track down the problem.
So I can right-click on
that property and then select
"Break One Value Changes".
I know that the data
breakpoint has been
created because I have
the standard breakpoint icon there.
>> Nice.
>> Yeah. Of course I
can see it along with
the rest of the other
breakpoints that
I have in the breakpoints window.
Then if I scroll up a little bit
to the top of this item,
an object ID has been created,
and this is how Visual Studio
will be able to keep track
of that object if it ever goes out
of scope while my program is running.
So from there, I'm
going to hit "Continue"
and perform the same action again,
and hopefully I get
some quick fast useful information.
Yeah. So this time I
get an a notification
telling me that my data
breakpoint has been hit,
with an added bonus
of telling me what
the previous value of
that particular property was,
and now what the new
current value is.
It'll also redirect me to
the exact location where
that change came from.
So in this case, obviously it's
coming from the property setter,
which makes sense, but ideally,
I'd like to know what called it.
So I can go into the call stack
and then just double-click here,
and then I'll be taken to
where that setter was called.
In this case, it's happening in
my get shelved book function,
which I don't need because I already
set the timesRead property
to be committed elsewhere.
>> Yeah. So you retrieve the list.
So the fact that you got the book
off the shelf is being
equated to reading it.
>> Yeah. Apparently.
>> Yeah. Okay.
>> That's what I did in
high school from time to time
if I didn't like the book,
like time to go to spark notes,
but I'll buy the book anyway,
just so it looks legit.
>> So there's
another blog post that you
wrote on this as well,
Managed data breakpoints.
>> There is, yeah. Yeah.
Definitely go check
it out at
aka.msmanageddatabreakpoints.
>> Managed data breakpoint.
>> Yeah.
>> All right.
>> Kind of a mouthful but.
>> We'll have these
in the show notes.
>> Yeah. Looks all good.
>> All right. Cool.
>> Great. So now that
I found the issue,
I'm going to comment out this line.
>> That is really
helpful because you're
now being notified when it changed,
and then go finding out why,
and then you get to decide whether
that's valid or not. Very cool.
>> Absolutely. So it can be great
in several different scenarios.
>> That can save a ton of time.
>> Right. Yeah. You
don't want to play
trial and error all time nonstop.
So this is currently a
Dynacore 3.0 exclusive
feature at the moment though.
>> All right. Okay.
>> So yeah.
You're going to need to get
3.0 and play around with that
if you want to check these
out in a managed code land.
>> Is it scheduled to make it
into framework or is that TBD?
>> TBD.
>> Okay.
>> We've gotten a lot
of feedback about that,
so it has not been forgotten.
We are acknowledging that
and go in from there.
>> Okay.
>> Cool. So going back and
performing that same action.
In this case, I'm going to read
some other book I've never
heard of called Mrs Dalloway,
but this time correctly it
tells me I haven't read it yet.
>> Okay.
>> So that's a good sign.
If I say I finished
the book and go back to it,
it's increased from zero to one.
So yeah, those are
data breakpoints and searching.
So data breakpoints again are
extremely useful for many scenarios.
In that case, I just wanted to
hone in on a specific object.
So it's great for that, especially
in contrast to if
you were to just set
a breakpoint on that property setter
where multiple objects
could be accessing that,
and maybe you don't want that.
>> Yeah.
>> It's also good if you have
a global variable
that's being accessed
across multiple files and things and
you don't know where
it's being modified,
and you can use that for this.
>> Yeah.
>> Or maybe you just inherited one of
your teammate's pieces of code
and you're unfamiliar with it,
but there's something
going on in it that's
causing a property to change
without your knowledge.
So then you can use
a data breakpoint to hunt it
down instead of having to play,
"Well, maybe it's in this area.
I don't know what
this piece of code does."
>> Yeah.
>> Let's try it.
>> Cool.
>> This type of deal. All right.
So from there, there's one last bug
that I want to deal with.
It's not so much of a bug, so much as
an added addition on my part.
But the line right
below read one times,
it tells me when I last
completed the book,
but I have a tendency to
read multiple books at once,
and can finished several books
in one day as a result,
so I'd like to know also
the exact time that I
finished it as well.
>> Oh, okay.
>> So that's currently not there.
So I want to go into Visual Studio
and see where I can add that.
So I'm going to set a breakpoint
at this line here that
returns that related String
about when I finished the book,
and refresh the page.
Just looking at it at first glance,
there's a lot going on on this line,
I have a nested function call
happening within a parameter
of an outer function call,
and then there's a property value
being fed, it's a lot.
So I want to break down
this line of code and
see what pieces of the String
are coming from where,
just so I have a better
understanding of what's happening.
So the first thing
I want to look into
is the Person.ToString function.
But as it stands now,
if I were to try to use depth into
or step-over or any of those,
there's not really a way to get into
that nested function from there.
>> All right.
>> So I can use step into
specific in order to
choose which of these function calls
I want to go to first.
>> Is that new in 2019?
>> No. This has been around.
Yeah. This is an old one.
>> Yeah. So it's been
around for awhile.
So I can right-click this line,
and I can go to step into specific,
and I'll get a dropdown with all
the different places I can go to.
>> Yeah. We need to add
a feature to Visual Studio where
when you hover over something,
it will tell you when
it first appeared.
>> That would be amazing, if
there is an extension for that.
>> Yeah.
>> It's like, Visual
Studio history extension.
>> Exactly. Yeah. Just for fun.
>> Yeah. So you can pull
your hair out wonder,
''How did I not know
about that seriously?''
>> You can load it over your friends.
>> Oh, man. Yeah. So from there,
I can select person.ToString and
just as if I were to use
the regular step into,
it'll take me into that function.
Yes, so super great.
So this one is pretty
straightforward.
It's just returning the
value of the parameter
that I gave it in which case
it was just my name.
So I'm going to step through
it and then step out.
Then I'm back to this line again.
So from there, now I want to look
into the FinishedToString
method here.
So again, using Step Into Specific,
I'm going to select that one.
Here, I'll be taken to
the FinishedToString method.
I have even more stuff going on here.
I have some string
concatenation going on.
So first, I just like to see what
is the exact return value
with this method?
But normally, in order to do that
because it's not currently set to a
variable at first, I
would think, Oh, great.
Now, I got to stop
debugging and set it to
an arbitrary variable and then
look in the Watch window or something
what that variable could be.
But another way that you can look at
this return value without
having to stop debugging and
do all that is to step to
the end of that function.
You'll notice that in the Locals
as well as the Autos window,
there is a line that has
the return key Word on it,
and that will tell you exactly
what's being returned
by that function.
So that happens by default.
So you don't have to do any other
additional leg work in order to
see the results of something that's
not set to a particular variable.
Another way that you can do this
is also in the Watch window.
So I'm going to add dollar sign
and then ReturnValue,
and then I get that same result.
>> Okay, cool.
>> So the added bonus
about being able
to do that in
the Watch window is that,
I can also add
format specifiers to it,
which are things that allow me to
temporarily view the contents
of the Watch window
in a different light.
So if I wanted to remove the quotes
around the string for instance,
because they're
redundant at this point,
I can add a comma to the item
I have here and I'll get
this dropdown which is new to 2019,
with a list of different
format specifiers I can use.
So instead of having to
memorize the giant table
that you'd have to look up online,
it'll give me some options
right off the bat.
So I'm going to select nq,
which stands for
string with no quotes.
Hit "Enter" in that
will enable it to pass.
>> That's just in the Watch window,
you're not actually
touching the running code.
>> Correct.
>> Okay.
>> I'm not filling with
the code itself at all.
Yeah. So great.
From there, I now want to step
into yet another function,
I have this finished
book string here.
But again, I am
now under scope because I've
reached the end of the function,
so I need to get back to it.
I'm going to use that to
next statement again.
There's several ways you can
use that to next statement.
I can actually drag the execution
arrow up if I wanted to,
instead of holding down the control
key, like I did previously.
So from there once more,
we're going to use
Step Into Specific,
and I'm going to select
FinishedBookString.
Here, I'm being taken to
yet another function with
more string concatenation going on.
So let's say, I wanted to
break down this line of code.
So I can use ReturnValue again.
Again, I'm going to step to
the end of the function.
This time, I have
the final result here, of course.
But if I wanted to break
it down even further,
then I can do that as well
by adding ReturnValue,
I can do ReturnValue1.
Now, give me the result
of this.Title.
If I wanted to get this last
read date thing over here,
then I can also do ReturnValue3,
and that will give me
the value of these two.
>> It's interesting.
>> This also goes for
if you're looking
in the Locals and Autos windows,
it will surely do things like this.
>> So why do that rather than just
if hovered over this .Title,
it shows you that information.
All right. If you hovered
over ToShortDateString,
it shows you that.
>> Yep.
>> You can also add those
to the Watch window.
So when would you list
the value of being able
to specify ReturnValue1,
ReturnValue3?
>> It's just another variation to be
able to look at what's being
returned on top of that,
you're doing it in the Watch window.
You can mess around with
the format specifiers and stuff,
and just keep everything
grouped together.
I like to say organize though.
I'd prefer to just have
all the ReturnValue group together.
>> Okay.
>> So all right.
From there, I have found where I can
add my time-related scenario
because I have
this ToShortDateString function
here that I don't need
in order to show
the full time and the date.
>> Right.
>> From there, I'm going to
continue running my code.
>> That is known as
edit and continue.
>> That it's edit and continue that.
Yeah, that's a magic that
sometimes it works,
sometimes it doesn't.
>> Yeah.
>> This is a scenario where it
should work because if
I refresh the speed.
>> I remember when
that was introduced.
>> Okay.
>> That's amazing.
>> When was it introduced?
Because I think that was interesting.
>> But they told you
then I meet to date
and I had to admit it a while ago.
>> Yep. So we are making-
>> I'm old enough to
remember when that
was introduced the first time.
>> Awesome, yep.
So isn't empty tool when it works,
we are making improvements
on it as we speak however.
>> Cool.
>> So yeah. From there,
I just refreshed the page,
and as you can see,
I now have the time.
That was ReturnValue,
Step Into Specific,
Format Specifiers,
and then Set To Next Statement
made a reprise as well.
>> Cool. So now the app is perfect.
>> Yeah. Now it's absolutely
perfect. There is
nothing wrong with it.
I'm never going to have
any trouble with it ever again.
>> Cool. So over the course
of these two parts,
we've obviously seen some things
that we knew were in
there, learned a lot.
I saw a number of things I
didn't know were in there,
including some things that
have been in there for awhile.
So this has been
great. Thanks so much.
>> Awesome. Thanks for
having me yet again.
>> Hope you guys enjoyed that.
We will see you next time
on Visual Studio Toolbox.

CodeMaid, a Visual Studio extension for cleaning up & simplifing code

on today's visual studio toolbox we're
going to take a look at code made a
visual studio extension that cleans and
simplifies your code you are not gonna
want to miss this one hi welcome to
visual studio toolbox I'm your host
Robert Greene and joining me today on
skype from Indianapolis is Steve
Cadwallader hey Steve how are you doing
great how are you excellent steve is the
author of code made which is a visual
studio extension that he's going to show
us it has more than a million downloads
and it's very well received and Steve
you're going to show us all about this
extension and all the wonderful things
it does tell us a little bit about why
you wrote it and when did you write it
sure yeah I started writing it in 2006
and first published it in 2007 I wrote
it because I was very particular about
the way the code is organized and
cleaning up whitespace and little things
and like most developers got tired of
doing things automatically and I kind of
got into it from a friend Eric Potter
who was starting to work on Visual
Studio macros I saw what he was doing
there and I started with an add-on and
eventually moved up to an extension cool
and it's available in the marketplace
people can get it we'll have a link for
it in the show notes all right show us
what it can do great
so yeah to get started with code made I
recommend going to our website code made
dotnet from there you can see a
high-level overview of the features I
mean go down into a deep mail detailed
documentation as well as a YouTube video
demo walk-through we also have a blog
and you can see some information about
getting started this is an open source
project so I love contributions over 25
contributors so far and that's been
great you can also of course go to the
visual studio marketplace like Robert
mentioned download it look at reviews
and we do all of our work in give-up
that's we can file issues or grab the
source code no excellent so if somebody
wanted to know what it takes to write an
extension like that they can just go to
github and poke around in the code yeah
absolutely they never put a few other
extension authors mm-hmm excellent great
so I can start diving into some of the
features hop over
visual city a solution so the
bread-and-butter or code made where it
started out is code cleaning so the idea
is taking them code that's kind of just
on the page and making on a bit more
cleaned up automatically this is really
just saving you from having to do these
things yourself
so for example if we look at this file
we can see we have unused using
statements we have the using statements
out of order we have classes and methods
that don't have an access modifier on
them so you don't know if they're
internal or private by default we have
regions that don't actually have any
content we've got extra white space at
the front of the method extra white
space between lines extra white space
between arguments at the end of the
lines and so on and so forth and so what
I like to do show you everything through
a context menu you can use in Visual
Studio so just right-click on the
document there's code made where you
have all of our different commands
available as an aside everything has a
keyboard shortcut but all of course do
everything to the menu so you can see
what I'm doing
so forget we'll just clean up back to
the document and you can see well I'll
go ahead and clean up everything for you
so you can see the using statements are
in order the access modifiers been added
a bunch of white spaces and been removed
and standardized we do this by
leveraging some of the existing
functionality that's inside Visual
Studio so for example are moving and
sorting using statements is now natively
baked in we started back in Visual
Studio 2005 was our first integration
before that ever existed obviously
leveraging and gladly using anything the
Visual Studio starts to build in
natively so does that just mean less
code that you have to maintain yes
absolutely which I'm all for yeah I
won't mind if some day everything is
just baked in natively
likewise for formatting document a lot
of the argument level whitespace and
there's something that's already built
in to do the visual state videos format
document below there's stuff around
whitespace and things like that and so
you can do that mainly in one file at a
time a lot more powerful though as you
can turn on automatic cleanup on the
safe so every time you save your file
will automatically step in and will
clean up the file for you before it gets
written out to disk that's a real nice
way to just kind of turn it on and
forget it
yeah that is all I default as people
don't get too surprised but that's we
did one setting I recommend flipping
once you get comfortable with the tool
you can also do code up clap cleanup
across a whole bunch of awesome one so
for example you can clean up all of your
open documents you clean up your entire
solution or you can also pick any level
inside the solution Explorer right-click
and clean up the selected codes so for
example if you just want to clean up
that specific project if your project
inside a bigger solution you can do it
that way too
so all does the entire solution and if
you want to do one project at a time you
do it at the project level yeah you can
do it
folder levels or anything that's
appropriate okay cool that's the part of
the cleaning fix t-shirt next big
features we call the digging feature so
the idea is you have this file and you
want to kind of get an overview of what
you're looking at so we've got a tool
window I'll call it code mate Spade
because it digs through code that I'll
show you kind of a visual overview of
the file so for example we can see our
constructors our properties methods so
on and so forth you can click on
anything to navigate to it for example I
click on this event a my editor window
they'll jump to that file sorry jump to
that event you can double click on
something to highlight all the codes so
I'm gonna put on the clipboard
do something like that you can middle
click on regions and will synchronize
back and forth between the two whether
they're open there collapse so those are
all kind of useful mm-hmm one other
thing I like to do is you come into a
file you're not real familiar with and
perhaps things are kind of scattered
across first you just kind of want to
look at them in a standard order so you
can actually even though we sort by file
order by default you can switch the way
you view so you can view all the types
grouped together without affecting the
file so you can see all of our methods
have been grouped together and put in a
logical order mm-hmm or you can just do
a straightforward medical sort too if
you just want to look at it that way if
you know exactly what you're looking for
one other way that's handy to search is
by just using the search window so if I
know I'm looking for something a bird
path in it I can just type that in it's
just like solution Explorer is using the
same API they want to find the thing
looking for jump speak to it mm-hmm
so those are all useful and something
else that it's really helpful is you can
do drag and drop to reorder of your code
so for example I've got this is
initialized probably probably filled at
the bottom of the file style cough
convention
that's at the top of the file so you can
click and drag to move that up to the
top of your file and one of those code
numbers around for you that is cool
yep and one step further than that is
you can do multi select so for example
if I want to take everything in this
region I can either shift click or
control-click just like the Windows
Explorer and drag those items are around
so say I one of those methods to both be
at the top of the file for some reason
you can see that I can do that real
quick through there as well couple other
items like finding references and our
routing regions things like that that
are hooked in as well and then you can
delete methods from there as well or
member excuse me yep-yep regions as
popular one people don't like regions a
lot of stuff that's there as well
does that get rid of everything in the
region or just the region identifier it
gets rid of everything that's in the
region cool um so you can do that
manually through the digging window next
step forwards from there is you may want
to kind of just set that up on auto run
right you don't want to mainly drag
those items around so we have a another
feature called reorganizing so this will
basically do that automatically for you
so for example you can see we have this
file where the fields are scattered
across the properties are scattered
across methods scattered across so we
just want to kind of start the freshly
you cannot go in right click and come in
to reorganize active document just you
know see that we've moved all the fields
to the top of the file followed that by
the Constructors delegates events
properties so on and so forth so that's
a nice way to kind of clean up a file
that you're going to start over with or
just been looking into already and you
have the ability to set a custom order
for the Oregon is absolutely yep so yeah
I'll get into options a little bit later
go ahead and show that but it defaults
to the style cop guidelines right cool
and one other feature I didn't show in
the other window with is the ability to
do we have these tooltips to show up so
for example if you mouse over something
will show you any XML comments
associated with it will do a make a
complexity calculation for you so you
can see if something this kind of
complex that's what will give you like a
little
Fyers is a static tree dried things like
that this little queues for you to know
just kinda working through the files
yeah and that shows what those icons
were over to the right yeah again so
yeah these are just trade out individual
studios icons so the same things you'd
see like an outline window or in that
Explorer one runs right the 15 the one
the two yeah sorry so that 15 is a
mccabe complexity score okay my own
rough calculation that's not perfect but
close pretty close so you for example
you see this method has a whole bunch of
or conditionals that's triggering a high
mccabe complexity score within that
method and i kind of highlight those
you can configure what the thresholds
are I think Aven 10 is kind of like a
warning level and 15s in alert levels so
you kind of see where's the meat of your
file and he kind of look at something
right away or if something's getting
kind of unwieldy okay cool
cool so one other hello feature we have
is comic formatting so for example we
turn off word wraps you can see this
comet just kind of goes on and on and on
it's really long the parameters are just
kind of in place there's like space
amongst them things like that you do
have a common formatting feature to kind
of standardize that for you you can
specify you know what com you want to
wrap at which tags you want to auto wrap
things like that yep this little handy
feature needs and then below that a lot
of features are kind of more little
small utilities some simple we have a
join feature so if we look at this
property accessor and we want to join
those lines together can do that very
simply obviously it's very basic thing
to do
yeah you have the ability to sort code
that's natively sooner or later but um
it's basic alphabetical sort on the code
so you can see that when these
attributes were out of order before we
can help the ties it owes
into a certain order if you would like
to and then um hop over to another
session for a couple other features one
other thing we have is when you're
looking in a document you can hop to
that same document inside the solution
Explorer this has been built in
through the sink active documents and
later versions ranked you still have our
shortcut but we actually just turn
around and evoke the native command for
people who have the muscle memory so you
see it'll hop directly to that file
within the solution Explorer and we also
have the ability to collapse at
different levels so if we can't look out
a whole bunch of folders is it a real
thing it's gonna collapse them at a
certain level you can do that you can
also at the top level again that's one
the visual studio is now built in
natively so you can do that as well and
then one more I want to show off is when
you have a large solution waiting for
your build times there isn't a lot of
feedback I think and how far you are in
your builds what's being built right now
there's a building well as a build here
so I have a little tool window I'll show
you your build so example if I go for
you build my solution see your little
build window comes up and show me which
project it's building as it goes usually
as much faster so are you basing it on
the Amana code or how long it takes to
build things how do you make that
calculation so yeah it's coming from the
visual studio does have api's around
built progress events you can know an
individual projects completes or example
that could meet projects built now our
unit testing integration tests can kick
off and build on top of that okay and we
also show the Soto show a green status
or red status obviously as those builds
are running through they also do a
little update inside the windows taskbar
so you can see it down there as well so
it's it's it's based on the number of
projects yes see I have three projects
for code made right so there's a primary
solution integration test and unit tests
so the integration test and unit tests
depend on the primary project before it
can be built so you can see that just
that one project is building right now
and as soon as that other one fires
finishes the other two can start off
concurrently right so you don't have the
ability to calculate it based on the
amount of work the build has to do right
no it's really just project level but
I've had some larger solutions I had
like 120 projects in them it's really
useful for those yeah cool
so then one last area want to show is
kind of the options within code making
and so when you install code made
there'll be a top-level menu right up
here mm-hmm
shows all those different commands we
can also I didn't show removing all
regions that's another popular one you
just don't like any regions in your
files or if you remove selected regions
things like that to go down in the
options window we have a we've really
tried to focus on having the defaults be
pretty good so you don't generally have
to mess with these I'm personally of the
opinion it doesn't really matter what
your coding style is you just want your
code base to be consistent people can
argue a lot about little details but
honestly as long as it's the same that's
usually been my goal so I tried to make
the settings as general for most people
keep them happy but obviously you know
people have a lot of requests a lot of
very specific features that they want to
have so I think we have 170 options or
so trying to keep somewhat managed
within here and we'll go through all
those by any stretch of imagination I
just want to go through a couple of
these pains
at a high level so first one is we have
the ability to have both user level
settings which would be on your machines
stored in your user profile as well as
solution specific settings an example of
this is if you have specific files you
want to exclude from operations so for
example I don't want any of my
integration test data even though it
looks like c-sharp code I don't want it
to be cleaned because of course that's
what the test was supposed to be doing
for me right so you can specify you know
files you want to exclude based on
regular expressions but that's something
that's a good example of a solution
specific setting versus a user level
setting and you can store that just a
code need a config value store right
alongside your solution file and so we
support a whole bunch of languages as
you can see up here I won't listen to
them all c-sharp and VB definitely get
the best support because those have the
most integration with the visual studios
api's scaevola
c++ would be behind that we allow you to
turn on operations even for text files
but it's pretty basic just in the line
white space
duplicate white lines things like that
okay um another high-level feature that
has recently been added from
our community contributors is ability to
turn on or off any one of our features
so if you want to get rid of some
feature you don't want to see it in any
of the context menus you don't want to
hook into the event handlers you can
just turn those off altogether and it
will disappear from the menus pretty
straightforward just registries in most
operations and code made are I don't
until invoked so it's usually not too
harmful I'll leave everything on but if
you just want to clean up your context
menus you're welcome to do that what was
the general impetus for that the this
person only wanted to see the things
that they were going to use regularly
yeah so they thought this menu was too
long they want to be small right and
seem to go for this one where's does
show everything so Sheridan yeah it's a
nice featured app yeah anyway what's
trending sauce so we talked before about
the reorganizing types so yes you can
customize those so I've come down to
reorganizing types you'll see the
default order so if the elds
constructors so on so forth okay kind of
down the bottom did you can do a lot of
customization here so for example if we
want to merge our properties index to
get properties indexers together in this
drag and drop those onto each other mhm
we can rename those to something else we
wanted some support so you can customize
that however you want
that will affect both what you see in
the digging tool window as well as what
the reorganizing functionality invokes
and cleans up and you could have that at
the solution level or the user level
right so if there's a particular project
you're working on where you're using a
different a non-default
or non-standard order you could do that
yes absolutely
okay and then you can always reset to
default very important button right
there right oh yes I like that one
that's a super useful for debugging yeah
you know one last thing I wanted to show
off in here is this we have a little bit
of integration with third-party tools
I'm so JetBrains resharper telluric and
zamel styler mm-hmm these are
deactivated cuz I'm not using any of
them anymore but you can turn those on
and well basically chain or cleanup
alongside there's just like retaining
alongside visual studios cleanup okay
and you can even customize that further
if you have other commands right awesome
so have you
assume you've found over the years that
more and more of the features actually
get baked into Visual Studio um which
then gives you the ability to write less
code and just hook into what Visual
Studio is doing yeah that's been really
useful I think some of the big ones were
of course removing and sorting using
statements yes fault as well as
collapsing the solution Explorer cool so
how difficult was it to write this
extension what advice would you have for
people who were thinking of doing
something similar or potentially are
thinking of looking at your code and
either leveraging it or helping to
contribute how hard is it to figure out
the model for Visual Studio and then
also how hard is it to write an
extension like this yeah that's a great
question and it's very different today
than a decade ago when I wrote Visual
Studio 2005 it was mostly add-ons at
that point I was leaning a lot on Carlos
Quintero had a blog with Visual Basic
examples that was about the main source
of data had mm-hm
back then everybody's on SourceForge
things like that so it wasn't a ton of
available code to refer to nowadays
there's been a lot of push from that
team to really improve the documentation
so there's stuff out there directly on
MSDN I mean there's a ton of example
repos on github okay Matz Kristensen has
a ton of extensions who's done a great
resource snow' leaned on him as well as
he's got some examples of automation
event through that lawyer so you can
have a alpha channel basically a CI
Channel
really easy extension so I definitely
recommend checking out other extensions
there's a good starting point okay cool
so code made awesome tool highly
recommend people take a look at it
download it join the ranks of the
million plus people who have downloaded
it and they're currently using it that's
tremendous
thank you thanks a lot for coming on the
show thank you very much for having me
all right hope you enjoyed that go take
a look at the tool and we will see you
next time on visual studio toolbox
[Music]