Thursday, March 3, 2011

C++/CLI IntelliSense in Visual Studio vNext

C++/CLI IntelliSense in Visual Studio vNext


C++/CLI IntelliSense in Visual Studio vNext

Posted: 03 Mar 2011 03:26 PM PST

Recently Mohsen & Craig talked about a Renaissance within C++ development and Tony talked rebuilding our developer communication around C++, both of these videos touched on the subject of providing a more real world pragmatic discussion around why we do things and what we're planning. This post is the first in a series of posts we're planning on making over the coming months where we're asking for your thoughts about what you need in a C++ development tool and about our proposals for the next version of Visual C++. To set the stage for those discussions we'll be providing some insight into how and why we made some particular decisions regarding product features. In the case of something new we'll share how we saw the problem space and how we're thinking of addressing it.

We're looking forward to hearing your thoughts regarding these features and how best we can use the developer resources we have to give you the most value in the upcoming product (ideally we'd want to deliver on 100% of your needs but, as you know, sometimes you have to make trade-offs so we're looking for your help to make the right ones).

The first feature area we'd like to hear from you about is C++/CLI IntelliSense. Let's provide some background explanation and then discuss what we're doing.

 

Why We Didn't Include C++/CLI IntelliSense in Visual Studio 2010

As we are close to the final release of Visual Studio 2010 SP1, one of the top issues that came back is the absence of IntelliSense in C++/CLI projects. When we released the SP1 Beta last December, this issue topped the list of complaints as it was announced that it would not to be part of SP1. In this post we'll explain a bit about the evolution of C++ IntelliSense support and one of the two questions everybody asks: why it's not supported for C++/CLI projects in Visual Studio 2010?

 

A Brief Evolution of IntelliSense in C++ Languages

Those developers who have been using Visual Studio since its earliest editions know that IntelliSense has been featured for both native and managed C++. So why is it today only available for native? IntelliSense is a powerful feature that has to meet certain goals:

  • Accuracy: all suggestions must fall within the context you are in, still encompassing the latest version of the complete related projects (i.e. a change in a header file).
  • Speed: as fast as your fingertips. Thus the implementation must be based on a time-critical approach.

Our first implementation of C++ IntelliSense appeared in Visual C++ 6.0 and we did this through the creation of a supporting file, the infamous .NCB, that contained consolidated references and definitions generated by the compiler. IntelliSense was pretty limited but still considered an outstanding feature as no other IDE at the time offered anything similar. The .NCB file contained a rich set of information including class members, global variables, etc. but we didn't have complete information for such constructs as namespaces and exceptions. This deficiency and the fact that these files grew so large, complex and occasionally corrupted (who doesn't remember fixing an IntelliSense problem by deleting the .NCB file and having it rebuild), that we needed to change the underlying implementation.

With projects becoming more complex, additional issues emerged such as the one known as the "multi-mod" problem. This problem occurs when a header file is included into multiple translation units with different contexts (such as difference macros). With the NCB approach, we only remembered one context for a header file and you would see incorrect results for IntelliSense when in a different context. There was also the issue where we needed to recompile many files when a shared header was changed. This could cause the IDE to freeze in some cases (this also happened if a compile option was changed, like switching from DEBUG to RELEASE). To address this we needed to not only better understand the information contained in the source code but also store that data more efficiently and reliably. We also wanted to ensure that the IDE was as responsive as possible. Initially, we used techniques such as background compilation threads, idle time detection and priority queues to achieve this but eventually we realized that a complete IntelliSense re-architecture was required. For Visual Studio 2010 we started that work and decided to use a live model for IntelliSense, while changing the store (which is still used for "browsing" features) from an .NCB file to SQL Server Compact Edition. This helped increase the performance while also decreasing memory consumption. We also wanted to address the problem of differences between how we interpreted the code for IntelliSense and how we did it for the final compilation product. This problem manifested itself in things like the language features appearing in the IntelliSense engine but not in the compiler and vice versa.

 

The 2010 Dilemma

Prior to VS 2010, we used a modified version of our command-line compiler to implement IntelliSense. As we added new features to the language it was minimal work to enable them for IntelliSense. As part of our IntelliSense/IDE re-architecture in VS 2010 we decided to use a new compiler codebase for IntelliSense. This decision provided many benefits, but we simply underestimated the amount of work it would take to implement C++/CLI in this codebase, and we couldn't change our plans by the time we realized it.

In addition to this unexpected amount of work, there were lots of new features that customers' were asking for, such as:

  • An improved IntelliSense error reporting.
  • Faster compilation and more optimized code generation.
  • #include auto-completion.
  • The ability to target specific compilers and libraries.
  • New MFC features like the class wizard or the restart manager.
  • A build platform that provides better diagnostics, extensibility and integration.
  • Improved C++ standards adherence.
  • Support for parallel programming from both libraries and tooling (debugging, etc.)
  • Standard Library improvements.
  • Availability of Windows 7 technologies (like Direct3D 11, etc.)

Even with this constraint we really wanted to deliver IntelliSense for C++/CLI in VS 2010. We looked at several alternatives and mitigations, but nothing would fit our schedule and provide real value to our users. We considered trying to enable the old IntelliSense mechanism (i.e. NCB) for C++/CLI projects, but that would have been a huge amount of work as well. We also considered trying to hack something in, but we rejected that as well after investigation. We wouldn't have been able to provide IntelliSense on any imported metadata, which would have made IntelliSense pretty useless for most people.

In the end it was one of those hard cuts you have to make when dealing with the real world resource and schedule constraints. It turned out that the work was also too much work to fit into SP1. As soon as we wrapped up VS 2010, we started work on C++/CLI IntelliSense, but it wasn't ready in time for SP1. We realize this wasn't what you wanted to happen and an explanation doesn't help you get your work done if you are affected by this, but we want you to know the truth.

The good news, though, is that all these architectural changes made in Visual Studio 2010 have enabled us to deliver a better IntelliSense experience overall and will set us up to deliver a number of other features in the future.

 

C++/CLI IntelliSense in Visual Studio v.Next

Hopefully this gives you some insight into why we made the decisions we did.

The good news is that C++/CLI IntelliSense will be in the next version of Visual Studio. We've done a lot of work to get this in and, barring major unforeseen complications, you should expect to see it in the final product. As always, there is some risk, but we wanted to get this information out in front of you for your comments.

In our next post on this subject we'll delve into more detail on our plans and ask you to comment on our thoughts. Stay tuned.

 

References

Hanselminutes Podcast 255 - The Opinionated Cloud - Learning about AppHarbor

Posted: 02 Mar 2011 12:07 PM PST

Scott sits down with Rune from AppHarbor . AppHarbor has some strong opinions about how the cloud should work and how applications should be deployed. Is there room for another cloud offering? Is the cloud about elasticity or something else? What's a Cloud and what's Platform as a Service. All this and more as Scott gets educated. Download: MP3 Full Show NOTE: If you want to download our complete archives as a feed - that's all 255 shows, subscribe to the Complete MP3 Feed here . Also, please do take a moment and review the show on iTunes . Subscribe: or or Zune Do also remember the complete archives are always up and they have PDF Transcripts , a little known feature that show up a few weeks after each show. Telerik is our sponsor...(read more)

ASP.NET Rounded Coreners AND DropShadow with jQuery.

Posted: 02 Mar 2011 10:43 AM PST

I've started blogging examples of how to replace Microsoft AJAX and the Ajax Control Toolkit usages with jQuery based equivalents. In this post I showed how to replace the ACT's Rounded Corner Extender with jQuery and in this one I demonstrated how to replace the Drop Shadow control extender with jQuery. But lots of folks want [...] Read More......(read more)

Windows 7 Specific Desktop Applications Videos (9)

Posted: 01 Mar 2011 06:21 PM PST

How Do I: Use Windows 7 Known Folders with VS 2010 and the Code Pack API Windows 7 Sensor and Location API Part 2 – Accelerometer as a Joystick How Do I: Implement Windows 7 Taskbar Icon Overlays with WPF 4 How Do I: Use Windows 7 Text-to-Speech from .NET 4 and WPF How do [...] Read More......(read more)

IIS & Hosting Videos for ASP.NET MVC Developers (25)

Posted: 01 Mar 2011 08:30 AM PST

Deploying ASP.NET MVC Application Using ASP.NET MVC with Different Versions of IIS IIS for ASP.NET Videos Developing and Deploying in Shared Hosting Working with IIS7 Delegated Admin Feature Specific Delegated Management Troubleshooting Production ASP.NET Apps Creating a Site with IIS7 Manager Installing FTP 7 Bit Rate Throttling IIS 7 Playlists Hosting Tutorials ASP.NET Hosting Options [...] Read More......(read more)

ASP.NET MVC Security Videos (5)

Posted: 28 Feb 2011 06:44 AM PST

Authentication Authenticating Users with Forms Authentication Authenticating Users with Windows Authentication Preventing Open Redirection Attacks Defense in Depth Preventing JavaScript Injection Attacks Preventing JavaScript Injection Attacks 2 Read More......(read more)

Dynamically switching the theme in Orchard

Posted: 27 Feb 2011 10:16 PM PST

It may sound a little puzzling at first, but in Orchard CMS, more than one theme can be active at any given time. The reason for that is that we have an extensibility point that allows a module (or a theme) to participate in the choice of the theme to use, for each request. The motivation for building the theme engine this way was to enable developers to switch themes based on arbitrary criteria, such as user preferences or the user agent (if you want to serve a mobile theme for phones for example). The choice is made between the active themes, which is why there is a difference between the default theme and the active themes. In order to have a say in the choice of the theme, all you have to do is implement IThemeSelector. That interface is...(read more)

Templated Razor Delegates

Posted: 27 Feb 2011 02:50 PM PST

David Fowler turned me on to a really cool feature of Razor I hadn't realized made it into 1.0, Templated Razor Delegates. What's that? I'll let the code do the speaking. @{ Func<dynamic, object > b = @ < strong > @ item </ strong > ; } < span > This sentence is @ b("In Bold"). </ span > That could come in handy if you have friends who'll jump on your case for using the bold tag instead of the strong tag because it's "not semantic". Yeah, I'm looking at you Damian . I mean, don't both words signify being forceful? I digress. Note that the delegate that's generated is a Func<T, HelperResult> . Also, the @item parameter is a special magic parameter. These delegates are only allowed one such parameter...(read more)

ASP.NET DropShadow with jQuery.

Posted: 26 Feb 2011 01:31 PM PST

As I started in this blog post, I'm creating jQuery based samples for all of my origional Ajax and Ajax Control Toolkit guidance. (Find it here.) In this video I demonstrated adding "DropShadow" visual effects to ASP.NET controls using the DropShadow Control Extender from the ASP.NET Ajax Control Toolkit. As you might expect, and as [...] Read More......(read more)

ASP.NET MVC Data Access Videos & Tutorials (17)

Posted: 26 Feb 2011 10:47 AM PST

ASP.NET MVC Models Creating Model Classes with the EF Creating Model Classes with LINQ to SQL Creating Model Classes with LINQ to SQL 2 Displaying a Table of Database Data Implement View Models to Manage Data ASP.NET MVC Validation Performing Simple Validation Validation with the IDataErrorInfo Validating with a Service Layer Validation with the Data [...] Read More......(read more)

ASP.NET Rounded Corners with jQuery

Posted: 25 Feb 2011 10:49 AM PST

