Evaluate replacing JsonConvert serialization

Aperta
#1 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
tooling

Direzione di ricerca

Inizia tracciando come viene serializzato e deserializzato savedState di Installer, quindi confronta le opzioni del serializzatore per netstandard2.0 discusse nell’issue, inclusi NetDataContractSerializer e BinaryFormatter. Verifica se un IDictionary arbitrario e lo stato di un Installer figlio possono effettuare un round-trip senza Json.NET; il lavoro è completato quando viene identificato un sostituto compatibile oppure viene documentato il motivo per cui la dipendenza deve rimanere.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It looks like you're just using JSON.net to serialize IDictionary in savedState and this could be accomplished with built-in serializers that would remove the dependency on JSON.net (so that a different version can be used or just not bring that dependency along with someone using System.Configuration.Install).

I looked at the reference source and the built-in classes use NetDataContractSerializer which can serialize/deserialize arbitrary types in an IDictionary. We don't have that in netstandard2.0. Another possibility is BinaryFormatter, but that requires ISerializable which IDictionary is not. The concrete type is Hashtable in the underlying implementation for installers.

@flamencist thought this approach might work, but it relies on ToString() to put it in a key value store. Since IDictionary (and Hashtable) can hold any object, this doesn't really work. Some objects may not have a sensible ToString() which would end up with the type name in the output, and they can't really be deserialized in this manner.

In the Installer source I looked at, it appeared that it was putting an integer in there for the count of Installers and then saving all the child Installer states (which can be any object since anyone can inherit Installer).

The reason JsonConvert works is that it serializes the type information too. Is it possible to replace it with something we have in netstandard2.0 so that we don't have to bring along a JSON.Net dependency?

Lingua principale
C#
Stelle
26
Fork
12
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di flamencist/Core.System.Configuration.Install

Tutte le issue di flamencist/Core.System.Configuration.Install

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.