Start Debugging

Daily notes on .NET, C#, EF Core, MAUI, Blazor, and Flutter - for developers who ship.

How does Microsoft.Extensions.DependencyInjection resolve a service internally, from AddSingleton to the instance?

AddSingleton only appends a ServiceDescriptor to a list. BuildServiceProvider indexes those descriptors, and the first GetService builds a call-site tree with reflection, caches it, and wraps it in an accessor delegate. Singletons are stored on the call site itself, scoped instances in a per-scope dictionary, and after the second resolve of a non-singleton the container compiles an IL DynamicMethod on the thread pool. Walked through the .NET 11 source and observed with reflection, EventSource events and BenchmarkDotNet.
2026-11-26 ai-agentscodexssh

How to Stop a Coding Agent Desktop App From Using Your Forwarded SSH Agent Keys on Remote Hosts

The Codex app inside ChatGPT Desktop links any forwarded SSH agent on a remote host to a stable socket that its long-lived app server and every agent command inherit. How the link works, how to check whether your keys are exposed, a dedicated ssh_config alias with ForwardAgent no and IdentityAgent none, why turning forwarding off does not cut a link that is still live, and how to scope keys with ssh-add -c, -t and -h when the agent really needs git.

Why can't I cast IDisplayVM<Derived> to IDisplayVM<Base> in C#, and when does out variance fix it?

A class that implements IDisplayVM<DiseaseDTO> does not implement IDisplayVM<IDTO>, so the assignment fails with CS0266, 'as' returns null and an explicit cast throws InvalidCastException. Marking T as 'out' fixes it only if T never appears in an input position; with ICollection<T> or a setter you get CS1961. Reproduced on .NET 11 with the four designs that actually work, benchmarked.
Page 1 of 122 Next ›