autofac, net comments edit

Today the Autofac team and I are pleased to announce the release of Autofac 5.0!

This is the first major-version release we’ve had in about three years (Autofac 4.0 was released in August 2016). There are some breaking changes and new features you should know about as you decide your upgrade strategy. Hopefully this will help you navigate those waters.

Breaking Changes

Framework Version Targeting Changes

Starting with Autofac 5.0 there is no longer support for .NET 4.5.x. .NET 4.5.2, the last release in that line, follows the same support lifecycle as Windows Server 2012 R2 which ended mainstream support in September 2018.

Autofac 5.0 now targets:

  • netstandard2.0
  • netstandard2.1
  • net461

Containers are Immutable

The container registry can no longer be updated after it has been built.

The ContainerBuilder.Update method was marked obsolete in November 2016 and there has been a robust discussion to answer questions about how to get the container contents to adjust as needed at runtime.

ContainerBuilder.Update has now been removed entirely.

If you need to change registration behavior at runtime, there are several options available to you including the use of lambdas or child lifetime scopes. See this discussion issue for examples and ideas. We will work to add some documentation based on this issue.

[PR #948 - thanks @weelink!]

Lifetime Scope Disposal Hierarchy Enforced

Resolving a service from a lifetime scope will now check all parent scopes to make sure none of them have been disposed.

If you dispose a lifetime scope, all children of that lifetime scope will stop resolving objects. In cases like this you’ll start getting ObjectDisposedException instead.

If you have a custom application integration that involves creating/destroying lifetime scopes (e.g., custom per-request support) this may cause issues where proper disposal ordering is not occurring.

[Fixes #1020; PR #1061 - thanks @alistairjevans!]

Prevent Auto-Injecting onto Static Properties

Autofac will no longer do property injection on static properties when auto-wiring of properties is enabled.

If your application behavior depends on static property injection you will need to do some additional work like adding a build callback to populate the property.

[Fixes #1013; PR #1021 - thanks @alistairjevans!]

Features and Fixes

Asynchronous Disposal Support

Autofac lifetime scopes now implement the IAsyncDisposable interface so they can be disposed asynchyronously.

await using (var scope = container.BeginLifetimeScope())
{
   var service = scope.Resolve<ServiceThatImplementsIAsyncDisposable>();
   // When the scope disposes, any services that implement IAsyncDisposable will be
   // Disposed of using DisposeAsync rather than Dispose.
}

[PR #1037 - thanks @alistairjevans!]

Nullable Reference Type Annotations

Autofac is now build using nullable reference type annotations. This allows developers to get sensible compiler warnings if they opt-in, thus avoiding NullReferenceException instances where possible.

Nullable reference type warnings

[PR #1037 - thanks @alistairjevans!]

Build Callbacks in Lifetime Scopes

One method of running code at container build time is by registering a build callback. Previously this only worked at the container level, but we’ve added the ability to register callbacks that run at lifetime scope creation as well.

var scope = container.BeginLifetimeScope(cfg =>
{
    cfg.RegisterBuildCallback(scope => { /* do something */ });
});

The callback will be invoked just prior to BeginLifetimeScope exiting, after any startable components are instantiated.

[Fixes #985; PR #1054 - thanks @alistairjevans!]

Other Fixes

Still TODO

Now that Autofac 5.0 is out, there is still a lot to do. We’ll be working on these things as fast as we can:

  • Updating integration packages we support so they ensure compatibility with Autofac 5.
  • Updating the documentation to reflect the above changes.

Some of this is sitting in branches ready to go, other things need to be done now that we have this core package out there.

If your favorite integration isn’t ready yet, we’re doing our best. Rather than filing “When will this be ready?” issues, consider pull requests with the required updates.

Thank You!

On a more personal note, I’d like to thank all the folks that threw code at Autofac in the past few months. We appreciate the effort and the contributions. NuGet tells me we’re at 41,587,203 total downloads as I write this, #27 on the list of top package downloads in the last six weeks. We have 25 integration packages we maintain along with documentation, examples, and support.

Without your contributions this wouldn’t be possible. Thank you so much!

Hopefully git shortlog and the GitHub contributors page didn’t fail me - I don’t want to miss anyone!

personal comments edit

I’ve been having trouble of late when trying to repair robots at home. This is leading me to the belief that if anything you own has a battery, that battery must be user-serviceable. I’m going to start looking for things with this specific feature.

Robot repair is, admittedly, not the most common occurrence, but within the last few months there have been some robotic mishaps.

The first issue came along with my Sphero. I had one of the originals and it was working pretty well, but I left it unused for a few months while I was doing other things. When I came back it wouldn’t hold a battery charge anymore.

The body on a Sphero is a sealed plastic ball. You can’t open it or do anything with it. Once it dies, you throw it out. Which is a shame, because with a new battery it’d be good as new.

Luckily, despite the age of the robot, the super amazing awesome folks at Sphero replaced it at no cost. I got a newer robot which paired easier with my phone (the old one was giving me problems, likely due to an old firmware) and it’s sweet.

Of course… I figured I’d try to replace the battery in the old one anyway. Why not? Worst case scenario I’d be in the same position I was already in - one working robot, one non-working robot.

I took a Dremel and opened the sphere. I bought some 70mm clear plastic ornaments to serve as a replacement body. I looked at the battery in there and bought a replacement of the same type. Easy enough to unscrew the body part that covers the battery, unplug the old one, plug in the new one, and put it all back together.

I did all that and stuck it on the charger for a day. It appeared to charge, but… it just wouldn’t wake up. Hmmm. I unplugged the battery, plugged it back in, put it back on the charger for a day. Next day I tried again and it woke up… but wouldn’t pair with my phone. Or the iPad. Or anything else. It just blinked until the pairing timed out.

I have no idea what went wrong there. I’m guessing there was something else messed up, or the new battery wasn’t as identical as I thought it was… or something.

That robot went to the trash and now I have a bag of clear ornaments and a battery pack that doesn’t go to anything.

The second issue was with a “BB-8 Hero Droid”. This is a gift I got my wife a few years back. It follows you around, responds to voice commands… pretty fun.

Just like with my Sphero, BB-8 went unused for a few months. After we tried charging him up, he wouldn’t hold a charge.

I found this video where a guy takes one of these apart. Seemed involved but easy enough.

Today I got around to doing that, being on vacation for the holidays. I was hoping to get it fixed up for my wife for Christmas.

With no small effort I got the shell of the BB-8 body off. All the parts were labeled in the order in which I removed them, I had a bunch of photos, and the video also shows the exact steps I did.

Once the body is off, though… that’s where the video ends. There aren’t instructions for actually replacing the battery. It’s buried right in the center of the thing, too. In for a penny, in for a pound. Let’s do this.

I got two or three screws off the motor and realized I needed to detach the power switch on the side because it was holding the two halves together. I unscrewed one part, then started unscrewing the other…

…and I guess my screwdriver was in the power charging port or something rather than on an actual screw because fire shot out of the side of the motor and smoke started rolling out. FUUUUUUUUUUUUUUUUUUUUUUUUUUUU

I just about ran for the fire extinguisher but yanking all the cables out of the main board stopped the power flow and the fire. It did not, however, leave things in a functional state.

I feel really bad. I didn’t mean to kill Jenn’s BB-8 but… I guess it’s not a worse situation than it was before - the robot didn’t work before, now it still doesn’t work. But I still feel bad.

I had a small funeral for the BB-8 as I put his parts in the trash can. He is survived by the R-unit that Jenn made when we were in Disney World last month. I guess next trip we make to a Disney theme park she’ll have to make a new BB-unit to replace ol’ Hero Droid.

Anyway, if it has batteries, I need to be able to replace them without breaking into the device, lighting anything on fire, or otherwise causing the device to stop functioning. That should be a thing. I would also accept “lifetime warranty on the battery” such that I can take a unit that isn’t functioning due to the battery and have the factory replace either the battery or the whole unit.

(Yes, I realize there’s some interesting coincidence/irony about this post follwing the post about grounding the yellow wire to hack a fan into working but none of my fans have started a fire. Yet.)

hardware comments edit

WARNING I’m going to explain a total hack here that worked for me. If you do this, any consequences are totally on you. I’m not responsible if your hardware gets fried.

I have a Synology Diskstation DS1010+ with… loud fans. It’s old, the fans are starting to sound like a rock tumbler. For the life of me, I can’t find a quiet fan alternative. I can replace the fans with the same ones I already have, but they’ve always been kind of loud.

Unfortunately, the fans in the DS1010+ are the kind that detect locked rotors.

Let me explain.

Fans for computers come in three-wire or four-wire varieties. Let’s focus on three-wire because that’s what the DS1010+ and many other systems use.

The three wires are sometimes:

  • Red: Power
  • Black: Ground
  • Yellow: Fan speed sensor

However, server fans usually don’t control the speed this way; instead they want to detect if the fan is dead. So the three wires there are:

  • Red: Power
  • Black: Ground
  • Yellow: Locked rotor detection

What’s important to know about the locked rotor signal is that if the signal is grounded then the server thinks the fan is still spinning. Alarms don’t go off, things work as normal. When the rotors get locked, power comes out that yellow cable and that’s when the alarms sound.

I bought really nice be quiet! cooling fans that are totally quiet… but they have a speed sensor on the yellow wire, not locked rotor detection.

This caused the Diskstation to generate all sorts of fan alarms - flashing lights, emails, beeping, the whole thing. You can search for this in forums, lots of people see it. You can silence the beeping and stop the emails, but you’ll still periodically get a yellow flashing light on the side, the fans spin up like jet engines, and alerts show up in the UI. No, thanks.

I tried building this circuit that someone figured out that would fake the rotor lock. Either I did it wrong or I have yet different fans than that person has. Point being, that was some time I’ll never get back.

The missing piece is that info about grounding. I found it on that page:

As long as it is rotating, the signal pin is tied to ground, but left floating once the rotor stopped spinning (the output stage of these types of fans is of an open collector type and pulled up by the main board. Hence, “floating” is equivalent to “high”).

I don’t really care if the Diskstation, at this point in its way-past-the-warranty life, alerts me about the fans. They’re gonna work. It’ll be fine. I just need the beeping to stop.

The answer: clip the yellow wire between the fan and the main board. On the side that comes from the fan, just bundle it up so it doesn’t make contact with anything. On the side that connects to the main board, connect the other end of the yellow wire to the case somewhere that’s grounded.

WARNING I’ll again warn you, this works for me. If it doesn’t work for you and things overheat and your house burns down or you lose all your data, that’s not my fault. Do this at your own risk!

Here’s a picture:

Ground the yellow wire!

I did this with both fans in the Diskstation and it’s been quiet for days.

I also did this with an HP ProCurve 2810-24G switch - the fans in there are like jet engines, no joke. You can’t be in the room with the thing. Swapped them out for some nice equivalent Noctua fans and it’s so quiet… but it also required that I ground the yellow wire or it would fill up error logs and lights would flash.

Now I have new quiet fans, no alarms, and things are working great.

FINAL WARNING Last time, if you do this, it’s all at your own risk!

personal comments edit

I live on the west coast of the US so while I’d been to Disneyland in California a few times, I hadn’t been to Disney World. We decided this year was the time to take that trip.

We stayed at Kidani Village, which is a resort in the Animal Kingdom portion of Disney World. It was pretty cool because outside the room (well, air-gapped, so your room, then a fence, then some space, then another fence) are animals like zebras, ostriches, and ankole cattle. Depending on the room, there may be giraffes and other animals.

The first thing that struck me about Disney World is the sheer scale. It’s 44 square miles all told - the resorts, the parks, everything. That means everything in general is big. It was a quarter mile between the lobby and our room. At the end of a tired day, that’s a full five minute walk.

I filmed the walk. Watch it and be amazed.

The first day was a travel day. It’s about five and a half hours to fly from one side of the US to the other. We basically landed, went to dinner, and crashed.

The second day was spent in Hollywood Studios. This is roughly equivalent to California Adventure by Disneyland. The majority of the day was spent in Black Spire Outpost, the Star Wars section of the park.

I could spend a whole day in Black Spire Outpost. The whole thing is so immersive, so well done. If you are a Star Wars fan at all, this is the coolest thing ever. The cast members there are in character, stormtroopers randomly patrol the streets, sometimes Chewbacca just walks by. At night it’s lit up and is gorgeous. You can look around and you’d never know you were in a Disney park.

We pretty much bought everything they sold here. Take my credits! We built a lightsaber, we built a custom droid, we adopted a pet, we bought literally every drink they sold in the cantina. We had the blue milk with and without alcohol.

I would say the “can’t miss” items here are flying the Falcon and building the lightsaber.

The Falcon flight is sort of short but is super fun, something any Star Wars fan has wanted to do forever. There’s a photo op area inside where you can take your picture at the chess table.

Sitting in the Millennium Falcon

The ride is actually responsive to the controls, like a video game, not just a ride on rails. You have to work as a four-person team to capture some cargo. One pilot controls left/right, one controls up/down. There’s a gunner to take care of incoming bad guys and an engineer who is in charge of nabbing the cargo from a moving ship.

Building a lightsaber is… it’s like participating in a live action version of a scene from Star Wars. It takes place in “Savi’s Workshop,” where some “junk gatherers” guide you through the process of building a custom lightsaber.

Savi's Workshop

The cast members there give you a speech about the various Jedi who carried the different saber colors and what each color conveys. The whole speech is timed to this background music that plays like a soundtrack and changes with the mood. As they talk about each color, the lights in the room change to reflect it. Voices of the Jedi speak like ghosts from beyond.

The build itself is fairly straightforward but you probably won’t be prepared for how heavy the saber hilt is. It’s like two pounds. It’s solid metal around a plastic holder that handles the electronics.

The kyber crystal you put in the saber is also interesting. It controls both the color of the blade as well as the sounds the saber makes when it moves, turns on, and turns off. You can get different crystals at the shop (naturally) and if you swap them into your lightsaber it will change the colors and sounds - it’s not that you need a different blade or anything.

Further, you can get these little boxes called “holocrons” where you can put a crystal into the box and it’ll glow the color of the crystal and share “stored knowledge” (recorded lines from various movie characters) associated with the crystal.

Anyway, do the Millennium Falcon flight and make a lightsaber. It’s sweet.

Jenn pried me away from Star Wars land for a little at the end of that day and we rode some of the Pixar rides. Slinky Dog Dash is a pretty good little coaster.

That night we went to the “Jingle Bell Jingle BAM!” dessert party, which was basically an all-you-can-eat dessert bar with some interesting holiday treats, a meet-and-greet with Chip and Dale, and front row seats for a really cool music and light show. It was super fun and even after a whole day of walking, Phoenix was dancing through the show.

The second day was spent at Animal Kingdom. I liked this a lot more than I thought I would. There’s a safari style ride where they drive you around through a preserve and you can see the animals there. It reminds me a lot of Wildlife Safari in southern Oregon. Really fun, really interesting.

The “Expedition Everest” ride here is pretty fun, a decent roller coaster. I’d recommend hitting this one if you get there.

We didn’t get to see a lot of the shows, but we did find Kevin from Up! running around the park and dancing to bands playing in various areas.

Day three was Epcot. Hmmm.

If you go, unless you’re a real foodie, try to avoid the Food and Wine Festival. This brings in a lot of folks who really want to “drink around the world” and wear reasonably annoying - if not obnoxious - group t-shirts talking about how drunk they’re going to get. If you go during the Food and Wine Festival, try to go on a day with crappy weather rather than nice, clear, sunny weather. If you have to go during the Food and Wine Festival and you end up with beautiful weather, by all you deem holy try not to go on a holiday weekend.

We hit the trifecta. It was so packed. Like SO SO SO PACKED. People were just there getting trashed and we’re not the only ones who noticed. I heard rumor that there was a fight amongst the drunks.

It doesn’t help that most of the “foodie food” isn’t palatable to the eight-year-old set, so finding “regular kid food” which consists of chicken tenders, cheese pizza, or some similar bland-yet-kid-standard fare is a lot of walking.

We spent the majority of the time either looking for kid-friendly food [which didn’t require standing in an hour-or-more line] or hanging in the other area of the park where “Mission Space” and “Spaceship Earth” are. We did enjoy these rides but I’d like to go back and see the countries at Epcot when there aren’t a bunch of people trashing it up.

Days four and five were Magic Kingdom. This is basically the same as original Disneyland. Most of the rides are the same. There are a couple of rides Disneyland doesn’t have, like the Peoplemover and the Carousel of Progress. Some rides are slightly different, too, like “It’s a Small World” and the Haunted Mansion are both just a little different.

The one thing I’ll focus on is the tiki room. I love the Enchanted Tiki Room. We go to Disneyland, I look forward to grabbing a Dole Whip and heading into a kitschy show of 50’s audio-animatronic birds. It makes my heart smile. They changed the show in Disney World so it doesn’t have the fountain in the middle and the birds seem different, not as retro or cartoon looking. It wasn’t the same and I was disappointed.

We did attend the Very Merry Holiday Party and that was really cool. The Magic Kingdom park closes to the public at 6:00 PM for these and guests with party tickets can stay until midnight. They have stands handing out cookies, hot cocoa, and cider. Rides change to holiday themes like “Jingle Cruise.” Space Mountain lights and music all switch to holiday music. It’s insane and awesome.

The last day was a half day at Hollywood Studios where we saw the rides we didn’t see the first time around. The Tower of Terror is my all-time favorite ride, so I’m glad we got to ride it again. (I’m sort of sad they changed the one in California to be Guardians of the Galaxy theme.) We also saw the Aerosmith “Rock n Roller Coaster” which was a great ride, too.

The remainder of that last day was travel back home. Another long flight.

In all, this was a great vacation. It was worth doing once, and I’d love to go back in the future to see more of Animal Kingdom and Epcot. In the meantime, I definitely need another Star Wars hit and original Disneyland in California will be much more affordable for me on my side of the country.

Also, it wouldn’t have happened if Jenn hadn’t planned the whole thing and watched altogether too many YouTube videos on where to eat, where to stay, how to take advantage of all the deals, and so on. She’s amazing and both Phoe and I owe her a debt for all the work she put into it.

Finally, if you want to see a walkthrough of how much Disney got us for, here’s an overview of all the stuff we got.

process, culture comments edit

Microsoft Teams is a collaborative communications tool in the same vein as Slack. You get your logical ‘teams’ together, folks chat and collaborate in ‘channels,’ and somehow that open office plan your company loves so much is totally justified because just look at that collaboration in action.

I’m a Slack guy. I like Slack over Teams for a few reasons which will probably become clear as I go through this.

The topic of the day is: CONVERSATIONS.

Teams organizes discussions around “conversations.” A conversation is sort of like the first post in a forum thread. It sets the topic of the conversation and replies on that conversation are attached chronologically to that conversation.

This is interesting to understand because it’s very, very different than Slack or other group chat solutions. In a group chat, messages are generally the first-class object. Slack added “threads” that approximate this conversation concept, but it’s still not the same.

Let’s say you want to search for something that was said six months ago. You remember a few key words and want to see the context.

In Slack, you’ll search, find the message, and when you click it you’ll see the message in chronological context of the rest of the messages. You can scroll up and down to find what you need, follow that thread to the next chronological conversation, or follow it back to see what led to the discussion in the first place.

In Teams, you’ll search, find the message, and when you click it you’ll see the conversation that contains the message. Just that conversation. It may not even pop you to the message itself, depending on if you’re lucky or if Teams is misbehaving. Outside of the conversation, there’s no chronological context. What else was discussed that day? Who’s to say?

Now let’s say you want to reply to a discussion that was being had earlier. You thought of something to add and you want to mention it.

In Slack, you can scroll back in the timeline to find the message. You can start a thread from that, or you can grab some text from it, quote it, and add your info to the main channel. Either way, pretty easy to find the earlier conversation.

In Teams, the timeline is not arranged chronologically. At least, not the way you might think. The timeline is ordered by “most recently replied to” conversation. If someone replies to a conversation, that conversation jumps to the bottom of your timeline as “most recent.” The conversation may have started a year ago, if someone comments on it, it’s suddenly most recent.

This means a couple of things in Teams that aren’t necessarily obvious:

  • Search is the only real way to find things. You can’t just scroll back necessarily and see the history.
  • You can never say “scroll up about X lines to see what was said” because… “up” isn’t up. The timeline dynamically rearranges on you so as soon as someone responds to that earlier conversation, everything appears in a different order.

What all this yields is that it’s important to know when to continue an existing conversation and when to start a new one.

That’s a really, really hard thing to do because conversation can be organic. However, you sort of have to “run the conversation” the way you “run a meeting” - curbing things that are off topic or getting folks to start new topics.

Why?

Let’s say there’s a conversation someone starts about the weather in Florida. It’s nice, sunny, might rain next week. That conversation goes for a while, talking about weather patterns and seasons. Then you see something like this:

Bob: The sun can really beat down and hit hard.

Alice: The sun is why my favorite season there is Summer.

Bob: It sure means a hot baseball season, though. I can barely get out to games in that heat.

Carl: How are the Marlins doing recently? I saw they traded pitchers.

Bob: They did, and now they’re not doing so well.

Carl: Maybe they should watch that movie Moneyball where they make smarter trades based on stats.

Bob: You could be right. I did see that the Yankees made a good trade this week.

The topic is “weather in Florida” but suddenly has now been totally derailed by a side conversation about baseball.

At first, you might think, “Who cares? It’s not that big of a deal.”

Well, sort of, and sort of not.

Let’s say this is a long conversation. Let’s also say it’s not about inconsequential topics, but about decisions being made for your business.

In six months, you want to go back and find out what was decided. You do a search… and remember how search results show you conversations not messages? You click on the search result and you’re presented with a wall of text where you have to do a manual search to get past all the totally unrelated junk.

This is generally not helped by the fact Teams “conveniently” hides the main body of longer conversations requiring you to click and expand them. Only the last few replies in a conversation are displayed.

It’s a real challenge in Teams when conversations and collaboration become organic like this. Sometimes it’s good to let open-ended discussions flow, and if there’s a conversation started where that’s intentional, great. Some meetings are like that, too. On the other hand, if you have a conversation on “standards for writing documentation” and someone derails it with argumentation about Oxford comma usage and “Hey, I went to Oxford!” and “Oh, really, were you born there or did you go overseas for college?” then things fall apart quickly: Search results become useless, notifications about changes to the conversation become useless, and the timeline rearranges to show the conversation has been updated with off-topic content.

If you’re trying to make the most of your time in a large set of teams and channels, one or two of these isn’t a problem but everyone taking conversations into odd directions makes managing time and discussion very hard.

Finally, it doesn’t help that chats don’t have conversations. If you get into a group chat then it’s like a standard app - it’s chronological, the timeline doesn’t rearrange, etc. It’s different if you’re in team channels. If you’re switching between chats and channels a lot, this can be really jarring.

“Couldn’t you just get everyone to agree to not use the conversations?” The idea here being if everyone used “conversations” as “individual messages” then the problems go away. I’ve tried this, and if you’re only scrolling this works fine. It breaks down if anyone, at any time, forgets and does a reply to a conversation rather than posting a new message. Any reply and the timeline rearranges. It’s done. Further, search won’t work because you can’t see conversations in relation to each other, so all you will ever get in search results is that one message.

All of this is basically why I like Slack far, far better. The organic conversation flows better, you can start threads if you want but you don’t have to, search works… it’s generally better for how I work.