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

Can't create ApnSetting object #6527

Closed
hubocan opened this issue Nov 29, 2021 · 1 comment · Fixed by #6535
Closed

Can't create ApnSetting object #6527

hubocan opened this issue Nov 29, 2021 · 1 comment · Fixed by #6535
Assignees
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). needs-triage Issues that need to be assigned.

Comments

@hubocan
Copy link

hubocan commented Nov 29, 2021

Steps to Reproduce

Try to create an ApnSetting object.

using var apn = new ApnSetting.Builder();
apn.SetEntryName("APN name");
apn.SetApnName("some.apn");
var test = apn.Build();

Android documentation says that there have to be:

  • apnTypeBitmask
  • apnName
  • entryName

I can't find any way how to set the APN type and that's probably the reason why the result is null. There should be something like apn.SetApnTypeBitmask(ApnType.Default);, but it is not or I can't find it.

Reference: https://stackoverflow.com/questions/70146587/how-can-i-create-apnsetting-object

Expected Behavior

The test variable should be non-null (proper ApnSetting object).

Actual Behavior

The test variable is always null.

Version Information

@hubocan hubocan added Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). needs-triage Issues that need to be assigned. labels Nov 29, 2021
@jonpryor
Copy link
Member

Comparing our API-31 docs for ApnSetting.Builder to the Android docs, and it looks like we have no binding for ApnSetting.Builder.setApnTypeBitmask(int).

I'm not currently sure why this is the case.

jonpryor pushed a commit that referenced this issue Nov 30, 2021
Fixes: #6527

Several methods in [`android.telephony.data.ApnSetting`][0] and
[`android.telephony.data.ApnSetting.Builder`][1] have been mapped to
enums that do not exist, such as `Android.Telephony.ApnType`.

These enums are actually in the `Android.Telephony.Data` namespace
and thus should be e.g. `Android.Telephony.Data.ApnType`.

Fixing these enum mappings allows the methods to be bound instead of
being invalidated for trying to reference non-existent types.

Once the enum mapping is corrected, the previously unbound methods
such as [`ApnSetting.Builder.setApnTypeBitmask()`][2] are bound:

![ILDasm output showing `ApnSetting.Builder.SetApnTypeBitmask()`][3]

[0]: https://developer.android.com/reference/android/telephony/data/ApnSetting
[1]: https://developer.android.com/reference/android/telephony/data/ApnSetting.Builder
[2]: https://developer.android.com/reference/android/telephony/data/ApnSetting.Builder#setApnTypeBitmask(int)
[3]: https://user-images.githubusercontent.com/179295/144113897-1de3a5a4-315f-47dc-b1a0-a2d3cd5a0bfd.png "ILDasm output showing `ApnSetting.Builder.SetApnTypeBitmask()`"
@msftbot msftbot bot locked as resolved and limited conversation to collaborators Jun 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). needs-triage Issues that need to be assigned.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants