Jeff and .NET

The .NET musings of Jeff Putz



My Sites


August 2012 - Posts

.NET development on a Retina MacBook Pro with Windows 8

I remember sitting in Building 5 at Microsoft with some of my coworkers, when one of them came in with a shiny new 11” MacBook Air. It was nearly two years ago, and we found it pretty odd that the OEM’s building Windows machines sucked at industrial design in a way that defied logic. While Dell and HP were in a race to the bottom building commodity crap, Apple was staying out of the low-end market completely, and focusing on better design. In the process, they managed to build machines people actually wanted, and maintain an insanely high margin in the process.

I stopped buying the commodity crap and custom builds in 2006, when Apple went Intel. As a .NET guy, I was still in it for Microsoft’s stack of development tools, which I found awesome, but had back to back crappy laptops from HP and Dell. After that original 15” MacBook Pro, I also had a Mac Pro tower (that I sold after three years for $1,500!), a 27” iMac, and my favorite, a 17” MacBook Pro (the unibody style) with an SSD added from OWC.

The 17” was a little much to carry around because it was heavy, but it sure was nice getting as much as eight hours of battery life, and the screen was amazing. When the rumors started about a 15” model with a “retina” screen inspired by the Air, I made up my mind I wanted one, and ordered it the day it came out. I sold my 17”, after three years, for $750 to a friend who is really enjoying it.

I got the base model with the upgrade to 16 gigs of RAM. It feels solid for being so thin, and if you’ve used the third generation iPad or the newer iPhone, you’ll be just as thrilled with the screen resolution. I’m typically getting just over six hours of battery life while running a VM, but Parallels 8 allegedly makes some power improvements, so we’ll see what happens. (It was just released today.)

The nice thing about VM’s are that you can run more than one at a time. Primarily I run the Windows 8 VM with four cores (the laptop is quad-core, but has 8 logical cores due to hyperthreading or whatever Intel calls it) and 8 gigs of RAM. I also have a Windows Server 2008 R2 VM I spin up when I need to test stuff in a “real” server environment, and I give it two cores and 4 gigs of RAM.

The Windows 8 VM spins up in about 8 seconds. Visual Studio 2012 takes a few more seconds, but count part of that as the “ReSharper tax” as it does its startup magic. The real beauty, the thing I looked most forward to, is that beautifully crisp C# text. Consolas has never looked as good as it does at 10pt. as it does on this display. You know how it looks great at 80pt. when conference speakers demo stuff on a projector? Think that sharpness, only tiny. It’s just gorgeous.

Beyond that, everything is just so responsive and fast. Builds of large projects happen in seconds, hundreds of unit tests run in seconds… you just don’t spend a lot of time waiting for stuff. It’s kind of painful to go back to my 27” iMac (which would be better if I put an SSD in it before its third birthday).

Are there negatives? A few minor issues, yes. As is the case with OS X, not everything scales right. You’ll see some weirdness at times with splash screens and icons and such. Chrome’s text rendering (in Windows) is apparently not aware of how to deal with higher DPI’s, so text is fuzzy (the OS X version is super sharp, however). You’ll also have to do some fiddling with keyboard settings to use the Windows 8 keyboard shortcuts.

Overall, it’s as close to a no-compromise development experience as I’ve ever had. I’m not even going to bother with Boot Camp because the VM route already exceeds my expectations. You definitely get what you pay for. If this one also lasts three years and I can turn around and sell it, it’s worth it for something I use every day.


POP Forums v10 for ASP.NET MVC 4 posted to CodePlex

Download it here!

This is the RTW source for POP Forums v10, with the mobile special sauce. It requires ASP.NET MVC 4 RTM, which you can download here. The project and solution files require Visual Studio 2010 or 2012. If you need an MVC3 version, please enjoy v9.2.1 The database has been tested and known to work on SQL Server 2008 and later, as well as Windows Azure SQL Database. The app runs great in Windows Azure Web Sites. Of course, feel free to submit bugs to the issue tracker.

See a live demo here:

Read the documentation for installation and integration.

While the app will run fine on .NET 4.5, you'll need to replace the Ninject reference to the 4.5 build (go to to get it) and change the target framework in each project to 4.5.


You can mostly just replace the files, though /Areas/PopForums/Home has been replaced by /Areas/PopForums/ForumHome. The database is unchanged from v9.2.x. If you're upgrading from v9.0.x or v9.1.x, please see the scripts included in the SQL data project.

What's new?

  • Uses a very light weight CSS and Javascript package to provide a touch-friendly interface for mobile devices.
  • Numbers are formatted (sensitive to culture) when 1,000 or higher.
  • CSS is more integration friendly, and specific to the ForumContainer element.
  • Mail delivery from queue is now parallel, so you can specify a sending interval, and the number of messages to process on each interval.
  • Background "services" refactored, and will only run with a call on app start to PopForumsActivation.StartServices(). This is partly to facilitate future use in Web farms/multiple Web roles in Azure.
  • Update to jQuery v1.7.1.
  • Replaced use of .live() with .on() in script, pursuant to jQuery update, which deprecates .live().
  • Renamed HomeController to ForumHomeController, to make lives easier when integrating into an MVC app.
  • Dependency resolution no longer requires that you set Ninject as the container for the entire MVC app. The controllers now resolve their dependencies in their constructors, so you're free to set up any DI container in your global.asax.
  • The included single-server SQL data layer now uses the base classes and interfaces for (DbConnection, DbCommand, etc.) instead of the specific SQL flavors, for easier refactoring in case you want to build an Oracle version or something.
  • FIX: Bug in topic repository around caching keys for single-server data layer.
  • FIX: Pager links on recent topics pointed to incorrect route.
  • FIX: Deleting a post didn't update last user/post time.
  • FIX: Ditched attempt at writing to event log with super failures, since almost no one has permission in production.
  • FIX: Bug in grayed-out fields in admin mail setup.
  • FIX: Weird color profiles would break loading of images for resize.
  • FIX: TOS text on account sign-up was double encoded.

Known issues

  • A potential race condition exists that could prevent the app from starting in ASP.NET v4.5. See the issue:ServiceModule has potential race condition in ASP.NET v4.5
  • There is apparently a bug in the MVC 4 framework around the internal caching of views (not output cache, but instances of the views). You can read about it here. Because you probably get fewer requests that result in mobile views, it's possible that these expire from the cache and the framework falls back to the standard views. This will break POP Forums because the mobile views have an extra section for the pullout menu. The fix is described in the issue tracker link, and it requires adding a line to your global.asax. We're waiting to see how the MVC team handles this before committing any new code.
A debugging experience with "highly compatible" ASP.NET 4.5

I have to admit that I will pretty much upgrade software for no reason other than being on the latest version. I won't do it if it's super expensive (Adobe gets money from me about once every three or four years at best), but particularly with frameworks and stuff generally available as part of my MSDN subscription, I'll be bleeding edge. CoasterBuzz was running on the MVC 4 framework pretty much as soon as they did a "go live" license for it.

I didn't really jump in head-first with Windows 8 and Visual Studio 2012, in part because I just wasn't interested in doing the reinstalls for each new version. Turns out there weren't that many revisions anyway. But when the final versions were released a week and a half ago, I jumped in.

I saw on one of the Microsoft sites that .Net 4.5 was a "highly compatible in-place update" to the framework. Good enough for me. I was obviously running it by default in Windows 8, and installed it on my production server. I suppose it's "highly compatible," except when it isn't.

Three of my sites are running with various flavors of the MVC version of POP Forums. All of them stopped working under ASP.NET 4.5. It was not immediately obvious what the problem might be beyond an exception indicating that there were no repository classes registered with Ninject, which I use for dependency injection in the forums. This was made all the more weird by the fact that it ran fine locally in the dev Web host.

My first instinct was to spin up a Windows Server VM on my local box and put the remote debugger on it. (Side note: running multiple VM's on a Retina MacBook Pro with 16 gigs of RAM is pretty much the most awesome thing ever. I can't believe this computer is for real, and not a 50-pound tower under my desk.) What might have been going on in IIS that doesn't happen in Visual Studio?

In the debugging process, I realized that I might be looking in the wrong place. POP Forums creates a Ninject container using a method called from a PreApplicationStartMethod attribute, and at that time registers a module (what Ninject uses to map interfaces to implementations) that maps all of the core dependencies. It also creates an instance of an HttpModule that originally hosted the "services" (search indexing, mailer, etc.), but now just records errors.

That's all well and good, but the actual repository mapping, where data is actually read or persisted, happens in Application_Start() in global.asax. The idea there is that you can swap out the SqlSingleWebServer repos for something tuned for multiple servers, Oracle or something else. Of course, if I used something like StructureMap, which does convention-based mapping for dependency injection (a class implementing ISettingsRepository called SettingsRepository is automagically mapped), I wouldn't have to worry about it.

In any case, the HttpModule, being instantiated before Application_Start() gets to run, would throw because there was no repo mapped where it could get settings from the database. This makes total sense. The fix is sort of a hack, where I don't setup the innards of the HttpModule until a call to its BeginRequest is made. I say it's a hack, because its primary function, logging exceptions, won't work until the app has warmed up.

Still, this brings up an interesting question about the race condition, and what changed in 4.5 when it's running in IIS. In ASP.NET 4, it would appear that the code called via the PreApplicationStartMethod was either failing silently, and running again later, or it was getting to that code after Application_Start was called.

In any case, weird thing. The real pain point I'm experiencing now is a bug in MVC 4 that is extremely serious because it renders the mobile/alternate view functionality very much broken.

More Posts