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

[Bug] "typemap: module matching MVID [xxxxxxx] not found." A lot of android logs #4791

Closed
kuramochia opened this issue Jun 9, 2020 · 13 comments · Fixed by #4831
Closed

[Bug] "typemap: module matching MVID [xxxxxxx] not found." A lot of android logs #4791

kuramochia opened this issue Jun 9, 2020 · 13 comments · Fixed by #4831
Labels
Area: App Runtime Issues in `libmonodroid.so`.

Comments

@kuramochia
Copy link

Release build using Xamarin Android SDK v10.3.1.4, I will see a large number of logs below.

monodroid-assembly typemap: module matching MVID [49B5F91A-2F8E-439E-AD20-F837EB41AFF4] not found.

The following command was executed.

> adb shell setprop mono.debug.log all

And when you view the log, it became the following log.

monodroid-assembly typemap: module matching MVID [49B5F91A-2F8E-439E-AD20-F837EB41AFF4] not found.
monodroid typemap: failed to map managed type to Java type: System.Byte, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cecToken=7cec85d7bea7798e (Module: ID: Module: 49b5f91a-2f8e-439e-ad20-f837eb41aff4; Type token: 33554569)

I think its same issue with #4727. I want you to fix this, too.

Originally posted by @kuramochia in #4727 (comment)

@jonpryor
Copy link
Member

jonpryor commented Jun 9, 2020

The fix for Issue #4727 in 755a521 was to turn the messages from warning messages, which were always written, to info messages, which would only be shown if "assembly" messages were enabled.

By running adb shell set prop debug.mono.log all, you have indicated that you want all messages shown. As such, all messages are shown, and is generally considered to be a Bad Idea™, as LREF logging is also enabled ("all" means all), which will quickly drown out logcat.

This is By Design™.

If you don't want all messages shown, then don't enable them all, which can be done by clearing the debug.mono.log system property:

adb shell setprop debug.mono.log "''"

@jonpryor jonpryor closed this as completed Jun 9, 2020
@kuramochia
Copy link
Author

@jonpryor below message can change to info level?

monodroid-assembly typemap: module matching MVID [49B5F91A-2F8E-439E-AD20-F837EB41AFF4] not found.

this message shown in large number of logs.

adb shell setprop debug.mono.log just checked why this log is logged.

@roninstar
Copy link

Just to make sure I am not missing something. I never had any monodroid warning error in my Release build before this most recent Visual Studio upgrade to 16.6.2. Now I get these errors every few seconds. Why did this just start? How can I prevent this from logging in a production device if its a benign warning?
W/monodroid-assembly(5608): typemap: module matching MVID [96E78666-3B05-47DD-A3A2-B357695888AB] not found.

grendello added a commit to grendello/xamarin-android that referenced this issue Jun 17, 2020
Context: xamarin#4791

Make a couple of messages related to MVID use `log_info` instead of
`log_warn` so that they are not shown by default (even though they are
useful for diagnostic purposes)
grendello added a commit to grendello/xamarin-android that referenced this issue Jun 17, 2020
Fixes: xamarin#4791

Make a couple of messages related to MVID use `log_info` instead of
`log_warn` so that they are not shown by default (even though they are
useful for diagnostic purposes)
@brendanzagaeski
Copy link
Member

Thanks for the questions. There is a new candidate change now in progress to make these other typemap messages informational also, like the previous messages that were changed for #4727.

I will reopen this issue for to help track when that candidate change is merged, and then, as in #4727, I will update this item with version information when the changes are available in a published version of Xamarin.Android. Thanks!

@brendanzagaeski brendanzagaeski added this to the Under Consideration milestone Jun 18, 2020
@brendanzagaeski brendanzagaeski added the Area: App Runtime Issues in `libmonodroid.so`. label Jun 18, 2020
@roninstar
Copy link

roninstar commented Jun 18, 2020

thanks grendello and Brendan!

jonpryor pushed a commit that referenced this issue Jun 18, 2020
Fixes: #4791

Context: 755a521

The following kind of messages were printed as *warning* messages,
meaning they were *always* printed, and apparently printed often:

	monodroid-assembly typemap: module matching MVID […] not found.
	monodroid-assembly typemap: managed type '…' (mapped from Java type '…') could not be loaded

As with commit 755a521, reduce the importance of these messages from
*warning* messages to *informational* messages, via `log_info()`.
@brendanzagaeski
Copy link
Member

@kuramochia, the new fix grendello added in #4831 is specifically targeting the following message:

monodroid-assembly typemap: module matching MVID [49B5F91A-2F8E-439E-AD20-F837EB41AFF4] not found.

That fix should take care of the majority of the messages you are seeing, but as I was discussing this more with grendello and the team, a question came up about the second message you mentioned:

