Chik3r
Custom MSBuild task fails to load `System.Runtime`
Hi, I'm making a custom MSBuild task that needs to load images and I was using
ImageSharp
for that. Before, I was targetting net6.0
and it worked when using dotnet build
or Rider, but I now had to change to netstandard2.0
as I need to support VS and forgot that VS only likes netstandard. After I changed to netstandard2.0
, a method using ImageSharp
started to throw the following exception while running the task, but only from VS (it still works when using dotnet build
):
10 replies
❔ How to serialize certain null values with System.Text.Json
In System.Text.Json, if I have something like
I can serialize a list of items but ignore null values when writing, but what should I do if I want to serialize a single
null
value and ignore all others, something like this:
5 replies
✅ Serializing XML with diacritics/accents
Hi, I'm trying to serialize a class to xml that contains some strings, some of which may contain an accent (example:
genérica
) or other latin characters (example: diseño
). Currently I'm serializing it using the following code:
(I was previously trying to use a StringWriter but it also doesn't work)
It ends up replacing the characters with ??
instead of writing the actual characters.
The final XML needs to be formatted to UTF8 (and include encoding="utf-8"
at the top of the xml), so I'm not able to use iso-8859-1 (but even when I tried to use it as an encoding it replaced characters with "??")21 replies