Remember the AJAX Control Toolkit ? I created a LOT of content on how to use it. While the Ajax Control Toolkit (ACT) is still around, new development on it (by Microsoft) has stopped as we have adopted a more jQuery centric strategy for client UI development. Not only does this make sense, but I'm [...] Read More......(read more)

Wanna deploy WordPress on Microsoft Azure ?

Posted: 25 Feb 2011 08:19 AM PST

Read these. http://blogs.msdn.com/b/jimoneil/archive/2010/09/19/windows-azure-companion-php-and-wordpress-in-azure.aspx http://blogs.msdn.com/b/windows-azure-support/archive/2010/08/13/microsoft-cloud-computing-windows-azure-host-wordpress-on-windows-azure-host-wordpress-on-windows-azure.aspx http://blogs.msdn.com/b/windows-azure-support/archive/2010/08/10/microsoft-cloud-computing-windows-azure-host-wordpress-on-windows-azure-using-sql-azure-and-windows-azure-storage-run-php-application-in-windows-azure.aspx Read More......(read more)

Weekly Links– 2010_08

Posted: 25 Feb 2011 07:15 AM PST

Software Developer Links of the Week. Rick Strahl – A jQuery Plug-in to monitor Html Element CSS Changes OdeToCOce – Revisiting Charts: HTML5 Attributes AllNewsManager Project (Cool & Free) Access Control Service Samples and Documentation (Labs) Scott Mitchell – Focusing and Selecting the Text in ASP.NET TextBox Controls Instructional Design for eLearning Why choose OpenRasta [...] Read More......(read more)

ASP.NET MVC App Building Videos (61)

Posted: 25 Feb 2011 05:47 AM PST

Building the ASP.NET MVC Music Store Part 1: Intro, Tools, and Project Structure Part 2: Controllers Part 3: Views and ViewModels ASP.NET MVC 2 Displaying a Table of Database Data Creating Model Classes with LINQ to SQL Creating Unit Tests for ASP.NET MVC Applications Preventing JavaScript Injection Attacks An Introduction to URL Routing Understanding Views, [...] Read More......(read more)

How To Find Out Which NuGet Packages Depend on Yours

Posted: 23 Feb 2011 11:31 PM PST

Renaming a package ID is a potentially destructive action and one we don't recommend doing. Why? Well if any other packages depend on your package, you've effectively broken them if you change your package ID. For example, today I wanted to rename a poorly named package, MicrosoftWebMvc , to Mvc2Futures . What I ended up doing is recreating the same package with the new ID and uploading it. That way existing packages that depend on MicrosoftWebMvc aren't broken. But now, I have two packages that have the same functionality, but different IDs. Wouldn't it be nice to eventually remove the old one? I guess I could if I knew that no other package had a dependency on it . This is where the benefit of having an OData service over the packages in the...(read more)

"Your feedback is important to us; please stay on the line..." [Improving Windows Phone 7 application performance is even easier with these LowProfileImageLoader and DeferredLoadListBox updates]

Posted: 03 Mar 2011 09:48 AM PST

A few months ago I began a similar post about LowProfileImageLoader/DeferredLoadListBox updates by saying : Windows Phone 7 applications run on hardware that's considerably less powerful than what drives typical desktop and laptop machines. Therefore...( read more )...(read more)

Silverlight TV 64: Dive into 64bit Support, App Model and Security

Posted: 03 Mar 2011 09:46 AM PST

Silverlight TV 64: In this week's episode of SLTV, Nick Kramer of the Silverlight team joins John on Silverlight TV to discuss the application model, 64bit support, and security features with Silverlight. Nick dives into some of his favorite features...( read more )...(read more)

eTrader Pro

Posted: 03 Mar 2011 03:25 AM PST

An easy-to-use, lightweight and customisable e-commerce solution developed in ASP.NET and SQL Server. Build an online shop in no time. Skin using ASP.NET themes. Localised for English and Spanish with integral CMS, order management and e-marketing tools.

No comments:

Post a Comment