SleepWellPupper
Securing a plugin system:
Using:
<PackageReference Include="DotNetIsolator" Version="0.1.0-preview.10032" />
Here's a MVE for WASM sandboxing in dotnet. Maybe this is useful to you. Steve Sanders has a video on his YT channel on the package.
https://github.com/SleepWellPupper/ConsoleApp1/blob/4d638be8f6f895532718b82bcb04647ea468d5d0/ConsoleApp1/Program.cs#L233-L30443 replies
✅ Will I fall into a gotcha with this constructor?
What I mean by "injecting TransferUtility instead of IAmazonS3" is that you replace your constructor parameter from
IAmazonS3
to TransferUtility
and leave the disposal to whatever is creating your S3Service
25 replies
✅ Will I fall into a gotcha with this constructor?
Since
S3Service
is new
ing up the TransferUtility
, it owns its lifetime. Therefore, you should either implement IDisposable
on S3Service
, or move ownership by injecting TransferUtility
instead of IAmazonS3
.25 replies
✅ meaning on dependency injection in C#
Hey @Faker
I see you're on quite the learning journey from all your posts. If you want to read more about DI, I can highly recommend this book:
https://www.oreilly.com/library/view/dependency-injection-principles/9781617294730/
It is in my opinion one of the best books any dotnet (or OOP in general) developer should read.
14 replies
Question about Dependency Injection:
The answer is in tebes replies and my linked article:
Are you writing a library/framework to be consumed by 3rd parties? Use MEDI.
Are you writing a library/framework/application to be consumed by you/your company alone? Use your container of choice.
74 replies
Question about Dependency Injection:
My meaning was that MEDI is inferior to anything that isn't "exactly what ServiceCollection (the implementation) provides". For me that means
- Decorators
- conditional registration
- registration validation & analysis
- generic registration
which MEDI does not support, and SimpleInjector does. So SI it is for me.
74 replies
Question about Dependency Injection:
This is correct but also the crux of the problem as not a single large third party DI container can correctly implement the abstraction; it is leaky as hell.
So the only real option for library authors is to stick to MEDI and application authors can go write a bunch of integration logic to use their container of choice (thanks MS)
https://blog.simpleinjector.org/2016/06/whats-wrong-with-the-asp-net-core-di-abstraction/
specifically:
there will definitely be behavior differences between the Autofac DI container and the Microsoft DI container. We’re not trying to behave identically – if you choose to use Autofac as your backing container, you’re also choosing the Autofac behaviors. The difference in behavior you found is one of probably manyand
Considering that Microsoft’s DI Container is heavily influenced by Autofac’s design, it is a telling sign that even Autofac can’t comply with the abstraction.You will likely inevitably run into issues like those described in the article. That said, I will choose SimpleInjector as my container of choice because it is objectively superior to MEDI given my usecases.
74 replies
Fast regex that takes in a span instead of a string
Are you aware of the source generated regex implementation?
https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-source-generators#source-generation
44 replies