nik codes

Archive for the category “Glimpse”

301 Moved Permanently, Location: Microsoft

Pluralsight If you like my blog, you’ll love my Pluralsight courses:
Tracking Real World Web Performance
WebPageTest Deep Dive

A few weeks ago, I began a new gig as a Program Manager on the Cross Platform and Open Tooling team at Microsoft!

Microsoft

Needless to say, I’m very excited about this opportunity. Let me tell you why:

  1. It’s a very exciting time to join Microsoft. The entire web stack is being re-done. There’s a new browser in Edge, new cross-platform web framework in ASP.NET 5 and Azure, which is technically the “oldest hat”, is still under heavy development and revs every six weeks. As a lover of the web, I can’t think of a better company to be working for right now than Microsoft.
  2. I’m working with a cutting edge group that embodies, perhaps more than any other team, what the “new Microsoft” is all about. Case in point: After 18+ years of successfully avoiding Apple and Mac computers, I’ve been issued a Mac Book Pro as my work machine. I’m still getting used to the OSX way of doing things, but I’m very excited to see how the other side lives. Need more proof that this team is doing something different? Well, they released Visual Studio Code, a cross platform text editor, just a few weeks ago – and that’s pretty cool.
  3. I’ll be working with Anthony, the co-founder of Glimpse. We’ve worked together for nearly five years now, across three different companies. If the past is any indication, we’ll be able to do great things together at Microsoft.
  4. My family and I get to stay put in New York city. Remote work is nothing new to me, and I’m happy that I don’t have to disrupt my family’s life to take this opportunity.

I’d also like to take a moment to thank Red Gate for the past three years. Working for them has been a joy. Not only did I get to work directly with the community to bring Glimpse to new heights, but I got to see the world speaking at tons of conferences and made many great new friends. I’ll certainly be staying in touch with everyone there and I wish them the best of luck as our paths take us in separate directions.

I’ll continue to periodically post on this blog as well as tweet @nikmd23.

Advertisements

Understanding AppDomain Unloads & Old Lessons, Learned Anew

I spent the better part of two days pulling my hair out about a bug report claiming a website that opened an OleDbConnection to Microsoft Access would break Glimpse, my open source project.

I couldn’t believe it. Glimpse knows nothing about OleDb or Access, but alas, the bug was reported and I was able to reproduce it.

With reproduction in hand, I quickly figured out what was really happening. Opening the connection to Access caused the current AppDomain to unload, which in turn tore down Glimpse’s internal data stores resulting in the undesired behavior.

But why was the AppDomain being unloaded? I know tons of applications out there, running on little web servers underneath people’s cubicle desks, leverage Access as a data backend. Surely they don’t recycle the AppDomain after every database connection, do they?

Turns out, this problem would have been very easy to solve if I hadn’t oversimplified ASP.NET’s behavior in my head. I’ve known for a long time that changing a site’s web.config causes the AppDomain to recycle, but that’s only a partial truth now-a-days. With the help of a post by Tess Ferrandez I found souring the internet, I learned that as of ASP.NET 2.0 the file system watcher watches much more than just web.config for changes – including everything in the bin and its subdirectories. (I found out about several other reasons why an AppDomain might recycle from her excellent post too.)

Once I correctly understood modern ASP.NET’s behavior, I realized that connecting to the .MDB Access file in my bin directory was causing the file system watcher to kick off an application domain unload. Awesome! I moved the database out of the bin and the problem was solved.

Of course, after wasting more than a day of tinkering with this, I thought “There must be a way to figure this out without Google’ing high and wide”.

Turns out, there is! Unfortunately it’s not very obvious and requires some private reflection. Scott Gu covers the technique in a blog post from late 2005, before I was even involved in .NET.

The (simplified!) code, which you’d place in the AppDomain.DomainUnload event handler, looks like this:

var httpRuntimeType = typeof(HttpRuntime);             

var httpRuntime = httpRuntimeType.InvokeMember(
    "_theRuntime", 
    BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, 
    null, null, null) as HttpRuntime;             

var shutDownMessage = httpRuntimeType.InvokeMember(
    "_shutDownMessage", 
    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, 
    null, httpRuntime, null) as string;

The shutDownMessage will be a string describing the exact reason why the AppDomain is being recycled – which is great to log and saves lots of guess work.

Now that I know this technique, I have now begun logging all AppDomain recycles within Glimpse’s internal log in an effort to aid diagnosis of future problems like this.

It’s amazing just how easy it is to take for granted the mountain of code we build on top of everyday. This year I’m really going to try and not gloss over the lessons learned by those who came before us – just a mere 8 years ago.

– By

New Job

“Choose a job you love, and you will never have to work a day in your life”.

It’s no secret that my love of web development has materialized into Glimpse, the project I started a little over a year ago with Anthony Van der Hoorn. I’ve had an amazing ride with Glimpse; becoming an ASP Insider, getting to meet many of my dev heroes and working with fantastic contributors from all around the world.

About a month ago that ride took a new and unexpected turn. An opportunity to work full time with the open source community on our little project arose from a seemingly unexpected source: Red Gate.

Red Gate

I was taken surprised by Red Gate’s proposal and spent several weeks with Anthony and Red Gate’s top brass discussing our philosophies of open development, open source, ASP.NET, the web development community, software development practices and yes, even Reflector. As the discussions progressed I became more and more convinced that Red Gate genuinely believed in our vision of Glimpse, our model of development, and most importantly, the community that we were serving. Given that, I decided to take a new job with Red Gate – getting to focus a much larger portion of my time on the things I love: Glimpse and the web development community.

There are a lot more details about what this means for Glimpse on the Glimpse blog, so I won’t rehash that here, but in summary it’s all positive. From a personal perspective, I will remain in New York City, and, in addition to spending a majority of my time working on Glimpse, I have also been given the opportunity to interact with the community. This basically means that part of my new position requires writing blog posts, speaking at user groups/meetups, working with open source and attending conferences like Monospace in October.

This is all new and very exciting to me. Keep an eye on this blog and my twitter feed for updates as things progress.

– By

Post Navigation