Skip to content
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

Request: please make mono_type_get_name_full a public symbol #19377

Closed
grendello opened this issue Mar 30, 2020 · 0 comments · Fixed by dotnet/runtime#34436 or #19414
Closed

Request: please make mono_type_get_name_full a public symbol #19377

grendello opened this issue Mar 30, 2020 · 0 comments · Fixed by dotnet/runtime#34436 or #19414

Comments

@grendello
Copy link
Member

Currently, Mono exports only mono_type_get_name which calls mono_type_get_name_full requesting the IL format of the name, which will put a . for nested type separator instead of the + one. This poses a problem in Xamarin.Android code I'm working on which needs to look up managed type name given a Java type name, so that the managed type can be loaded by reflection, but it also needs to do the reverse operation - match the managed type name to the Java name. In the latter case, Xamarin.Android uses an icall which gets passed an instance of System.Type and the native code uses mono_type_get_name to retrieve the type name, then searches for the match in order to return the corresponding Java type name. Current approach in Xamarin.Android optimizes the lookup tables by assuming that the managed type name is always of the same format. Since we must load the types in the native code, we need the + which means we won't be able to match the type with the name returned by mono_type_get_name in its current form, which in turn means we'd need to remove the optimization and generate two sets of managed names - one with . and the other with the +, to be used in the two mapping scenarios. It would be ideal if we could avoid it, both for performance and memory/storage usage. I'll be happy with any solution which allows me to get the name with + :)

Please backport the fix, once it's available, to the Mono 2020-02 branch, as that's the one currently being used by Xamarin.Android.

/cc @CoffeeFlux

@CoffeeFlux CoffeeFlux self-assigned this Mar 30, 2020
monojenkins pushed a commit to monojenkins/mono that referenced this issue Apr 2, 2020
This is needed by Xamarin.Android to be able to round-trip with names fetched via reflection, as the only public API for this (`mono_type_get_name`) uses the IL format instead.

Fixes mono#19377
monojenkins pushed a commit to monojenkins/mono that referenced this issue Apr 2, 2020
This is needed by Xamarin.Android to be able to round-trip with names fetched via reflection, as the only public API for this (`mono_type_get_name`) uses the IL format instead.

Fixes mono#19377
CoffeeFlux added a commit that referenced this issue Apr 2, 2020
This is needed by Xamarin.Android to be able to round-trip with names fetched via reflection, as the only public API for this (`mono_type_get_name`) uses the IL format instead.

Fixes #19377

Co-authored-by: CoffeeFlux <[email protected]>
CoffeeFlux added a commit that referenced this issue Apr 2, 2020
This is needed by Xamarin.Android to be able to round-trip with names fetched via reflection, as the only public API for this (`mono_type_get_name`) uses the IL format instead.

Fixes #19377

Co-authored-by: CoffeeFlux <[email protected]>
jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Apr 3, 2020
Changes: mono/mono@fda7399...ecde086

Context: mono/mono#18127
Context: mono/mono#19377
Context: dotnet#4487

  * mono/mono@ecde08600b2: [runtime] Allocate the memory for gshared gparams from image sets. (#19361) (#19419)
  * mono/mono@8fb93012925: [meta] Add mono_type_get_name_full to public API (#19415)
  * mono/mono@7bfb441fb4c: Fix Windows .msi build using newer xar
  * mono/mono@e77cea19105: Fix Windows .msi build with recent cygwin updates
jonpryor added a commit to dotnet/android that referenced this issue Apr 3, 2020
Changes: mono/mono@fda7399...ecde086

Context: mono/mono#18127
Context: mono/mono#19377
Context: #4487

  * mono/mono@ecde08600b2: [runtime] Allocate the memory for gshared gparams from image sets. (#19361) (#19419)
  * mono/mono@8fb93012925: [meta] Add mono_type_get_name_full to public API (#19415)
  * mono/mono@7bfb441fb4c: Fix Windows .msi build using newer xar
  * mono/mono@e77cea19105: Fix Windows .msi build with recent cygwin updates
jonpryor added a commit to dotnet/android that referenced this issue Apr 4, 2020
Changes: mono/mono@fda7399...ecde086

Context: mono/mono#18127
Context: mono/mono#19377
Context: #4487

  * mono/mono@ecde08600b2: [runtime] Allocate the memory for gshared gparams from image sets. (#19361) (#19419)
  * mono/mono@8fb93012925: [meta] Add mono_type_get_name_full to public API (#19415)
  * mono/mono@7bfb441fb4c: Fix Windows .msi build using newer xar
  * mono/mono@e77cea19105: Fix Windows .msi build with recent cygwin updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants