@andrewlock@hachyderm.io
@andrewlock@hachyderm.io avatar

andrewlock

@andrewlock@hachyderm.io

Microsoft MVP, blogger, and author of ASP.​NET Core in Action. #dotnet #dotnetcore #aspnet #aspnetcore #csharp

This profile is from a federated server and may be incomplete. Browse more on the original instance.

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Blocking primary constructor member capture using a Roslyn Analyzer

https://andrewlock.net/blocking-primary-constructor-member-capture-using-an-analyzer/

In this post I describe a Rosyln analyzer you can use to enforce that primary constructors are only used for initialization and never to capture as fields

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh THANK YOU 😂

andrewlock, to CSharp
@andrewlock@hachyderm.io avatar

Blogged: An introduction to primary constructors in C#12

https://andrewlock.net/an-introduction-to-primary-constructors-in-csharp-12/

In this post I introduce C#12 primary constructors, describe the various ways to use them and how they work behind the scenes.

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Understanding C# 8 default interface methods

https://andrewlock.net/understanding-default-interface-methods/

In this post I provide an introduction to default interface methods, how they work at a high level, their typical uses, and some of their sharp edges

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Updates to the StronglyTypedId library - simplification, templating, and CodeFixes

https://andrewlock.net/updates-to-the-stronglytypedid-library/

In this post I describe some recent major updates to my StronglyTypedId NuGet package, describe why I made the changes, and demonstrate how they work

khalidabuhakmeh, to dotnet
@khalidabuhakmeh@mastodon.social avatar

I was reading @andrewlock latest blog post on redacted logging and thought I would recreate a sample for my understanding.

I also sourced all the packages you will need in the off chance you’re using logging in a non- situation.

Cheers :) 🍻

sample: https://github.com/khalidabuhakmeh/DotNetRedactedLogging
blog post: https://andrewlock.net/redacting-sensitive-data-with-microsoft-extensions-compliance/

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh nice, thanks! 😄

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Enriching logs with [TagProvider] and ILogEnricher

https://andrewlock.net/customising-the-new-telemetry-logging-source-generator/

In this post I look at the [TagProperties] and ILogEnricher features from the Microsoft.Extensions.Telemetry package and show how they can be used in your apps.

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Short-circuit routing in .NET 8 - Exploring the .NET 8 preview - Part 11

https://andrewlock.net/exploring-the-dotnet-8-preview-short-circuit-routing/

In this post I describe the new short-circuit routing feature, how it differs from normal routing, discuss why it's useful, and look at how it's implemented.

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh Pretty sure that's what you said in response to my last post too 🤣

And I agree - I think the reality is that the core of the framework is really solid. There's new features like HTTP3 etc which will continue to evolve, but it feels like niche features.

Maybe that's just the reality of mature frameworks. But it's also a bit concerning as catering to every edge case like this adds complexity and ultimately, bloat.

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh For this feature in particular - there are so many other ways you could essentially achieve the same thing, I don't really understand why it was necessary.

None of the comments on the original issue seem to address the fact this is trivial to do if you place it before the call to UseRouting()...
https://github.com/dotnet/aspnetcore/issues/46071

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @bytefish To be fair, "short-circuit" is often used to describe bypassing the remainder of the pipeline, but it's never been applied to "routing" before.

I think they're just trying to make my next aspnetcore book even thicker...

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh Just to be clear:

  • I'm not really sure what issues short-circuiting could fix tbh.
  • if the endpoint has any authorization (or cors) requirements, it can't be short circuited, you'll get an exception at runtime.
  • This isn't really 'breaking' the middleware pipeline, it just breaks the elegance of the routing design IMO

My main argument against this is "we already say don't put everything in routing e.g. see static files". This use case fits in that statement afaict

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Updates to Docker images in .NET 8 - Exploring the .NET 8 previews - part 10

https://andrewlock.net/exploring-the-dotnet-8-preview-updates-to-docker-images-in-dotnet-8/

In this post I describe the changes to .NET 8 docker files in .NET 8 including changes to images, new image types, changes to image tagging, and breaking changes

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh I don't entirely disagree😅 Though I'm thinking primarily about native AOT...

Most of the docker changes are relatively harmless at least, you just don't need to use the newer stuff... But I suspect a lot of people are going to get burned by the default port change! 😬

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh 😬 that bodes well then...

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @chethusk I don't think LTS means anything about breaking changes 🤔 it's semver, so can break going from 7 to 8, or 8 to 9, but not in minor and patch? But that has nothing to do with LTS.

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Rendering Blazor components to a string - Exploring the .NET 8 preview - Part 9

https://andrewlock.net/exploring-the-dotnet-8-preview-rendering-blazor-components-to-a-string/

In this post I describe how to render Blazor components to a string, how to use HtmlRenderer in ASP​ .NET Core, and show what does and doesn't work.

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

​Very happy to see that ASP​.NET Core in Action, Third Edition is now shipping from Amazon! 🎉

https://buff.ly/3L8xQ3e

Even better, it's apparently the No. 1 new release in Microsoft .NET 😄

Thanks to everyone that's bought it!

No reviews yet though - if you've already read it, I'd really appreciate it if you could leave an honest review 🙏 It really helps boost the visibility! Thanks again everyone 🙂

andrewlock, to dotnet
@andrewlock@hachyderm.io avatar

Blogged: Form binding in minimal APIs - Exploring the .NET 8 preview - Part 7

https://andrewlock.net/exploring-the-dotnet-8-preview-form-binding-in-minimal-apis/

In this post I discuss the new form binding support for minimal APIs, the current limitations and rough edges, and how to work with antiforgery tokens

andrewlock,
@andrewlock@hachyderm.io avatar

@jchannon Nice! Out of interest, did you run into any of the issues I flag in that post?

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @jchannon Yeah, the duplicate key one seems problematic. As for how it should handle duplicates is potentially up for discussion I guess, if they're explicitly choosing to not behave like MVC 🤔

RE the value attribute to true - good point, thanks, definitely was too tired to spot that by the time I finished 😂 My complaint that their blog post fails hard still stands though I think 😉 + using it in a complex object.

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @jchannon

or I think this would work?

([FromForm] bool isCompleted = false) => Results.Ok(isCompleted);

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @jchannon records aren't supported at all yet :)

andrewlock,
@andrewlock@hachyderm.io avatar

@khalidabuhakmeh @jchannon I mean, I find it kinda funny it exists at all. There are numerous statements from Fowler et al "minimal APIs will not support forms" 😅

Personally I'm going to stick with "minimal APIs are for JSON" MVC/Razor Pages are for forms as a general rule for now😉

andrewlock,
@andrewlock@hachyderm.io avatar

@jchannon @khalidabuhakmeh You could also go the other way and render blazor components to strings instead of Razor view files 😉

andrewlock,
@andrewlock@hachyderm.io avatar

@jchannon @khalidabuhakmeh Of course, that's a given 😉

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines