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

Bump to net6 preview2 (6.0.100-preview.2.21114.3) #5669

Merged

Conversation

radekdoulik
Copy link
Member

@radekdoulik radekdoulik commented Mar 1, 2021

Bump net6 preview2 version, be in sync with iOS https://github.com/xamarin/xamarin-macios/blob/871e7b1cd0ca0e8434e94c8eedb168f33d5da2e8/Make.config#L500

Bump runtime pack version.

Added System.Private.CoreLib.xml as workaround for the crash in GlobalizationNative_GetSortHandle.
Context: dotnet/runtime#49073

Stop using mono_register_config_for_assembly and mono_config_parse_memory functions,
they are gone from net6 runtime.

BuildReleaseArm64 test, net6 apk size difference before/after

Simple XA:

Summary:
  +           0 Other entries 0.00% (of 58,410)
  +           0 Dalvik executables 0.00% (of 316,728)
  -       7,699 Assemblies -1.10% (of 696,896)
  -      41,704 Shared libraries -0.80% (of 5,196,608)
  -      14,848 Uncompressed assemblies -1.09% (of 1,361,408)
  -      36,864 Package size difference -1.25% (of 2,946,926)

XF/XA:

Summary:
  +           0 Other entries 0.00% (of 917,033)
  +           0 Dalvik executables 0.00% (of 3,455,720)
  -      15,978 Assemblies -0.28% (of 5,682,747)
  -      41,704 Shared libraries -0.79% (of 5,271,800)
  -      31,232 Uncompressed assemblies -0.25% (of 12,712,960)
  -      45,056 Package size difference -0.45% (of 9,952,454)

@radekdoulik
Copy link
Member Author

@grendello looks like there's new crash during startup with net6/preview2. I am not sure whether it is related to #5665, would you like to take a look?

In the logcat from DotNetDebug test (https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4512157&view=ms.vss-test-web.build-test-results-tab&runId=19348020&resultId=100007&paneView=attachments), I see this:

03-01 12:47:49.275  7424  7424 D debug-app-helper: Checking if libmonodroid was unpacked to /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64/libmonodroid.so
03-01 12:47:49.275  7424  7424 D debug-app-helper: Native libs extracted to /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64, assuming application/android:extractNativeLibs == true
03-01 12:47:49.275  7424  7424 I debug-app-helper: Setting up for DSO lookup in app data directories
03-01 12:47:49.275  7424  7424 D debug-app-helper: Added filesystem DSO lookup location: /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64
03-01 12:47:49.275  7424  7424 W debug-app-helper: Using runtime path: /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64
03-01 12:47:49.275  7424  7424 W debug-app-helper: checking directory: `/data/user/0/com.xamarin.dotnetdebug/files/.__override__/lib`
03-01 12:47:49.275  7424  7424 W debug-app-helper: directory does not exist: `/data/user/0/com.xamarin.dotnetdebug/files/.__override__/lib`
03-01 12:47:49.275  7424  7424 W debug-app-helper: Checking whether Mono runtime exists at: /data/user/0/com.xamarin.dotnetdebug/files/.__override__/libmonosgen-2.0.so
03-01 12:47:49.275  7424  7424 W debug-app-helper: Checking whether Mono runtime exists at: /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64/libmonosgen-2.0.so
03-01 12:47:49.275  7424  7424 I debug-app-helper: Mono runtime found at: /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64/libmonosgen-2.0.so
03-01 12:47:49.276  7424  7424 W rin.dotnetdebu: Attempt to remove non-JNI local reference, dumping thread
03-01 12:47:49.298  7424  7424 I monodroid: Failed to preload libmono-native.so (may not exist), ignoring
03-01 12:47:49.298  7424  7424 I monodroid: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64, /data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/base.apk!/lib/x86_64, /system/lib64, /system/product/lib64]]] couldn't find "libmono-native.so"
03-01 12:47:49.298  7424  7424 I monodroid: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
03-01 12:47:49.298  7424  7424 I monodroid: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
03-01 12:47:49.298  7424  7424 I monodroid: 	at java.lang.System.loadLibrary(System.java:1667)
03-01 12:47:49.298  7424  7424 I monodroid: 	at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:86)
03-01 12:47:49.298  7424  7424 I monodroid: 	at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:35)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread.access$1300(ActivityThread.java:219)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.os.Handler.dispatchMessage(Handler.java:107)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.os.Looper.loop(Looper.java:214)
03-01 12:47:49.298  7424  7424 I monodroid: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
03-01 12:47:49.298  7424  7424 I monodroid: 	at java.lang.reflect.Method.invoke(Native Method)
03-01 12:47:49.298  7424  7424 I monodroid: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
03-01 12:47:49.298  7424  7424 I monodroid: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
03-01 12:47:49.298  7424  7424 D AndroidRuntime: Shutting down VM
--------- beginning of crash
03-01 12:47:49.300  7424  7424 E AndroidRuntime: FATAL EXCEPTION: main
03-01 12:47:49.300  7424  7424 E AndroidRuntime: Process: com.xamarin.dotnetdebug, PID: 7424
03-01 12:47:49.300  7424  7424 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "mono_register_config_for_assembly" referenced by "/data/app/com.xamarin.dotnetdebug-IRqADJ5VqJrSpmyD6efZQQ==/lib/x86_64/libmonodroid.so"...
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1667)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:91)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:35)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread.access$1300(ActivityThread.java:219)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
03-01 12:47:49.300  7424  7424 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
03-01 12:47:49.303  1802  1817 W ActivityTaskManager:   Force finishing activity com.xamarin.dotnetdebug/.MainActivity

