-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Preventing NullReferenceException on WebAuthenticatorIntermediateActi… #12347
Conversation
Hey there @ederbond! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Hello, |
Hi @LAXStudios, I'm not sure. I just got a NullReferenceException that was happening randomly when I try do authenticate with Identity Server. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Any news about this @jfversluis and @mattleibow ? |
@ederbond did you actually verify this works? I can imagine that maybe this line might now break because this value is going to be null? Still, this wouldn't be worse than what is happening now. Just wondering if we have a full solution here. |
Hi @jfversluis I didn't tested it cause I don't know how to compile a modifield version of .NET MAUI locally and use it on my own Maui Project. But this is a random error that happen time to time when I try to authenticate using OAuth. The stacktrace that Visual Studio 2022 shows me, make it cristal clear that there was a NullReference exception on that line. BTW I couldn't navigate the line you asked me a question on your previous reply: |
This might be helpful https://github.com/dotnet/maui/blob/main/.github/DEVELOPMENT.md#compile-using-a-local-bindotnet, see:
It does not affect your system if you follow the "Compile using a local bin\dotnet" section. If you are on Windows, then #12762 (comment) is important too. |
Azure Pipelines successfully started running 2 pipeline(s). |
Thank you for your pull request. We are auto-formating your source code to follow our code guidelines. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Hi, @mattleibow is it going to be merged? Time to time I bump into an app crash because of this. But since it's a random error it's hard to reproduce, I'm quite confident this PR will fix the issue. |
We're currently not planning on backporting this because we don't have a repro and we haven't tested this fix. We feel there is most likely still an issue inside the |
While that my MAUI app will still be randomly crashing most of the time when I ask it to logoff. Sometimes when I call IdentityModel.OidcClient.LogoutAsync() it crashes with a NullReferenceException on that line that I have changed on this PR. But since it doesn't happen very oftem (random) it's hard to create a repro test. |
Unfortunately, this pull request does not solve the whole problem. I was able to debug the behavior a bit closer. This probably causes that the activity is not started and so the intent extras are null. The null check is not sufficient as suspected. I was able to fix it with a null check.
Maybe someone could test this with the Mi Browser. |
I would like to test the workaround @Px7-941 shared. However, I added the Activity class: WebAuthenticatorIntermediateActivity.cs in the /Platforms/Android folder using same Maui namespace to see if get overwritten without luck. do you have any idea how to overwrite it in any .NEt MAUI app, so I can test using the Mi Browser? Thanks in advance |
Description of Change
Preventing random NullReferenceException on WebAuthenticatorIntermediateActivity.android.cs