ReSharper Nightly Builds Back in Action?

I just happened to check the ReSharper nightly builds today and to my surprise there was build 900 sitting there. I checked the associated bug fixes and there were too many - at least 4 pages worth - for me to go through them all. The build date shows today. I am going to go for it and install it.

Dynamic Compilation

It is ridiculously simple to compile code dynamically using the .NET Framework. Most of the code is merely setting up the parameters you need to pass to the compiler. Once that is done, basically, you have a 2-liner on your hands. We are using the technique to provide formulas to a bidding system that we are working on. Essentially, the code looks like this:

using System;
using System.CodeDom.Compiler;
using System.Reflection;
using Microsoft.CSharp;

namespace AppUtils
{
    
    public class Compiler
    {

        private static readonly CompilerParameters parameters;

        static Compiler()
        {
            parameters = CreateCompilerParameters();
        }

        public static CompilerResults Compile(string code)
        {
            var provider = new CSharpCodeProvider();
            return provider.CompileAssemblyFromSource(parameters, code);
        }

        private static CompilerParameters CreateCompilerParameters()
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            var options = new CompilerParameters
            {
                GenerateInMemory = true,
                GenerateExecutable = false,
                IncludeDebugInformation = true
            };

            foreach (var loadedAssemblies in assemblies)
            {
                options.ReferencedAssemblies.Add(loadedAssemblies.Location);

                foreach (var reference in loadedAssemblies.GetReferencedAssemblies())
                {
                    var referencedAssembly = Assembly.Load(reference);
                    options.ReferencedAssemblies.Add(referencedAssembly.Location);
                }
            }

            return options;
        }
    }

}

Our "formulas" are just code with a friendly name (e.g. "Turnkey Days + 1"). The extensibility points in our system are maintained by developers, so this is not a problem. However, in situations where I would want to provide the user the ability to enter formulas, I still think it would be easy to write some kind of pre-processor that could expand simple formulas into C# which could then be forwarded to the compiler at runtime.

More Visual Studio Zen

As I have said already, I am pairing down Visual Studio to the bare bones. I have decided that when is comes to the IDE, less really is more, at least when it comes to "stuff that is visible when I am writing code". Currently, I run with no toolbars of any kind.

I had been docking non-code windows (Solution Explorer, Properties, Team Explorer, etc.) unpinned to the right side of the screen. However, I noticed that I would accidentally un-auto-hide (hmmm) these docked windows randomly throughout the day. This is annoying.

Now, I keep these windows undocked (floating) and off. If I need Solution Explorer, I just use CTRL+ALT+L. Or if I need Properties, I hit F4. Then, when I am done, I close the windows. Stare into the void:

emptyvs

The only bad thing here is that I am crippled with the VB language, which is out of my control. And I only mention that because I like to take a jab at VB whenever I can.

Visual Studio Fast Load Optimization

I hate stuff that keeps me from doing my work. One such is the Visual Studio Start Page. If I want to look at recent projects, I can select File/Recent Projects from the menu. If I want a bunch of links that update and give me news, I can open my favorite RSS reader. I don't need a screen (that takes a significant amount of time to load) that shows me this information when I launch Visual Studio. When I am using this program, really, I just want to write some code, you know?

Do yourself a favor. Go to Tools/Options and turn off the Start Page. Visual Studio will load about 10x faster.

vs-startup

It's Official!

I just got back from Austin and it's official: I'm a ScrumMaster. I know the secret handshake and everything. All I can say is "finally". My instructor,  Robin Dymond is speaking at Agile Austin tonight, and let me tell you, he knows his stuff. I wish I could have stayed to hear his talk, but I had a long drive home. Before I go, I need to thank my company, Sogeti, for making it possible for me to attend the training. With a wife and three kids, it would have been a long time coming without their support.