@radekdoulik
Copy link
Member Author

Looks like mono_register_config_for_assembly is gone.

The apkdiff output for before/after the bump I see that it is indeed missing (*1 means it exists only in the "before" apk):

  -      41,016 lib/arm64-v8a/libmonosgen-2.0.so
                  Section size difference
    -           8 .gnu.version
    -          12 .gnu.hash
    -          16 .hash
    -          48 .got
    -          85 .dynstr
    -          96 .dynsym
    -          96 .plt
    -          96 .data
    -         144 .rela.plt
    -         344 .data.rel.ro
    -         352 .bss
    -         840 .rela.dyn
    -       4,120 .text
    -      31,143 .rodata
                  Symbol size difference
    +          24 mono_eventpipe_fini
    +          12 mono_eventpipe_init
    +           8 mono_verify_corlib *2
    -           4 mono_runtime_cleanup
    -           4 mono_thread_get_coop_aware
    -           8 mono_threads_attach_coop
    -           8 mono_threads_exit_gc_safe_region_unbalanced
    -           8 mono_threads_detach_coop
    -           8 mono_threads_enter_gc_safe_region_unbalanced
    -           8 mono_threads_enter_gc_unsafe_region_unbalanced
    -           8 mono_jit_init_version
    -           8 mono_jit_cleanup
    -           8 mono_jit_init
    -           8 mono_assembly_get_image
    -           8 mono_assembly_get_name
    -           8 mono_assembly_name_get_culture
    -           8 mono_assembly_name_get_name
    -           8 mono_class_get_element_class
    -           8 mono_class_get_name
    -           8 mono_class_get_namespace
    -           8 mono_class_get_parent
    -           8 mono_signature_get_return_type
    -           8 mono_thread_manage
    -           8 mono_class_is_delegate
    -           8 mono_class_is_enum
    -           8 mono_class_is_valuetype
    -           8 mono_object_get_class
    -           8 mono_object_get_domain
    -           8 mono_raise_exception
    -           8 mono_runtime_quit
    -           8 mono_type_is_byref
    -           8 mono_gc_collect
    -           8 mono_gc_wbarrier_generic_nostore
    -           8 mono_assembly_name_free
    -           8 mono_class_enum_basetype
    -           8 mono_domain_set_internal
    -           8 mono_class_from_mono_type
    -           8 mono_class_init
    -           8 mono_domain_set
    -           8 mono_gc_reference_queue_new
    -           8 mono_gchandle_get_target
    -           8 mono_gchandle_get_target_v2
    -           8 mono_string_new_wrapper
    -           8 mono_thread_internal_detach
    -           8 mono_thread_is_foreign
    -           8 mono_gc_wbarrier_generic_store
    -           8 mono_gc_wbarrier_generic_store_atomic
    -           8 mono_gc_wbarrier_object_copy
    -           8 mono_image_loaded
    -           8 mono_threads_exit_gc_safe_region
    -           8 mono_class_get_property_from_name
    -           8 mono_field_static_set_value
    -           8 mono_gc_wbarrier_arrayref_copy
    -           8 mono_gc_wbarrier_set_arrayref
    -           8 mono_gc_wbarrier_set_field
    -           8 mono_gchandle_new
    -           8 mono_gchandle_new_v2
    -           8 mono_gchandle_new_weakref
    -           8 mono_gchandle_new_weakref_v2
    -           8 mono_object_get_virtual_method
    -           8 mono_threads_enter_gc_safe_region
    -           8 mono_threads_enter_gc_unsafe_region
    -           8 mono_threads_exit_gc_unsafe_region
    -           8 mono_threads_exit_gc_unsafe_region_unbalanced
    -           8 mono_domain_assembly_open
    -           8 mono_g_hash_table_insert
    -           8 mono_get_exception_execution_engine
    -           8 mono_image_loaded_full
    -           8 mono_class_is_subclass_of
    -           8 mono_method_full_name
    -           8 mono_object_unbox
    -           8 mono_class_vtable
    -           8 mono_debug_open_image_from_memory
    -           8 mono_gc_wbarrier_value_copy
    -           8 mono_object_new
    -           8 mono_string_new_size
    -           8 mono_thread_create
    -           8 mono_type_get_object
    -           8 mono_assembly_load_with_partial_name
    -           8 mono_ldstr
    -           8 mono_assembly_open
    -           8 mono_class_get_method_from_name
    -           8 mono_class_is_assignable_from
    -           8 mono_assembly_name_new
    -           8 mono_compile_method
    -           8 mono_class_get_method_from_name_flags
    -           8 mono_method_get_unmanaged_thunk
    -           8 mono_assembly_load_from
    -           8 mono_image_open_from_data
    -           8 mono_signature_get_params
    -           8 mono_string_new_utf16
    -           8 mono_field_get_type
    -           8 mono_field_set_value
    -           8 mono_g_hash_table_new_type
    -           8 mono_assembly_load_full_alc
    -           8 mono_assembly_open_full
    -           8 mono_string_to_utf8
    -           8 mono_string_to_utf8_checked
    -           8 mono_class_get_nullable_param
    -           8 mono_assembly_loaded
    -           8 mono_image_open_from_data_alc
    -           8 mono_jit_thread_attach
    -           8 mono_assembly_load_full
    -           8 mono_assembly_load_from_full
    -           8 mono_image_open_from_data_full
    -           8 mono_class_from_name
    -           8 mono_image_open_from_data_with_name
    -           8 mono_runtime_exec_managed_code
    -           8 mono_field_get_value_object
    -           8 mono_reflection_type_get_type
    -           8 mono_method_signature
    -           8 mono_array_new
    -           8 mono_field_get_value
    -           8 mono_get_exception_argument_null
    -           8 mono_string_intern
    -           8 mono_object_isinst
    -           8 mono_assembly_get_object
    -           8 mono_runtime_invoke_array
    -           8 mono_string_new
    -           8 mono_string_new_len
    -           8 mono_class_get_field_from_name
    -           8 mono_lookup_pinvoke_call
    -           8 mono_runtime_run_main
    -           8 mono_class_get_fields
    -           8 mono_exception_from_name_msg
    -           8 mono_runtime_invoke
    -           8 mono_value_box
    -           8 mono_method_get_object
    -           8 mono_runtime_object_init
    -           8 mono_gc_reference_queue_add
    -           8 mono_runtime_exec_main
    -           8 mono_string_is_interned
    -           8 mono_property_set_value
    -           8 mono_method_print_code
    -           8 mono_property_get_value
    -           8 mono_gc_toggleref_add
    -           8 mono_thread_cleanup
    -           8 mono_domain_foreach
    -           8 mono_reflection_get_custom_attrs_blob
    -           8 mono_jit_exec
    -           8 mono_thread_internal_attach
    -           8 mono_check_corlib_version
    -          12 mono_method_signature_checked_slow
    -          16 mono_thread_detach
    -          16 mono_class_from_typeref_checked
    -          16 mono_domain_finalize
    -          16 mono_metadata_parse_mh_full
    -          20 mono_thread_set_coop_aware
    -          20 mono_exception_walk_trace
    -          20 mono_main
    -          24 mono_domain_create
    -          28 mono_domain_get_by_id
    -          40 mono_config_cleanup *1
    -          60 mono_register_config_for_assembly *1
    -          76 mono_config_parse_memory *1
    -          76 mono_class_name_from_token
    -          80 mono_config_for_assembly
    -          88 mono_config_string_for_assembly_file
    -         252 mono_config_parse *1

@grendello
Copy link
Contributor

@grendello looks like there's new crash during startup with net6/preview2. I am not sure whether it is related to #5665, would you like to take a look?

In the logcat from DotNetDebug test (https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4512157&view=ms.vss-test-web.build-test-results-tab&runId=19348020&resultId=100007&paneView=attachments), I see this:

It's not new, it's handled and we merely print the exception, see here.

I'm changing the code in my native net6 PR, you can safely ignore it here.

@grendello
Copy link
Contributor

Looks like mono_register_config_for_assembly is gone.

The apkdiff output for before/after the bump I see that it is indeed missing (*1 means it exists only in the "before" apk):

Yes, my net6 PR stops using it, indeed

@radekdoulik
Copy link
Member Author

Looks like mono_register_config_for_assembly is gone.
The apkdiff output for before/after the bump I see that it is indeed missing (*1 means it exists only in the "before" apk):

Yes, my net6 PR stops using it, indeed

Cool. Do you know when will this PR land in master? Or could you please add, if possible, a simplified fix to this PR?

@radekdoulik radekdoulik force-pushed the pr-bump-net6-preview.2.21114.3 branch from 4c15d90 to 64725bb Compare March 3, 2021 08:59
Fixes:

    ld : error : undefined symbol: mono_register_config_for_assembly
    ld : error : undefined symbol: mono_config_parse_memory
@radekdoulik
Copy link
Member Author

OK, we have new crash:

03-03 12:13:51.898  9205  9205 W monodroid: Found xa-internal-api@monodroid_TypeManager_get_java_class_name in internal p/invoke map (0x7e9202496140)
03-03 12:13:51.901  9205  9205 W monodroid: MonodroidRuntime::monodroid_pinvoke_override ("xa-internal-api", "monodroid_TypeManager_get_java_class_name")
03-03 12:13:51.901  9205  9205 I monodroid-timing: p/invoke cache lookup for 'monodroid_TypeManager_get_java_class_name' (internal); elapsed: 0s:0::42000
03-03 12:13:51.901  9205  9205 I monodroid-timing: p/invoke override for 'monodroid_TypeManager_get_java_class_name' (internal); elapsed: 0s:0::122000
03-03 12:13:51.901  9205  9205 W monodroid: Found xa-internal-api@monodroid_TypeManager_get_java_class_name in internal p/invoke map (0x7e9202496140)
03-03 12:13:51.953  1583  1890 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
03-03 12:13:51.955  1583  1890 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
03-03 12:13:51.956  9205  9230 D libEGL  : Emulator has host GPU support, qemu.gles is set to 1.
03-03 12:13:51.979  9205  9230 W libc    : Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
03-03 12:13:51.981  9205  9230 D libEGL  : loaded /vendor/lib64/egl/libEGL_emulation.so
03-03 12:13:51.981  9205  9230 D libEGL  : loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
03-03 12:13:51.982  9205  9230 D libEGL  : loaded /vendor/lib64/egl/libGLESv2_emulation.so
03-03 12:13:52.031  9205  9205 W monodroid: MonodroidRuntime::monodroid_pinvoke_override ("xa-internal-api", "monodroid_free")
03-03 12:13:52.032  9205  9205 I monodroid-timing: p/invoke cache lookup for 'monodroid_free' (internal); elapsed: 0s:0::41000
03-03 12:13:52.032  9205  9205 I monodroid-timing: p/invoke override for 'monodroid_free' (internal); elapsed: 0s:0::123000
03-03 12:13:52.032  9205  9205 W monodroid: Found xa-internal-api@monodroid_free in internal p/invoke map (0x7e9202495b70)
03-03 12:13:52.032  9205  9205 W monodroid: MonodroidRuntime::monodroid_pinvoke_override ("xa-internal-api", "monodroid_free")
03-03 12:13:52.032  9205  9205 I monodroid-timing: p/invoke cache lookup for 'monodroid_free' (internal); elapsed: 0s:0::41000
03-03 12:13:52.032  9205  9205 I monodroid-timing: p/invoke override for 'monodroid_free' (internal); elapsed: 0s:0::121000
03-03 12:13:52.032  9205  9205 W monodroid: Found xa-internal-api@monodroid_free in internal p/invoke map (0x7e9202495b70)
03-03 12:13:52.037  9205  9205 W monodroid: MonodroidRuntime::monodroid_pinvoke_override ("xa-internal-api", "monodroid_free")
03-03 12:13:52.037  9205  9205 I monodroid-timing: p/invoke cache lookup for 'monodroid_free' (internal); elapsed: 0s:0::40000
03-03 12:13:52.037  9205  9205 I monodroid-timing: p/invoke override for 'monodroid_free' (internal); elapsed: 0s:0::122000
03-03 12:13:52.037  9205  9205 W monodroid: Found xa-internal-api@monodroid_free in internal p/invoke map (0x7e9202495b70)
03-03 12:13:52.075  9205  9205 I monodroid-timing: Typemap.managed_to_java: end, total time; elapsed: 0s:0::64000
--------- beginning of crash
03-03 12:13:52.156  9205  9205 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 9205 (etinstallandrun), pid 9205 (etinstallandrun)
03-03 12:13:52.171  9233  9233 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
03-03 12:13:52.172  1647  1647 I /system/bin/tombstoned: received crash request for pid 9205
03-03 12:13:52.173  9233  9233 I crash_dump64: performing dump of process 9205 (target tid = 9205)
03-03 12:13:52.176  9233  9233 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-03 12:13:52.177  9233  9233 F DEBUG   : Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:10/QPP6.190730.005.B1/5775370:userdebug/test-keys'
03-03 12:13:52.177  9233  9233 F DEBUG   : Revision: '0'
03-03 12:13:52.177  9233  9233 F DEBUG   : ABI: 'x86_64'
03-03 12:13:52.177  9233  9233 F DEBUG   : Timestamp: 2021-03-03 12:13:52+0000
03-03 12:13:52.177  9233  9233 F DEBUG   : pid: 9205, tid: 9205, name: etinstallandrun  >>> com.xamarin.dotnetinstallandrun <<<
03-03 12:13:52.177  9233  9233 F DEBUG   : uid: 10114
03-03 12:13:52.177  9233  9233 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
03-03 12:13:52.177  9233  9233 F DEBUG   : Cause: null pointer dereference
03-03 12:13:52.177  9233  9233 F DEBUG   :     rax 00007e92035238c0  rbx 00007fff72799640  rcx 00007e92006a2c00  rdx 00007e92006a2c00
03-03 12:13:52.177  9233  9233 F DEBUG   :     r8  0000000000000300  r9  00007fff727995d0  r10 0000000000000000  r11 00007e920327e4d0
03-03 12:13:52.177  9233  9233 F DEBUG   :     r12 00007e92de16b700  r13 0000000000000001  r14 00007e924deabd40  r15 00007e924ddac810
03-03 12:13:52.177  9233  9233 F DEBUG   :     rdi 00007e924deabd40  rsi 00007fff72799584
03-03 12:13:52.177  9233  9233 F DEBUG   :     rbp 00007e924deabd40  rsp 00007fff72799578  rip 0000000000000000
03-03 12:13:52.299  9233  9233 F DEBUG   : 
03-03 12:13:52.299  9233  9233 F DEBUG   : backtrace:
03-03 12:13:52.299  9233  9233 F DEBUG   :       #00 pc 0000000000000000  <unknown>
03-03 12:13:52.299  9233  9233 F DEBUG   :       #01 pc 0000000000188413  /data/app/com.xamarin.dotnetinstallandrun-mohHjr39jCg4t6k-27AiAg==/lib/x86_64/libmonosgen-2.0.so (GlobalizationNative_GetSortHandle+67) (BuildId: 33fce761e5916a36f82a20218609caed501d8812)
03-03 12:13:52.300  9233  9233 F DEBUG   :       #02 pc 0000000000158587  [anon:libc_malloc]

