1/ At the time that we shipped VS 2002, it was common to release several 'service packs' over the course of months or years afterwards. These service packs contained a large number of bug fixes that addressed issues that were discovered after we released. In comparison to today,
2/ the pace of releasing was glacial. I am much happier with the velocity at which we can ship updates now (though admittedly, I know some folks wish we didn't ship quite so often). Regardless, the next release after VS 2002 was originally intended to be a service pack. However,
3/ after some development, it became clear that the service pack was growing past simple bug fixes. Most notably, the release was set to align with the release of the .NET compact framework (anyone remember the codename for this? :-), and we wanted VS to have good support for
4/ smart devices. This led to the 'Everett' release being christened, which ultimately manifested publicly as VS 2003.

The C# compiler added very few features in VS 2003. Much effort was already happening in designing generics for VS 2005. However, that isn't to say there were
5/ no compiler features released in 2003. In this post, I'm going to talk about a very small feature that had an outsized experience on the debugging experience. That feature was a new pragma option, #line hidden. C# already supported a #line directive. It was heavily used for
6/ scenarios where C# was embedded into another language, like ASP. NET. #line allows specifying a mapping between the source file and another file for the purposes of both stepping and error reporting. Generally, ASP. NET would generate a #line back to the .aspx file at the
7/ proper line that contains the C# code so that if there was an error on that line the error was shown in the aspx instead of the generated source file. The problem in VS 2002 was that there was no way to prevent stepping to the generated code if you stepped over the last line
8/ of the script block. For example:
9/ In this case, after the breakpoint is hit, if you were to step twice, you'd end up with:
10/ #line default told the compiler to stop mapping the error and stepping behavior to the other file. However, there was no way to say 'don't allow stepping through the rest of the code in this file'. That's where #line hidden came in.
11/ ASP. NET would start generating this code instead:
12/ The compiler would then generate a PDB with no additional mapping which, in this example, would mean that stepping past the end of the C# block would simply have the same impact as a 'continue'. The only real complexity here was explaining that #line hidden didn't impact
13/ error reporting, while #line <line number> <filename> did. I expect very few people explicitly noticed this change, but #line hidden has been used over and over again across many code generation scenarios for the past 18 years.
14/ There was an additional scenario that we considered at the same time that #line still doesn’t completely address - anyone know what it is?

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Anson Horton

Anson Horton Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @AnsonHorton

22 Sep
1/ The second 'feature' that the compiler team invested in during the VS 2003 release was ECMA conformance. The VS 2002 compiler was close; however, there were some areas that weren't yet covered. These were almost universally small things, but one is interesting because a lot of
2/ folks are still unaware this feature exists. C# supports two forms of XML doc comments, the extremely common single-line-doc-comment, and the much less used delimited-doc-comment. The delimited-doc-comment wasn't in the specification that Microsoft proposed to ECMA and was
3/ added later through the committee process. I cannot remember the who exactly pushed for this inclusion, but they were reasonably passionate about it, and I believe their rationale was familiarity with JavaDoc comment forms.
Read 10 tweets
26 Jun
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?
Read 13 tweets
25 Jun
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.
Read 5 tweets
24 Jun
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.
Read 11 tweets
23 Jun
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
Read 26 tweets
14 Jun
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.
Read 18 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(