Video summary
In this episode of Fast Focus, Yujin from the Visual Studio Copilot team demonstrates how GitHub Copilot can significantly accelerate daily engineering workflows within Visual Studio by automating the entire bug-fixing lifecycle. The session centers on a specific scenario involving an online store application where a runtime pricing bug causes incorrect discount calculations during checkout. Although all unit tests pass initially, a manager reports that the final total is miscalculated because discounts are being applied to the entire cart subtotal rather than just eligible items. Yujin reproduces this issue in Visual Studio, highlighting how Copilot's specialized debugger agent can be leveraged to investigate such runtime problems without requiring manual setup of breakpoints or prior knowledge of the codebase.
The core of the demonstration involves using the debugger agent to trace the root cause of the pricing error by analyzing running application state, local variables, and call stacks automatically. Once the agent identifies that the discount logic is flawed, Yujin switches to standard agent mode to generate a regression test that validates the expected behavior against the actual faulty output. After confirming the test fails as intended, Copilot applies a minimal code change to fix the calculation logic and runs the full test suite to ensure no regressions are introduced. This seamless transition between debugging, testing, and fixing illustrates how the tool handles complex reasoning tasks while maintaining code quality and adhering to existing project styles.
To complete the workflow, Yujin uses the debugger agent once more to validate the fix in a live runtime environment, ensuring that the customer-facing experience is corrected before deployment. Recognizing that similar pricing bugs might occur in different contexts, he saves the entire investigation pattern as a reusable prompt file stored in the repository under the standard prompts directory. This feature allows teams to share and reuse effective debugging strategies across various projects, effectively institutionalizing knowledge gained from solving specific issues. The session concludes by emphasizing that Copilot supports the complete engineering loop—from initial investigation and testing to fixing, validation, and finally, reusing solutions for future challenges—making it an indispensable asset for modern software development.
Read the full video transcript
All right.
Welcome, everyone.
My name is Yujin, and welcome to Fast
Focus 20-minutes speed round for AI in
Visual Studio.
I'm Yujin, and I'll be your host today.
I'm a software engineer on the Visual
Studio Copilot team.
And I help build AI-powered experiences
in Visual Studio Copilot.
I focus on model integration,
evaluation, and developer workflows.
Today, I want to walk you through how
GitHub Copilot can supercharge your
daily engineering workflow inside Visual
Studio.
We're going to dive right into where
many of our workflows start with a bug
report.
Say you're an engineer on the Summit
Store. This is an online store where the
application builds,
all tests pass,
and all the checkout completes
correctly, but
your manager reports that it returns the
wrong total.
I'll demonstrate four Copilot
capabilities as we fix the bug end to
end.
First, the debugger agent will
investigate the running application.
The agent mode will add a regression
test and fix the issue.
And the debugger agent will validate the
fix and will save the workflow as a
reusable prompt.
Before I ask the Copilot for help, I
want to reproduce the report myself. So,
I'm going to open my Visual Studio
instance.
And I'm going to run.
And here is the
app.
Okay.
So,
my app runs.
And from my solution, I have four
solutions. I have
these 1 2 3 4
and tests.
In my test explorer,
I can tell you that all my tests are
passing. So, there must be a runtime bug
that's not captured here.
So, in my instance, I'm going to go
back.
Here you can see that I'm a premium
user.
And as a premium user, I get a 10%
discount.
In my cart, I have an $80 mechanical
keyboard that's eligible for this $10
discount. So, I'm expecting $8 off.
And I have a $20 store gift card that
shouldn't be eligible for any discounts.
So, the total should be $92.
This button here runs the real checkout
API.
So, when I click this button, I would
expect the $92,
but we're getting 90.
So, we're over applying the discount
by a couple of dollars.
And my boss is going to kill me.
So, here we reproduce the bug, um and
it's a runtime pricing bug.
Going back to Visual Studio, we are
um we have Copilot Chat in the bottom.
And you can also open it here.
Um this is the main interface for
working with Copilot.
The mode selected in bottom here is the
tool that lets us choose which type of
help that we need.
The agent mode uh sorry, the ask ask
mode here is great when you just want an
explanation for a question.
The agent mode
can explain questions still, but it the
it can
add code, edit code, run commands, and
work across multiple steps.
The debugger agent here that we're going
to be using today
is a specialized agent that can use the
debugger context.
That means two things.
One, it can use breakpoints, local
variables, and the call stack while the
code runs.
And two, that means it's really useful
for runtime investigation just like this
bug.
So, to investigate the root cause of
this bug, I'm choosing the debugger
agent.
A useful debugger prompt contains three
things. I'm going to paste the code.
Uh the prompt.
It has three things of what we ran,
what should have happened, and what
actually happened.
So, this prompt includes the cart
contents, the expected and the actual
totals,
and instructions to start the debugging
session, inspect the runtime values, and
identify the root cause.
And I want to run it under the debugger,
so I'm going to choose the first option
and submit.
And notice what I didn't provide.
I didn't tell it which service,
I didn't open a source file, and I
didn't set any breakpoints, and I didn't
tell it where to put a breakpoint.
I gave it the same evidence that I would
have gotten from a support ticket,
and it's the agent's job now to trace
the symptom back to the root cause.
So, the agent here is now inspecting the
solution, tracing the request, and
deciding where and which tool will be
useful.
And it's asking me whether I want to
start a debugging session. Yes, I do.
And while the agent was working here,
you might see that it's been calling
some tools and calling tasks.
And that's the Visual Studio agent using
the tools that we have within Visual
Studio
to inspect the running code.
And that integration is what makes the
debugger agent in VS really special, and
it differentiates it from asking a
general chat window.
So, I can see that it opened a file.
>> And while this is running, it's actually
attached to the debugger and it's
waiting for me
to do an action.
So, I'm going to run the checkout.
And it placed a breakpoint where it
thinks the issue is.
So, as I expand this tab,
it put a breakpoint in line 29
and it's going to start analyzing the
values.
And it's going to move to the next next
breakpoint that it also sets and
calculate the values.
And you can see that it confirmed that
the discount amount
is $10 and the final total is $90 just
like what we've seen before.
It proposed a fix and found a root
cause.
Before I make any fixes, I want to
create a unit test that should have
caught this bug.
So, I'm going to switch from the
debugger agent to a regular agent
because the nature of the task has
changed from reasoning about a running
debugging session to adding a unit test.
So, I'm going to add this prompt
that asks the agent
to add one test to cover the scenario.
For the same cart that we saw earlier,
assert the premium user rate, the
discount amount, and the final total.
So, Agent mode will follow the existing
code style, add the test, and run the
test by itself.
I want to stop debugging.
And I also didn't tell it where to add
the test. It found the test files on its
own and it added it where it seems
appropriate.
And looking at the diff,
I'm out a little bit.
I can tell that it asserted the discount
percentage of us 10% the amount as $8
and the final total total as 92.
And it also ran only this test and it
fails as expected. So, if you go back to
the test explorer,
you can actually see that it ran the
test for me.
And you can also assert for yourself
that
the expected value is 8 and the actual
value is 10.
So, before accepting this diff, I'm
checking for three things.
The test follows the exist existing
style.
It checks the expected values and it
doesn't modify production change yet.
And looking at this, it only changed
this one file
and it looks right. So, I'm going to
click this check mark, which keeps the
remaining changes and applies them.
So,
this is a failure that we actually
wanted.
With the help of Copilot, we created a
unit test that should pass when we're
all done.
Now, I'm going to let Agent mode
implement the fix by
um by applying these changes.
So,
I'm going to paste this code uh
this prompt.
And I'm going to ask it to apply the fix
supported by the debug session and then
run the entire test suite.
And I'm not repeating the findings from
the debug session because it should be
able to pull that information from
history.
And given this diff,
you can see that the intended production
change is really small. It's just one
expression
uh where the discount amount should be
multiplied by the eligible subtotal
instead of the cart subtotal.
I'm going to keep this change.
And it also ran the full test suites,
and all of them passed, including the
one that we just created.
So, we know that there's no regressions
here. And you can also check again that
it reran the tests, and all of them
passed.
So, I'm switching back to the debugger
agent now,
because passing tests are great, but
they don't validate the final customer
experience.
We found this bug at runtime, so let's
verify this at runtime, too.
I'm pasting this prompt,
where I ask the debugger to validate
the fix end-to-end.
I'm asking it to start the application
under the debugger and reproduce the
checkout issue. And when I run the
checkout, it's again going to put the
breakpoints where it believes you can
find the issues.
And you can see that
it fixed.
So, the checkout now shows $92 as
expected on the store page, too.
Um I can happily report that this issue
is fixed, and I can confirm these
changes.
So, I'm going to pause execution.
And even here, they printed out the
values for me from the runtime
execution.
So, the debugger agent suggested a fix,
and helped us validate the complete loop
against the running instance.
And before we finish, I want to save
this investigation as a reusable prompt.
I know that my teammates and I will run
into bugs with the same basic shape,
even if the areas or the values are very
different,
and this will come in really handy.
Visual Studio supports reusable prompt
files, just like how we support custom
instructions, skills, and MCP.
Prompt files are just markdown files
stored within the repository, and it's
typically under doc.github/prompts.
So, in the agent,
typing {slash} shows you the slash
commands that represent a repeatable
prompt that can be saved and reused
again and again.
So, here you can see all these different
prompts, um all these different reusable
prompts. And I'm going to use save
prompt because this is a slash command
that extracts the useful pattern from
this conversation as a reusable prompt.
Give it a title, and save it in the
repository.
And just like that, it's going to work
on extracting the core information from
this conversation.
The title it gave from
its bots were debug checkout regression.
Uh you can type
the changes.
And
you can see that from double-clicking,
you can read into the file.
It has a name, the objective, some
context, and the steps to follow.
And now that we added this, I'm going to
keep this change.
Pressing {slash} now exposes the prompt
that we just added.
It opens the slash command and the
prompt files, including the new one that
we just added, debug checkout
regression. And now your teammates or
you can easily find and reuse the same
workflow.
So, let's recap the workflow here.
Going back, we used the debugger agent
to trace a runtime pricing bug to the
discount base.
The agent mode added a regression test,
applied the targeted fix, and ran the
test suite.
Then the debugger agent validated the
customer experience
and {slash} save prompt preserved the
workflow as you found them.
The takeaway here is that Copilot
supported the complete engineering loop
where you investigate,
test, fix, validate, and reuse.
And the same workflow applies to larger
and more complex solutions with longer
call paths and more runtime states.
And lastly, we also love feedback. So,
please scan the QR code and tell us what
was useful and what you want to see
next.
Um again, my name is Yujin and thanks
for joining me in this session.
We have a couple minutes left for
questions if anybody wants to share.
Okay, awesome. I'll stay after um and
feel free to join me after.