@radekdoulik
Copy link
Member Author

^^^ @grendello Any idea? @steveisok Could that be a crash related to ICU? Does 6.0.0-preview.2.21114.2 runtimepack already contain ICU for Android?

@radekdoulik
Copy link
Member Author

Looks like untrimmed apps run OK. I am going to try find out, what we are missing in trimmed assemblies.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something changed in my code that parses .binlog files:

System.IO.InvalidDataException : No project build duration found in /Users/runner/work/1/s/bin/TestRelease/temp/BuildXAMLChangeTrueTrue/MyApp/msbuild.binlog

I remember seeing something where they made a new type for MSBuild messages -- maybe it caused this?

I might be able to take a look tonight, if not tomorrow morning.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ignored the tests for now and filed:

dotnet/msbuild#6225

@radekdoulik if this is green tomorrow, I would say go ahead and merge this. 👍

@radekdoulik radekdoulik merged commit 8cd0b47 into dotnet:master Mar 4, 2021
@radekdoulik
Copy link
Member Author

The only failing check is because of InstallWithoutSharedRuntime test, which is currently broken in master.

jonpryor pushed a commit that referenced this pull request May 28, 2021
Changes: dotnet/installer@f442964...3ebe0ca
Changes: dotnet/linker@7a5c445...620b243
Changes: dotnet/runtime@6430375...5a26d12

