Skip to content

Compile ProcessImportedType in IDataContractSurrogate for unityaot #1183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2019

Conversation

joshpeterson
Copy link

The IDataContractSurrogate interface is part of the public API of
.NET 4.7.1. In has a method named ProcessImportedType, which was not
compiled into the unityaot profile.

The ProcessImportedType method uses types CodeTypeDeclaration and
CodeCompileUnit as parameters. Both of these types are pretty large,
and we don't want to compile them into the unityaot profile.

So in order to compile the ProcessImportedType method method, add
empty CodeTypeDeclaration and CodeCompileUnit types in unityaot (the
profile stubber will fill these in properly). This change allows the
unstripped unityaot profile work correctly with IL2CPP.

It is difficult for the profile stubber to handle this case, because
the code in SurrogateProviderAdapter is in a facade assembly, which
the profile stubber currently ignores.

The `IDataContractSurrogate` interface is part of the public API of
.NET 4.7.1. In has a method named `ProcessImportedType`, which was not
compiled into the unityaot profile.

The `ProcessImportedType` method uses types `CodeTypeDeclaration` and
`CodeCompileUnit` as parameters. Both of these types are pretty large,
and we don't want to compile them into the unityaot profile.

So in order to compile the `ProcessImportedType` method method, add
empty `CodeTypeDeclaration` and `CodeCompileUnit` types in unityaot (the
profile stubber will fill these in properly). This change allows the
unstripped unityaot profile work correctly with IL2CPP.

It is difficult for the profile stubber to handle this case, because
the code in `SurrogateProviderAdapter` is in a facade assembly, which
the profile stubber currently ignores.
@joshpeterson joshpeterson requested review from joncham and mrvoorhe May 20, 2019 19:05
@joshpeterson joshpeterson merged commit 9f684e0 into unity-master May 21, 2019
@joshpeterson joshpeterson deleted the add-mising-codedom-unityaot branch May 21, 2019 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants