[Xamarin.Android.Build.Tasks] Use marshal-ilgen component #7260
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #7249
Context: dotnet/runtime#71203
Context: dotnet/runtime#60639
Context: dotnet/runtime#61685
Mono introduced a new
marshal-ilgen
component indotnet/runtime@de32c446 which needs to be used when
non-blittable type is required.
string
marshaling is a form of non-blittable marshaling.Eventually the idea is that assemblies should migrate to use the
DllImport Generator
for non-blittable marshaling purposes,then
[assembly:DisableRuntimeMarshallingAttribute]
can beapplied to the assembly, and -- if no assemblies in an Android app
require non-blittable marshaling -- then the
marshal-ilgen
component can be omitted from the
.apk
, reducing app size.That's a fair number of
if
s; this won't be happening soon.In the meantime, we need to start including the
marshal-ilgen
component in all .NET 7 RC1+ builds so that our existing
DllImport
declarations continue to work.
Update
@(_MonoComponent)
to addmarshal-ilgen
.In order to facilitate future testing, allow the
marshal-ilgen
component to be excluded if the
$(_AndroidExcludeMarshalIlgenComponent)
property is True.