Context: https://github.com/dotnet/sdk/blob/1f544a59270cecb2947e50a01f7056c685b4e319/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L389-L392
Context: #5954 (comment)
Context: #5669 (comment)
 
Updates:
 
  * Microsoft.Dotnet.Sdk.Internal:
    [from 6.0.100-preview.5.21266.3 to 6.0.100-preview.6.21276.2][0]

  * Microsoft.NET.ILLink.Tasks:
    [from 6.0.100-preview.5.21264.1 to 6.0.100-preview.6.21275.1][1]

  * Microsoft.NETCore.App.Ref:
    [from 6.0.0-preview.5.21265.5 to 6.0.0-preview.6.21274.1][2]
 
Update `.apkdesc` files, as `System.Net.Quic.dll` is now included
in the Xamarin.Forms sample.

Fix `azure-pipelines.yaml` so that if (when) the
`Mono.Android.NET_Tests` unit tests fail, the corresponding `.apk`
or `.aab` file is uploaded for our later investigation; see also
commit af7f7f5, which contained a "typo" such that .NET 6 packages
*weren't* uploaded on unit test failure, as they used the wrong
target framework identifier in the path.

Finally, and most annoying of all, the `$(InvariantGlobalization)`
MSBuild property should *not* default to `false` in .NET 6 projects,
as was introduced in commit 9ac280c, but instead should default
to *the empty string*.

The problem is due to [`Microsoft.NET.Sdk.targets`][3]:

	<RuntimeHostConfigurationOption
	    Condition=" '$(InvariantGlobalization)' != '' "
	    Include="System.Globalization.Invariant"
	    Value="$(InvariantGlobalization)"
	    Trim="true"
	/>

The above fragment sets `%(RuntimeHostConfigurationOption.Trim)` to
`True` for `System.Globalization.Invariant` whenever
`$(InvariantGlobalization)` is *not* the empty string.

