voltagex
LibraryImport examples, especially on Linux
Has anyone got examples of usage of the newer LibraryImport infrastructure (?) as opposed to DllImport?
I have seen https://stackoverflow.com/questions/75304403/marshalling-function-pointers-with-net-7-libraryimport which just about melted my face off
and https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke-source-generation isn't bad but no one seems to be using this in open source code.
85 replies
✅ NotSupportedException: JsonTypeInfo metadata for type... & "minimal" APIs
Coming back to C# after quite a while and minimal APIs got complicated.
What's going on with the error here? What does it actually want me to add?
Why is it trying to serialize a System.Func?
5 replies
System.CommandLine and injection of IOptions (not Option!) type
I'm trying to work out how to use the hosting and dependency injection parts of System.CommandLine to inject IOptions configuration settings into my app via the command line. See https://github.com/dotnet/command-line-api/issues/1858#issuecomment-1254653273. Short version: how can I make System.CommandLine binding or dependency injection work to change the value of a typed IOptions instance?
1 replies
[solved] Injecting configuration in (minimal) WebAPI
https://git.sr.ht/~voltagex/wherethefile/tree/main/item/src/WhereTheFile.NetworkScanner/Program.cs#L24
How can I make
builder.Services.Configure
do what I think it should? i.e. when the service is resolved, a configuration object with my configuration is provided?
Alternatively, how should I be passing database configuration strings in?3 replies