TypeScript IntelliSense

We are going to use TypeScript in our product, so imagine my disappointment when I realized that IntelliSense is not working for TypeScript files in Visual Studio 2012, despite it should.

I have tried everything I could – played with VS settings, uninstalled and reinstalled TypeScript, ReSharper, whole Visual Studio… Nothing. Finally, I had to reset my Windows and start from scratch. After two full days completely wasted trying to get IntelliSense working, I finally got to the magic point of having fresh Windows, Visual Studio, and TypeScript. Started it all up, and bang – no IntelliSense again! After pulling some hair out, and crying quietly in the corner, I started second round of uninstalling and installing TypeScript, including older version 0.8.2, Web Essentials, resetting VS settings, etc. Same result. Finally I checked my Visual Studio plugins, and, to my surprise, spotted MySQL Tools for Visual Studio extension, despite I did not want to install it in the first place when MySQL was installed earlier. Removed this plugin, and voila, TypeScript IntelliSense at its best!

What is strange, I have tried to install MySQL server and its Connector/.NET at home (although a newer version 5.6.10.1 package), and surely got the unwelcome MySQL Tools for Visual Studio extension with them. But! The TypeScript IntelliSense works nevertheless, despite a completely different picture was observed at work twice. Go figure.

So, if TypeScript’s IntelliSense is not working, I would recommend to remove all extensions, starting from those more exotic (e.g. MySQL, and those less used by wide population) – it might actually repair the thing.

Visual Studio Behind Proxy: Expectation Failed

We have a transparent proxy at work, and it was causing troubles in Visual Studio 2012 when going to the Extensions and Updates. Contrary to your expectations, “The remote server returned an unexpected response: (417) Expectation failed” message was appearing. The fix is pretty easy, and involves editing devenv.exe.config file in the Visual Studio 2012 folder (normally C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\). Somewhere towards the end of that file there is a

<system.net>
    <settings>
        <ipv6 enabled="true"/>
    </settings>
</system.net>

fragment, which has to be fixed to read

<system.net>
    <settings>
        <ipv6 enabled="true"/>
        <servicePointManager expect100Continue="false"/>
    </settings>
</system.net>

That’s it.

Rant About Software Industry Crap

I wonder, why so many companies that have substantial part of their revenue generated directly or indirectly by the in-house developed software, treat their software developers and processes like a totally unimportant shit that is financed last, mostly from left-overs of the budget pie? Examples? As many as you like:

  • Want to buy some books? Oh no, we have already purchased two books in 2006!
  • Pluralsight trainings? Waaaaaay out of budget! You have Internet, don’t you?
  • Latest Visual Studio? We just got VS2008 6 years ago – it is almost new!
  • Resharper? We have heard that Notepad++ and vim are quite cool – use them!

Interestingly, these same people in charge happily use PowerPoint, instead of Paint, create budgets and sales funnels in Excel, instead of Notepad, and write documents in Word, not WordPad. Outlook with Exchange is also a standard “feature”, despite corporate Gmail would be more than sufficient. Service personnel in these same companies is using DeWALT or Metabo accumulator drills costing $150-$300 each, instead of those from local Cheap-o-Store, costing $30 for two.

No-one would repair his car in a garage outfitted with an in-house made car lift; no-one would let a dentist with a 1970s tooth-drill to do anything in his mouth; nor would anyone buy a 10 years old TV as a first choice. No matter how cheap all these would be!

So, why this difference? Is it because salaries are a “fixed cost”, and all other expenses are not? That developers’ productivity is only a small fraction of what is would be with modern tools and up to date training seems to be completely ignored; likely, this argument would be called “speculation” or “matter of opinion”. Or is it because developers cannot voice out and defend their needs/demands? Service guys, for a comparison, are nicely covered by their union agreements with all those “job safety” rules (plus, companies would not like to see office walls or doors destroyed by crappy tools).

I have no answer. But it is really sad to see this picture again and again, year after year. And if I could explain it in 1995 by lack of information and research data, why is it still like this in 2013? Any ideas?

LocalDB and NHibernate

We’ve got a request to support SQL Server 2012 in our product at work. Well, the LocalDB (coming with Visual Studio 2012; a rough equivalent of SQL Server Express of the past) is practically SQL Server 2012 I thought, so it was reasonable to do initial testing on it. We use NHibernate 3 in our system, so I went to the .nhibernate.config file, and changed the connection.connection_string property (the Data Source part of it, to be precise) from

Data Source=localhost\SQLEXPRESS

to the logically sounding

Data Source=(localdb)\Projects

and… It did not work. A bit of googling pointed me to a solution: named pipe connection. To get its name, run

sqllocaldb info <InstanceName>

in the command line, which in my case translated into sqllocaldb info Projects. The output will contain the Instance pipe name line, and the value of it is the data source name you are after. So, in my case the correct Data Source read

Data Source=np:\\.\pipe\LOCALDB#5E0F8FF8\tsql\query

(as far as I understand, usually only the number after LOCALDB# will change).

Windows Phone 8 SDK + VirtualBox = Problem

Just installed the Windows Phone 8 SDK and got disappointed when running the sample app on the phone emulator failed with the following cryptic message:

The Windows Phone Emulator wasn’t able to create the virtual machine. Something happened while creating a switch: Xde couldn’t find an IPv4 address for the host machine.

Some people suggested that the problem might be related to the VirtualBox being installed on the machine (I had it). Uninstalling VirtualBox helped, although it is a bit annoying, as I need VirtualBox to access my work VPN.

Toolbox Scrollbar Disappeared in Visual Studio

My colleague just hit into a problem with his Visual Studio 2012 – the Toolbox (the one keeping UI controls) lost its scrollbar. The scrollbar was appearing if he was filtering controls by name, and disappearing again when filtering was off. After searching a bit on the net I found that people were seeing the same problem in Visual Studio 2010 as well. The workaround Barney Nicholls, that post’s author, proposes for Visual Studio 2010 involves deleting toolbox*.* files from the Visual Studio settings’ folder:

  1. Close Visual Studio.
  2. Delete toolbox settings using the commands below.
  3. Start Visual Studio.

The commands (script) to delete the toolbox settings (those files are normally hidden, thus we need to remove the hidden file attribute before):

attrib -h %userprofile%\appdata\local\microsoft\visualstudio\10.0\toolbox*.*
del %userprofile%\appdata\local\microsoft\visualstudio\10.0\toolbox*.*

Needless to say, that this worked for Visual Studio 2012 as well – just substitute 10.0 with 11.0 in the commands above. And, of course, you can perform these operations in Explorer, FAR, or any other file manager as well.

PS Just occurred to me, that there is one more problem, similar in its nature, but with different symptoms – IntelliSense stops working after some actions, e.g. renaming some function. Usually, deleting the hidden .suo file with the same name as the solution .sol file and located in the same folder as the solution file resolves the problem. Of course, Visual Studio must be closed when performing this operation.

TypeScript = Application Scale JavaScript

A few days ago Microsoft announced a new programming language, TypeScript. Effectively, it is a typed super-set of JavaScript that compiles to “normal” JavaScript. Being super-set also implies that JavaScript programs are also TypeScript programs, so one can reuse all the existing code-base and external libraries, while still benefiting higher productivity, new language features, and new tools (e.g. there is a VS2012 plugin with full IntelliSense).

The thing looks quite interesting, solid, and extra credibility is added by the fact that Anders Hejlsberg himself made almost an hour long Introducing TypeScript video about the subject. Of course, it is not guarantying that the project will survive in the long-term, but then, on the other hand, the risk of using TypeScript in own projects is minimal, even non-existing, as you always end up with normal JavaScript, so you can migrate back to JavaScript-only development any time you wish.

Scott Hanselman also expresses his view about TypeScript in Why does TypeScript have to be the answer to anything?. The article has some explanations, and references some extra tools, e.g. Web Essentials 2012 VS2012 plugin that, among many other cool things, improves TypeScript support in the VS2012.

Windows Phone 8: What’s Wrong, Microsoft?

On September 5, Nokia announced new Windows Phone 8 Lumias. While those phones are not revolutionary on the surface (no pun intended :), but rather evolutionary, the story is completely different on the software side: Windows Phone 8 has not much resemblance to its predecessor Windows Phone 7.5. Specifically, I refer to WinRT, and completely new ways of developing software for it.

Today I decided to get Windows Phone 8 SDK to start developing a new app I have an idea for, so that it would be ready for the WP8 launch, or at least soon after it. Imagine my surprise when I learned that there is no preview version of WP8 SDK available. And, even worse, Microsoft is not even planning to release it to the general public before WP8 launch in the end of October – only “more published developers” will be able to get it later this month in addition to those “select partners and developers” that have already seen early builds of the new SDK before.

Now this is seriously puzzling me. Microsoft, which has troubles getting market share with Windows Phone, is not giving interested developers the new SDK before WP8 release? What the heck!? I guess they hope that their “select partners” and “more published developers” will develop some cool apps for the launch date. Which is fine. But they do forget, that by giving these guys this kind of advantage they are stealing a chance from other developers. And these developers (me included) will be pissed, and rightfully so. How can we be loyal to Microsoft, if Microsoft is dividing developers into two classes: first class people who get the SDK, and “everyone else”?

In the last few years I started to believe that Microsoft has genuinely changed its approach to developers by offering early previews of their new technologies, and even listening to the developers’ feedback. Now I see that not much has changed in reality – different divisions of Microsoft act in completely different ways (e.g. Visual Studio 2012 vs Windows Phone 8 SDK), and, for some of them, political agendas are more important than real issues in the market. Sad.

PS I am not the only one with this opinion…

PerfView: Performance Analysis

Microsoft rather quietly has released PerfView“a performance analysis tool focusing on ETW information (ETL files) as well as CLR memory information (heap dumps). It can collect and view ETL files as well as XPERF CSV files. Powerful grouping operators allow you to understand performance profiles in ways other tools can’t. PerfView is used internally at Microsoft by a number of teams and is the primary performance investigation tool on the .NET Runtime team.” Found it by accident, while reading an article about performance improvements in Visual Studio 2010 that mentioned Publication of the PerfView performance analysis tool!

It is in a functionality way related to the CLR Profiler that “allows developers to see the allocation profile of their managed applications.” Both tools are useful in optimizing memory usage, except that PerfView is supporting also native and mixed applications.

JetBrains dotPeek

redgate‘s decision to start charging for their Reflector .NET decompiler sent ripples through the .NET development community. Personally, while I do not think that the 25-69 EUR price is outrageous, I must agree with many people – redgate promised to keep Reflector free after the acquisition.

But, whatever happens, happens for the best. New decompilers started appearing like mushrooms after the rain, and JetBrains, the famous maker of e.g. ReSharper and TeamCity, came with its own free dotPeek decompiler, which is in the EAP or Early Access Program stage now. Knowing and using JetBrains’ products, I believe that dotPeek has all chances to become the de-facto standard for a .NET decompiler eventually, so I will keep an eye on it.

Task Parallel Library / TPL

It has been very long since my last post here – I was really busy at work. But I will try to “fix it”! :)

I don’t know where Sacha Barber finds time for all his articles and “hobby” projects, but I am glad he does! One of the latest subjects of his investigations is Task Parallel Library (or TPL in short), one of the new parts of .NET 4:

  1. Part 1: Starting Tasks / Trigger Operations / Exception Handling / Cancelling / UI Synchronization
  2. Part 2: Continuations / Cancelling Chained Tasks
  3. Part 3: Parallel For / Custom Partioner / Aggregate Operations
  4. Part 4: Parallel LINQ
  5. Part 5: Pipelines
  6. Part 6: Advanced Scenarios / v.Next for Tasks

Managed/Native Debugging in C#/C++

I had a problem debugging my solution consisting of C#, C++/CLI, and native C++ projects. I was not able to get breakpoints working in the native C++ parts – after running the solution with breakpoints set, they were turning gray with warning sign, and their tooltip stated that “The breakpoint will not currently be hit. No symbols have been loaded for this document.” despite all debug properties were set right on those projects and all debugging symbols existed. After fighting it for a few hours and almost giving up, I started to think that the problem might not be with the native C++ projects, but rather somewhere else, e.g. in the StartUp project, which is C#. Checked that project’s properties, and guess what! Debug > Enable unmanged code debugging option was off!!! Switched it on, and voila – breakpoints work fine in native C++ DLL now!!! :)

What is Wrong with Agile?

Agile Ruined My Life shows an interesting perspective on the subject, and I really share author’s view on many of the points enumerated – there are too many things in today’s “agile” that make it really a joke. Despite this, I still believe there is a “right agile”, but it really has nothing to do with dumb religious following of “holy agile scriptures”; instead, agile must be pragmatic and flexible, or otherwise it turns into a cargo cult with all the negative consequences.

Criminal Overengineering

Just a few days ago we talked within a team about this subject, and now I bumped into Criminal Overengineering article that says it all (well, almost all) about the subject of over-engineered design/code. IMHO, this is a must reading for all beginners (and not only, to be honest), and it will be definitely on a list of “things to read” for all new members of our team.

Debugging MSBuild Scripts (VS2010)

I did not actively search for the subject, but once I bumped into a three-part article about the MSBuild script debugging (Part I, Part II, Part III) on The Visual Studio Blog I immediately though that it is worth remembering about it when (I am not saying if, but rather when here) I need it in the future. The blog itself is also worth checking, as there is much information about VS IDE, MSBuild, and extensibility from the Visual Studio development team.

Help in the Visual Studio 2010

Mmmmm… I don’t know what kind of daemon possessed Microsoft usability engineers when they were designing Visual Studio 2010 help system, but something definitely went very-very-very wrong. :( What’s wrong, you might ask?

  • It opens in a web browser, which kind of sucks as it breaks my normal work-flow (I have to track help tabs in browser, and then close them, and if I open some new tabs, then help is not in place I expect it, etc. etc. etc.)
  • It’s content tree (the thing on the left side) is not really a tree anymore – it just shows top-level hierarchy and then also “path” to current topic. No more, no less. And if you need to go to some other topic, you will immediately lose track of previous topic. So, if you want to “browse around” the documentation – tough luck. What’s even more ugly is that the online help can be at least configured to show full content tree, but offline help won’t allow you any customizations.
  • There is no index. Full stop. Yes, yes – N-O—I-N-D-E-X. They say that there is search, but try to find some API related to paths and that you vaguely remember exists and has name PathBlaBlaBla (where BlaBlaBla is some meaningful name) and you will see that the search is as useless as it can only get.

Conclusion: new help system is VS2010 is light years behind that of VS2008 or VS2005.

Can something be done about it? There are at least two partial solutions:

  1. Microsoft Help Viewer Power Tool – simply adds keyword index capability to the Help Viewer, with an option to display help in a standalone window.
  2. Help 3 Viewer goes much further: it shows VS 2010 help in a traditional help viewer (similar to “old” DExplore) with full TOC and Index, and features multiple document tabs. There are other features too, and it can be set as default VS2010 help viewer.

I hope that these tools will help you with your help experience :) .

How to Enable Using the Binding Builder in WPF and Silverlight Applications

In VS2010, when the Data Sources Window is used to generate the UI, the generated XAML injects design-time information so that the Binding Builder can be used to create bindings for the UI controls. But if your application was written in Visual Studio 2005 or 2008, or you used the XAML Editor, the Designer or Expression Blend without the Data Sources Window, your coding style is to assign the DataContext in code and not data bind to CollectionViewSources in your XAML, then you won’t be able to take advantage of the new Binding Builder. How to Enable Using the Binding Builder in WPF and Silverlight Applications by Karl Shifflett to the rescue – it demonstrates the simple requirements to enable you to use the new Binding Builder in a variety of scenarios like the ones mentioned above.