The value `false` is *not* the empty string.

This caused `System.Globalization.Invariant`-related trim features
to be enabled, which had the unfortunate and unanticipated side effect
of causing ICU to *not* be properly initialized when running the
`Mono.Android.NET_Tests` unit test apps, which resulted in a SIGSEGV:

	libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 31880 (droid.NET_Tests), pid 31880 (droid.NET_Tests)
	crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
	tombstoned: received crash request for pid 31880
	crash_dump64: performing dump of process 31880 (target tid = 31880)
	DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
	DEBUG   : Build fingerprint: 'google/redfin/redfin:11/RQ1A.201205.011/6966805:user/release-keys'
	DEBUG   : Revision: 'MP1.0'
	DEBUG   : ABI: 'arm64'
	DEBUG   : Timestamp: 2021-05-26 15:21:42-0400
	DEBUG   : pid: 31880, tid: 31880, name: droid.NET_Tests  >>> Mono.Android.NET_Tests <<<
	DEBUG   : uid: 10282
	DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
	DEBUG   : Cause: null pointer dereference
	DEBUG   :     x0  b400007c4de52530  x1  0000007fcc4cbeec  x2  fffffffffffffff0  x3  b400007d2de37c80
	DEBUG   :     x4  b400007d2de37cf0  x5  0000000000000004  x6  0000007c2225ddac  x7  0000007fcc4cbfe0
	DEBUG   :     x8  0000000000000000  x9  000000001333c921  x10 0000000000000000  x11 000000002de37cf0
	DEBUG   :     x12 000000002a742e66  x13 0000000000000012  x14 0000000000000200  x15 0000000000000011
	DEBUG   :     x16 0000007bd6adb810  x17 0000007ed2056240  x18 0000007ed3b94000  x19 0000007fcc4cc040
	DEBUG   :     x20 b400007c4de52530  x21 b400007c4de52530  x22 0000000000000000  x23 b400007d7de490c0
	DEBUG   :     x24 0000000000000001  x25 0000007bd58055c0  x26 0000007bd5cc0130  x27 0000007ed33ab000
	DEBUG   :     x28 0000007bd6af1000  x29 0000007fcc4cbf00
	DEBUG   :     lr  0000007bd69119c8  sp  0000007fcc4cbee0  pc  0000000000000000  pst 0000000080001000
	…
	DEBUG   : backtrace:
	DEBUG   :       #00 pc 0000000000000000  <unknown>
	DEBUG   :       #1 pc 000000000014e9c4  /data/app/~~oruJhhqj_EC_NWSaIGF_RQ==/Mono.Android.NET_Tests-G1iNxUwmGyu-tDRqYcK94g==/lib/arm64/libmonosgen-2.0.so (GlobalizationNative_GetSortHandle+76) (BuildId: 869ce5526fa884035199acac4ddc81bb6eeaf134)
	DEBUG   :       #2 pc 000000000000ddbc  <anonymous:7c22250000>

While we've (inadvertently) had `%(Trim)` enabled for over three
months now, the *trigger* for this particular crash appears to be
commit dotnet/runtime@bc27d49, which moved ICU initialization outside
of the `GlobalizationMode` static constructor and into a new
`GlobalizationMode.Settings` static constructor…which wasn't executed.

Explicitly setting `$(InvariantGlobalization)` to the empty string
*unless* it is the value `true` allows us to avoid setting
`%(RuntimeHostConfigurationOption.Trim)`=True for
`System.Globalization.Invariant`, which in turn avoids whatever set
of linker-induced changes were preventing ICU from being properly
initialized, which avoids the SIGSEGV.

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Co-authored-by: Peter Collins <pecolli@microsoft.com>
 
[0]: dotnet/installer@f442964...3ebe0ca
[1]: dotnet/linker@7a5c445...620b243
[2]: dotnet/runtime@6430375...5a26d12
[3]: https://github.com/dotnet/sdk/blob/1f544a59270cecb2947e50a01f7056c685b4e319/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L389-L392
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants