Skip to content

Conversation

@tlakollo
Copy link
Contributor

@tlakollo tlakollo commented Aug 3, 2022

Enables AOT analyzer and adds RDC annotations

}

[RequiresUnreferencedCode(DataContract.SerializerTrimmerWarning)]
[RequiresDynamicCode(DataContract.SerializerAOTWarning)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one RDC even with the knowledge that the DataContractSerializer.Option == SerializationOption.ReflectionOnly codepath will always be taken when AOT compiling?

DataContractSerializer.Option basically controls whether we're going to take the ref.emit code paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both implementations are flagged by the analyzer as annotated with RDC, so the option seems to not affect the end result. I tried to go depper on the ReflectionOnly call and at several points it calls multiple methods annotated with RDC

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good start.
It might be worth filing an issue that even asking for reflection-only (no ref.emit) doesn't make it AOT friendly. Maybe it's not possible, but currently we don't know why.

@tlakollo tlakollo merged commit c4ea2ca into dotnet:main Aug 12, 2022
@tlakollo tlakollo deleted the AnnotateDataContractSerialization branch August 12, 2022 21:51
@StephenMolloy
Copy link
Member

Thanks for the heads up on this guys. We've been working on a huge PR for DCR for months and this has just caused a slew of conflict resolutions for that PR in our area at the last minute before we were set to checkin.

@StephenMolloy
Copy link
Member

Actually, after looking at all the conflicts that need resolving, there is so much that has changed here, I don't want to try and figure out how to keep your annotations correct in the new code. I'm reverting this PR.

@tlakollo
Copy link
Contributor Author

@StephenMolloy can you add a reference to the big PR you mentioned to know when is safe to reenable the analyzer?

@StephenMolloy
Copy link
Member

Sure. #71752 Once I can merge the revert, I'll merge that PR and ping back here.

@StephenMolloy
Copy link
Member

#71752 has been merged. Thanks for understanding.

@ghost ghost locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants