json icon indicating copy to clipboard operation
json copied to clipboard

FormatterServices is obsoleted in .NET 8.0

Open emako opened this issue 1 year ago • 1 comments

WARN:

SYSLIB0050	“FormatterServices” obsoleted :“Formatter-based serialization is obsolete and should not be used.”	JSONParser.cs

SRC:

[Obsolete("Formatter-based serialization is obsolete and should not be used.", DiagnosticId = "SYSLIB0050", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static class FormatterServices
{
    ///
}

emako avatar Apr 18 '24 09:04 emako

Maybe someone can confirm that this change is okay or even provide a better solution? https://github.com/topeterk/SystemTrayMenu/commit/173cf0e8e4cbde8e8a75282b33918af76dea4157#diff-77183a5d671cbfb04ff571978b4597b80825b764581bebbf29b2da038e8d236c So for now, I am ending up with...

        private static object? ParseObject(Type type, string json)
        {
            object? instance = Activator.CreateInstance(type);
            if (instance is null)
            {
                return null;
            }

topeterk avatar May 05 '24 22:05 topeterk