Skip to content

Commit aa830f9

Browse files
grendellojonpryor
authored andcommitted
[monodroid] Reduce typemap-related logging (#4720)
Fixes: #4727 Context: https://developercommunity.visualstudio.com/content/problem/1021788/javainterop-assembly-not-found-for-xamarin-android.html Turn some warnings about about typemap not finding entries to info- level messages, not visible by default. Additionally, use `LOG_ASSEMBLY` and `LOG_DEFAULT` for the remaining `log_warn()` calls, as they're assembly-related, not "catch-all".
1 parent a218dae commit aa830f9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/monodroid/jni/embedded-assemblies.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ EmbeddedAssemblies::typemap_java_to_managed (const char *java_type_name)
282282
}
283283

284284
if (XA_UNLIKELY (entry == nullptr)) {
285-
log_warn (LOG_ASSEMBLY, "typemap: unable to find mapping to a managed type from Java type '%s'", java_type_name);
285+
log_info (LOG_ASSEMBLY, "typemap: unable to find mapping to a managed type from Java type '%s'", java_type_name);
286286
return nullptr;
287287
}
288288

@@ -314,7 +314,7 @@ EmbeddedAssemblies::typemap_java_to_managed (const char *java_type_name)
314314
TypeMapModule *module;
315315
const TypeMapJava *java_entry = binary_search<const char, TypeMapJava, compare_java_name, true> (java_type_name, map_java, java_type_count, java_name_width);
316316
if (java_entry == nullptr) {
317-
log_warn (LOG_ASSEMBLY, "typemap: unable to find mapping to a managed type from Java type '%s'", java_type_name);
317+
log_info (LOG_ASSEMBLY, "typemap: unable to find mapping to a managed type from Java type '%s'", java_type_name);
318318
return nullptr;
319319
}
320320

@@ -326,7 +326,7 @@ EmbeddedAssemblies::typemap_java_to_managed (const char *java_type_name)
326326
module = const_cast<TypeMapModule*>(&map_modules[java_entry->module_index]);
327327
const TypeMapModuleEntry *entry = binary_search <uint32_t, TypeMapModuleEntry, compare_type_token> (&java_entry->type_token_id, module->map, module->entry_count);
328328
if (entry == nullptr) {
329-
log_warn (LOG_ASSEMBLY, "typemap: unable to find mapping from Java type '%s' to managed type with token ID %u in module [%s]", java_type_name, java_entry->type_token_id, MonoGuidString (module->module_uuid).get ());
329+
log_info (LOG_ASSEMBLY, "typemap: unable to find mapping from Java type '%s' to managed type with token ID %u in module [%s]", java_type_name, java_entry->type_token_id, MonoGuidString (module->module_uuid).get ());
330330
return nullptr;
331331
}
332332
uint32_t type_token_id = java_entry->type_token_id;
@@ -451,13 +451,13 @@ EmbeddedAssemblies::typemap_managed_to_java ([[maybe_unused]] MonoType *type, Mo
451451
entry = typemap_managed_to_java (full_name);
452452

453453
if (XA_UNLIKELY (entry == nullptr)) {
454-
log_warn (LOG_ASSEMBLY, error_message, full_name);
454+
log_info (LOG_ASSEMBLY, error_message, full_name);
455455
}
456456
} else {
457457
simple_pointer_guard<char> full_name = utils.string_concat (type_name.get (), ", ", image_name);
458458
entry = typemap_managed_to_java (full_name.get ());
459459
if (XA_UNLIKELY (entry == nullptr)) {
460-
log_warn (LOG_ASSEMBLY, error_message, full_name.get ());
460+
log_info (LOG_ASSEMBLY, error_message, full_name.get ());
461461
}
462462
}
463463

@@ -524,7 +524,7 @@ EmbeddedAssemblies::typemap_managed_to_java ([[maybe_unused]] MonoType *type, Mo
524524
}
525525

526526
if (entry == nullptr) {
527-
log_warn (LOG_ASSEMBLY, "typemap: type with token %d (0x%x) in module {%s} (%s) not found.", token, token, MonoGuidString (mvid).get (), match->assembly_name);
527+
log_info (LOG_ASSEMBLY, "typemap: type with token %d (0x%x) in module {%s} (%s) not found.", token, token, MonoGuidString (mvid).get (), match->assembly_name);
528528
return nullptr;
529529
}
530530
}
@@ -569,7 +569,7 @@ EmbeddedAssemblies::typemap_managed_to_java (MonoReflectionType *reflection_type
569569

570570
MonoType *type = mono_reflection_type_get_type (reflection_type);
571571
if (type == nullptr) {
572-
log_warn (LOG_DEFAULT, "Failed to map reflection type to MonoType");
572+
log_warn (LOG_ASSEMBLY, "Failed to map reflection type to MonoType");
573573
return nullptr;
574574
}
575575

@@ -884,7 +884,7 @@ EmbeddedAssemblies::try_load_typemaps_from_directory (const char *path)
884884
simple_pointer_guard<char[]> dir_path (utils.path_combine (path, "typemaps"));
885885
monodroid_dir_t *dir;
886886
if ((dir = utils.monodroid_opendir (dir_path)) == nullptr) {
887-
log_warn (LOG_DEFAULT, "typemap: could not open directory: `%s`", dir_path.get ());
887+
log_warn (LOG_ASSEMBLY, "typemap: could not open directory: `%s`", dir_path.get ());
888888
return;
889889
}
890890

0 commit comments

Comments
 (0)