Address remaining warnings from DataContractSerialization#51200
Conversation
|
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @tannergooding, @sbomer Issue DetailsContributes to #45623 This Resolves the remaining warnings on System.Private.DataContractSerialization.
In reply to: 819084419 |
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. In reply to: 819084428 |
eerhardt
left a comment
There was a problem hiding this comment.
Looks good. Just some minor-ish comments.
| public abstract class XmlObjectSerializer | ||
| { | ||
| [RequiresUnreferencedCode(DataContractJsonSerializer.SerializerTrimmerWarning)] | ||
| public abstract void WriteStartObject(XmlDictionaryWriter writer, object? graph); |
There was a problem hiding this comment.
This isn't necessarily true. This class is public abstract and may not require unreferenced code. WCF carries an implementation of this abstract type and customers might in their own code too. The WCF implementation does delegate work to XmlSerializer (which doesn't implement this abstract class) and doesn't reference anything from DCS or DCJS.
There was a problem hiding this comment.
The way the API is shaped - object? graph - doesn't lead to being trim compatible. The trimmer has no way of knowing statically which Types are being passed into WriteStartObject. Therefore, it doesn't know what members on what Types should be preserved.
Even if you looked at the type of variables:
Customer c = GetSomeCustomer();
serializer.WriteStartObject(writer, c);You don't know statically if c is concretely a Customer or a type derived from Customer.
|
@StephenMolloy as he owns DCS and DCJS |
|
Hello @joperezr! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Contributes to #45623
This Resolves the remaining warnings on System.Private.DataContractSerialization.
cc: @eerhardt @vitek-karas