When it comes to leveraging OSS and other reusable components, developers have more options today than ever before. Productivity gains from taking on external dependencies can evaporate quickly though, when you need to spend time debugging or searching for dependency source code. To do these tasks, you might need to enlist and rebuild a library (and replace all solution references to this rebuilt version) to take advantage of Visual Studio capabilities like “go to definition” that “just work” for your own project code.
Visual Studio debugging and code exploration works pretty well (if we do say so ourselves) when you’re building everything in your solution. Well, what if VS worked just as well for code that you aren’t compiling? Code that you compile from a completely different solution, for example? Or even code you’ve dropped in as a NuGet dependency? While we have the hood up, what if Visual Studio could help with search scenarios before you take on a dependency?
This post presents a set of ideas that we are considering or have started to implement in Visual Studio “15” to keep developers productive when they take on OSS and other external dependencies. Take a look at this video for a lightning tour of what we have in mind and let us know what you think.
To follow along at a different pace, keep reading …
Do any of the following problems sound familiar? You open a dependency source file from outside your solution and it doesn’t colorize completely. You set a breakpoint on a call to an OSS dependency you’d like to debug and VS steps over it. Or you hit F12 on an external call and VS offers a “metadata view” instead of the actual implementation:
What if we could make all these problems disappear? What if we could make sure that all of Visual Studio’s rich code debugging, search and exploration features keep working without requiring that you download and build dependency source code, or locate dependency symbols? That’d be great, right?
Let’s take a quick tour through an end-to-end example of what this might look like, starting with acquiring a useful code snippet from the web and adding it to a fresh project (with no dependencies).
Useful code samples found without leaving Visual Studio
We’ll start with something that you can do today in Visual Studio: locate useful code snippets without leaving the IDE. The Bing team is updating this extension right now to provide even better search results for “how to” scenarios (by adding new “fuzzy match” search capabilities). In our “what if” scenario, we’ll look for a code snippet that can convert an XML string to the JSON format.
Visual Studio makes it all compile.
Now that we’ve located a useful snippet, we paste it into the editor. Visual Studio “15” can apply auto-fixers that make it all compile, with minimal keystrokes. VS can even suggest and install the NuGet packages you need to make everything work. This feature is shipping in the Visual Studio “15” preview bits that you can download today.
“Go to definition” just works.
Now we get to new magic we have in mind. What if you never saw a metadata view again or a message that VS “could not resolve symbol under the caret”? What if “go to definition” always worked for all the code your solution pulls in?
Debugging works. With no extra work.
If you run into an unexpected problem and need to debug your external dependencies, that can slow you down at the worst possible time. For Visual Studio “15”, we’d like to make it so that you can set and hit breakpoints without doing any extra work. No more searching the web for PDBs or source server information. No more cloning repos and rebuilding them locally, just to fix a single bug.
Search dependency code as well as yours.
Searching code is critical to productivity and you should be able to comprehensively search external code bases that you depend on. What if we could improve “find all references”, for example, to locate usage patterns within a dependency’s source code on GitHub as well as yours? We’re looking at it for Visual Studio “15”.
Tell us what you think. We’ll move forward.
Altogether, we think the experiences described above would be a great advance in developer productivity. These features should also help with extremely complex projects, where teams take on many dependencies coded elsewhere in their company (but which they don’t compile in their own solutions). What do you think? Let us know!
|Michael C. Fanning, Principal SDE, Visual StudioMichael is a developer and technical lead in the Compiler Language & Platform team in Developer Division. Michael has been at Microsoft for a long time, primarily working on developer technologies and security.|
|Joe Morris, Senior Program Manager, Visual Studio
@_jomorrisJoe has been with Microsoft for 19 years, with a particular focus on static analysis and developer productivity for the last three years.