`Java.Interop.__TypeRegistrations` isn't always removed
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 579
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 257
Description
### Android application type
.NET Android (net7.0-android, etc.)
### Affected platform version
.NET 8
### Description
The `Java.Interop.__TypeRegistrations` type is (mostly) vestigial (except when using the Android Designer), and should never be used on-device. We should thus always remove it. We even have a unit test for that!
https://github.com/xamarin/xamarin-android/blob/a5fb6054a2bd5a79e7b7810d174f0d74135c2689/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs#L478-L479
(When `enabled` is true, `VSAndroidDesigner` is set, so `__TypeRegistrations` is preserved. Otherwise, it is removed by default.)
Somewhat-related: https://github.com/xamarin/java.interop/pull/1152
See also:
* 756b86507e6af5dd05e1739e2143dda8bfe273af
Yet…
### Steps to Reproduce
```sh
% dotnet new maui -n yay-maui
% cd yay-maui
% dotnet build -f net8.0-android -p:Configuration=Release
% for f in obj/Release/net8.0-android/android-arm64/linked/*.dll; do echo "## $f"; monodis --typedef $f | grep __TypeRegis ; done
…
## obj/Release/net8.0-android/android-arm64/linked/Microsoft.Maui.dll
11: Java.Interop.__TypeRegistrations (flist=1, mlist=34, flags=0x100000, extends=0x61)
584: Java.Interop.__TypeRegistrations/<>O (flist=931, mlist=3904, flags=0x100183, extends=0x61)
```
Why does `Microsoft.Maui.dll` have a `Java.Interop.__TypeRegistrations` type?! Nothing else does.
### Did you find any workaround?
_No response_
### Relevant log output
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.