byteflux

Nov 092012
 

This is the first post from several in which I am going to detail some of my experiences with the new WinRT platform for Windows 8 (ex. Metro) applications. Disclaimer: this series of posts reflect my personal experiences and needs, so it might be different for other developers or users out there.

The UI

First of all the operating system. I am sure that everyone has seen (or at least heard) about the new OS from Microsoft and what it can do. First of all, as you know there are two flavors of user experience – the old “Desktop”-like experience and the new tablet/touch-friendly WinRT experience.

Starting with the first day of using Windows 8, I can honestly say that I have mixed feelings about the UI. While I like the concept behind the WinRT style (and had the opportunity of playing with it on a tablet), for a professional user like me, the constant switching from desktop to WinRT mode and back is sometimes annoying. I find it especially annoying that I have to click more than in the past to achieve the same results.

Nevertheless, I like the integrated approach that the OS has taken – search from one single place, share from one single place etc. The downside of this, especially for non-touch systems is that a lot of the options are hidden and you need to dig around to find them. For me it’s not a problem, but for less experienced users it becomes frustrating very quickly.

Anyway, I won’t go into more details about this, since you can find an entire encyclopedia of reviews and opinions on the internet regarding this. In the end I guess everything comes down to experience, taste and automations that we as users have developed over time.

Compatibility and breaking changes

This is another big part of switching to a new OS. While for the typical home user which 99% of the time does some browsing, emailing, Facebook, games this might not be of such importance, for a professional developer that wants to use this OS, it’s a very important thing.

So far I could get most of my applications to run on Windows 8 without too much hassle. Low level utilities such as hard drive optimizers etc. can sometimes cause issues, but so far I could live without them. Applications that have issues can be fixed most of the time by explicitly setting the compatibility level.

On the development side, I have quickly encountered some issues. Some are minor, some are annoying and some are causing real problems.

The User Access Control system

This is the first thing you encounter and the most annoying one. In the past versions of Windows, this was the first thing I was disabling (after removing the obnoxious windows sounds). The reasons why I am disabling this are simple:

  • I am able to manage security and applications by myself
  • I need to work most of the time in applications which require elevated permissions (aka. Visual Studio). Having UAC on is always breaking my workflow.

In Windows 8 even if you set the UAC feedback to the lowest value, it does not get completely disabled. This means that you still need to explicitly run applications with elevated permissions. This has several side effects:

  • Trying to start non-elevated processes from within an elevated process does not work out of the box. A typical example is trying to open the web help from within an elevated Visual Studio. If you are an application developer and need to go around this scenario, I have posted already a solution for handling this in code: http://byteflux.me/opening-an-url-in-the-default-browser-on-windows-8/
  • If you start applications directly from the WinRT desktop, you need always to right click them and run them as Administrator… This would be ok, if this would be remembered somehow.
  • If you pin your application to the taskbar, then there are two behaviors. If you configure your shortcut to always run as administrator, it works fine when clicking it directly. When you try to open up something using the jump lists (for example a recent Visual Studio solution), then the application will run without elevated permissions. This is always very annoying because you can either do it without thinking and then bang your head against the wall until figuring why things don’t work, or, otherwise, you have to always do things in two steps – open up the application, load the project/file/whatever.

Task manager

This is one of the best improvements in the new Windows. The new task manager is much cleaner, easier to use and works better. Thumbs up for this.

Security

Windows 8 feels more secure. I have encountered some security issues related to DCOM/COM+ but nothing that cannot be solved. In the end if security rules get tighter it can be a better thing, since you have to be more aware of the exposed attack surface. The security changes have caused minimal interference so far, so I don’t have too much to say about them.

Other things

Of course covering all the changes in the new OS would lead to an entire book, so I won’t do that. Overall I can say that most things are better. Windows Explorer has better and cleaner UI and most of the things that come out of the box work at least as good as in Windows 7.

Stability is very good – I did not have any bad experiences with it. Startup performance is amazingly quick. One thing that is annoying is how hidden the power options are. I understand that it gets targeted more and more towards mobile devices where you put the system to sleep and start it quickly but for desktop systems, it’s too hidden.

Conclusion

Overall I think it’s a good direction, I would just liked more attention to desktop/professional users. At the moment the feeling is that you always have to switch between worlds.

In the next posts I will dive deeper into development tasks related to the new platform, the problems and solutions I have encountered so far.

Oct 162012
 

UPDATE: due to many requests, I have compiled the code below into a project that you can download from here: Validation.zip

To my big surprise the Microsoft team behind the WinRT XAML framework has decided not to include the built-in support for validation that exists in the WPF and Silverlight frameworks. Anyway, for anyone that needs an alternative, I have created a set of helper classes to make things easier.

 Implementing INotifyDataErrorInfo validation in Windows 8 WinRT XAML applications

Continue reading »

Sep 222012
 

With the changes to the UAC system in Windows 8, it seems that whenever you try to launch an non-elevated application from an elevated application, you get an error similar to: “Class not registered (Exception from HRESULT: 0×80040154 (REGDB_E_CLASSNOTREG)”.

The reason is that under Windows 8, even if you set UAC to the lowest setting, you don’t disable it completely.

In my case, I was trying to start an URL using the default browser from an elevated application. After a lot of digging around on stackoverflow.com and other blogs and websites, I’ve managed to build a solution that seems to be working.

Continue reading »

Jun 082012
 

We would probably have these horror masterpieces:

  • “Dead code don’t talk”
  • “Threaddy vs JSON”
  • “The Garbage Collector”
  • “Internals”
  • “The silence of the lambdas”
  • “I know what you did last method”
  • “I still know what you did last method”

or these adult movies:

  • “Show me your privates”
  • “Inside her sexy braces”
  • “Deep nesting”
  • “Show me your var Gina”
  • “Class action”
  • “Finalizers”

or Sci-Fi stuff like:

  • “Matrix trilogy” : “The Rotation Matrix”, “The Translation Matix”, “The Scaling Matrix”

or action movies like:

  • “Frozen”
  • “Try hard”
  • “Catch”

The best thing is that all of these are girl movies. They all cry at the end when this hero is Disposed.

Hopefully this makes you end the long workday with a smile. Happy weekend!

Apr 092012
 

In Visual Studio 2010, depending on the project type you get different options when you want to add new items to a project. If you have created a class library and later you figure out that you want to add WPF custom controls, you will need to change the project so that it supports this functionality.

Continue reading »

Oct 052011
 

In one of my recent projects I have reached the need to validate that I have all dependencies correctly registered in my UnityContainer. For those that are not familiar with Unity, it is a dependency injection container that allows constructor, property and method call dependency injection.

You can get more information about how Unity works and also download the latest release from Codeplex: http://unity.codeplex.com/

 Validating UnityContainer configuration

 

Continue reading »

Aug 242011
 

There are situations in which you need to do some processing when an event fires but you don’t want to do it every time if the event happens in a very short time interval. Such a situation can occur for example when handling MouseMove events – you want to do the processing when the mouse stops for a certain amount of time, but not for every intermediate position of the mouse.

 Reusable deferred action execution mechanism

Continue reading »

Aug 022011
 

Snoop A must have for any WPF developer As a WPF developer, I often find myself trying to debug the visual structure of my applications or to find out why something doesn’t work as expected. The Visual Studio debugger can help up to a certain point, but for runtime visual debugging it lacks the necessary features. Luckily, there is an awesome free tool that you can use for this – Snoop. The tool itself is very straightforward – you select your running application press a button and you can see the whole visual tree:

Continue reading »

Jul 282011
 

I find that with the extension support in VS2010, programmers don’t really have an excuse for not using tools to increase their productivity and to increase the overall quality of their work. I am a really lazy programmer, in the sense that I don’t’ like to do repetitive boring tasks. Extensions are one of the solutions to being a happy lazy programmer. The other one is writing quality code, but that’s another story. So here is a list of all Extensions that I use in day-to-day work

 My list of Visual Studio 2010 Extensions
Continue reading »

May 182011
 

When doing TDD or at least unit testing, it is necessary to know how much of your code is covered by tests and, more importantly, which code isn’t. Since we migrated to NUnit the integrated Visual Studio 2010 code coverage does not do the job anymore for us (although I’ve found several articles on how to enable it, for some reason I couldn’t get it running).

There are two tools that you can use instead – one of them is NCover, which is a great tool but not free. The other one is PartCover, which is a free code coverage tool. I’ve opted to go with the latter. The main problem with PartCover is the almost non-existent documentation. After several hours of trying out different combinations of options I finally got it running and it does it job really good.

Continue reading »