1/ In the VS 2005 release there were many new features for the C# IDE experience, several of which would generate code. An example was implement interface, which was proffered as either a 'smart tag' or through the context menu.
2/ Another was generate method stub, where we would optionally create a method if you consumed it without having declared it first. When we released VS 2005, these features would generate stubs of the following form (this is the code gen for implementing IComparable<Widget>):
3/ public int CompareTo(Widget other)
{
throw new Exception("The method or operation is not implemented.");
}
The C# community was, not surprisingly, somewhat confused (and often livid) that the code generation didn't use NotImplementedException instead.
4/ I received a good amount of angry mail explaining how dumb this was. It's hard to argue, and in fact, we had generated NotImplementedException for every Community Tech Preview (CTP) release of VS 2005. So what changed?
5/ In late 2004, the Visual Studio for Devices team was updating the VS support to build .NET apps for devices that ran on the compact framework. The first release of this tooling was in VS 2003; however, in VS 2005 we changed implement interface in significant ways that I'll
6/ talk about at some later point. For this discussion though, the notable change was that in VS 2003 we returned a 'default value' instead of throwing an exception. The new generation broke the code for Smartphones. Why? Well, because of the lag time of getting framework
7/ versions on hardware, Smartphones were running CF 1.0. CF 1.0 didn't have NotImplementedException.
We didn't have time to implement smarter code generation that would selectively generate different results when targeting CF versus the desktop framework at that point,
8/ so we did the simplest thing possible. We rationalized this as follows: 1) the generated code was almost always going to be replaced anyway, so surely having it generate temporary code that wasn't ideal was okay, 2) even though there were fewer Smartphone than framework
9/ developers, we wanted to maintain that the code generation we did would work regardless of target, and 3) the code generation was based on a stub that could be changed by the user if they found it particularly offensive.
10/ It seemed relatively benign, but I got a surprising amount of hate mail about this one :-)
I'll talk about customizing this generated code some other time, but in case folks are interested, it's still possible in much the same way as it was then.
11/ The furor around this eventually calmed down as we were able to change the code generation in future releases as newer versions of CF were adopted.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
1/ If you have ever worked with Windows Forms, you may have noticed that the icon that appears in solution explorer changes when it contains a 'designable' type, and that when you double-click on any file with that icon, it opens the designer.
2/ If you play around with this a bit, you may also notice that if you change a class to descend from System.Windows.Forms.Form, it will become designable, and the designer lights up. I doubt many people have thought about how that works.
3/ However, given the behavior, we can tell that somehow the project system must be able to detect when a class becomes designable… and how does it even know what it means to be designable anyway?
1/ In the late 90s we were busy on the ambitious project of Visual Studio .NET, introducing a new runtime, new languages, and a new shell. The last involved combining several existing shells, VJ/VI/MSE 6, VC6, and VB6.
2/ This led to many difficult discussions, incredibly complicated and confounding technical challenges, and the most difficult problem - what side of the environment should the Solution Explorer dock to by default?
3/ In VC6, file view was on the left. In VJ/VI/MSE and VB6 the project explorer was on the right. You'd think that since you could move it, and that was persisted, it wouldn't matter that much.
1/ @DesignPuddle asked why Solution Explorer search is so much slower than Goto All when searching for files. This is seemingly nonsensical because Goto All is presumably searching for everything while solution explorer search is searching less, right? Well… it is nonsensical,
2/ the search should be much faster, and the reason it’s slow has a lot to do with how it was initially designed versus what it’s now being used for. So, lets dig in a bit.
Both Goto All and Search in Solution Explorer are extensible via providers. However, the providers are
3/ different, and that’s critical to understand the difference. Search in Solution Explorer was added in VS 2012 as I recall. It works by kicking off an asynchronous task that invokes each provider. It currently does this sequentially instead of in parallel. There are really two
1/ It's been very busy at MS ever since the new year started, and you've probably seen a bit of what we're working on with Visual Studio 2022 (devblogs.microsoft.com/visualstudio/v…).
2/ I'm going to go further back in history though, and talk about a defining moment for Visual Studio .NET (2002) and really all of Microsoft. In early 2002, Bill Gates sent a memo to the entire company that kicked off the Trustworthy Computing initiative.
3/ There had recently been a raft of serious computer viruses, coupled with the September 11th terrorist attacks; it was a turning point for the country, industry, and company.
One of the stories that my first manager used to tell, that I always got a kick out of was the following. Context: Think Week was a week that Bill Gates used to take every year to learn about a huge variety of topics, and folks at MS would submit papers/bits. It was a big deal.
"I joined Microsoft on 3/19/99 and found out I was working on a new language. The first week was a blur just getting up to speed and I don't think I even installed the complier (not that it did much then - I think you could define an interface but not use it yet).
In my second week (3/27/99) I get an email from Drew saying that Bill [Gates] wants the C# Language spec and the latest build of the compiler by 4.30 (Note that it was 4.30 not 4/30). I'm still getting used to US dates so I see 4.30 and think it's 4:30pm that day.
Incremental rebuild was a feature of the C# compiler which was meant to increase the throughput after an initial build. It worked on the principle that changes in between builds are localized, and that the information gathered by the compiler from previous builds wouldn't be
entirely invalidated; specifically, some of the information and, indeed, the assembly itself could be updated in an incremental fashion resulting in faster builds.
Both the VS 2002 and VS 2003 compilers exposed this option through the /incr switch on the command line, and the ‘Incremental Rebuild’ option in the Advanced tab of Project Properties. In 2002 incremental rebuild was enabled by default for all project types.