dotnet / dotnet/android-libraries

AndroidX.Credentials ICredentialManagerCallback wrong parameter types.

Open
#856 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
317
Forks
73
Avg merge
1d 8h
Merged PRs (30d)
17

Description

### Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.), Android for .NET (net6.0-android, etc.)

### Affected platform version

VS Mac 2022 17.6.9

### Description

The interface ICredentialManagerCallback.cs OnError and OnResult use Java.Lang.Object parameter type.
It should be

onResult(GetCredentialResponse result)
and
onError(GetCredentialException e)

Unfortunately, It is not possible cast.
So, it's impossible to get a proper error message on the c# level.

### Steps to Reproduce

```
ICredentialManager credentialManager = CredentialManager.Companion.Create(this.Context);
CreatePublicKeyCredentialRequest createPublicKeyCredentialRequest = new CreatePublicKeyCredentialRequest(passkeyRequestVO.RequestJson);
credentialManager.CreateCredentialAsync(this.Context, createPublicKeyCredentialRequest, new Android.OS.CancellationSignal(), this, this);
```

```
void ICredentialManagerCallback.OnError(Java.Lang.Object e){ System.Diagnostics.Debug.WriteLine("ICredentialManagerCallback.OnError: " + e);}
void ICredentialManagerCallback.OnResult(Java.Lang.Object result){ System.Diagnostics.Debug.WriteLine("ICredentialManagerCallback.OnResult");}
```

![Bildschirmfoto 2024-03-05 um 11 57 22](https://github.com/xamarin/AndroidX/assets/13417507/ea6a0e14-7c37-4ef1-a829-194c1d3eef39)

### Did you find any workaround?

nope

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.