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

StringIndexOutOfBoundsException on firestore API with unicode character #900

Closed
Thaina opened this issue Dec 16, 2020 · 7 comments
Closed
Assignees
Labels

Comments

@Thaina
Copy link
Contributor

Thaina commented Dec 16, 2020

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2016.1
  • Firebase Unity SDK version: 7.0.1 (suspect since 7.0.0)
  • Source you installed the SDK: UPM
  • Problematic Firebase Component: FireStore
  • Other Firebase Components in use: Auth,Analytics,Crashlytics,DynamicLinks,Messaging
  • Additional SDKs you are using: Facebook, Admob, OneSignal
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

There are weird error in android when using firebase 7.0.1, which is not occur in 6.16.1 when there is unicode character in firestore document

Steps to reproduce:

  • Making a firestore document with some unicode character, for example

image

  • Listening to collection query normally and just try to access field with unicode

  • It then error like this

12-16 12:14:10.776 12841 12993 W System.err: java.lang.StringIndexOutOfBoundsException: offset=0 length=8 string.length()=4
12-16 12:14:10.776 12841 12993 W System.err: 	at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
12-16 12:14:10.776 12841 12993 W System.err: 	at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
12-16 12:14:10.776 12841 12993 W System.err: 	at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
12-16 12:14:10.776 12841 12993 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:103)
12-16 12:14:10.776 12841 12993 W System.err: 	at android.os.Looper.loop(Looper.java:214)
12-16 12:14:10.776 12841 12993 W System.err: 	at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
  • In this case it error from "message" : "محمد" but also happen to emoji too. Maybe any unicode would be the same problem

Relevant Code:

collection.Listen((messages) => {
	var messageTexts = messages.Documents.Select((doc) => {
		try
		{
			Debug.LogFormat("Message : {0}",doc.Id); // debug can still log this line
			if(doc.TryGetValue<string>("message",out var message)) // error around this line
				Debug.LogFormat("MessageType : {0}",message);
			return message;
		}
		catch(Exception e)
		{
			Debug.LogException(e);
			throw;
		}
	}).ToArray();

	// do something
});
@Thaina Thaina added the new New issue. label Dec 16, 2020
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@wilhuff
Copy link

wilhuff commented Dec 16, 2020

Thanks for this report and I'm sorry for the trouble. I'm not yet sure what the cause of this issue is yet, but I've managed to reproduce the error you're seeing and will give updates as I have have them.

@Thaina
Copy link
Contributor Author

Thaina commented Dec 17, 2020

@wilhuff I wish this would fix and release immediately. I couldn't just roll back to 6.16.1 because it will have dependency conflict in ios. While 7.0.1 let me build ios but will have this error in android

@wilhuff
Copy link

wilhuff commented Dec 17, 2020

I've found the issue and submitted a fix for review. This was a regression introduced in 7.0.0.

I'll discuss our release options with the team tomorrow.

What's the dependency conflict issue with rolling back to 6.16.1? My understanding is that if you roll back the Unity SDK and the corresponding CocoaPods there should be no conflict.

@Thaina
Copy link
Contributor Author

Thaina commented Dec 17, 2020

@wilhuff Sorry for not being clear, it just conflict dependency with admob that I was upgraded along with firebase 7.0

@Thaina
Copy link
Contributor Author

Thaina commented Dec 21, 2020

@wilhuff How the fix is going? Could we have ETA about this?

@DellaBitta DellaBitta added needs-attention Need Googler's attention type: bug and removed new New issue. labels Dec 21, 2020
@wilhuff
Copy link

wilhuff commented Dec 21, 2020

The download package has been released. The Unity Package Manager release is in progress.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants