Talk: You're Doing Exceptions Wrong

We use Azure’s Application Insights features as the performance monitoring tool on a lot of our apps.
These are some queries I’ve found that are useful for various troubleshooting situations
.NET 8 is going to ship Keyed Services with
Microsoft.Extensions.DependencyInjection
, the default IOC container. Keyed
services allow developers to register multiple implementations of an interface
under different names (or, more generically, “keys”). This is useful in some
scenarios. Let’s take a look.
I saw a Reddit post asking which test framework to use: xUnit, NUnit, or MSTest. I’ve used xUnit almost exclusively for years and don’t have firm enough experience with the others to recommend for or against them. Any bias I have against MSTest is probably years out of date. I hear it’s pretty good now!
Instead, I thought I would list my top test framework considerations.
I’ve frequently seen a question arise about why anyone would use an open-source
dependency injection framework like AutoFac when Microsoft provides
Microsoft.Extensions.DependencyInjection
(MEDI). Isn’t that good enough?
It’s a fair question. MEDI is a capable dependency injection container and will support most application needs. However, I still find it worthwhile to plug AutoFac in.
Microsoft created MEDI so that framework and library authors could depend on some basic dependency injection capabilities without writing adapters for every popular DI container. Microsoft specified base-level functional expectations, but application developers that wanted more power could use a different tool as long as it could conform to the protocol Microsoft specified. As a result, the MEDI provides a limited feature set by design.
I frequently want more robust capabilities and will install AutoFac to get them.
The rest of this post will highlight some of the features of AutoFac that I particularly like. While not provided out of the box, Developers can emulate many of these features with MEDI, though perhaps clumsily. Some have no analog at all. Sample code is also on GitHub.
My company’s CEO once commented that Architect is a sales position. I think that is a wise observation and applies to most technical leadership roles.
It’s not enough to have good ideas: you need to sell them.
Here are some tips I’ve found that help build consensus and nudge a team in a direction I believe is best.
Last week I helped a client plan an upgrade from an internal custom JavaScript
library to a more modern UI framework. The existing code uses a tool called
“jingo“ to manage dependencies. We
wanted to support modern bundlers that use the new EcmaScript Modules (import
and export
) syntax. A straight forward mechanical transformation exists but
the codebase consists of hundreds of files to convert. It would be tedious,
boring work over the course of days. However, I could use codemods to write a
script that would convert the syntax automatically.
Mastodon 4.1.0rc1 has new flags to tootctl media remove
to help prune old
storage of profile avatars and header images. Each account you encounter, either
via follow, boost, or reply to a post that was followed or boosted, hits your
instance and caches an avatar (profile pic) and header image (banner image).
This can take up a lot of space!