Dependency Injection Lifetimes in Blazor

in C# Blazor Razor Components

I’ve been playing with Server-side Blazor for a few days and I’ve been really impressed. I can see that this will be an immensely powerful technology and I hope to make it my main web platform going forward. But it’s model does change some things. Since you’re running the app on the server and just using SignalR to update the browser’s UI it changes the lifetime of Scoped objects in Asp.Net’s dependency injection.

Continue Reading

Removing Items From a List

in C#

It’s not at all uncommon to need to iterate through a List to remove an item. And about half the time when I do so I get a “Collection was modified; enumeration operation may not execute.” exception the first time I run the code. Then I do something fancy like use a for loop to iterate through the list backward and remove the items from the list. Something like this:

Continue Reading

Working Remote

in Random

One of my coworkers will be moving and switching to working remotely. He asked me to share my thoughts about working remote and it turns out I have a lot. Hopefully, they are worth sharing.

I’ve been remote for 4 years now as an employee, and also worked remotely for about 7 years while as an independent consultant. The consulting was more solo work and less teamwork and was much more isolating, but it did help me form some boundaries around working from home. At this point, I hope never to work in an office again. Here’s what I think are the keys to being happy working from home:

Continue Reading

Networking Online

in Random

Which online social network is the best when looking for a new job? If you had asked me 2 weeks ago I would have told you it was LinkedIn, but it turns out LinkedIn is a distant second.

Continue Reading

Simple Deploy to Azure from Command Line

in Azure DevOps

I’m currently working on moving our product from AWS to Azure and as part of the planning for that move, one of the problems I needed to solve was deployment. Our current deployments are handled by an automated build on Bamboo, but Bamboo doesn’t have a “Deploy to Azure” task. I needed to do the deploy from the command line (CMD or Powershell), and I wanted to avoid including publish profiles in the projects.

The first part, running from the command line was easy to find through with a Google search. You can just tell MSBuild to publish to Azure

msbuild MyWeb\MyWeb.csproj /t:TransformWebConfig;Publish /p:TargetProfile=ProdMyWebApp /p:Configuration=AzDev

But the catch is that you can’t do it without a publish profile as part of your project or at least I wasn’t able to make it work.

Continue Reading