monodroid typemap: failed to map managed type to Java type: System.Byte, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cecToken=7cec85d7bea7798e (Module: ID: Module: 49b5f91a-2f8e-439e-ad20-f837eb41aff4; Type token: 33554569)

If you might be able to share your project or a trimmed down sample project that produces that second message, the team would be interested to take a look. If the project contains private information, one option is to attach it on a new Visual Studio Developer Community feedback item via Help > Send Feedback > Report a Problem in Visual Studio. Another option would be to put the sample in a private GitHub repository and add brendanzagaeski or grendello with view permissions. Thanks in advance!

One idea is that this second message could appear in cases where adjusting the app code to use a .NET base class library type instead of a binding for a Java type code would improve performance, so the team would be interested to find out if that case matches your app or if there's another scenario that Xamarin.Android might need to handle differently.

@roninstar
Copy link

A weird thing about this code as I was trying to find exactly where this is happening in code I found a couple of interesting things. When I am in Debug mode I have no errors at all. Its an Android 9 app running Services. Our main service is essentially using an AudioRecord and raising that buffer to a third party that is waiting for a wake word to be spoken. We also have another service that manages the devices LEDs. This service would sometimes get raised on the UI thread causing a delay between the third party responding to the wake word because it had a Task Delay which paused everything on the top. I changed this to execute on ThreadPool
ThreadPool.QueueUserWorkItem(abc => doit);
Long story short only in Release mode would I see any of these logs and I also see this error
06-18 11:47:23.515: I/chatty(13385): uid=1000(system) Thread Pool Wor identical 1387 lines
In Android project Properties -> Build I unchecked one setting "Optimize Code". Once this was off the warnings and chatty messages went away. I thought the issue was coming from Proguard but it seems like just this setting was throwing it.
To answer your question with code, I will see if I can get this example. The project itself is a big one with lots of moving parts so it will take some detective work to figure out exactly what code is doing this. thanks so much for your help with this!
Mark Lane

@kuramochia
Copy link
Author

Thanks @brendanzagaeski !

Second message shown only below command.

> adb shell setprop mono.debug.log

I thinks this message is good without change.

monodroid typemap: failed to map managed type to Java type: System.Byte, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cecToken=7cec85d7bea7798e (Module: ID: Module: 49b5f91a-2f8e-439e-ad20-f837eb41aff4; Type token: 33554569)

jonpryor pushed a commit that referenced this issue Jun 20, 2020
Fixes: #4791

Context: 755a521

The following kind of messages were printed as *warning* messages,
meaning they were *always* printed, and apparently printed often:

	monodroid-assembly typemap: module matching MVID […] not found.
	monodroid-assembly typemap: managed type '…' (mapped from Java type '…') could not be loaded

As with commit 755a521, reduce the importance of these messages from
*warning* messages to *informational* messages, via `log_info()`.
@brendanzagaeski
Copy link
Member

Ah, perfect. Thanks roninstar and kuramochia for the additional information and sanity checks! The other team members and I will stay attentive for any other reports of unexpectedly verbose typemap messages that might need additional adjustments, but so far, it sounds like the next fix from #4831 will work well.

I'll update this issue as the new Preview and then Release versions become available with the fix.

@grendello
Copy link
Member

A weird thing about this code as I was trying to find exactly where this is happening in code I found a couple of interesting things. When I am in Debug mode I have no errors at all. Its an Android 9 app running Services. Our main service is essentially using an AudioRecord and raising that buffer to a third party that is waiting for a

@roninstar Debug mode uses a different typemap implementation, one which doesn't involve MVIDs (which are UUIDs identifying each manage assembly, with the [MVID]:[TypeToken] pair uniquely identifying every managed type in the typemap) and this is the reason you see these messages only in Release builds.

@brendanzagaeski
Copy link
Member

Release status update

A new Preview version of Xamarin.Android has now been published that includes the fix for this item to prevent showing the extra "module matching MVID ... not found" messages unless assembly logging as been explicitly enabled. The fix is not yet included in a Release version. I will update this again when a Release version is available that includes the fix.

Fix included in Xamarin.Android 11.0.0.3.

Fix included on Windows in Visual Studio 2019 version 16.7 Preview 4. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.

Fix included on macOS in Visual Studio 2019 for Mac version 8.7 Preview 4. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.

@brendanzagaeski
Copy link
Member

Release status update

A new Release version of Xamarin.Android has now been published that includes the fix for this item to prevent showing the extra "module matching MVID ... not found" messages unless assembly logging as been explicitly enabled.

Fix included in Xamarin.Android SDK version 11.0.0.3.

Fix included on Windows in Visual Studio 2019 version 16.7. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.

Fix included on macOS in Visual Studio 2019 for Mac version 8.7. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.

@roninstar
Copy link

roninstar commented Aug 6, 2020 via email

@xamarin xamarin locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants