Getting to .NET Core when migrating is a slow, slow process

posted by Jeff | Thursday, May 17, 2018, 3:57 PM | comments: 0

I finally got CoasterBuzz moved to .NET Core this week. I guess you can say I've been in the process for years, since it uses POP Forums' user system underneath, and I've been working on porting that to Core now since September, 2015. That's when Core was still called vNext. v1 was released June, 2016, and v2 was August last year, but ultimately the problem was that ASP.NET Core was just missing too many things to use it. I wanted to see out its vision of breaking entirely from the old .NET, so I didn't want to take those dependencies. Yeah, I wanted to run it on a Mac just to see it was possible.

The first and biggest problem is that I needed SignalR, which keeps an open connection to get messages from the server indicating something happened. I introduced real-time loading and updating on the forum a very long time ago, and maybe it was the first forum that wasn't Facebook to do it. I couldn't move forward without that, and it's finally coming with v2.1 of Core. The other challenge was that I needed something to do image resizing, and fortunately ImageSharp was already in development, though it's still beta. I can't be critical of that one because it's a great volunteer effort, and it's pretty high quality stuff.

I spent a lot of time messing around with various scale tricks during that time, and while they need some polish, I could in theory scale out the forum app to epic places without a lot of effort. The thing is, I personally will probably never need it. When I had a weird Google news feed traffic spike a few weeks ago, the old app was doing 20 pages/second with no performance degradation, and I've pushed it close to 500 without a lot of wear and tear. In the last year, I also started porting parts of CoasterBuzz over, little by little, and last week I used my plentiful spare time to just get it done. When migrating, you don't really have to change a ton of stuff, and even the views will work as they did before, but I fundamentally decoupled user handling from the framework in the forums, so that was my biggest change.

Beyond that, any of the old plumbing stuff from ASP.NET.old has to come along to the new world. The OWIN stack is kind of what we have now, in terms of handling the request/response lifecycle, but it was changed dramatically in some cases. HttpModules and HttpHandlers are of course gone, so you have to convert those into middleware. And then there are little nuanced things like figuring out the order of middleware, conditionally mapped middleware, the right way to wire up error pages so they still have the right status code (hint: 500's and 404's aren't configured together), rules for redirect middleware... it's a lot of new stuff. Entity Framework is dramatically different in convention, so there's a lot of re-learning to do there (and I don't even use it that much on CB). Oh, and of course configuration is totally different now, too. I think the hardest thing to reconcile is that stuff changed enough that I'm not sure which things I'm doing "right" and which have changed, since even the preferred tooling was not a constant.

The bottom line is that migration is fairly time consuming, as opposed to doing something greenfield. It also took a long time to go from something totally new to supporting all of the stuff that you used to know you could do. I think with v2.1, it's pretty much "there," you just have to understand how and where your cheese was moved. If I'm thinking about the parity with the old platform, I guess I should be impressed they've come so far in two-ish years, and all open source, too.

With this hurdle out of the way, and relative stability with all of the features I needed, at least my hobby can be fun again. I look forward to actually pushing the release button on GitHub for v14 of the forum, at which point I can start to get it out of 2011 in terms of front-end technology.


Comments

No comments yet.


Post your comment: